X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fmoremember.pl;h=d78cc1fd570bd03566a90fa2221cee7147e0e95e;hb=42678f3abfce12c49d23edbe58d228cd46463997;hp=7188e90a57524a633f94591f44e6653c0ff07bbd;hpb=1a58e8cde36d8f8b91d16dac50156812e42ea78f;p=koha_fer diff --git a/members/moremember.pl b/members/moremember.pl index 7188e90a57..d78cc1fd57 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -48,11 +48,10 @@ use C4::Koha; use C4::Letters; use C4::Biblio; use C4::Branch; # GetBranchName -use C4::Overdues qw/CheckBorrowerDebarred/; use C4::Form::MessagingPreferences; use List::MoreUtils qw/uniq/; use C4::Members::Attributes qw(GetBorrowerAttributes); - +use Koha::Borrower::Debarments qw(GetDebarments); #use Smart::Comments; #use Data::Dumper; use DateTime; @@ -147,7 +146,7 @@ for (qw(gonenoaddress lost borrowernotes)) { $data->{$_} and $template->param(flagged => 1) and last; } -my $debar = CheckBorrowerDebarred($borrowernumber); +my $debar = $data->{'debarred'}; if ($debar) { $template->param( 'userdebarred' => 1, 'flagged' => 1 ); if ( $debar ne "9999-12-31" ) { @@ -214,11 +213,14 @@ $bor{'borrowernumber'} = $borrowernumber; my $samebranch; if ( C4::Context->preference("IndependentBranches") ) { my $userenv = C4::Context->userenv; - unless ( $userenv->{flags} % 2 == 1 ) { + if ( C4::Context->IsSuperLibrarian() ) { + $samebranch = 1; + } + else { $samebranch = ( $data->{'branchcode'} eq $userenv->{branch} ); } - $samebranch = 1 if ( $userenv->{flags} % 2 == 1 ); -}else{ +} +else { $samebranch = 1; } my $branchdetail = GetBranchDetail( $data->{'branchcode'}); @@ -230,6 +232,19 @@ my $lib2 = &GetSortDetails( "Bsort2", $data->{'sort2'} ); $template->param( lib1 => $lib1 ) if ($lib1); $template->param( lib2 => $lib2 ) if ($lib2); +# If printing a page, send the account informations to the template +if ($print eq "page") { + foreach my $accountline (@$accts) { + $accountline->{amount} = sprintf '%.2f', $accountline->{amount}; + $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding}; + + if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){ + $accountline->{printtitle} = 1; + } + } + $template->param( accounts => $accts ); +} + # Show OPAC privacy preference is system preference is set if ( C4::Context->preference('OPACPrivacy') ) { $template->param( OPACPrivacy => 1); @@ -244,7 +259,7 @@ my $relissue = []; if ( @borrowernumbers ) { $relissue = GetPendingIssues(@borrowernumbers); } -my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); +my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); my $today = DateTime->now( time_zone => C4::Context->tz); $today->truncate(to => 'day'); my @borrowers_with_issues; @@ -302,6 +317,8 @@ if ($borrowernumber) { $getreserv{nottransferedby} = GetBranchName( $getiteminfo->{'holdingbranch'} ); } + $getreserv{title} = $getiteminfo->{'title'}; + $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($getiteminfo->{biblionumber}), GetFrameworkCode($getiteminfo->{biblionumber})); # if we don't have a reserv on item, we put the biblio infos and the waiting position if ( $getiteminfo->{'title'} eq '' ) { @@ -309,6 +326,7 @@ if ($borrowernumber) { my $getbibtype = getitemtypeinfo( $getbibinfo->{'itemtype'} ); $getreserv{color} = 'inwait'; $getreserv{title} = $getbibinfo->{'title'}; + $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($num_res->{biblionumber}), GetFrameworkCode($num_res->{biblionumber})); $getreserv{nottransfered} = 0; $getreserv{itemtype} = $getbibtype->{'description'}; $getreserv{author} = $getbibinfo->{'author'}; @@ -338,14 +356,17 @@ foreach (@$alerts) { my $candeleteuser; my $userenv = C4::Context->userenv; -if($userenv->{flags} % 2 == 1){ +if ( C4::Context->IsSuperLibrarian() ) { $candeleteuser = 1; -}elsif ( C4::Context->preference("IndependentBranches") ) { +} +elsif ( C4::Context->preference("IndependentBranches") ) { $candeleteuser = ( $data->{'branchcode'} eq $userenv->{branch} ); -}else{ - if( C4::Auth::getuserflags( $userenv->{flags},$userenv->{number})->{borrowers} ) { +} +else { + if ( C4::Auth::getuserflags( $userenv->{flags}, $userenv->{number} )->{borrowers} ) { $candeleteuser = 1; - }else{ + } + else { $candeleteuser = 0; } } @@ -353,7 +374,7 @@ if($userenv->{flags} % 2 == 1){ # check to see if patron's image exists in the database # basically this gives us a template var to condition the display of # patronimage related interface on -my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); +my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; my $branch=C4::Context->userenv->{'branch'}; @@ -404,7 +425,7 @@ $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), CANDELETEUSER => $candeleteuser, - roaddetails => $roaddetails, + roadtype => $roadtype, borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, categoryname => $data->{'description'}, @@ -427,6 +448,7 @@ $template->param( AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), RoutingSerials => C4::Context->preference('RoutingSerials'), + debarments => GetDebarments({ borrowernumber => $borrowernumber }), ); $template->param( $error => 1 ) if $error; @@ -448,8 +470,7 @@ sub build_issue_data { if ($issue->{issuedate} ) { $issuedate = $issue->{issuedate}->clone(); } - - my $biblionumber = $issue->{biblionumber}; + $issue->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($issue->{biblionumber}), GetFrameworkCode($issue->{biblionumber})); $issue->{issuingbranchname} = GetBranchName($issue->{branchcode}); my %row = %{$issue}; $totalprice += $issue->{replacementprice}; @@ -512,6 +533,15 @@ sub build_issue_data { $row{"norenew_reason_$renewerror"} = 1 if $renewerror; $row{renew_failed} = $renew_failed{ $issue->{itemnumber} }; $row{return_failed} = $return_failed{ $issue->{barcode} }; + ($row{'renewcount'},$row{'renewsallowed'},$row{'renewsleft'}) = C4::Circulation::GetRenewCount($issue->{'borrowernumber'},$issue->{'itemnumber'}); #Add renewal count to item data display + + $row{'soonestrenewdate'} = output_pref( + C4::Circulation::GetSoonestRenewDate( + $issue->{borrowernumber}, + $issue->{itemnumber} + ) + ); + push( @{$localissue}, \%row ); } return $localissue;