Lines 157-168
if ( $query->param('reserve_id') && $op eq 'cud-affect_reserve') {
Link Here
|
157 |
# fix up item type for display |
157 |
# fix up item type for display |
158 |
my $item = Koha::Items->find( $itemnumber ); |
158 |
my $item = Koha::Items->find( $itemnumber ); |
159 |
my $biblio = $item->biblio; |
159 |
my $biblio = $item->biblio; |
|
|
160 |
my $hold = Koha::Holds->find($reserve_id) or die "Hold for item $itemnumber not found\n"; #TODO Not very elegant |
160 |
|
161 |
|
161 |
if ( $cancel_reserve ) { |
162 |
if ( $cancel_reserve ) { |
162 |
my $hold = Koha::Holds->find( $reserve_id ); |
163 |
$hold->cancel( { charge_cancel_fee => !$forgivemanualholdsexpire, cancellation_reason => $cancel_reason} ); |
163 |
if ( $hold ) { |
164 |
|
164 |
$hold->cancel( { charge_cancel_fee => !$forgivemanualholdsexpire, cancellation_reason => $cancel_reason} ); |
165 |
# check if we have other reserves for this document, if we have a result send the message of transfer |
165 |
} # FIXME else? |
166 |
my ( undef, $nextreservinfo, undef ) = CheckReserves( $item, C4::Context->preference('ConfirmFutureHolds') ); |
|
|
167 |
if ( $userenv_branch ne $nextreservinfo->{'branchcode'} ) { |
168 |
my $patron = Koha::Patrons->find( $nextreservinfo->{'borrowernumber'} ); |
169 |
$template->param( |
170 |
itemtitle => $biblio->title, |
171 |
itembiblionumber => $biblio->biblionumber, |
172 |
iteminfo => $biblio->author, |
173 |
patron => $patron, |
174 |
diffbranch => 1, |
175 |
); |
176 |
} |
166 |
} else { |
177 |
} else { |
167 |
my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef; |
178 |
my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef; |
168 |
|
179 |
|
Lines 170-176
if ( $query->param('reserve_id') && $op eq 'cud-affect_reserve') {
Link Here
|
170 |
# i.e., whether to apply waiting status |
181 |
# i.e., whether to apply waiting status |
171 |
ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id, $desk_id ); |
182 |
ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id, $desk_id ); |
172 |
|
183 |
|
173 |
my $hold = Koha::Holds->find($reserve_id); |
|
|
174 |
if ($diffBranchSend) { |
184 |
if ($diffBranchSend) { |
175 |
my $tobranch = $hold->pickup_library(); |
185 |
my $tobranch = $hold->pickup_library(); |
176 |
|
186 |
|
Lines 179-198
if ( $query->param('reserve_id') && $op eq 'cud-affect_reserve') {
Link Here
|
179 |
$transfer->transit; |
189 |
$transfer->transit; |
180 |
} |
190 |
} |
181 |
} |
191 |
} |
182 |
# check if we have other reserves for this document, if we have a result send the message of transfer |
|
|
183 |
# FIXME do we need to do this if we didn't take the cancel_reserve branch above? |
184 |
my ( undef, $nextreservinfo, undef ) = CheckReserves( $item, C4::Context->preference('ConfirmFutureHolds') ); |
185 |
|
186 |
if ( $userenv_branch ne $nextreservinfo->{'branchcode'} ) { |
187 |
my $patron = Koha::Patrons->find( $nextreservinfo->{'borrowernumber'} ); |
188 |
$template->param( |
189 |
itemtitle => $biblio->title, |
190 |
itembiblionumber => $biblio->biblionumber, |
191 |
iteminfo => $biblio->author, |
192 |
patron => $patron, |
193 |
diffbranch => 1, |
194 |
); |
195 |
} |
196 |
} |
192 |
} |
197 |
|
193 |
|
198 |
if ( $query->param('recall_id') && $op eq 'cud-affect_recall' ) { |
194 |
if ( $query->param('recall_id') && $op eq 'cud-affect_recall' ) { |
199 |
- |
|
|