);
}
-# XXX This is not safe in a persistant environment
-my $dbh = C4::Context->dbh;
=head1 FUNCTIONS
=cut
sub TransportCostMatrix {
+ my $dbh = C4::Context->dbh;
my $transport_costs = $dbh->selectall_arrayref("SELECT * FROM transport_cost",{ Slice => {} });
my %transport_cost_matrix;
sub UpdateTransportCostMatrix {
my ($records) = @_;
+ my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("INSERT INTO transport_cost (frombranch, tobranch, cost, disable_transfer) VALUES (?, ?, ?, ?)");
sub GetHoldsQueueItems {
my ($branchlimit) = @_;
+ my $dbh = C4::Context->dbh;
my @bind_params = ();
my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber
=cut
sub CreateQueue {
+ my $dbh = C4::Context->dbh;
$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info
$dbh->do("DELETE FROM hold_fill_targets");
FROM reserves
WHERE found IS NULL
AND priority > 0
- AND reservedate <= CURRENT_DATE()";
+ AND reservedate <= CURRENT_DATE()
+ AND suspend = 0
+ ";
my $sth = $dbh->prepare($bib_query);
$sth->execute();
AND found IS NULL
AND priority > 0
AND reservedate <= CURRENT_DATE()
+ AND suspend = 0
ORDER BY priority";
my $sth = $dbh->prepare($request_query);
$sth->execute($biblionumber);
foreach my $item (@$available_items) {
next unless $item->{holdallowed};
- push @{ $items_by_branch{ $automatic_return ? $item->{homebranch}
- : $item->{holdingbranch} } }, $item
+ push @{ $items_by_branch{ $item->{holdingbranch} } }, $item
unless exists $allocated_items{ $item->{itemnumber} };
}
return unless keys %items_by_branch;