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

(-)a/circ/returns.pl (-22 / +21 lines)
Lines 114-119 for my $counter ( $query->multi_param("checkin_counter") ) { Link Here
114
114
115
my $op = $query->param('op') // '';
115
my $op = $query->param('op') // '';
116
116
117
# Routine for handling the confirm hold part of cud-affect_reserve.
118
# Reused during batch checkin.
119
sub confirm_hold {
120
    my ( $item, $hold, $diffBranchSend, $desk_id ) = @_;
121
122
    # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
123
    # i.e., whether to apply waiting status
124
    ModReserveAffect( $item->itemnumber, $hold->borrowernumber, $diffBranchSend, $hold->reserve_id, $desk_id );
125
126
    if ($diffBranchSend) {
127
        my $tobranch = $hold->pickup_library();
128
129
        # Add transfer, enqueue if one is already in the queue, and immediately set to in transit
130
        my $transfer = $item->request_transfer( { to => $tobranch, reason => 'Reserve', enqueue => 1 } );
131
        $transfer->transit;
132
    }
133
}
134
117
############
135
############
118
# Deal with the requests....
136
# Deal with the requests....
119
my $itemnumber = $query->param('itemnumber');
137
my $itemnumber = $query->param('itemnumber');
Lines 146-163 if ( $query->param('reserve_id') && $op eq 'cud-affect_reserve' ) { Link Here
146
        }
164
        }
147
    } else {
165
    } else {
148
        my $diffBranchSend = ( $userenv_branch ne $diffBranchReturned ) ? $diffBranchReturned : undef;
166
        my $diffBranchSend = ( $userenv_branch ne $diffBranchReturned ) ? $diffBranchReturned : undef;
149
167
        confirm_hold( $item, $hold, $diffBranchSend, $desk_id );
150
        # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
151
        # i.e., whether to apply waiting status
152
        ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id, $desk_id );
153
154
        if ($diffBranchSend) {
155
            my $tobranch = $hold->pickup_library();
156
157
            # Add transfer, enqueue if one is already in the queue, and immediately set to in transit
158
            my $transfer = $item->request_transfer( { to => $tobranch, reason => 'Reserve', enqueue => 1 } );
159
            $transfer->transit;
160
        }
161
    }
168
    }
162
}
169
}
163
170
Lines 703-717 if ( $messages->{'ResFound'} ) { Link Here
703
        my $biblio = $item->biblio;
710
        my $biblio = $item->biblio;
704
711
705
        my $diffBranchSend = !$branchCheck ? $reserve->{branchcode} : undef;
712
        my $diffBranchSend = !$branchCheck ? $reserve->{branchcode} : undef;
706
        ModReserveAffect( $itemnumber, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id}, $desk_id );
713
        my $hold           = Koha::Holds->find( $reserve->{reserve_id} );      #TODO Hold not found
707
714
        confirm_hold( $item, $hold, $diffBranchSend, $desk_id ) if $hold;
708
        if ($diffBranchSend) {
709
            my $tobranch = Koha::Libraries->find( $reserve->{branchcode} );
710
711
            # Add transfer, enqueue if one is already in the queue, and immediately set to in transit
712
            my $transfer = $item->request_transfer( { to => $tobranch, reason => 'Reserve', enqueue => 1 } );
713
            $transfer->transit;
714
        }
715
715
716
        $template->param(
716
        $template->param(
717
            hold_auto_filled => 1,
717
            hold_auto_filled => 1,
718
- 

Return to bug 19814