View | Details | Raw Unified | Return to bug 29130
Collapse All | Expand All

(-)a/C4/HoldsQueue.pm (-5 / +16 lines)
Lines 167-174 Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets Link Here
167
sub CreateQueue {
167
sub CreateQueue {
168
    my $dbh   = C4::Context->dbh;
168
    my $dbh   = C4::Context->dbh;
169
169
170
    $dbh->do("DELETE FROM tmp_holdsqueue");  # clear the old table for new info
170
    $dbh->do("DROP TABLE IF EXISTS tmp_holdsqueue_builder");
171
    $dbh->do("DELETE FROM hold_fill_targets");
171
    $dbh->do("DROP TABLE IF EXISTS hold_fill_targets_builder");
172
    $dbh->do("CREATE TABLE tmp_holdsqueue_builder LIKE tmp_holdsqueue");
173
    $dbh->do("CREATE TABLE hold_fill_targets_builder LIKE hold_fill_targets");
172
174
173
    my $total_bibs            = 0;
175
    my $total_bibs            = 0;
174
    my $total_requests        = 0;
176
    my $total_requests        = 0;
Lines 213-218 sub CreateQueue { Link Here
213
            #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map);
215
            #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map);
214
        }
216
        }
215
    }
217
    }
218
219
    my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_TESTING};
220
    $dbh->{AutoCommit} = 0 unless $do_not_lock;
221
    $dbh->do("DELETE FROM tmp_holdsqueue");  # clear the old tables for new info
222
    $dbh->do("DELETE FROM hold_fill_targets");
223
    $dbh->do("INSERT INTO tmp_holdsqueue SELECT * FROM tmp_holdsqueue_builder");
224
    $dbh->do("INSERT INTO hold_fill_targets SELECT * FROM hold_fill_targets_builder");
225
    $dbh->do("DROP TABLE tmp_holdsqueue_builder");
226
    $dbh->do("DROP TABLE hold_fill_targets_builder");
227
    $dbh->commit() unless $do_not_lock;
216
}
228
}
217
229
218
=head2 GetBibsWithPendingHoldRequests
230
=head2 GetBibsWithPendingHoldRequests
Lines 702-708 sub CreatePicklistFromItemMap { Link Here
702
    my $dbh = C4::Context->dbh;
714
    my $dbh = C4::Context->dbh;
703
715
704
    my $sth_load=$dbh->prepare("
716
    my $sth_load=$dbh->prepare("
705
        INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber,
717
        INSERT INTO tmp_holdsqueue_builder (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber,
706
                                    cardnumber,reservedate,title, itemcallnumber,
718
                                    cardnumber,reservedate,title, itemcallnumber,
707
                                    holdingbranch,pickbranch,notes, item_level_request)
719
                                    holdingbranch,pickbranch,notes, item_level_request)
708
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
720
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
Lines 747-753 sub AddToHoldTargetMap { Link Here
747
    my $dbh = C4::Context->dbh;
759
    my $dbh = C4::Context->dbh;
748
760
749
    my $insert_sql = q(
761
    my $insert_sql = q(
750
        INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id)
762
        INSERT INTO hold_fill_targets_builder (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id)
751
                               VALUES (?, ?, ?, ?, ?, ?)
763
                               VALUES (?, ?, ?, ?, ?, ?)
752
    );
764
    );
753
    my $sth_insert = $dbh->prepare($insert_sql);
765
    my $sth_insert = $dbh->prepare($insert_sql);
754
- 

Return to bug 29130