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

(-)a/misc/cronjobs/recalls/convert_holds_to_recalls.pl (-3 / +2 lines)
Lines 92-98 foreach my $bib ( @bib_holds ) { Link Here
92
    if ( $bib->{bibcount} >= $min ) {
92
    if ( $bib->{bibcount} >= $min ) {
93
        # If there are $min or more holds on the same record, convert the oldest hold to a recall
93
        # If there are $min or more holds on the same record, convert the oldest hold to a recall
94
94
95
        my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber} }, { order_by => { -asc => 'reservedate' } })->as_list;
95
        my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber}, found => undef }, { order_by => { -asc => 'reservedate' } })->as_list;
96
        my $hold_to_convert = $holds[0];
96
        my $hold_to_convert = $holds[0];
97
        foreach my $res ( @holds ) {
97
        foreach my $res ( @holds ) {
98
            if ( dt_from_string($res->reservedate) < dt_from_string($hold_to_convert->reservedate) ) {
98
            if ( dt_from_string($res->reservedate) < dt_from_string($hold_to_convert->reservedate) ) {
Lines 126-132 foreach my $bib ( @bib_holds ) { Link Here
126
            $hold_to_convert->cancel({ cancellation_reason => 'RECALLED' });
126
            $hold_to_convert->cancel({ cancellation_reason => 'RECALLED' });
127
            $count++;
127
            $count++;
128
            if ( $verbose ) {
128
            if ( $verbose ) {
129
                my $hold_id = $hold_to_convert->hold_id;
129
                my $hold_id = $hold_to_convert->reserve_id;
130
                my $biblionumber = $hold_to_convert->biblionumber;
130
                my $biblionumber = $hold_to_convert->biblionumber;
131
                print "$count. Hold converted to recall (hold_id: $hold_id, biblionumber: $biblionumber).\n";
131
                print "$count. Hold converted to recall (hold_id: $hold_id, biblionumber: $biblionumber).\n";
132
            }
132
            }
133
- 

Return to bug 31415