X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=circ%2Fcirculation.pl;h=e8d22cb1587eb0a63d60985f53428b33df20225f;hb=f7a525fa09008d98340739bd930fc48debcd306f;hp=524219355ecb7d07b667266138d49975a25de6f8;hpb=228587f19b25406f8a2ee76827524ef3fc921a77;p=koha_fer diff --git a/circ/circulation.pl b/circ/circulation.pl index 524219355e..e8d22cb158 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -30,11 +30,13 @@ 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 Date::Calc qw( Today @@ -186,7 +188,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 +232,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 +240,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 +261,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 +296,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,26 +431,23 @@ 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'}; - # 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'}; @@ -463,8 +473,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 +490,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 +511,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 +641,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 +666,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'}, @@ -654,10 +678,12 @@ $template->param( emailpro => $borrower->{'emailpro'}, borrowernotes => $borrower->{'borrowernotes'}, city => $borrower->{'city'}, + state => $borrower->{'state'}, zipcode => $borrower->{'zipcode'}, country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, cardnumber => $borrower->{'cardnumber'}, + othernames => $borrower->{'othernames'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, @@ -678,6 +704,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