Lines 174-180
foreach my $biblioNumber (@biblionumbers) {
Link Here
|
174 |
# |
174 |
# |
175 |
if ( $query->param('place_reserve') ) { |
175 |
if ( $query->param('place_reserve') ) { |
176 |
my $notes = $query->param('notes'); |
176 |
my $notes = $query->param('notes'); |
177 |
my $canreserve=0; |
177 |
my $reserve_cnt = 0; |
|
|
178 |
if ($MAXIMUM_NUMBER_OF_RESERVES) { |
179 |
$reserve_cnt = GetReservesFromBorrowernumber( $borrowernumber ); |
180 |
} |
178 |
|
181 |
|
179 |
# List is composed of alternating biblio/item/branch |
182 |
# List is composed of alternating biblio/item/branch |
180 |
my $selectedItems = $query->param('selecteditems'); |
183 |
my $selectedItems = $query->param('selecteditems'); |
Lines 205-259
if ( $query->param('place_reserve') ) {
Link Here
|
205 |
while (@selectedItems) { |
208 |
while (@selectedItems) { |
206 |
my $biblioNum = shift(@selectedItems); |
209 |
my $biblioNum = shift(@selectedItems); |
207 |
my $itemNum = shift(@selectedItems); |
210 |
my $itemNum = shift(@selectedItems); |
208 |
my $branch = shift(@selectedItems); # i.e., branch code, not name |
211 |
my $branch = shift(@selectedItems); # i.e., branch code, not name |
|
|
212 |
|
213 |
my $canreserve = 0; |
209 |
|
214 |
|
210 |
my $singleBranchMode = C4::Context->preference("singleBranchMode"); |
215 |
my $singleBranchMode = C4::Context->preference("singleBranchMode"); |
211 |
if ($singleBranchMode || ! $OPACChooseBranch) { # single branch mode or disabled user choosing |
216 |
if ( $singleBranchMode || !$OPACChooseBranch ) |
|
|
217 |
{ # single branch mode or disabled user choosing |
212 |
$branch = $borr->{'branchcode'}; |
218 |
$branch = $borr->{'branchcode'}; |
213 |
} |
219 |
} |
214 |
|
220 |
|
215 |
#item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber |
221 |
#item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber |
216 |
if ($itemNum ne '') { |
222 |
if ( $itemNum ne '' ) { |
217 |
my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum); |
223 |
my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum); |
218 |
if ($hostbiblioNum ne $biblioNum) { |
224 |
if ( $hostbiblioNum ne $biblioNum ) { |
219 |
$biblioNum = $hostbiblioNum; |
225 |
$biblioNum = $hostbiblioNum; |
220 |
} |
226 |
} |
221 |
} |
227 |
} |
222 |
|
228 |
|
223 |
my $biblioData = $biblioDataHash{$biblioNum}; |
229 |
my $biblioData = $biblioDataHash{$biblioNum}; |
224 |
my $found; |
230 |
my $found; |
225 |
|
231 |
|
226 |
# Check for user supplied reserve date |
232 |
# Check for user supplied reserve date |
227 |
my $startdate; |
233 |
my $startdate; |
228 |
if ( |
234 |
if ( C4::Context->preference('AllowHoldDateInFuture') |
229 |
C4::Context->preference( 'AllowHoldDateInFuture' ) && |
235 |
&& C4::Context->preference('OPACAllowHoldDateInFuture') ) |
230 |
C4::Context->preference( 'OPACAllowHoldDateInFuture' ) |
236 |
{ |
231 |
) { |
237 |
$startdate = $query->param("reserve_date_$biblioNum"); |
232 |
$startdate = $query->param("reserve_date_$biblioNum"); |
238 |
} |
233 |
} |
239 |
|
234 |
|
240 |
my $expiration_date = $query->param("expiration_date_$biblioNum"); |
235 |
my $expiration_date = $query->param("expiration_date_$biblioNum"); |
|
|
236 |
|
241 |
|
237 |
# If a specific item was selected and the pickup branch is the same as the |
242 |
# If a specific item was selected and the pickup branch is the same as the |
238 |
# holdingbranch, force the value $rank and $found. |
243 |
# holdingbranch, force the value $rank and $found. |
239 |
my $rank = $biblioData->{rank}; |
244 |
my $rank = $biblioData->{rank}; |
240 |
if ($itemNum ne ''){ |
245 |
if ( $itemNum ne '' ) { |
241 |
$canreserve = 1 if CanItemBeReserved($borrowernumber,$itemNum); |
246 |
$canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum ); |
242 |
$rank = '0' unless C4::Context->preference('ReservesNeedReturns'); |
247 |
$rank = '0' unless C4::Context->preference('ReservesNeedReturns'); |
243 |
my $item = GetItem($itemNum); |
248 |
my $item = GetItem($itemNum); |
244 |
if ( $item->{'holdingbranch'} eq $branch ){ |
249 |
if ( $item->{'holdingbranch'} eq $branch ) { |
245 |
$found = 'W' unless C4::Context->preference('ReservesNeedReturns'); |
250 |
$found = 'W' |
|
|
251 |
unless C4::Context->preference('ReservesNeedReturns'); |
246 |
} |
252 |
} |
247 |
} |
253 |
} |
248 |
else { |
254 |
else { |
249 |
$canreserve = 1 if CanBookBeReserved($borrowernumber,$biblioNum); |
255 |
$canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum ); |
|
|
256 |
|
250 |
# Inserts a null into the 'itemnumber' field of 'reserves' table. |
257 |
# Inserts a null into the 'itemnumber' field of 'reserves' table. |
251 |
$itemNum = undef; |
258 |
$itemNum = undef; |
252 |
} |
259 |
} |
253 |
|
260 |
|
|
|
261 |
if ( $MAXIMUM_NUMBER_OF_RESERVES |
262 |
&& $reserve_cnt >= $MAXIMUM_NUMBER_OF_RESERVES ) |
263 |
{ |
264 |
$canreserve = 0; |
265 |
} |
266 |
|
254 |
# Here we actually do the reserveration. Stage 3. |
267 |
# Here we actually do the reserveration. Stage 3. |
255 |
AddReserve($branch, $borrowernumber, $biblioNum, 'a', [$biblioNum], $rank, $startdate, $expiration_date, $notes, |
268 |
if ($canreserve) { |
256 |
$biblioData->{'title'}, $itemNum, $found) if ($canreserve); |
269 |
AddReserve( |
|
|
270 |
$branch, $borrowernumber, |
271 |
$biblioNum, 'a', |
272 |
[$biblioNum], $rank, |
273 |
$startdate, $expiration_date, |
274 |
$notes, $biblioData->{title}, |
275 |
$itemNum, $found |
276 |
); |
277 |
++$reserve_cnt; |
278 |
} |
257 |
} |
279 |
} |
258 |
|
280 |
|
259 |
print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds"); |
281 |
print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds"); |
Lines 274-287
if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstan
Link Here
|
274 |
$noreserves = 1; |
296 |
$noreserves = 1; |
275 |
$template->param( too_much_oweing => $amount ); |
297 |
$template->param( too_much_oweing => $amount ); |
276 |
} |
298 |
} |
277 |
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} eq 1) ) { |
299 |
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) { |
278 |
$noreserves = 1; |
300 |
$noreserves = 1; |
279 |
$template->param( |
301 |
$template->param( |
280 |
message => 1, |
302 |
message => 1, |
281 |
GNA => 1 |
303 |
GNA => 1 |
282 |
); |
304 |
); |
283 |
} |
305 |
} |
284 |
if ( $borr->{lost} && ($borr->{lost} eq 1) ) { |
306 |
if ( $borr->{lost} && ($borr->{lost} == 1) ) { |
285 |
$noreserves = 1; |
307 |
$noreserves = 1; |
286 |
$template->param( |
308 |
$template->param( |
287 |
message => 1, |
309 |
message => 1, |
288 |
- |
|
|