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

(-)a/C4/HoldsQueue.pm (-5 / +16 lines)
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 TABLE IF NOT EXISTS tmp_holdsqueue_builder LIKE tmp_holdsqueue");
179
    $dbh->do("DELETE FROM hold_fill_targets");
179
    $dbh->do("DELETE FROM tmp_holdsqueue_builder");
180
    $dbh->do("CREATE TABLE IF NOT EXISTS hold_fill_targets_builder LIKE hold_fill_targets");
181
    $dbh->do("DELETE FROM hold_fill_targets_builder");
180
182
181
    my $total_bibs            = 0;
183
    my $total_bibs            = 0;
182
    my $total_requests        = 0;
184
    my $total_requests        = 0;
Lines 222-227 sub CreateQueue { Link Here
222
            #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map);
224
            #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map);
223
        }
225
        }
224
    }
226
    }
227
228
    my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_TESTING};
229
    $dbh->{AutoCommit} = 0 unless $do_not_lock;
230
    $dbh->do("DELETE FROM tmp_holdsqueue");  # clear the old table for new info
231
    $dbh->do("INSERT INTO tmp_holdsqueue SELECT * FROM tmp_holdsqueue_builder");
232
    $dbh->do("DELETE FROM hold_fill_targets");
233
    $dbh->do("INSERT INTO hold_fill_targets SELECT * FROM hold_fill_targets_builder");
234
    $dbh->do("DROP TABLE tmp_holdsqueue_builder");
235
    $dbh->do("DROP TABLE hold_fill_targets_builder");
236
    $dbh->commit() unless $do_not_lock;
225
}
237
}
226
238
227
=head2 GetBibsWithPendingHoldRequests
239
=head2 GetBibsWithPendingHoldRequests
Lines 711-717 sub CreatePicklistFromItemMap { Link Here
711
    my $dbh = C4::Context->dbh;
723
    my $dbh = C4::Context->dbh;
712
724
713
    my $sth_load=$dbh->prepare("
725
    my $sth_load=$dbh->prepare("
714
        INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber,
726
        INSERT INTO tmp_holdsqueue_builder (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber,
715
                                    cardnumber,reservedate,title, itemcallnumber,
727
                                    cardnumber,reservedate,title, itemcallnumber,
716
                                    holdingbranch,pickbranch,notes, item_level_request)
728
                                    holdingbranch,pickbranch,notes, item_level_request)
717
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
729
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
Lines 756-762 sub AddToHoldTargetMap { Link Here
756
    my $dbh = C4::Context->dbh;
768
    my $dbh = C4::Context->dbh;
757
769
758
    my $insert_sql = q(
770
    my $insert_sql = q(
759
        INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id)
771
        INSERT INTO hold_fill_targets_builder (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id)
760
                               VALUES (?, ?, ?, ?, ?, ?)
772
                               VALUES (?, ?, ?, ?, ?, ?)
761
    );
773
    );
762
    my $sth_insert = $dbh->prepare($insert_sql);
774
    my $sth_insert = $dbh->prepare($insert_sql);
763
- 

Return to bug 29130