|
Lines 3-9
Link Here
|
| 3 |
# Copyright 2000-2002 Katipo Communications |
3 |
# Copyright 2000-2002 Katipo Communications |
| 4 |
# 2006 SAN-OP |
4 |
# 2006 SAN-OP |
| 5 |
# 2007-2010 BibLibre, Paul POULAIN |
5 |
# 2007-2010 BibLibre, Paul POULAIN |
| 6 |
# 2010 Catalyst IT |
6 |
# 2010-2011 Catalyst IT |
| 7 |
# |
7 |
# |
| 8 |
# This file is part of Koha. |
8 |
# This file is part of Koha. |
| 9 |
# |
9 |
# |
|
Lines 86-91
my $userenv_branch = C4::Context->userenv->{'branch'} || '';
Link Here
|
| 86 |
my %returneditems; |
86 |
my %returneditems; |
| 87 |
my %riduedate; |
87 |
my %riduedate; |
| 88 |
my %riborrowernumber; |
88 |
my %riborrowernumber; |
|
|
89 |
my %ribarcode; |
| 89 |
my @inputloop; |
90 |
my @inputloop; |
| 90 |
foreach ( $query->param ) { |
91 |
foreach ( $query->param ) { |
| 91 |
my $counter; |
92 |
my $counter; |
|
Lines 99-122
foreach ( $query->param ) {
Link Here
|
| 99 |
next; |
100 |
next; |
| 100 |
} |
101 |
} |
| 101 |
|
102 |
|
|
|
103 |
# These "slide up" the list of returned items, to make room for the one |
| 104 |
# being processed now. |
| 102 |
my %input; |
105 |
my %input; |
| 103 |
my $barcode = $query->param("ri-$counter"); |
106 |
my $itemnumber = $query->param("ri-$counter"); |
|
|
107 |
my $barcode = $query->param("bc-$counter"); |
| 104 |
my $duedate = $query->param("dd-$counter"); |
108 |
my $duedate = $query->param("dd-$counter"); |
| 105 |
my $borrowernumber = $query->param("bn-$counter"); |
109 |
my $borrowernumber = $query->param("bn-$counter"); |
| 106 |
$counter++; |
110 |
$counter++; |
| 107 |
|
111 |
|
| 108 |
# decode barcode ## Didn't we already decode them before passing them back last time?? |
112 |
$returneditems{$counter} = $itemnumber; |
| 109 |
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace |
|
|
| 110 |
$barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter')); |
| 111 |
|
| 112 |
###################### |
| 113 |
#Are these lines still useful ? |
| 114 |
$returneditems{$counter} = $barcode; |
| 115 |
$riduedate{$counter} = $duedate; |
113 |
$riduedate{$counter} = $duedate; |
| 116 |
$riborrowernumber{$counter} = $borrowernumber; |
114 |
$riborrowernumber{$counter} = $borrowernumber; |
|
|
115 |
$ribarcode{$counter} = $barcode; |
| 117 |
|
116 |
|
| 118 |
####################### |
|
|
| 119 |
$input{counter} = $counter; |
117 |
$input{counter} = $counter; |
|
|
118 |
$input{itemnumber} = $itemnumber; |
| 120 |
$input{barcode} = $barcode; |
119 |
$input{barcode} = $barcode; |
| 121 |
$input{duedate} = $duedate; |
120 |
$input{duedate} = $duedate; |
| 122 |
$input{borrowernumber} = $borrowernumber; |
121 |
$input{borrowernumber} = $borrowernumber; |
|
Lines 168-173
my $returned = 0;
Link Here
|
| 168 |
my $messages; |
167 |
my $messages; |
| 169 |
my $issueinformation; |
168 |
my $issueinformation; |
| 170 |
my $itemnumber; |
169 |
my $itemnumber; |
|
|
170 |
# Depending on the setting of CircItemnumberFallback, this may also contain |
| 171 |
# the itemnumber. |
| 171 |
my $barcode = $query->param('barcode'); |
172 |
my $barcode = $query->param('barcode'); |
| 172 |
my $exemptfine = $query->param('exemptfine'); |
173 |
my $exemptfine = $query->param('exemptfine'); |
| 173 |
my $dropboxmode = $query->param('dropboxmode'); |
174 |
my $dropboxmode = $query->param('dropboxmode'); |
|
Lines 198-218
if ($canceltransfer){
Link Here
|
| 198 |
} |
199 |
} |
| 199 |
|
200 |
|
| 200 |
# actually return book and prepare item table..... |
201 |
# actually return book and prepare item table..... |
|
|
202 |
my $item; |
| 201 |
if ($barcode) { |
203 |
if ($barcode) { |
| 202 |
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace |
204 |
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace |
|
|
205 |
my $orig_barcode = $barcode; |
| 203 |
$barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter'); |
206 |
$barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter'); |
| 204 |
$itemnumber = GetItemnumberFromBarcode($barcode); |
207 |
$itemnumber = GetItemnumberFromBarcode($barcode); |
| 205 |
|
208 |
if (!$itemnumber && C4::Context->preference('CircFallbackItemnumber')) { |
| 206 |
if ( C4::Context->preference("InProcessingToShelvingCart") ) { |
209 |
# See if we have a real item number instead of a barcode |
| 207 |
my $item = GetItem( $itemnumber ); |
210 |
$item = GetItem($orig_barcode); |
|
|
211 |
$itemnumber = $item->{itemnumber} if $item; |
| 212 |
} |
| 213 |
else { |
| 214 |
$item = GetItem($itemnumber); |
| 215 |
} |
| 216 |
# If the provided item doesn't exist, then we will fall through and |
| 217 |
# this problem is picked up by AddReturn. |
| 218 |
if ( C4::Context->preference("InProcessingToShelvingCart") && $item ) { |
| 208 |
if ( $item->{'location'} eq 'PROC' ) { |
219 |
if ( $item->{'location'} eq 'PROC' ) { |
| 209 |
$item->{'location'} = 'CART'; |
220 |
$item->{'location'} = 'CART'; |
| 210 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
221 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
| 211 |
} |
222 |
} |
| 212 |
} |
223 |
} |
| 213 |
|
224 |
|
| 214 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
225 |
if ( C4::Context->preference("ReturnToShelvingCart") && $item) { |
| 215 |
my $item = GetItem( $itemnumber ); |
|
|
| 216 |
$item->{'location'} = 'CART'; |
226 |
$item->{'location'} = 'CART'; |
| 217 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
227 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
| 218 |
} |
228 |
} |
|
Lines 221-227
if ($barcode) {
Link Here
|
| 221 |
# save the return |
231 |
# save the return |
| 222 |
# |
232 |
# |
| 223 |
( $returned, $messages, $issueinformation, $borrower ) = |
233 |
( $returned, $messages, $issueinformation, $borrower ) = |
| 224 |
AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode); # do the return |
234 |
AddReturn( $itemnumber, $userenv_branch, $exemptfine, $dropboxmode ); |
| 225 |
my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn') or 'homebranch'; |
235 |
my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn') or 'homebranch'; |
| 226 |
|
236 |
|
| 227 |
# get biblio description |
237 |
# get biblio description |
|
Lines 237-259
if ($barcode) {
Link Here
|
| 237 |
itembarcode => $biblio->{'barcode'}, |
247 |
itembarcode => $biblio->{'barcode'}, |
| 238 |
itemtype => $biblio->{'itemtype'}, |
248 |
itemtype => $biblio->{'itemtype'}, |
| 239 |
ccode => $biblio->{'ccode'}, |
249 |
ccode => $biblio->{'ccode'}, |
| 240 |
itembiblionumber => $biblio->{'biblionumber'}, |
250 |
itembiblionumber => $biblio->{'biblionumber'}, |
|
|
251 |
itemnumber => $itemnumber, |
| 241 |
); |
252 |
); |
| 242 |
|
253 |
|
| 243 |
my %input = ( |
254 |
my %input = ( |
| 244 |
counter => 0, |
255 |
counter => 0, |
| 245 |
first => 1, |
256 |
first => 1, |
| 246 |
barcode => $barcode, |
257 |
barcode => $biblio->{barcode}, |
|
|
258 |
itemnumber => $itemnumber, |
| 247 |
); |
259 |
); |
| 248 |
|
260 |
|
| 249 |
if ($returned) { |
261 |
if ($returned) { |
| 250 |
my $duedate = $issueinformation->{'date_due'}; |
262 |
my $duedate = $issueinformation->{'date_due'}; |
| 251 |
$returneditems{0} = $barcode; |
263 |
$returneditems{0} = $itemnumber; |
| 252 |
$riborrowernumber{0} = $borrower->{'borrowernumber'}; |
264 |
$riborrowernumber{0} = $borrower->{'borrowernumber'}; |
| 253 |
$riduedate{0} = $duedate; |
265 |
$riduedate{0} = $duedate; |
|
|
266 |
$ribarcode{0} = $biblio->{barcode}; |
| 254 |
$input{borrowernumber} = $borrower->{'borrowernumber'}; |
267 |
$input{borrowernumber} = $borrower->{'borrowernumber'}; |
| 255 |
$input{duedate} = $duedate; |
268 |
$input{duedate} = $duedate; |
| 256 |
$input{return_overdue} = 1 if ($duedate and $duedate lt $today->output('iso')); |
269 |
$input{return_overdue} = 1 |
|
|
270 |
if ( $duedate and $duedate lt $today->output('iso') ); |
| 257 |
push( @inputloop, \%input ); |
271 |
push( @inputloop, \%input ); |
| 258 |
|
272 |
|
| 259 |
if ( C4::Context->preference("FineNotifyAtCheckin") ) { |
273 |
if ( C4::Context->preference("FineNotifyAtCheckin") ) { |
|
Lines 283-291
if ($barcode) {
Link Here
|
| 283 |
} |
297 |
} |
| 284 |
} |
298 |
} |
| 285 |
} |
299 |
} |
| 286 |
elsif ( !$messages->{'BadBarcode'} ) { |
300 |
elsif ( !$messages->{'BadItemnumber'} ) { |
| 287 |
$input{duedate} = 0; |
301 |
$input{duedate} = 0; |
| 288 |
$returneditems{0} = $barcode; |
302 |
$returneditems{0} = $itemnumber; |
| 289 |
$riduedate{0} = 0; |
303 |
$riduedate{0} = 0; |
| 290 |
if ( $messages->{'wthdrawn'} ) { |
304 |
if ( $messages->{'wthdrawn'} ) { |
| 291 |
$input{withdrawn} = 1; |
305 |
$input{withdrawn} = 1; |
|
Lines 376-385
if ( $messages->{'ResFound'}) {
Link Here
|
| 376 |
); |
390 |
); |
| 377 |
} elsif ( $reserve->{'ResFound'} eq "Reserved" ) { |
391 |
} elsif ( $reserve->{'ResFound'} eq "Reserved" ) { |
| 378 |
$template->param( |
392 |
$template->param( |
| 379 |
intransit => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ), |
393 |
intransit => |
| 380 |
transfertodo => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ), |
394 |
( $userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ), |
| 381 |
resbarcode => $barcode, |
395 |
transfertodo => |
| 382 |
reserved => 1, |
396 |
( $userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ), |
|
|
397 |
resbarcode => $item->{barcode}, |
| 398 |
resitemnumber => $item->{itemnumber}, |
| 399 |
reserved => 1, |
| 383 |
); |
400 |
); |
| 384 |
} |
401 |
} |
| 385 |
|
402 |
|
|
Lines 401-407
if ( $messages->{'ResFound'}) {
Link Here
|
| 401 |
borcnum => $borr->{'cardnumber'}, |
418 |
borcnum => $borr->{'cardnumber'}, |
| 402 |
debarred => $borr->{'debarred'}, |
419 |
debarred => $borr->{'debarred'}, |
| 403 |
gonenoaddress => $borr->{'gonenoaddress'}, |
420 |
gonenoaddress => $borr->{'gonenoaddress'}, |
| 404 |
barcode => $barcode, |
421 |
barcode => $reserve->{'barcode'}, |
| 405 |
destbranch => $reserve->{'branchcode'}, |
422 |
destbranch => $reserve->{'branchcode'}, |
| 406 |
borrowernumber => $reserve->{'borrowernumber'}, |
423 |
borrowernumber => $reserve->{'borrowernumber'}, |
| 407 |
itemnumber => $reserve->{'itemnumber'}, |
424 |
itemnumber => $reserve->{'itemnumber'}, |
|
Lines 415-423
my @errmsgloop;
Link Here
|
| 415 |
foreach my $code ( keys %$messages ) { |
432 |
foreach my $code ( keys %$messages ) { |
| 416 |
my %err; |
433 |
my %err; |
| 417 |
my $exit_required_p = 0; |
434 |
my $exit_required_p = 0; |
| 418 |
if ( $code eq 'BadBarcode' ) { |
435 |
if ( $code eq 'BadItemnumber' ) { |
| 419 |
$err{badbarcode} = 1; |
436 |
$err{badbarcode} = 1; |
| 420 |
$err{msg} = $messages->{'BadBarcode'}; |
437 |
$err{msg} = $messages->{'BadItemnumber'} || $barcode; |
| 421 |
} |
438 |
} |
| 422 |
elsif ( $code eq 'NotIssued' ) { |
439 |
elsif ( $code eq 'NotIssued' ) { |
| 423 |
$err{notissued} = 1; |
440 |
$err{notissued} = 1; |
|
Lines 499-510
if ($borrower) {
Link Here
|
| 499 |
my $items = $flags->{$flag}->{'itemlist'}; |
516 |
my $items = $flags->{$flag}->{'itemlist'}; |
| 500 |
foreach my $item (@$items) { |
517 |
foreach my $item (@$items) { |
| 501 |
my $biblio = GetBiblioFromItemNumber( $item->{'itemnumber'}); |
518 |
my $biblio = GetBiblioFromItemNumber( $item->{'itemnumber'}); |
| 502 |
push @waitingitemloop, { |
519 |
push @waitingitemloop, |
| 503 |
biblionum => $biblio->{'biblionumber'}, |
520 |
{ |
| 504 |
barcode => $biblio->{'barcode'}, |
521 |
biblionum => $biblio->{'biblionumber'}, |
| 505 |
title => $biblio->{'title'}, |
522 |
barcode => $biblio->{'barcode'}, |
| 506 |
brname => $branches->{ $biblio->{'holdingbranch'} }->{'branchname'}, |
523 |
itemnumber => $item->{'itemnumber'}, |
| 507 |
}; |
524 |
title => $biblio->{'title'}, |
|
|
525 |
brname => |
| 526 |
$branches->{ $biblio->{'holdingbranch'} }->{'branchname'}, |
| 527 |
}; |
| 508 |
} |
528 |
} |
| 509 |
$flaginfo{itemloop} = \@waitingitemloop; |
529 |
$flaginfo{itemloop} = \@waitingitemloop; |
| 510 |
} |
530 |
} |
|
Lines 515-527
if ($borrower) {
Link Here
|
| 515 |
@$items ) |
535 |
@$items ) |
| 516 |
{ |
536 |
{ |
| 517 |
my $biblio = GetBiblioFromItemNumber( $item->{'itemnumber'}); |
537 |
my $biblio = GetBiblioFromItemNumber( $item->{'itemnumber'}); |
| 518 |
push @itemloop, { |
538 |
push @itemloop, |
| 519 |
duedate => format_date($item->{'date_due'}), |
539 |
{ |
| 520 |
biblionum => $biblio->{'biblionumber'}, |
540 |
duedate => format_date( $item->{'date_due'} ), |
| 521 |
barcode => $biblio->{'barcode'}, |
541 |
biblionum => $biblio->{'biblionumber'}, |
| 522 |
title => $biblio->{'title'}, |
542 |
barcode => $biblio->{'barcode'}, |
| 523 |
brname => $branches->{ $biblio->{'holdingbranch'} }->{'branchname'}, |
543 |
itemnumber => $item->{'itemnumber'}, |
| 524 |
}; |
544 |
title => $biblio->{'title'}, |
|
|
545 |
brname => |
| 546 |
$branches->{ $biblio->{'holdingbranch'} }->{'branchname'}, |
| 547 |
}; |
| 525 |
} |
548 |
} |
| 526 |
$flaginfo{itemloop} = \@itemloop; |
549 |
$flaginfo{itemloop} = \@itemloop; |
| 527 |
$flaginfo{overdue} = 1; |
550 |
$flaginfo{overdue} = 1; |
|
Lines 551-557
my $shelflocations = GetKohaAuthorisedValues('items.location','');
Link Here
|
| 551 |
foreach ( sort { $a <=> $b } keys %returneditems ) { |
574 |
foreach ( sort { $a <=> $b } keys %returneditems ) { |
| 552 |
my %ri; |
575 |
my %ri; |
| 553 |
if ( $count++ < $returned_counter ) { |
576 |
if ( $count++ < $returned_counter ) { |
| 554 |
my $bar_code = $returneditems{$_}; |
577 |
my $returned_item = $returneditems{$_}; |
| 555 |
my $duedate = $riduedate{$_}; |
578 |
my $duedate = $riduedate{$_}; |
| 556 |
if ($duedate) { |
579 |
if ($duedate) { |
| 557 |
my @tempdate = split( /-/, $duedate ); |
580 |
my @tempdate = split( /-/, $duedate ); |
|
Lines 574-582
foreach ( sort { $a <=> $b } keys %returneditems ) {
Link Here
|
| 574 |
} |
597 |
} |
| 575 |
|
598 |
|
| 576 |
# my %ri; |
599 |
# my %ri; |
| 577 |
my $biblio = GetBiblioFromItemNumber(GetItemnumberFromBarcode($bar_code)); |
600 |
my $biblio = GetBiblioFromItemNumber($returned_item); |
|
|
601 |
|
| 578 |
# fix up item type for display |
602 |
# fix up item type for display |
| 579 |
$biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'}; |
603 |
$biblio->{'itemtype'} = |
|
|
604 |
C4::Context->preference('item-level_itypes') |
| 605 |
? $biblio->{'itype'} |
| 606 |
: $biblio->{'itemtype'}; |
| 580 |
$ri{itembiblionumber} = $biblio->{'biblionumber'}; |
607 |
$ri{itembiblionumber} = $biblio->{'biblionumber'}; |
| 581 |
$ri{itemtitle} = $biblio->{'title'}; |
608 |
$ri{itemtitle} = $biblio->{'title'}; |
| 582 |
$ri{itemauthor} = $biblio->{'author'}; |
609 |
$ri{itemauthor} = $biblio->{'author'}; |
|
Lines 584-595
foreach ( sort { $a <=> $b } keys %returneditems ) {
Link Here
|
| 584 |
$ri{itemtype} = $biblio->{'itemtype'}; |
611 |
$ri{itemtype} = $biblio->{'itemtype'}; |
| 585 |
$ri{itemnote} = $biblio->{'itemnotes'}; |
612 |
$ri{itemnote} = $biblio->{'itemnotes'}; |
| 586 |
$ri{ccode} = $biblio->{'ccode'}; |
613 |
$ri{ccode} = $biblio->{'ccode'}; |
|
|
614 |
$ri{barcode} = $biblio->{'barcode'}; |
| 587 |
$ri{itemnumber} = $biblio->{'itemnumber'}; |
615 |
$ri{itemnumber} = $biblio->{'itemnumber'}; |
| 588 |
$ri{barcode} = $bar_code; |
|
|
| 589 |
|
| 590 |
$ri{location} = $biblio->{'location'}; |
616 |
$ri{location} = $biblio->{'location'}; |
| 591 |
my $shelfcode = $ri{'location'}; |
617 |
my $shelfcode = $ri{'location'}; |
| 592 |
$ri{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) ); |
618 |
$ri{'location'} = $shelflocations->{$shelfcode} |
|
|
619 |
if ( defined($shelfcode) |
| 620 |
&& defined($shelflocations) |
| 621 |
&& exists( $shelflocations->{$shelfcode} ) ); |
| 593 |
|
622 |
|
| 594 |
} |
623 |
} |
| 595 |
else { |
624 |
else { |
|
Lines 599-615
foreach ( sort { $a <=> $b } keys %returneditems ) {
Link Here
|
| 599 |
} |
628 |
} |
| 600 |
|
629 |
|
| 601 |
$template->param( |
630 |
$template->param( |
| 602 |
riloop => \@riloop, |
631 |
riloop => \@riloop, |
| 603 |
genbrname => $branches->{$userenv_branch}->{'branchname'}, |
632 |
genbrname => $branches->{$userenv_branch}->{'branchname'}, |
| 604 |
genprname => $printers->{$printer}->{'printername'}, |
633 |
genprname => $printers->{$printer}->{'printername'}, |
| 605 |
branchname => $branches->{$userenv_branch}->{'branchname'}, |
634 |
branchname => $branches->{$userenv_branch}->{'branchname'}, |
| 606 |
printer => $printer, |
635 |
printer => $printer, |
| 607 |
errmsgloop => \@errmsgloop, |
636 |
errmsgloop => \@errmsgloop, |
| 608 |
exemptfine => $exemptfine, |
637 |
exemptfine => $exemptfine, |
| 609 |
dropboxmode => $dropboxmode, |
638 |
dropboxmode => $dropboxmode, |
| 610 |
dropboxdate => $dropboxdate->output(), |
639 |
dropboxdate => $dropboxdate->output(), |
| 611 |
overduecharges => $overduecharges, |
640 |
overduecharges => $overduecharges, |
| 612 |
soundon => C4::Context->preference("SoundOn"), |
641 |
soundon => C4::Context->preference("SoundOn"), |
|
|
642 |
can_be_itemnumber => C4::Context->preference('CircFallbackItemnumber'), |
| 613 |
); |
643 |
); |
| 614 |
|
644 |
|
| 615 |
### Comment out rotating collections for now to allow it a little more time to bake |
645 |
### Comment out rotating collections for now to allow it a little more time to bake |