Lines 175-182
Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets
Link Here
|
175 |
sub CreateQueue { |
175 |
sub CreateQueue { |
176 |
my $dbh = C4::Context->dbh; |
176 |
my $dbh = C4::Context->dbh; |
177 |
|
177 |
|
178 |
$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info |
178 |
$dbh->do("CREATE TEMPORARY TABLE tmp_holdsqueue_builder LIKE tmp_holdsqueue"); |
179 |
$dbh->do("DELETE FROM hold_fill_targets"); |
179 |
$dbh->do("CREATE TEMPORARY TABLE hold_fill_targets_builder LIKE hold_fill_targets"); |
180 |
|
180 |
|
181 |
my $total_bibs = 0; |
181 |
my $total_bibs = 0; |
182 |
my $total_requests = 0; |
182 |
my $total_requests = 0; |
Lines 222-227
sub CreateQueue {
Link Here
|
222 |
#warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map); |
222 |
#warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map); |
223 |
} |
223 |
} |
224 |
} |
224 |
} |
|
|
225 |
|
226 |
my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_TESTING}; |
227 |
$dbh->{AutoCommit} = 0 unless $do_not_lock; |
228 |
$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info |
229 |
$dbh->do("INSERT INTO tmp_holdsqueue SELECT * FROM tmp_holdsqueue_builder"); |
230 |
$dbh->do("DELETE FROM hold_fill_targets"); |
231 |
$dbh->do("INSERT INTO hold_fill_targets SELECT * FROM hold_fill_targets_builder"); |
232 |
$dbh->do("DROP TEMPORARY TABLE tmp_holdsqueue_builder"); |
233 |
$dbh->do("DROP TEMPORARY TABLE hold_fill_targets_builder"); |
234 |
$dbh->commit() unless $do_not_lock; |
225 |
} |
235 |
} |
226 |
|
236 |
|
227 |
=head2 GetBibsWithPendingHoldRequests |
237 |
=head2 GetBibsWithPendingHoldRequests |
Lines 711-717
sub CreatePicklistFromItemMap {
Link Here
|
711 |
my $dbh = C4::Context->dbh; |
721 |
my $dbh = C4::Context->dbh; |
712 |
|
722 |
|
713 |
my $sth_load=$dbh->prepare(" |
723 |
my $sth_load=$dbh->prepare(" |
714 |
INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, |
724 |
INSERT INTO tmp_holdsqueue_builder (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, |
715 |
cardnumber,reservedate,title, itemcallnumber, |
725 |
cardnumber,reservedate,title, itemcallnumber, |
716 |
holdingbranch,pickbranch,notes, item_level_request) |
726 |
holdingbranch,pickbranch,notes, item_level_request) |
717 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
727 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
Lines 756-762
sub AddToHoldTargetMap {
Link Here
|
756 |
my $dbh = C4::Context->dbh; |
766 |
my $dbh = C4::Context->dbh; |
757 |
|
767 |
|
758 |
my $insert_sql = q( |
768 |
my $insert_sql = q( |
759 |
INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id) |
769 |
INSERT INTO hold_fill_targets_builder (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id) |
760 |
VALUES (?, ?, ?, ?, ?, ?) |
770 |
VALUES (?, ?, ?, ?, ?, ?) |
761 |
); |
771 |
); |
762 |
my $sth_insert = $dbh->prepare($insert_sql); |
772 |
my $sth_insert = $dbh->prepare($insert_sql); |
763 |
- |
|
|