3 # script to execute issuing of books
5 # Copyright 2000-2002 Katipo Communications
6 # copyright 2010 BibLibre
7 # Copyright 2011 PTFS-Europe Ltd.
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along
21 # with Koha; if not, write to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 use C4::Auth qw/:DEFAULT get_session/;
30 use C4::Dates qw/format_date/;
31 use C4::Branch; # GetBranches
32 use C4::Koha; # GetPrinter
34 use C4::Overdues qw/CheckBorrowerDebarred/;
40 use C4::Members::Attributes qw(GetBorrowerAttributes);
49 use List::MoreUtils qw/uniq/;
57 my $sessionID = $query->cookie("CGISESSID") ;
58 my $session = get_session($sessionID);
60 # branch and printer are now defined by the userenv
61 # but first we have to check if someone has tried to change them
63 my $branch = $query->param('branch');
65 # update our session so the userenv is updated
66 $session->param('branch', $branch);
67 $session->param('branchname', GetBranchName($branch));
70 my $printer = $query->param('printer');
72 # update our session so the userenv is updated
73 $session->param('branchprinter', $printer);
76 if (!C4::Context->userenv && !$branch){
77 if ($session->param('branch') eq 'NO_LIBRARY_SET'){
78 # no branch set we can't issue
79 print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
84 my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
86 template_name => 'circ/circulation.tmpl',
90 flagsrequired => { circulate => 'circulate_remaining_permissions' },
94 my $branches = GetBranches();
96 my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers
97 our %renew_failed = ();
98 for (@failedrenews) { $renew_failed{$_} = 1; }
100 my @failedreturns = $query->param('failedreturn');
101 our %return_failed = ();
102 for (@failedreturns) { $return_failed{$_} = 1; }
104 my $findborrower = $query->param('findborrower') || q{};
105 $findborrower =~ s|,| |g;
106 my $borrowernumber = $query->param('borrowernumber');
108 $branch = C4::Context->userenv->{'branch'};
109 $printer = C4::Context->userenv->{'branchprinter'};
112 # If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
113 if (C4::Context->preference("AutoLocation") != 1) {
114 $template->param(ManualLocation => 1);
117 if (C4::Context->preference("DisplayClearScreenButton")) {
118 $template->param(DisplayClearScreenButton => 1);
121 if (C4::Context->preference("UseTablesortForCirc")) {
122 $template->param(UseTablesortForCirc => 1);
125 my $barcode = $query->param('barcode') || q{};
126 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
128 $barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
129 my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate');
130 my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate');
131 my $issueconfirmed = $query->param('issueconfirmed');
132 my $cancelreserve = $query->param('cancelreserve');
133 my $organisation = $query->param('organisations');
134 my $print = $query->param('print') || q{};
135 my $newexpiry = $query->param('dateexpiry');
136 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
138 # Check if stickyduedate is turned off
140 # was stickyduedate loaded from session?
141 if ( $stickyduedate && ! $query->param("stickyduedate") ) {
142 $session->clear( 'stickyduedate' );
143 $stickyduedate = $query->param('stickyduedate');
144 $duedatespec = $query->param('duedatespec');
148 my ($datedue,$invalidduedate);
150 my $duedatespec_allow = C4::Context->preference('SpecifyDueDate');
151 if($duedatespec_allow){
153 if ($duedatespec =~ C4::Dates->regexp('syspref')) {
154 $datedue = dt_from_string($duedatespec);
157 $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
162 our $todaysdate = C4::Dates->new->output('iso');
164 # check and see if we should print
165 if ( $barcode eq '' && $print eq 'maybe' ) {
169 my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess');
170 if ( $barcode eq '' && $query->param('charges') eq 'yes' ) {
173 borrowernumber => $borrowernumber
177 if ( $print eq 'yes' && $borrowernumber ne '' ) {
178 if ( C4::Context->boolean_preference('printcirculationslips') ) {
179 my $letter = IssueSlip($branch, $borrowernumber, "QUICK");
180 NetworkPrint($letter->{content});
182 $query->param( 'borrowernumber', '' );
183 $borrowernumber = '';
187 # STEP 2 : FIND BORROWER
188 # if there is a list of find borrowers....
193 my $borrowers = Search($findborrower, 'cardnumber') || [];
194 if (C4::Context->preference("AddPatronLists")) {
196 "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
198 if (C4::Context->preference("AddPatronLists")=~/code/){
199 my $categories = GetBorrowercategoryList;
200 $categories->[0]->{'first'} = 1;
201 $template->param(categories=>$categories);
204 if ( @$borrowers == 0 ) {
205 $query->param( 'findborrower', '' );
206 $message = "'$findborrower'";
208 elsif ( @$borrowers == 1 ) {
209 $borrowernumber = $borrowers->[0]->{'borrowernumber'};
210 $query->param( 'borrowernumber', $borrowernumber );
211 $query->param( 'barcode', '' );
214 $borrowerslist = $borrowers;
218 # get the borrower information.....
220 if ($borrowernumber) {
221 $borrower = GetMemberDetails( $borrowernumber, 0 );
222 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
224 # Warningdate is the date that the warning starts appearing
225 my ( $today_year, $today_month, $today_day) = Today();
226 my ($warning_year, $warning_month, $warning_day) = split /-/, $borrower->{'dateexpiry'};
227 my ( $enrol_year, $enrol_month, $enrol_day) = split /-/, $borrower->{'dateenrolled'};
228 # Renew day is calculated by adding the enrolment period to today
229 my ( $renew_year, $renew_month, $renew_day);
230 if ($enrol_year*$enrol_month*$enrol_day>0) {
231 ( $renew_year, $renew_month, $renew_day) =
232 Add_Delta_YM( $enrol_year, $enrol_month, $enrol_day,
233 0 , $borrower->{'enrolmentperiod'});
235 # if the expiry date is before today ie they have expired
236 if ( !$borrower->{'dateexpiry'} || $warning_year*$warning_month*$warning_day==0
237 || Date_to_Days($today_year, $today_month, $today_day )
238 > Date_to_Days($warning_year, $warning_month, $warning_day) )
240 #borrowercard expired, no issues
245 renewaldate => format_date("$renew_year-$renew_month-$renew_day")
248 # check for NotifyBorrowerDeparture
249 elsif ( C4::Context->preference('NotifyBorrowerDeparture') &&
250 Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
251 Date_to_Days( $today_year, $today_month, $today_day ) )
253 # borrower card soon to expire warn librarian
254 $template->param("warndeparture" => format_date($borrower->{dateexpiry}),
256 if (C4::Context->preference('ReturnBeforeExpiry')){
257 $template->param("returnbeforeexpiry" => 1);
262 issuecount => $issue,
266 my $debar = CheckBorrowerDebarred($borrowernumber);
268 $template->param( 'userdebarred' => 1 );
269 $template->param( 'debarredcomment' => $borrower->{debarredcomment} );
270 if ( $debar ne "9999-12-31" ) {
271 $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) );
282 # always check for blockers on issuing
283 my ( $error, $question, $alerts ) =
284 CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
285 my $blocker = $invalidduedate ? 1 : 0;
287 $template->param( alert => $alerts );
289 delete $question->{'DEBT'} if ($debt_confirmed);
290 foreach my $impossible ( keys %$error ) {
292 $impossible => $$error{$impossible},
298 my $confirm_required = 0;
299 unless($issueconfirmed){
300 # Get the item title for more information
301 my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
302 $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'};
303 $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} );
305 # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
306 foreach my $needsconfirmation ( keys %$question ) {
308 $needsconfirmation => $$question{$needsconfirmation},
309 getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
310 getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
311 NEEDSCONFIRMATION => 1
313 $confirm_required = 1;
316 unless($confirm_required) {
317 AddIssue( $borrower, $barcode, $datedue, $cancelreserve );
322 # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue
323 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
324 $template->param( issuecount => $issue );
327 # reload the borrower info for the sake of reseting the flags.....
328 if ($borrowernumber) {
329 $borrower = GetMemberDetails( $borrowernumber, 0 );
332 ##################################################################################
334 # show all reserves of this borrower, and the position of the reservation ....
335 if ($borrowernumber) {
338 # now we show the status of the borrower's reservations
339 my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber );
341 my @WaitingReserveLoop;
343 foreach my $num_res (@borrowerreserv) {
345 my %getWaitingReserveInfo;
346 my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
347 my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
348 my ( $transfertwhen, $transfertfrom, $transfertto ) =
349 GetTransfers( $num_res->{'itemnumber'} );
351 $getreserv{waiting} = 0;
352 $getreserv{transfered} = 0;
353 $getreserv{nottransfered} = 0;
355 $getreserv{reservedate} = format_date( $num_res->{'reservedate'} );
356 $getreserv{reservenumber} = $num_res->{'reservenumber'};
357 $getreserv{title} = $getiteminfo->{'title'};
358 $getreserv{itemtype} = $itemtypeinfo->{'description'};
359 $getreserv{author} = $getiteminfo->{'author'};
360 $getreserv{barcodereserv} = $getiteminfo->{'barcode'};
361 $getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'};
362 $getreserv{biblionumber} = $getiteminfo->{'biblionumber'};
363 $getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} );
364 $getreserv{suspend} = $num_res->{'suspend'};
365 $getreserv{suspend_until} = $num_res->{'suspend_until'};
366 # check if we have a waiting status for reservations
367 if ( $num_res->{'found'} eq 'W' ) {
368 $getreserv{color} = 'reserved';
369 $getreserv{waiting} = 1;
370 # genarate information displaying only waiting reserves
371 $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
372 $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'};
373 $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
374 $getWaitingReserveInfo{author} = $getiteminfo->{'author'};
375 $getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} );
376 $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} );
377 $getWaitingReserveInfo{waitinghere} = 1 if $num_res->{'branchcode'} eq $branch;
379 # check transfers with the itemnumber foud in th reservation loop
380 if ($transfertwhen) {
381 $getreserv{color} = 'transfered';
382 $getreserv{transfered} = 1;
383 $getreserv{datesent} = format_date($transfertwhen);
384 $getreserv{frombranch} = GetBranchName($transfertfrom);
385 } elsif ($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'}) {
386 $getreserv{nottransfered} = 1;
387 $getreserv{nottransferedby} = GetBranchName( $getiteminfo->{'holdingbranch'} );
390 # if we don't have a reserv on item, we put the biblio infos and the waiting position
391 if ( $getiteminfo->{'title'} eq '' ) {
392 my $getbibinfo = GetBiblioData( $num_res->{'biblionumber'} );
394 $getreserv{color} = 'inwait';
395 $getreserv{title} = $getbibinfo->{'title'};
396 $getreserv{nottransfered} = 0;
397 $getreserv{itemtype} = $itemtypeinfo->{'description'};
398 $getreserv{author} = $getbibinfo->{'author'};
399 $getreserv{biblionumber} = $num_res->{'biblionumber'};
401 $getreserv{waitingposition} = $num_res->{'priority'};
402 push( @reservloop, \%getreserv );
404 # if we have a reserve waiting, initiate waitingreserveloop
405 if ($getreserv{waiting} == 1) {
406 push (@WaitingReserveLoop, \%getWaitingReserveInfo)
411 # return result to the template
413 countreserv => scalar @reservloop,
414 reservloop => \@reservloop ,
415 WaitingReserveLoop => \@WaitingReserveLoop,
417 $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
420 # make the issued books table.
421 my $todaysissues = '';
423 our @todaysissues = ();
424 our @previousissues = ();
426 our @relprevissues = ();
427 my $displayrelissues;
431 sub build_issue_data {
432 my $issueslist = shift;
433 my $relatives = shift;
435 # split in 2 arrays for today & previous
436 foreach my $it ( @$issueslist ) {
437 my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} );
439 # set itemtype per item-level_itype syspref - FIXME this is an ugly hack
440 $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'};
442 ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges(
443 $it->{'itemnumber'}, $it->{'borrowernumber'}
445 $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
446 my ($can_renew, $can_renew_error) = CanBookBeRenewed(
447 $it->{'borrowernumber'},$it->{'itemnumber'}
449 $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
450 my ( $restype, $reserves, undef ) = CheckReserves( $it->{'itemnumber'} );
451 $it->{'can_renew'} = $can_renew;
452 $it->{'can_confirm'} = !$can_renew && !$restype;
453 $it->{'renew_error'} = $restype;
454 $it->{'checkoutdate'} = C4::Dates->new($it->{'issuedate'},'iso')->output('syspref');
455 $it->{'issuingbranchname'} = GetBranchName($it->{'branchcode'});
457 $totalprice += $it->{'replacementprice'};
458 $it->{'itemtype'} = $itemtypeinfo->{'description'};
459 $it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'};
460 $it->{'dd'} = output_pref($it->{'date_due'});
461 $it->{'displaydate'} = output_pref($it->{'issuedate'});
462 #$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ;
463 $it->{'od'} = $it->{'overdue'};
464 ($it->{'author'} eq '') and $it->{'author'} = ' ';
465 $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}};
466 $it->{'return_failed'} = $return_failed{$it->{'barcode'}};
468 if ( $it->{'issuedate'}."" gt $todaysdate or $it->{'lastreneweddate'} gt $todaysdate ) {
469 (!$relatives) ? push @todaysissues, $it : push @relissues, $it;
471 (!$relatives) ? push @previousissues, $it : push @relprevissues, $it;
478 # Getting borrower relatives
479 my @relborrowernumbers = GetMemberRelatives($borrower->{'borrowernumber'});
480 #push @borrowernumbers, $borrower->{'borrowernumber'};
482 # get each issue of the borrower & separate them in todayissues & previous issues
483 my $issueslist = GetPendingIssues($borrower->{'borrowernumber'});
484 my $relissueslist = [];
485 if ( @relborrowernumbers ) {
486 $relissueslist = GetPendingIssues(@relborrowernumbers);
489 build_issue_data($issueslist, 0);
490 build_issue_data($relissueslist, 1);
492 $displayrelissues = scalar($relissueslist);
494 if ( C4::Context->preference( "todaysIssuesDefaultSortOrder" ) eq 'asc' ) {
495 @todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
498 @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues;
501 if ( C4::Context->preference( "previousIssuesDefaultSortOrder" ) eq 'asc' ){
502 @previousissues = sort { $a->{'date_due'} cmp $b->{'date_due'} } @previousissues;
505 @previousissues = sort { $b->{'date_due'} cmp $a->{'date_due'} } @previousissues;
512 my $CGIselectborrower;
513 if ($borrowerslist) {
515 sort {(lc $a->{'surname'} cmp lc $b->{'surname'} || lc $a->{'firstname'} cmp lc $b->{'firstname'})
519 push @values, $_->{'borrowernumber'};
520 $labels{ $_->{'borrowernumber'} } =
521 "$_->{'surname'}, $_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'} - $_->{'branchcode'}) ... $_->{'address'} ";
523 $CGIselectborrower = CGI::scrolling_list(
524 -name => 'borrowernumber',
526 -id => 'borrowernumber',
529 -ondblclick => 'document.forms[\'mainform\'].submit()',
537 my $flags = $borrower->{'flags'};
538 foreach my $flag ( sort keys %$flags ) {
539 $template->param( flagged=> 1);
540 $flags->{$flag}->{'message'} =~ s#\n#<br />#g;
541 if ( $flags->{$flag}->{'noissues'} ) {
545 if ( $flag eq 'GNA' ) {
546 $template->param( gna => 'true' );
548 elsif ( $flag eq 'LOST' ) {
549 $template->param( lost => 'true' );
551 elsif ( $flag eq 'DBARRED' ) {
552 $template->param( dbarred => 'true' );
554 elsif ( $flag eq 'CHARGES' ) {
557 chargesmsg => $flags->{'CHARGES'}->{'message'},
558 chargesamount => $flags->{'CHARGES'}->{'amount'},
559 charges_is_blocker => 1
562 elsif ( $flag eq 'CREDITS' ) {
565 creditsmsg => $flags->{'CREDITS'}->{'message'},
566 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
571 if ( $flag eq 'CHARGES' ) {
574 chargesmsg => $flags->{'CHARGES'}->{'message'},
575 chargesamount => $flags->{'CHARGES'}->{'amount'},
578 elsif ( $flag eq 'CREDITS' ) {
581 creditsmsg => $flags->{'CREDITS'}->{'message'},
582 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
585 elsif ( $flag eq 'ODUES' ) {
588 oduesmsg => $flags->{'ODUES'}->{'message'}
591 my $items = $flags->{$flag}->{'itemlist'};
592 if ( ! $query->param('module') || $query->param('module') ne 'returns' ) {
593 $template->param( nonreturns => 'true' );
596 elsif ( $flag eq 'NOTES' ) {
599 notesmsg => $flags->{'NOTES'}->{'message'}
605 my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0;
606 $amountold =~ s/^.*\$//; # remove upto the $, if any
608 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
610 if ( $borrower->{'category_type'} eq 'C') {
611 my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
612 my $cnt = scalar(@$catcodes);
613 $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
614 $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
617 my $CGIorganisations;
618 my $member_of_institution;
619 if ( C4::Context->preference("memberofinstitution") ) {
620 my $organisations = get_institutions();
623 foreach my $organisation ( keys %$organisations ) {
624 push @orgs, $organisation;
625 $org_labels{$organisation} = $organisations->{$organisation}->{'surname'};
627 $member_of_institution = 1;
628 $CGIorganisations = CGI::popup_menu(
629 -id => 'organisations',
630 -name => 'organisations',
631 -labels => \%org_labels,
636 my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
637 if($lib_messages_loop){ $template->param(flagged => 1 ); }
639 my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch );
640 if($bor_messages_loop){ $template->param(flagged => 1 ); }
642 # Computes full borrower address
643 my (undef, $roadttype_hashref) = &GetRoadTypes();
644 my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'};
646 my $fast_cataloging = 0;
647 if (defined getframeworkinfo('FA')) {
651 if (C4::Context->preference('ExtendedPatronAttributes')) {
652 my $attributes = GetBorrowerAttributes($borrowernumber);
654 ExtendedPatronAttributes => 1,
655 extendedattributes => $attributes
660 lib_messages_loop => $lib_messages_loop,
661 bor_messages_loop => $bor_messages_loop,
662 all_messages_del => C4::Context->preference('AllowAllMessageDeletion'),
663 findborrower => $findborrower,
664 borrower => $borrower,
665 borrowernumber => $borrowernumber,
667 branchname => GetBranchName($borrower->{'branchcode'}),
669 printername => $printer,
670 firstname => $borrower->{'firstname'},
671 surname => $borrower->{'surname'},
672 showname => $borrower->{'showname'},
673 category_type => $borrower->{'category_type'},
674 dateexpiry => format_date($newexpiry),
675 expiry => format_date($borrower->{'dateexpiry'}),
676 categorycode => $borrower->{'categorycode'},
677 categoryname => $borrower->{description},
679 address2 => $borrower->{'address2'},
680 email => $borrower->{'email'},
681 emailpro => $borrower->{'emailpro'},
682 borrowernotes => $borrower->{'borrowernotes'},
683 city => $borrower->{'city'},
684 state => $borrower->{'state'},
685 zipcode => $borrower->{'zipcode'},
686 country => $borrower->{'country'},
687 phone => $borrower->{'phone'} || $borrower->{'mobile'},
688 cardnumber => $borrower->{'cardnumber'},
689 othernames => $borrower->{'othernames'},
690 amountold => $amountold,
692 stickyduedate => $stickyduedate,
693 duedatespec => $duedatespec,
695 CGIselectborrower => $CGIselectborrower,
696 totalprice => sprintf('%.2f', $totalprice),
697 totaldue => sprintf('%.2f', $total),
698 todayissues => \@todaysissues,
699 previssues => \@previousissues,
700 relissues => \@relissues,
701 relprevissues => \@relprevissues,
702 displayrelissues => $displayrelissues,
703 inprocess => $inprocess,
704 memberofinstution => $member_of_institution,
705 CGIorganisations => $CGIorganisations,
706 is_child => ($borrower->{'category_type'} eq 'C'),
708 soundon => C4::Context->preference("SoundOn"),
709 fast_cataloging => $fast_cataloging,
710 CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"),
711 activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
712 SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
713 AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
716 # save stickyduedate to session
717 if ($stickyduedate) {
718 $session->param( 'stickyduedate', $duedatespec );
721 my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
722 $template->param( picture => 1 ) if $picture;
724 # get authorised values with type of BOR_NOTES
726 my $canned_notes = GetAuthorisedValues("BOR_NOTES");
729 debt_confirmed => $debt_confirmed,
730 SpecifyDueDate => $duedatespec_allow,
731 CircAutocompl => C4::Context->preference("CircAutocompl"),
732 AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
733 export_remove_fields => C4::Context->preference("ExportRemoveFields"),
734 export_with_csv_profile => C4::Context->preference("ExportWithCsvProfile"),
735 canned_bor_notes_loop => $canned_notes,
738 output_html_with_http_headers $query, $cookie, $template->output;