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

(-)a/C4/Circulation.pm (-3 / +3 lines)
Lines 1129-1138 sub CanBookBeIssued { Link Here
1129
            if ( $r->itemnumber and
1129
            if ( $r->itemnumber and
1130
                $r->itemnumber == $item_object->itemnumber and
1130
                $r->itemnumber == $item_object->itemnumber and
1131
                $r->borrowernumber == $patron->borrowernumber and
1131
                $r->borrowernumber == $patron->borrowernumber and
1132
                $r->waiting ) {
1132
                ( $r->waiting or $r->requested ) ) {
1133
                $messages{RECALLED} = $r->recall_id;
1133
                $messages{RECALLED} = $r->recall_id;
1134
                $recall = $r;
1134
                $recall = $r;
1135
                # this item is already waiting for this borrower and the recall can be fulfilled
1135
                # this item is recalled by or already waiting for this borrower and the recall can be fulfilled
1136
                last;
1136
                last;
1137
            }
1137
            }
1138
            elsif ( $r->itemnumber and
1138
            elsif ( $r->itemnumber and
Lines 1569-1575 sub AddIssue { Link Here
1569
                $item_object->discard_changes;
1569
                $item_object->discard_changes;
1570
            }
1570
            }
1571
1571
1572
            Koha::Recalls->move_recall({ action => $cancel_recall, recall_id => $recall_id, itemnumber => $item_object->itemnumber, borrowernumber => $borrower->{borrowernumber} }) if C4::Context->preference('UseRecalls');
1572
            Koha::Recalls->move_recall({ action => $cancel_recall, recall_id => $recall_id, item => $item_object, borrowernumber => $borrower->{borrowernumber} }) if C4::Context->preference('UseRecalls');
1573
1573
1574
            C4::Reserves::MoveReserve( $item_object->itemnumber, $borrower->{'borrowernumber'}, $cancelreserve );
1574
            C4::Reserves::MoveReserve( $item_object->itemnumber, $borrower->{'borrowernumber'}, $cancelreserve );
1575
1575
(-)a/Koha/Recalls.pm (-5 / +5 lines)
Lines 145-151 sub add_recall { Link Here
145
    my $message = Koha::Recalls->move_recall({
145
    my $message = Koha::Recalls->move_recall({
146
        recall_id = $recall_id,
146
        recall_id = $recall_id,
147
        action => $action,
147
        action => $action,
148
        itemnumber => $itemnumber,
148
        item => $item_object,
149
        borrowernumber => $borrowernumber,
149
        borrowernumber => $borrowernumber,
150
    });
150
    });
151
151
Lines 155-161 We can also fulfill the recall here if the recall is placed by this borrower. Link Here
155
155
156
recall_id = ID of the recall to perform the action on
156
recall_id = ID of the recall to perform the action on
157
action = either cancel or revert
157
action = either cancel or revert
158
itemnumber = itemnumber the patron is attempting to check out
158
item = item object that the patron is attempting to check out
159
borrowernumber = borrowernumber of the patron that is attemptig to check out
159
borrowernumber = borrowernumber of the patron that is attemptig to check out
160
160
161
=cut
161
=cut
Lines 166-172 sub move_recall { Link Here
166
    my $recall_id = $params->{recall_id};
166
    my $recall_id = $params->{recall_id};
167
    my $action = $params->{action};
167
    my $action = $params->{action};
168
    return 'no recall_id provided' if ( !defined $recall_id );
168
    return 'no recall_id provided' if ( !defined $recall_id );
169
    my $itemnumber = $params->{itemnumber};
169
    my $item = $params->{item};
170
    my $borrowernumber = $params->{borrowernumber};
170
    my $borrowernumber = $params->{borrowernumber};
171
171
172
    my $message = 'no action provided';
172
    my $message = 'no action provided';
Lines 181-189 sub move_recall { Link Here
181
        $message = 'reverted';
181
        $message = 'reverted';
182
    }
182
    }
183
183
184
    if ( $message eq 'no action provided' and $itemnumber and $borrowernumber ) {
184
    if ( $message eq 'no action provided' and $item and $item->biblionumber and $borrowernumber ) {
185
        # move_recall was not called to revert or cancel, but was called to fulfill
185
        # move_recall was not called to revert or cancel, but was called to fulfill
186
        my $recall = Koha::Recalls->find({ borrowernumber => $borrowernumber, itemnumber => $itemnumber, old => undef });
186
        my $recall = Koha::Recalls->find({ borrowernumber => $borrowernumber, biblionumber => $item->biblionumber, itemnumber => [ $item->itemnumber, undef ], old => undef });
187
        if ( $recall ) {
187
        if ( $recall ) {
188
            $recall->set_finished;
188
            $recall->set_finished;
189
            $message = 'fulfilled';
189
            $message = 'fulfilled';
(-)a/circ/circulation.pl (-1 / +5 lines)
Lines 408-413 if (@$barcodes) { Link Here
408
        }
408
        }
409
        unless($confirm_required) {
409
        unless($confirm_required) {
410
            my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED};
410
            my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED};
411
            if ( !$recall_id ) {
412
                my $item = Koha::Items->find({ barcode => $barcode });
413
                my $recall = Koha::Recalls->find({ biblionumber => $item->biblionumber, itemnumber => [ undef, $item->itemnumber ], status => [ 'R','W' ], old => undef, borrowernumber => $patron->borrowernumber });
414
                $recall_id = ( $recall and $recall->recall_id ) ? $recall->recall_id : undef;
415
            }
411
            my $issue = AddIssue( $patron->unblessed, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, recall_id => $recall_id, } );
416
            my $issue = AddIssue( $patron->unblessed, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, recall_id => $recall_id, } );
412
            $template_params->{issue} = $issue;
417
            $template_params->{issue} = $issue;
413
            $session->clear('auto_renew');
418
            $session->clear('auto_renew');
414
- 

Return to bug 19532