Adding the 155th developer to the history
[koha.git] / circ / circulation.pl
blobda4878f94e51ff0fc049ccca1103c5d40d25d87c
1 #!/usr/bin/perl
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
13 # version.
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.
23 use strict;
24 #use warnings; FIXME - Bug 2505
25 use CGI;
26 use C4::Output;
27 use C4::Print;
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
32 use C4::Circulation;
33 use C4::Members;
34 use C4::Biblio;
35 use C4::Reserves;
36 use C4::Context;
37 use CGI::Session;
39 use Date::Calc qw(
40 Today
41 Add_Delta_YM
42 Add_Delta_Days
43 Date_to_Days
45 use List::MoreUtils qw/uniq/;
49 # PARAMETERS READING
51 my $query = new CGI;
53 my $sessionID = $query->cookie("CGISESSID") ;
54 my $session = get_session($sessionID);
56 # branch and printer are now defined by the userenv
57 # but first we have to check if someone has tried to change them
59 my $branch = $query->param('branch');
60 if ($branch){
61 # update our session so the userenv is updated
62 $session->param('branch', $branch);
63 $session->param('branchname', GetBranchName($branch));
66 my $printer = $query->param('printer');
67 if ($printer){
68 # update our session so the userenv is updated
69 $session->param('branchprinter', $printer);
72 if (!C4::Context->userenv && !$branch){
73 if ($session->param('branch') eq 'NO_LIBRARY_SET'){
74 # no branch set we can't issue
75 print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
76 exit;
80 my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
82 template_name => 'circ/circulation.tmpl',
83 query => $query,
84 type => "intranet",
85 authnotrequired => 0,
86 flagsrequired => { circulate => 'circulate_remaining_permissions' },
90 my $branches = GetBranches();
92 my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers
93 my %renew_failed;
94 for (@failedrenews) { $renew_failed{$_} = 1; }
96 my $findborrower = $query->param('findborrower');
97 $findborrower =~ s|,| |g;
98 my $borrowernumber = $query->param('borrowernumber');
100 $branch = C4::Context->userenv->{'branch'};
101 $printer = C4::Context->userenv->{'branchprinter'};
104 # If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
105 if (C4::Context->preference("AutoLocation") != 1) {
106 $template->param(ManualLocation => 1);
109 if (C4::Context->preference("DisplayClearScreenButton")) {
110 $template->param(DisplayClearScreenButton => 1);
113 if (C4::Context->preference("UseTablesortForCirc")) {
114 $template->param(UseTablesortForCirc => 1);
117 my $barcode = $query->param('barcode') || '';
118 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
120 $barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
121 my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate');
122 my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate');
123 my $issueconfirmed = $query->param('issueconfirmed');
124 my $cancelreserve = $query->param('cancelreserve');
125 my $organisation = $query->param('organisations');
126 my $print = $query->param('print');
127 my $newexpiry = $query->param('dateexpiry');
128 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
130 # Check if stickyduedate is turned off
131 if ( $barcode ) {
132 # was stickyduedate loaded from session?
133 if ( $stickyduedate && ! $query->param("stickyduedate") ) {
134 $session->clear( 'stickyduedate' );
135 $stickyduedate = $query->param('stickyduedate');
136 $duedatespec = $query->param('duedatespec');
140 my ($datedue,$invalidduedate);
142 my $duedatespec_allow = C4::Context->preference('SpecifyDueDate');
143 if($duedatespec_allow){
144 if ($duedatespec) {
145 if ($duedatespec =~ C4::Dates->regexp('syspref')) {
146 my $tempdate = C4::Dates->new($duedatespec);
147 # if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
148 # # i.e., it has to be later than today/now
149 $datedue = $tempdate;
150 # } else {
151 # $invalidduedate = 1;
152 # $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
154 } else {
155 $invalidduedate = 1;
156 $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
161 my $todaysdate = C4::Dates->new->output('iso');
163 # check and see if we should print
164 if ( $barcode eq '' && $print eq 'maybe' ) {
165 $print = 'yes';
168 my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess');
169 if ( $barcode eq '' && $query->param('charges') eq 'yes' ) {
170 $template->param(
171 PAYCHARGES => 'yes',
172 borrowernumber => $borrowernumber
176 if ( $print eq 'yes' && $borrowernumber ne '' ) {
177 printslip( $borrowernumber );
178 $query->param( 'borrowernumber', '' );
179 $borrowernumber = '';
183 # STEP 2 : FIND BORROWER
184 # if there is a list of find borrowers....
186 my $borrowerslist;
187 my $message;
188 if ($findborrower) {
189 my ($count, $borrowers) = SearchMember($findborrower, 'cardnumber', 'web');
190 my @borrowers = @$borrowers;
191 if (C4::Context->preference("AddPatronLists")) {
192 $template->param(
193 "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
195 if (C4::Context->preference("AddPatronLists")=~/code/){
196 my $categories = GetBorrowercategoryList;
197 $categories->[0]->{'first'} = 1;
198 $template->param(categories=>$categories);
201 if ( $#borrowers == -1 ) {
202 $query->param( 'findborrower', '' );
203 $message = "'$findborrower'";
205 elsif ( $#borrowers == 0 ) {
206 $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} );
207 $query->param( 'barcode', '' );
208 $borrowernumber = $borrowers[0]->{'borrowernumber'};
210 else {
211 $borrowerslist = \@borrowers;
215 # get the borrower information.....
216 my $borrower;
217 if ($borrowernumber) {
218 $borrower = GetMemberDetails( $borrowernumber, 0 );
219 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
221 # Warningdate is the date that the warning starts appearing
222 my ( $today_year, $today_month, $today_day) = Today();
223 my ($warning_year, $warning_month, $warning_day) = split /-/, $borrower->{'dateexpiry'};
224 my ( $enrol_year, $enrol_month, $enrol_day) = split /-/, $borrower->{'dateenrolled'};
225 # Renew day is calculated by adding the enrolment period to today
226 my ( $renew_year, $renew_month, $renew_day);
227 if ($enrol_year*$enrol_month*$enrol_day>0) {
228 ( $renew_year, $renew_month, $renew_day) =
229 Add_Delta_YM( $enrol_year, $enrol_month, $enrol_day,
230 0 , $borrower->{'enrolmentperiod'});
232 # if the expiry date is before today ie they have expired
233 if ( !$borrower->{'dateexpiry'} || $warning_year*$warning_month*$warning_day==0
234 || Date_to_Days($today_year, $today_month, $today_day )
235 > Date_to_Days($warning_year, $warning_month, $warning_day) )
237 #borrowercard expired, no issues
238 $template->param(
239 flagged => "1",
240 noissues => "1",
241 expired => "1",
242 renewaldate => format_date("$renew_year-$renew_month-$renew_day")
245 # check for NotifyBorrowerDeparture
246 elsif ( C4::Context->preference('NotifyBorrowerDeparture') &&
247 Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
248 Date_to_Days( $today_year, $today_month, $today_day ) )
250 # borrower card soon to expire warn librarian
251 $template->param("warndeparture" => format_date($borrower->{dateexpiry}),
252 flagged => "1",);
253 if (C4::Context->preference('ReturnBeforeExpiry')){
254 $template->param("returnbeforeexpiry" => 1);
257 $template->param(
258 overduecount => $od,
259 issuecount => $issue,
260 finetotal => $fines
265 # STEP 3 : ISSUING
268 if ($barcode) {
269 # always check for blockers on issuing
270 my ( $error, $question ) =
271 CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
272 my $blocker = $invalidduedate ? 1 : 0;
274 delete $question->{'DEBT'} if ($debt_confirmed);
275 foreach my $impossible ( keys %$error ) {
276 $template->param(
277 $impossible => $$error{$impossible},
278 IMPOSSIBLE => 1
280 $blocker = 1;
282 if( !$blocker ){
283 my $confirm_required = 0;
284 unless($issueconfirmed){
285 # Get the item title for more information
286 my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
287 $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} );
289 # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
290 foreach my $needsconfirmation ( keys %$question ) {
291 $template->param(
292 $needsconfirmation => $$question{$needsconfirmation},
293 getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
294 getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
295 NEEDSCONFIRMATION => 1
297 $confirm_required = 1;
300 unless($confirm_required) {
301 AddIssue( $borrower, $barcode, $datedue, $cancelreserve );
302 $inprocess = 1;
306 # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue
307 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
308 $template->param( issuecount => $issue );
311 # reload the borrower info for the sake of reseting the flags.....
312 if ($borrowernumber) {
313 $borrower = GetMemberDetails( $borrowernumber, 0 );
316 ##################################################################################
317 # BUILD HTML
318 # show all reserves of this borrower, and the position of the reservation ....
319 if ($borrowernumber) {
321 # new op dev
322 # now we show the status of the borrower's reservations
323 my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber );
324 my @reservloop;
325 my @WaitingReserveLoop;
327 foreach my $num_res (@borrowerreserv) {
328 my %getreserv;
329 my %getWaitingReserveInfo;
330 my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} );
331 my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} );
332 my ( $transfertwhen, $transfertfrom, $transfertto ) =
333 GetTransfers( $num_res->{'itemnumber'} );
335 $getreserv{waiting} = 0;
336 $getreserv{transfered} = 0;
337 $getreserv{nottransfered} = 0;
339 $getreserv{reservedate} = format_date( $num_res->{'reservedate'} );
340 $getreserv{reservenumber} = $num_res->{'reservenumber'};
341 $getreserv{title} = $getiteminfo->{'title'};
342 $getreserv{itemtype} = $itemtypeinfo->{'description'};
343 $getreserv{author} = $getiteminfo->{'author'};
344 $getreserv{barcodereserv} = $getiteminfo->{'barcode'};
345 $getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'};
346 $getreserv{biblionumber} = $getiteminfo->{'biblionumber'};
347 $getreserv{waitingat} = GetBranchName( $num_res->{'branchcode'} );
348 # check if we have a waiting status for reservations
349 if ( $num_res->{'found'} eq 'W' ) {
350 $getreserv{color} = 'reserved';
351 $getreserv{waiting} = 1;
352 # genarate information displaying only waiting reserves
353 $getWaitingReserveInfo{title} = $getiteminfo->{'title'};
354 $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'};
355 $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'};
356 $getWaitingReserveInfo{author} = $getiteminfo->{'author'};
357 $getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} );
358 $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} );
359 $getWaitingReserveInfo{waitinghere} = 1 if $num_res->{'branchcode'} eq $branch;
361 # check transfers with the itemnumber foud in th reservation loop
362 if ($transfertwhen) {
363 $getreserv{color} = 'transfered';
364 $getreserv{transfered} = 1;
365 $getreserv{datesent} = format_date($transfertwhen);
366 $getreserv{frombranch} = GetBranchName($transfertfrom);
367 } elsif ($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'}) {
368 $getreserv{nottransfered} = 1;
369 $getreserv{nottransferedby} = GetBranchName( $getiteminfo->{'holdingbranch'} );
372 # if we don't have a reserv on item, we put the biblio infos and the waiting position
373 if ( $getiteminfo->{'title'} eq '' ) {
374 my $getbibinfo = GetBiblioData( $num_res->{'biblionumber'} );
376 $getreserv{color} = 'inwait';
377 $getreserv{title} = $getbibinfo->{'title'};
378 $getreserv{nottransfered} = 0;
379 $getreserv{itemtype} = $itemtypeinfo->{'description'};
380 $getreserv{author} = $getbibinfo->{'author'};
381 $getreserv{biblionumber} = $num_res->{'biblionumber'};
383 $getreserv{waitingposition} = $num_res->{'priority'};
384 push( @reservloop, \%getreserv );
386 # if we have a reserve waiting, initiate waitingreserveloop
387 if ($getreserv{waiting} == 1) {
388 push (@WaitingReserveLoop, \%getWaitingReserveInfo)
393 # return result to the template
394 $template->param(
395 countreserv => scalar @reservloop,
396 reservloop => \@reservloop ,
397 WaitingReserveLoop => \@WaitingReserveLoop,
399 $template->param( adultborrower => 1 ) if ( $borrower->{'category_type'} eq 'A' );
402 # make the issued books table.
403 my $todaysissues = '';
404 my $previssues = '';
405 my @todaysissues;
406 my @previousissues;
407 my @relissues;
408 my @relprevissues;
409 my $displayrelissues;
411 my $totalprice = 0;
413 sub build_issue_data {
414 my $issueslist = shift;
415 my $relatives = shift;
417 # split in 2 arrays for today & previous
418 foreach my $it ( @$issueslist ) {
419 my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} );
421 # Getting borrower details
422 my $memberdetails = GetMemberDetails($it->{'borrowernumber'});
423 $it->{'borrowername'} = $memberdetails->{'firstname'} . " " . $memberdetails->{'surname'};
424 $it->{'cardnumber'} = $memberdetails->{'cardnumber'};
425 # set itemtype per item-level_itype syspref - FIXME this is an ugly hack
426 $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'};
428 ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges(
429 $it->{'itemnumber'}, $borrower->{'borrowernumber'}
431 $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
432 my ($can_renew, $can_renew_error) = CanBookBeRenewed(
433 $borrower->{'borrowernumber'},$it->{'itemnumber'}
435 $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
436 my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} );
437 $it->{'can_renew'} = $can_renew;
438 $it->{'can_confirm'} = !$can_renew && !$restype;
439 $it->{'renew_error'} = $restype;
440 $it->{'checkoutdate'} = C4::Dates->new($it->{'issuedate'},'iso')->output('syspref');
442 $totalprice += $it->{'replacementprice'};
443 $it->{'itemtype'} = $itemtypeinfo->{'description'};
444 $it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'};
445 $it->{'dd'} = format_date($it->{'date_due'});
446 $it->{'displaydate'} = format_date($it->{'issuedate'});
447 $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ;
448 ($it->{'author'} eq '') and $it->{'author'} = ' ';
449 $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}};
451 if ( $todaysdate eq $it->{'issuedate'} or $todaysdate eq $it->{'lastreneweddate'} ) {
452 (!$relatives) ? push @todaysissues, $it : push @relissues, $it;
453 } else {
454 (!$relatives) ? push @previousissues, $it : push @relprevissues, $it;
459 if ($borrower) {
461 # Getting borrower relatives
462 my @relborrowernumbers = GetMemberRelatives($borrower->{'borrowernumber'});
463 #push @borrowernumbers, $borrower->{'borrowernumber'};
465 # get each issue of the borrower & separate them in todayissues & previous issues
466 my $issueslist = GetPendingIssues($borrower->{'borrowernumber'});
467 my $relissueslist = [];
468 if ( @relborrowernumbers ) {
469 $relissueslist = GetPendingIssues(@relborrowernumbers);
472 build_issue_data($issueslist, 0);
473 build_issue_data($relissueslist, 1);
475 $displayrelissues = scalar($relissueslist);
477 if ( C4::Context->preference( "todaysIssuesDefaultSortOrder" ) eq 'asc' ) {
478 @todaysissues = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
480 else {
481 @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues;
484 if ( C4::Context->preference( "previousIssuesDefaultSortOrder" ) eq 'asc' ){
485 @previousissues = sort { $a->{'date_due'} cmp $b->{'date_due'} } @previousissues;
487 else {
488 @previousissues = sort { $b->{'date_due'} cmp $a->{'date_due'} } @previousissues;
493 my @values;
494 my %labels;
495 my $CGIselectborrower;
496 if ($borrowerslist) {
497 foreach (
498 sort {(lc $a->{'surname'} cmp lc $b->{'surname'} || lc $a->{'firstname'} cmp lc $b->{'firstname'})
499 } @$borrowerslist
502 push @values, $_->{'borrowernumber'};
503 $labels{ $_->{'borrowernumber'} } =
504 "$_->{'surname'}, $_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'}) ... $_->{'address'} ";
506 $CGIselectborrower = CGI::scrolling_list(
507 -name => 'borrowernumber',
508 -class => 'focus',
509 -id => 'borrowernumber',
510 -values => \@values,
511 -labels => \%labels,
512 -ondblclick => 'document.forms[\'mainform\'].submit()',
513 -size => 7,
514 -tabindex => '',
515 -multiple => 0
519 #title
520 my $flags = $borrower->{'flags'};
521 foreach my $flag ( sort keys %$flags ) {
522 $template->param( flagged=> 1);
523 $flags->{$flag}->{'message'} =~ s#\n#<br />#g;
524 if ( $flags->{$flag}->{'noissues'} ) {
525 $template->param(
526 flagged => 1,
527 noissues => 'true',
529 if ( $flag eq 'GNA' ) {
530 $template->param( gna => 'true' );
532 elsif ( $flag eq 'LOST' ) {
533 $template->param( lost => 'true' );
535 elsif ( $flag eq 'DBARRED' ) {
536 $template->param( dbarred => 'true' );
538 elsif ( $flag eq 'CHARGES' ) {
539 $template->param(
540 charges => 'true',
541 chargesmsg => $flags->{'CHARGES'}->{'message'},
542 chargesamount => $flags->{'CHARGES'}->{'amount'},
543 charges_is_blocker => 1
546 elsif ( $flag eq 'CREDITS' ) {
547 $template->param(
548 credits => 'true',
549 creditsmsg => $flags->{'CREDITS'}->{'message'},
550 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
554 else {
555 if ( $flag eq 'CHARGES' ) {
556 $template->param(
557 charges => 'true',
558 flagged => 1,
559 chargesmsg => $flags->{'CHARGES'}->{'message'},
560 chargesamount => $flags->{'CHARGES'}->{'amount'},
563 elsif ( $flag eq 'CREDITS' ) {
564 $template->param(
565 credits => 'true',
566 creditsmsg => $flags->{'CREDITS'}->{'message'},
567 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
570 elsif ( $flag eq 'ODUES' ) {
571 $template->param(
572 odues => 'true',
573 flagged => 1,
574 oduesmsg => $flags->{'ODUES'}->{'message'}
577 my $items = $flags->{$flag}->{'itemlist'};
578 if ( ! $query->param('module') || $query->param('module') ne 'returns' ) {
579 $template->param( nonreturns => 'true' );
582 elsif ( $flag eq 'NOTES' ) {
583 $template->param(
584 notes => 'true',
585 flagged => 1,
586 notesmsg => $flags->{'NOTES'}->{'message'}
592 my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0;
593 $amountold =~ s/^.*\$//; # remove upto the $, if any
595 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
597 if ( $borrower->{'category_type'} eq 'C') {
598 my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
599 my $cnt = scalar(@$catcodes);
600 $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
601 $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
604 my $CGIorganisations;
605 my $member_of_institution;
606 if ( C4::Context->preference("memberofinstitution") ) {
607 my $organisations = get_institutions();
608 my @orgs;
609 my %org_labels;
610 foreach my $organisation ( keys %$organisations ) {
611 push @orgs, $organisation;
612 $org_labels{$organisation} = $organisations->{$organisation}->{'surname'};
614 $member_of_institution = 1;
615 $CGIorganisations = CGI::popup_menu(
616 -id => 'organisations',
617 -name => 'organisations',
618 -labels => \%org_labels,
619 -values => \@orgs,
623 my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
624 if($lib_messages_loop){ $template->param(flagged => 1 ); }
626 my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch );
627 if($bor_messages_loop){ $template->param(flagged => 1 ); }
629 # Computes full borrower address
630 my (undef, $roadttype_hashref) = &GetRoadTypes();
631 my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'};
633 my $fast_cataloging = 0;
634 if (defined getframeworkinfo('FA')) {
635 $fast_cataloging = 1
638 $template->param(
639 lib_messages_loop => $lib_messages_loop,
640 bor_messages_loop => $bor_messages_loop,
641 all_messages_del => C4::Context->preference('AllowAllMessageDeletion'),
642 findborrower => $findborrower,
643 borrower => $borrower,
644 borrowernumber => $borrowernumber,
645 branch => $branch,
646 branchname => GetBranchName($borrower->{'branchcode'}),
647 printer => $printer,
648 printername => $printer,
649 firstname => $borrower->{'firstname'},
650 surname => $borrower->{'surname'},
651 dateexpiry => format_date($newexpiry),
652 expiry => format_date($borrower->{'dateexpiry'}),
653 categorycode => $borrower->{'categorycode'},
654 categoryname => $borrower->{description},
655 address => $address,
656 address2 => $borrower->{'address2'},
657 email => $borrower->{'email'},
658 emailpro => $borrower->{'emailpro'},
659 borrowernotes => $borrower->{'borrowernotes'},
660 city => $borrower->{'city'},
661 state => $borrower->{'state'},
662 zipcode => $borrower->{'zipcode'},
663 country => $borrower->{'country'},
664 phone => $borrower->{'phone'} || $borrower->{'mobile'},
665 cardnumber => $borrower->{'cardnumber'},
666 amountold => $amountold,
667 barcode => $barcode,
668 stickyduedate => $stickyduedate,
669 duedatespec => $duedatespec,
670 message => $message,
671 CGIselectborrower => $CGIselectborrower,
672 totalprice => sprintf('%.2f', $totalprice),
673 totaldue => sprintf('%.2f', $total),
674 todayissues => \@todaysissues,
675 previssues => \@previousissues,
676 relissues => \@relissues,
677 relprevissues => \@relprevissues,
678 displayrelissues => $displayrelissues,
679 inprocess => $inprocess,
680 memberofinstution => $member_of_institution,
681 CGIorganisations => $CGIorganisations,
682 is_child => ($borrower->{'category_type'} eq 'C'),
683 circview => 1,
684 soundon => C4::Context->preference("SoundOn"),
685 fast_cataloging => $fast_cataloging,
688 # save stickyduedate to session
689 if ($stickyduedate) {
690 $session->param( 'stickyduedate', $duedatespec );
693 my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
694 $template->param( picture => 1 ) if $picture;
696 # get authorised values with type of BOR_NOTES
698 my $canned_notes = GetAuthorisedValues("BOR_NOTES");
700 $template->param(
701 debt_confirmed => $debt_confirmed,
702 SpecifyDueDate => $duedatespec_allow,
703 CircAutocompl => C4::Context->preference("CircAutocompl"),
704 AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
705 dateformat => C4::Context->preference("dateformat"),
706 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
707 canned_bor_notes_loop => $canned_notes,
709 output_html_with_http_headers $query, $cookie, $template->output;