X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=circ%2Fcirculation.pl;h=26e20ae16b337a5338011a224bb851f1744b6163;hb=1d62ea2c9ff7edc0bc1e202b8f5591939ee5735f;hp=8c359b1ca847dde8f0e6071a93c9101a5c005a70;hpb=ad37f3e5e7175cb3a2a5785d552f6e06affaea97;p=koha_fer diff --git a/circ/circulation.pl b/circ/circulation.pl index 8c359b1ca8..26e20ae16b 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -4,6 +4,7 @@ # Copyright 2000-2002 Katipo Communications # copyright 2010 BibLibre +# Copyright 2011 PTFS-Europe Ltd. # # This file is part of Koha. # @@ -21,20 +22,22 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; -#use warnings; FIXME - Bug 2505 +use warnings; use CGI; use C4::Output; -use C4::Print; use C4::Auth qw/:DEFAULT get_session/; use C4::Dates qw/format_date/; use C4::Branch; # GetBranches use C4::Koha; # GetPrinter use C4::Circulation; +use C4::Overdues qw/CheckBorrowerDebarred/; use C4::Members; use C4::Biblio; use C4::Reserves; use C4::Context; use CGI::Session; +use C4::Members::Attributes qw(GetBorrowerAttributes); +use Koha::DateUtils; use Date::Calc qw( Today @@ -143,14 +146,9 @@ my $duedatespec_allow = C4::Context->preference('SpecifyDueDate'); if($duedatespec_allow){ if ($duedatespec) { if ($duedatespec =~ C4::Dates->regexp('syspref')) { - my $tempdate = C4::Dates->new($duedatespec); -# if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) { -# # i.e., it has to be later than today/now - $datedue = $tempdate; -# } else { -# $invalidduedate = 1; -# $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); -# } + $datedue = dt_from_string($duedatespec); + $datedue->set_hour(23); + $datedue->set_minute(59); } else { $invalidduedate = 1; $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec); @@ -174,7 +172,7 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { } if ( $print eq 'yes' && $borrowernumber ne '' ) { - printslip( $borrowernumber ); + PrintIssueSlip($session->param('branch') || $branch, $borrowernumber); $query->param( 'borrowernumber', '' ); $borrowernumber = ''; } @@ -186,7 +184,7 @@ if ( $print eq 'yes' && $borrowernumber ne '' ) { my $borrowerslist; my $message; if ($findborrower) { - my ($count, $borrowers) = SearchMember($findborrower, 'cardnumber', 'web'); + my $borrowers = Search($findborrower, 'cardnumber'); my @borrowers = @$borrowers; if (C4::Context->preference("AddPatronLists")) { $template->param( @@ -230,7 +228,7 @@ if ($borrowernumber) { 0 , $borrower->{'enrolmentperiod'}); } # if the expiry date is before today ie they have expired - if ( $warning_year*$warning_month*$warning_day==0 + if ( !$borrower->{'dateexpiry'} || $warning_year*$warning_month*$warning_day==0 || Date_to_Days($today_year, $today_month, $today_day ) > Date_to_Days($warning_year, $warning_month, $warning_day) ) { @@ -238,7 +236,7 @@ if ($borrowernumber) { $template->param( flagged => "1", noissues => "1", - expired => format_date($borrower->{dateexpiry}), + expired => "1", renewaldate => format_date("$renew_year-$renew_month-$renew_day") ); } @@ -259,6 +257,16 @@ if ($borrowernumber) { issuecount => $issue, finetotal => $fines ); + + my $debar = CheckBorrowerDebarred($borrowernumber); + if ($debar) { + $template->param( 'userdebarred' => 1 ); + $template->param( 'debarredcomment' => $borrower->{debarredcomment} ); + if ( $debar ne "9999-12-31" ) { + $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) ); + } + } + } # @@ -284,6 +292,7 @@ if ($barcode) { unless($issueconfirmed){ # Get the item title for more information my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); + $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'}; $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} ); # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. @@ -418,33 +427,31 @@ sub build_issue_data { foreach my $it ( @$issueslist ) { my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} ); - # Getting borrower details - my $memberdetails = GetMemberDetails($it->{'borrowernumber'}); - $it->{'borrowername'} = $memberdetails->{'firstname'} . " " . $memberdetails->{'surname'}; - $it->{'cardnumber'} = $memberdetails->{'cardnumber'}; # set itemtype per item-level_itype syspref - FIXME this is an ugly hack $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'}; ($it->{'charge'}, $it->{'itemtype_charge'}) = GetIssuingCharges( - $it->{'itemnumber'}, $borrower->{'borrowernumber'} + $it->{'itemnumber'}, $it->{'borrowernumber'} ); $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); my ($can_renew, $can_renew_error) = CanBookBeRenewed( - $borrower->{'borrowernumber'},$it->{'itemnumber'} + $it->{'borrowernumber'},$it->{'itemnumber'} ); $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; - my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} ); + my ( $restype, $reserves, undef ) = CheckReserves( $it->{'itemnumber'} ); $it->{'can_renew'} = $can_renew; $it->{'can_confirm'} = !$can_renew && !$restype; $it->{'renew_error'} = $restype; $it->{'checkoutdate'} = C4::Dates->new($it->{'issuedate'},'iso')->output('syspref'); + $it->{'issuingbranchname'} = GetBranchName($it->{'branchcode'}); $totalprice += $it->{'replacementprice'}; $it->{'itemtype'} = $itemtypeinfo->{'description'}; $it->{'itemtype_image'} = $itemtypeinfo->{'imageurl'}; - $it->{'dd'} = format_date($it->{'date_due'}); + $it->{'dd'} = output_pref($it->{'date_due'}); $it->{'displaydate'} = format_date($it->{'issuedate'}); - $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; + #$it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; + $it->{'od'} = $it->{'overdue'}; ($it->{'author'} eq '') and $it->{'author'} = ' '; $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}}; @@ -463,8 +470,11 @@ if ($borrower) { #push @borrowernumbers, $borrower->{'borrowernumber'}; # get each issue of the borrower & separate them in todayissues & previous issues - my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'}); - my ($relissueslist) = GetPendingIssues(@relborrowernumbers); + my $issueslist = GetPendingIssues($borrower->{'borrowernumber'}); + my $relissueslist = []; + if ( @relborrowernumbers ) { + $relissueslist = GetPendingIssues(@relborrowernumbers); + } build_issue_data($issueslist, 0); build_issue_data($relissueslist, 1); @@ -477,6 +487,7 @@ if ($borrower) { else { @todaysissues = sort { $b->{'timestamp'} cmp $a->{'timestamp'} } @todaysissues; } + if ( C4::Context->preference( "previousIssuesDefaultSortOrder" ) eq 'asc' ){ @previousissues = sort { $a->{'date_due'} cmp $b->{'date_due'} } @previousissues; } @@ -497,7 +508,7 @@ if ($borrowerslist) { { push @values, $_->{'borrowernumber'}; $labels{ $_->{'borrowernumber'} } = -"$_->{'surname'}, $_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'}) ... $_->{'address'} "; +"$_->{'surname'}, $_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'} - $_->{'branchcode'}) ... $_->{'address'} "; } $CGIselectborrower = CGI::scrolling_list( -name => 'borrowernumber', @@ -627,9 +638,17 @@ my (undef, $roadttype_hashref) = &GetRoadTypes(); my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; my $fast_cataloging = 0; - if (defined getframeworkinfo('FA')) { +if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 - } +} + +if (C4::Context->preference('ExtendedPatronAttributes')) { + my $attributes = GetBorrowerAttributes($borrowernumber); + $template->param( + ExtendedPatronAttributes => 1, + extendedattributes => $attributes + ); +} $template->param( lib_messages_loop => $lib_messages_loop, @@ -644,6 +663,8 @@ $template->param( printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, + showname => $borrower->{'showname'}, + category_type => $borrower->{'category_type'}, dateexpiry => format_date($newexpiry), expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, @@ -659,6 +680,7 @@ $template->param( country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, cardnumber => $borrower->{'cardnumber'}, + othernames => $borrower->{'othernames'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, @@ -679,6 +701,8 @@ $template->param( circview => 1, soundon => C4::Context->preference("SoundOn"), fast_cataloging => $fast_cataloging, + CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"), + activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), ); # save stickyduedate to session