=cut
-use strict;
-use warnings;
+use Modern::Perl;
# FIXME There are weird things going on with $patron and $borrowernumber in this script
use Koha::DateUtils;
use Koha::Calendar;
use Koha::BiblioFrameworks;
-use Koha::Checkouts;
use Koha::Holds;
use Koha::Items;
use Koha::Patrons;
+use Koha::Checkouts;
my $query = new CGI;
if ( $query->param('print_slip') ) {
$template->param(
print_slip => 1,
- borrowernumber => scalar $query->param('borrowernumber'),
+ borrowernumber => scalar $query->param('borrowernumber'), # FIXME We should send a Koha::Patron and raise an error if not exist.
biblionumber => scalar $query->param('biblionumber'),
+ itemnumber => scalar $query->param('itemnumber'),
);
}
itembiblionumber => $biblio->biblionumber,
iteminfo => $biblio->author,
name => $name,
- borrowernumber => $borrowernumber,
- borcnum => $patron->cardnumber,
- borfirstname => $patron->firstname,
- borsurname => $patron->surname,
- borcategory => $patron->category->description,
+ patron => $patron,
diffbranch => 1,
);
}
# make sure return branch respects home branch circulation rules, default to homebranch
my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
- $returnbranch = $item->$hbr;
+ $returnbranch = $hbr ne 'noreturn' ? $item->$hbr : $userenv_branch; # can be noreturn, homebranch or holdingbranch
my $materials = $item->materials;
my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
ccode => $item->ccode,
itembiblionumber => $biblio->biblionumber,
biblionumber => $biblio->biblionumber,
- borrower => $borrower,
additional_materials => $materials,
issue => $checkout,
);
my $patron = Koha::Patrons->find( $reserve->{'borrowernumber'} );
my $name = $patron->surname . ", " . $patron->title . " " . $patron->firstname;
$template->param(
- # FIXME The full patron object should be passed to the template
- wname => $name,
- wborfirstname => $patron->firstname,
- wborsurname => $patron->surname,
- wborcategory => $patron->category->description,
- wbortitle => $patron->title,
- wborphone => $patron->phone,
- wboremail => $patron->email,
- streetnumber => $patron->streetnumber,
- address => $patron->address,
- address2 => $patron->address2,
- city => $patron->city,
- zipcode => $patron->zipcode,
- state => $patron->state,
- country => $patron->country,
- wborrowernumber => $reserve->{'borrowernumber'},
- wborcnum => $patron->cardnumber,
+ patron => $patron,
);
}
$template->param(
$template->param(
# FIXME The full patron object should be passed to the template
found => 1,
- name => $patron->surname . ", " . $patron->title . " " . $patron->firstname,
- borfirstname => $patron->firstname,
- borsurname => $patron->surname,
- borcategory => $patron->category->description,
- bortitle => $patron->title,
- borphone => $patron->phone,
- boremail => $patron->email,
- boraddress => $patron->address,
- boraddress2 => $patron->address2,
- streetnumber => $patron->streetnumber,
- city => $patron->city,
- zipcode => $patron->zipcode,
- state => $patron->state,
- country => $patron->country,
- borcnum => $patron->cardnumber,
- debarred => $patron->debarred,
- gonenoaddress => $patron->gonenoaddress,
+ patron => $patron,
barcode => $barcode,
destbranch => $reserve->{'branchcode'},
- borrowernumber => $reserve->{'borrowernumber'},
itemnumber => $reserve->{'itemnumber'},
reservenotes => $reserve->{'reservenotes'},
reserve_id => $reserve->{reserve_id},
elsif ( $code eq 'NotIssued' ) {
$err{notissued} = 1;
$err{msg} = '';
- $err{msg} = $messages->{'IsPermanent'} if $messages->{'IsPermanent'};
}
elsif ( $code eq 'LocalUse' ) {
$err{localuse} = 1;
$err{withdrawn} = 1;
$exit_required_p = 1 if C4::Context->preference("BlockReturnOfWithdrawnItems");
}
- elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
- if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
- $err{ispermanent} = 1;
- $err{msg} = $messages->{'IsPermanent'};
- }
- }
elsif ( $code eq 'WrongTransfer' ) {
; # FIXME... anything to do here?
}
} else {
$ri{return_overdue} = 1 if (DateTime->compare($duedate, $dropboxdate) == -1);
}
- $ri{borrowernumber} = $patron->borrowernumber;
- $ri{borcnum} = $patron->cardnumber;
- $ri{borfirstname} = $patron->firstname;
- $ri{borsurname} = $patron->surname;
- $ri{bortitle} = $patron->title;
- $ri{bornote} = $patron->borrowernotes;
- $ri{borcategorycode}= $patron->categorycode;
- $ri{borissuescount} = Koha::Checkouts->count( { borrowernumber => $b->{'borrowernumber'} } );
+ $ri{patron} = $patron,
+ $ri{borissuescount} = $patron->checkouts->count;
}
else {
$ri{borrowernumber} = $riborrowernumber{$_};
$ri{homebranch} = $item->homebranch;
$ri{holdingbranch} = $item->holdingbranch;
- $ri{location} = $biblio->{'location'};
+ $ri{location} = $item->location;
my $shelfcode = $ri{'location'};
$ri{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
push @riloop, \%ri;
}
+my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count;
+
$template->param(
riloop => \@riloop,
printer => $printer,
forgivemanualholdsexpire => $forgivemanualholdsexpire,
overduecharges => $overduecharges,
AudioAlerts => C4::Context->preference("AudioAlerts"),
+ pending_checkout_notes => $pending_checkout_notes,
);
$itemnumber = GetItemnumberFromBarcode( $barcode );