3 # script to execute issuing of books
5 # Copyright 2000-2002 Katipo Communications
6 # copyright 2010 BibLibre
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #use warnings; FIXME - Bug 2505
28 use C4::Auth qw/:DEFAULT get_session/;
29 use C4::Dates qw/format_date/;
30 use C4::Branch; # GetBranches
31 use C4::Koha; # GetPrinter
33 use C4::Overdues qw/CheckBorrowerDebarred/;
39 use C4::Members::Attributes qw(GetBorrowerAttributes);
47 use List::MoreUtils qw/uniq/;
55 my $sessionID = $query->cookie("CGISESSID") ;
56 my $session = get_session($sessionID);
58 # branch and printer are now defined by the userenv
59 # but first we have to check if someone has tried to change them
61 my $branch = $query->param('branch');
63 # update our session so the userenv is updated
64 $session->param('branch', $branch);
65 $session->param('branchname', GetBranchName($branch));
68 my $printer = $query->param('printer');
70 # update our session so the userenv is updated
71 $session->param('branchprinter', $printer);
74 if (!C4::Context->userenv && !$branch){
75 if ($session->param('branch') eq 'NO_LIBRARY_SET'){
76 # no branch set we can't issue
77 print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
82 my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
84 template_name => 'circ/circulation.tmpl',
88 flagsrequired => { circulate => 'circulate_remaining_permissions' },
92 my $branches = GetBranches();
94 my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers
96 for (@failedrenews) { $renew_failed{$_} = 1; }
98 my $findborrower = $query->param('findborrower');
99 $findborrower =~ s|,| |g;
100 my $borrowernumber = $query->param('borrowernumber');
102 $branch = C4::Context->userenv->{'branch'};
103 $printer = C4::Context->userenv->{'branchprinter'};
106 # If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
107 if (C4::Context->preference("AutoLocation") != 1) {
108 $template->param(ManualLocation => 1);
111 if (C4::Context->preference("DisplayClearScreenButton")) {
112 $template->param(DisplayClearScreenButton => 1);
115 if (C4::Context->preference("UseTablesortForCirc")) {
116 $template->param(UseTablesortForCirc => 1);
119 my $barcode = $query->param('barcode') || '';
120 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
122 $barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
123 my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate');
124 my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate');
125 my $issueconfirmed = $query->param('issueconfirmed');
126 my $cancelreserve = $query->param('cancelreserve');
127 my $organisation = $query->param('organisations');
128 my $print = $query->param('print');
129 my $newexpiry = $query->param('dateexpiry');
130 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
132 # Check if stickyduedate is turned off
134 # was stickyduedate loaded from session?
135 if ( $stickyduedate && ! $query->param("stickyduedate") ) {
136 $session->clear( 'stickyduedate' );
137 $stickyduedate = $query->param('stickyduedate');
138 $duedatespec = $query->param('duedatespec');
142 my ($datedue,$invalidduedate);
144 my $duedatespec_allow = C4::Context->preference('SpecifyDueDate');
145 if($duedatespec_allow){
147 if ($duedatespec =~ C4::Dates->regexp('syspref')) {
148 my $tempdate = C4::Dates->new($duedatespec);
149 # if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
150 # # i.e., it has to be later than today/now
151 $datedue = $tempdate;
153 # $invalidduedate = 1;
154 # $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
158 $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
163 my $todaysdate = C4::Dates->new->output('iso');
165 # check and see if we should print
166 if ( $barcode eq '' && $print eq 'maybe' ) {
170 my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess');
171 if ( $barcode eq '' && $query->param('charges') eq 'yes' ) {
174 borrowernumber => $borrowernumber
178 if ( $print eq 'yes' && $borrowernumber ne '' ) {
179 printslip( $borrowernumber );
180 $query->param( 'borrowernumber', '' );
181 $borrowernumber = '';
185 # STEP 2 : FIND BORROWER
186 # if there is a list of find borrowers....
191 my $borrowers = Search($findborrower, 'cardnumber');
192 my @borrowers = @$borrowers;
193 if (C4::Context->preference("AddPatronLists")) {
195 "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
197 if (C4::Context->preference("AddPatronLists")=~/code/){
198 my $categories = GetBorrowercategoryList;
199 $categories->[0]->{'first'} = 1;
200 $template->param(categories=>$categories);
203 if ( $#borrowers == -1 ) {
204 $query->param( 'findborrower', '' );
205 $message = "'$findborrower'";
207 elsif ( $#borrowers == 0 ) {
208 $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} );
209 $query->param( 'barcode', '' );
210 $borrowernumber = $borrowers[0]->{'borrowernumber'};
213 $borrowerslist = \@borrowers;
217 # get the borrower information.....
219 if ($borrowernumber) {
220 $borrower = GetMemberDetails( $borrowernumber, 0 );
221 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
223 # Warningdate is the date that the warning starts appearing
224 my ( $today_year, $today_month, $today_day) = Today();
225 my ($warning_year, $warning_month, $warning_day) = split /-/, $borrower->{'dateexpiry'};
226 my ( $enrol_year, $enrol_month, $enrol_day) = split /-/, $borrower->{'dateenrolled'};
227 # Renew day is calculated by adding the enrolment period to today
228 my ( $renew_year, $renew_month, $renew_day);
229 if ($enrol_year*$enrol_month*$enrol_day>0) {
230 ( $renew_year, $renew_month, $renew_day) =
231 Add_Delta_YM( $enrol_year, $enrol_month, $enrol_day,
232 0 , $borrower->{'enrolmentperiod'});
234 # if the expiry date is before today ie they have expired
235 if ( !$borrower->{'dateexpiry'} || $warning_year*$warning_month*$warning_day==0
236 || Date_to_Days($today_year, $today_month, $today_day )
237 > Date_to_Days($warning_year, $warning_month, $warning_day) )
239 #borrowercard expired, no issues
244 renewaldate => format_date("$renew_year-$renew_month-$renew_day")
247 # check for NotifyBorrowerDeparture
248 elsif ( C4::Context->preference('NotifyBorrowerDeparture') &&
249 Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
250 Date_to_Days( $today_year, $today_month, $today_day ) )
252 # borrower card soon to expire warn librarian
253 $template->param("warndeparture" => format_date($borrower->{dateexpiry}),
255 if (C4::Context->preference('ReturnBeforeExpiry')){
256 $template->param("returnbeforeexpiry" => 1);
261 issuecount => $issue,
265 my $debar = CheckBorrowerDebarred($borrowernumber);
267 $template->param( 'userdebarred' => 1 );
268 $template->param( 'debarredcomment' => $borrower->{debarredcomment} );
269 if ( $debar ne "9999-12-31" ) {
270 $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) );
281 # always check for blockers on issuing
282 my ( $error, $question ) =
283 CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
284 my $blocker = $invalidduedate ? 1 : 0;
286 delete $question->{'DEBT'} if ($debt_confirmed);
287 foreach my $impossible ( keys %$error ) {
289 $impossible => $$error{$impossible},
295 my $confirm_required = 0;
296 unless($issueconfirmed){
297 # Get the item title for more information
298 my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
299 $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'};
300 $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} );
302 # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
303 foreach my $needsconfirmation ( keys %$question ) {
305 $needsconfirmation => $$question{$needsconfirmation},
306 getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
307 getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
308 NEEDSCONFIRMATION => 1
310 $confirm_required = 1;
313 unless($confirm_required) {
314 AddIssue( $borrower, $barcode, $datedue, $cancelreserve );
319 # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue
320 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
321 $template->param( issuecount => $issue );
324 # reload the borrower info for the sake of reseting the flags.....
325 if ($borrowernumber) {
326 $borrower = GetMemberDetails( $borrowernumber, 0 );
329 ##################################################################################
331 # show all reserves of this borrower, and the position of the reservation ....
332 if ($borrowernumber) {
335 # now we show the status of the borrower's reservations
336 my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber );
338 my @WaitingReserveLoop;
340 foreach my $num_res (@borrowerreserv) {
342 my %getWaitingReserveInfo;
343 my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
344 my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
345 my ( $transfertwhen, $transfertfrom, $transfertto ) =
346 GetTransfers( $num_res->{'itemnumber'} );
348 $getreserv{waiting} = 0;
349 $getreserv{transfered} = 0;
350 $getreserv{nottransfered} = 0;
352 $getreserv{reservedate} = format_date( $num_res->{'reservedate'} );
353 $getreserv{reservenumber} = $num_res->{'reservenumber'};
354 $getreserv{title} = $getiteminfo->{'title'};
355 $getreserv{itemtype} = $itemtypeinfo->{'description'};
356 $getreserv{author} = $getiteminfo->{'author'};
357 $getreserv{barcodereserv} = $getiteminfo->{'barcode'};
358 $getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'};
359 $getreserv{biblionumber} = $getiteminfo->{'biblionumber'};
360 $getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} );
361 # check if we have a waiting status for reservations
362 if ( $num_res->{'found'} eq 'W' ) {
363 $getreserv{color} = 'reserved';
364 $getreserv{waiting} = 1;
365 # genarate information displaying only waiting reserves
366 $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
367 $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'};
368 $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
369 $getWaitingReserveInfo{author} = $getiteminfo->{'author'};
370 $getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} );
371 $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} );
372 $getWaitingReserveInfo{waitinghere} = 1 if $num_res->{'branchcode'} eq $branch;
374 # check transfers with the itemnumber foud in th reservation loop
375 if ($transfertwhen) {
376 $getreserv{color} = 'transfered';
377 $getreserv{transfered} = 1;
378 $getreserv{datesent} = format_date($transfertwhen);
379 $getreserv{frombranch} = GetBranchName($transfertfrom);
380 } elsif ($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'}) {
381 $getreserv{nottransfered} = 1;
382 $getreserv{nottransferedby} = GetBranchName( $getiteminfo->{'holdingbranch'} );
385 # if we don't have a reserv on item, we put the biblio infos and the waiting position
386 if ( $getiteminfo->{'title'} eq '' ) {
387 my $getbibinfo = GetBiblioData( $num_res->{'biblionumber'} );
389 $getreserv{color} = 'inwait';
390 $getreserv{title} = $getbibinfo->{'title'};
391 $getreserv{nottransfered} = 0;
392 $getreserv{itemtype} = $itemtypeinfo->{'description'};
393 $getreserv{author} = $getbibinfo->{'author'};
394 $getreserv{biblionumber} = $num_res->{'biblionumber'};
396 $getreserv{waitingposition} = $num_res->{'priority'};
397 push( @reservloop, \%getreserv );
399 # if we have a reserve waiting, initiate waitingreserveloop
400 if ($getreserv{waiting} == 1) {
401 push (@WaitingReserveLoop, \%getWaitingReserveInfo)
406 # return result to the template
408 countreserv => scalar @reservloop,
409 reservloop => \@reservloop ,
410 WaitingReserveLoop => \@WaitingReserveLoop,
412 $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
415 # make the issued books table.
416 my $todaysissues = '';
422 my $displayrelissues;
426 sub build_issue_data {
427 my $issueslist = shift;
428 my $relatives = shift;
430 # split in 2 arrays for today & previous
431 foreach my $it ( @$issueslist ) {
432 my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} );
434 # set itemtype per item-level_itype syspref - FIXME this is an ugly hack
435 $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'};
437 ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges(
438 $it->{'itemnumber'}, $it->{'borrowernumber'}
440 $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
441 my ($can_renew, $can_renew_error) = CanBookBeRenewed(
442 $it->{'borrowernumber'},$it->{'itemnumber'}
444 $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
445 my ( $restype, $reserves, undef ) = CheckReserves( $it->{'itemnumber'} );
446 $it->{'can_renew'} = $can_renew;
447 $it->{'can_confirm'} = !$can_renew && !$restype;
448 $it->{'renew_error'} = $restype;
449 $it->{'checkoutdate'} = C4::Dates->new($it->{'issuedate'},'iso')->output('syspref');
450 $it->{'issuingbranchname'} = GetBranchName($it->{'branchcode'});
452 $totalprice += $it->{'replacementprice'};
453 $it->{'itemtype'} = $itemtypeinfo->{'description'};
454 $it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'};
455 $it->{'dd'} = format_date($it->{'date_due'});
456 $it->{'displaydate'} = format_date($it->{'issuedate'});
457 $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ;
458 ($it->{'author'} eq '') and $it->{'author'} = ' ';
459 $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}};
461 if ( $todaysdate eq $it->{'issuedate'} or $todaysdate eq $it->{'lastreneweddate'} ) {
462 (!$relatives) ? push @todaysissues, $it : push @relissues, $it;
464 (!$relatives) ? push @previousissues, $it : push @relprevissues, $it;
471 # Getting borrower relatives
472 my @relborrowernumbers = GetMemberRelatives($borrower->{'borrowernumber'});
473 #push @borrowernumbers, $borrower->{'borrowernumber'};
475 # get each issue of the borrower & separate them in todayissues & previous issues
476 my $issueslist = GetPendingIssues($borrower->{'borrowernumber'});
477 my $relissueslist = [];
478 if ( @relborrowernumbers ) {
479 $relissueslist = GetPendingIssues(@relborrowernumbers);
482 build_issue_data($issueslist, 0);
483 build_issue_data($relissueslist, 1);
485 $displayrelissues = scalar($relissueslist);
487 if ( C4::Context->preference( "todaysIssuesDefaultSortOrder" ) eq 'asc' ) {
488 @todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
491 @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues;
494 if ( C4::Context->preference( "previousIssuesDefaultSortOrder" ) eq 'asc' ){
495 @previousissues = sort { $a->{'date_due'} cmp $b->{'date_due'} } @previousissues;
498 @previousissues = sort { $b->{'date_due'} cmp $a->{'date_due'} } @previousissues;
505 my $CGIselectborrower;
506 if ($borrowerslist) {
508 sort {(lc $a->{'surname'} cmp lc $b->{'surname'} || lc $a->{'firstname'} cmp lc $b->{'firstname'})
512 push @values, $_->{'borrowernumber'};
513 $labels{ $_->{'borrowernumber'} } =
514 "$_->{'surname'}, $_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'} - $_->{'branchcode'}) ... $_->{'address'} ";
516 $CGIselectborrower = CGI::scrolling_list(
517 -name => 'borrowernumber',
519 -id => 'borrowernumber',
522 -ondblclick => 'document.forms[\'mainform\'].submit()',
530 my $flags = $borrower->{'flags'};
531 foreach my $flag ( sort keys %$flags ) {
532 $template->param( flagged=> 1);
533 $flags->{$flag}->{'message'} =~ s#\n#<br />#g;
534 if ( $flags->{$flag}->{'noissues'} ) {
539 if ( $flag eq 'GNA' ) {
540 $template->param( gna => 'true' );
542 elsif ( $flag eq 'LOST' ) {
543 $template->param( lost => 'true' );
545 elsif ( $flag eq 'DBARRED' ) {
546 $template->param( dbarred => 'true' );
548 elsif ( $flag eq 'CHARGES' ) {
551 chargesmsg => $flags->{'CHARGES'}->{'message'},
552 chargesamount => $flags->{'CHARGES'}->{'amount'},
553 charges_is_blocker => 1
556 elsif ( $flag eq 'CREDITS' ) {
559 creditsmsg => $flags->{'CREDITS'}->{'message'},
560 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
565 if ( $flag eq 'CHARGES' ) {
569 chargesmsg => $flags->{'CHARGES'}->{'message'},
570 chargesamount => $flags->{'CHARGES'}->{'amount'},
573 elsif ( $flag eq 'CREDITS' ) {
576 creditsmsg => $flags->{'CREDITS'}->{'message'},
577 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
580 elsif ( $flag eq 'ODUES' ) {
584 oduesmsg => $flags->{'ODUES'}->{'message'}
587 my $items = $flags->{$flag}->{'itemlist'};
588 if ( ! $query->param('module') || $query->param('module') ne 'returns' ) {
589 $template->param( nonreturns => 'true' );
592 elsif ( $flag eq 'NOTES' ) {
596 notesmsg => $flags->{'NOTES'}->{'message'}
602 my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0;
603 $amountold =~ s/^.*\$//; # remove upto the $, if any
605 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
607 if ( $borrower->{'category_type'} eq 'C') {
608 my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
609 my $cnt = scalar(@$catcodes);
610 $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
611 $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
614 my $CGIorganisations;
615 my $member_of_institution;
616 if ( C4::Context->preference("memberofinstitution") ) {
617 my $organisations = get_institutions();
620 foreach my $organisation ( keys %$organisations ) {
621 push @orgs, $organisation;
622 $org_labels{$organisation} = $organisations->{$organisation}->{'surname'};
624 $member_of_institution = 1;
625 $CGIorganisations = CGI::popup_menu(
626 -id => 'organisations',
627 -name => 'organisations',
628 -labels => \%org_labels,
633 my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
634 if($lib_messages_loop){ $template->param(flagged => 1 ); }
636 my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch );
637 if($bor_messages_loop){ $template->param(flagged => 1 ); }
639 # Computes full borrower address
640 my (undef, $roadttype_hashref) = &GetRoadTypes();
641 my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'};
643 my $fast_cataloging = 0;
644 if (defined getframeworkinfo('FA')) {
648 if (C4::Context->preference('ExtendedPatronAttributes')) {
649 my $attributes = GetBorrowerAttributes($borrowernumber);
651 ExtendedPatronAttributes => 1,
652 extendedattributes => $attributes
657 lib_messages_loop => $lib_messages_loop,
658 bor_messages_loop => $bor_messages_loop,
659 all_messages_del => C4::Context->preference('AllowAllMessageDeletion'),
660 findborrower => $findborrower,
661 borrower => $borrower,
662 borrowernumber => $borrowernumber,
664 branchname => GetBranchName($borrower->{'branchcode'}),
666 printername => $printer,
667 firstname => $borrower->{'firstname'},
668 surname => $borrower->{'surname'},
669 showname => $borrower->{'showname'},
670 category_type => $borrower->{'category_type'},
671 dateexpiry => format_date($newexpiry),
672 expiry => format_date($borrower->{'dateexpiry'}),
673 categorycode => $borrower->{'categorycode'},
674 categoryname => $borrower->{description},
676 address2 => $borrower->{'address2'},
677 email => $borrower->{'email'},
678 emailpro => $borrower->{'emailpro'},
679 borrowernotes => $borrower->{'borrowernotes'},
680 city => $borrower->{'city'},
681 state => $borrower->{'state'},
682 zipcode => $borrower->{'zipcode'},
683 country => $borrower->{'country'},
684 phone => $borrower->{'phone'} || $borrower->{'mobile'},
685 cardnumber => $borrower->{'cardnumber'},
686 othernames => $borrower->{'othernames'},
687 amountold => $amountold,
689 stickyduedate => $stickyduedate,
690 duedatespec => $duedatespec,
692 CGIselectborrower => $CGIselectborrower,
693 totalprice => sprintf('%.2f', $totalprice),
694 totaldue => sprintf('%.2f', $total),
695 todayissues => \@todaysissues,
696 previssues => \@previousissues,
697 relissues => \@relissues,
698 relprevissues => \@relprevissues,
699 displayrelissues => $displayrelissues,
700 inprocess => $inprocess,
701 memberofinstution => $member_of_institution,
702 CGIorganisations => $CGIorganisations,
703 is_child => ($borrower->{'category_type'} eq 'C'),
705 soundon => C4::Context->preference("SoundOn"),
706 fast_cataloging => $fast_cataloging,
707 CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"),
708 activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
711 # save stickyduedate to session
712 if ($stickyduedate) {
713 $session->param( 'stickyduedate', $duedatespec );
716 my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
717 $template->param( picture => 1 ) if $picture;
719 # get authorised values with type of BOR_NOTES
721 my $canned_notes = GetAuthorisedValues("BOR_NOTES");
724 debt_confirmed => $debt_confirmed,
725 SpecifyDueDate => $duedatespec_allow,
726 CircAutocompl => C4::Context->preference("CircAutocompl"),
727 AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
728 dateformat => C4::Context->preference("dateformat"),
729 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
730 canned_bor_notes_loop => $canned_notes,
732 output_html_with_http_headers $query, $cookie, $template->output;