From f9539fc23ffadaf464a33b32a070fda8453a96fc Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 13 Feb 2015 14:10:35 -0500 Subject: [PATCH] Bug 12933 [QA Followup] - Remove Template plugin and use thereof --- Koha/Template/Plugin/Borrowers.pm | 10 ---- .../prog/en/includes/members-toolbar.inc | 4 +- members/boraccount.pl | 1 + members/deletemem.pl | 41 ++++++++------- members/files.pl | 5 ++- members/mancredit.pl | 20 ++++--- members/maninvoice.pl | 18 ++++--- members/member-flags.pl | 55 ++++++++++--------- members/member-password.pl | 58 ++++++++++---------- members/moremember.pl | 1 + members/notices.pl | 17 +++--- members/pay.pl | 7 ++- members/paycollect.pl | 13 +++-- members/readingrec.pl | 21 ++++---- members/routing-lists.pl | 17 +++--- members/statistics.pl | 15 +++--- 16 files changed, 157 insertions(+), 146 deletions(-) diff --git a/Koha/Template/Plugin/Borrowers.pm b/Koha/Template/Plugin/Borrowers.pm index 3e2c59b..5220e16 100644 --- a/Koha/Template/Plugin/Borrowers.pm +++ b/Koha/Template/Plugin/Borrowers.pm @@ -23,7 +23,6 @@ use Modern::Perl; use base qw( Template::Plugin ); use Koha::Borrower::Debarments qw(); -use C4::Members qw(HasOverdues); =pod @@ -49,13 +48,4 @@ sub IsDebarred { return Koha::Borrower::Debarments::IsDebarred($borrower->{borrowernumber}); } -sub HasOverdues { - my ( $self, $borrowernumber ) = @_; - - return unless $borrowernumber; - - return C4::Members::HasOverdues($borrowernumber); -} - - 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index a092b85..81497be 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -159,8 +159,8 @@ function searchToHold(){ diff --git a/members/boraccount.pl b/members/boraccount.pl index ea63f29..aded6ad 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -120,6 +120,7 @@ $template->param( accounts => $accts, activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/deletemem.pl b/members/deletemem.pl index 972a898..e506464 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -111,26 +111,29 @@ if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'} or $de my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; - $template->param(borrowernumber => $member, - surname => $bor->{'surname'}, - title => $bor->{'title'}, - cardnumber => $bor->{'cardnumber'}, - firstname => $bor->{'firstname'}, - categorycode => $bor->{'categorycode'}, - category_type => $bor->{'category_type'}, - categoryname => $bor->{'description'}, - address => $bor->{'address'}, - address2 => $bor->{'address2'}, - city => $bor->{'city'}, - zipcode => $bor->{'zipcode'}, - country => $bor->{'country'}, - phone => $bor->{'phone'}, - email => $bor->{'email'}, - branchcode => $bor->{'branchcode'}, - branchname => GetBranchName($bor->{'branchcode'}), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), + $template->param( + has_overdues => HasOverdues($borrowernumber), + borrowernumber => $member, + surname => $bor->{'surname'}, + title => $bor->{'title'}, + cardnumber => $bor->{'cardnumber'}, + firstname => $bor->{'firstname'}, + categorycode => $bor->{'categorycode'}, + category_type => $bor->{'category_type'}, + categoryname => $bor->{'description'}, + address => $bor->{'address'}, + address2 => $bor->{'address2'}, + city => $bor->{'city'}, + zipcode => $bor->{'zipcode'}, + country => $bor->{'country'}, + phone => $bor->{'phone'}, + email => $bor->{'email'}, + branchcode => $bor->{'branchcode'}, + branchname => GetBranchName( $bor->{'branchcode'} ), + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), ); + if ($countissues >0) { $template->param(ItemsOnIssues => $countissues); } diff --git a/members/files.pl b/members/files.pl index 8f87492..641025a 100755 --- a/members/files.pl +++ b/members/files.pl @@ -44,7 +44,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( debug => 1, } ); -$template->param( 'borrower_files' => 1 ); +$template->param( + 'borrower_files' => 1, + has_overdues => HasOverdues($borrowernumber), +); my $borrowernumber = $cgi->param('borrowernumber'); my $bf = Koha::Borrower::Files->new( borrowernumber => $borrowernumber ); diff --git a/members/mancredit.pl b/members/mancredit.pl index 9fc3891..2237fad 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -95,14 +95,16 @@ if ($add){ $template->param(%$data); $template->param( - finesview => 1, - borrowernumber => $borrowernumber, - categoryname => $data->{'description'}, - roadtype => $roadtype, - branchname => GetBranchName($data->{'branchcode'}), - is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), - ); + finesview => 1, + borrowernumber => $borrowernumber, + categoryname => $data->{'description'}, + roadtype => $roadtype, + branchname => GetBranchName( $data->{'branchcode'} ), + is_child => ( $data->{'category_type'} eq 'C' ), + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), + ); + output_html_with_http_headers $input, $cookie, $template->output; } diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 164b833..48ff971 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -120,14 +120,16 @@ if ($add){ my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); $template->param(%$data); $template->param( - finesview => 1, - borrowernumber => $borrowernumber, - categoryname => $data->{'description'}, - branchname => GetBranchName($data->{'branchcode'}), - roadtype => $roadtype, - is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), + finesview => 1, + borrowernumber => $borrowernumber, + categoryname => $data->{'description'}, + branchname => GetBranchName( $data->{'branchcode'} ), + roadtype => $roadtype, + is_child => ( $data->{'category_type'} eq 'C' ), + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), ); + output_html_with_http_headers $input, $cookie, $template->output; } diff --git a/members/member-flags.pl b/members/member-flags.pl index 68c52aa..cb4fd02 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -175,33 +175,34 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $bor->{streettype} ); my $address = $bor->{'streetnumber'} . " $roadtype " . $bor->{'address'}; -$template->param( - borrowernumber => $bor->{'borrowernumber'}, - cardnumber => $bor->{'cardnumber'}, - surname => $bor->{'surname'}, - firstname => $bor->{'firstname'}, - othernames => $bor->{'othernames'}, - categorycode => $bor->{'categorycode'}, - category_type => $bor->{'category_type'}, - categoryname => $bor->{'description'}, - address => $address, - address2 => $bor->{'address2'}, - city => $bor->{'city'}, - state => $bor->{'state'}, - zipcode => $bor->{'zipcode'}, - country => $bor->{'country'}, - phone => $bor->{'phone'}, - phonepro => $bor->{'phonepro'}, - mobile => $bor->{'mobile'}, - email => $bor->{'email'}, - emailpro => $bor->{'emailpro'}, - branchcode => $bor->{'branchcode'}, - branchname => GetBranchName($bor->{'branchcode'}), - loop => \@loop, - is_child => ($bor->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), - ); + $template->param( + has_overdues => HasOverdues($borrowernumber), + borrowernumber => $bor->{'borrowernumber'}, + cardnumber => $bor->{'cardnumber'}, + surname => $bor->{'surname'}, + firstname => $bor->{'firstname'}, + othernames => $bor->{'othernames'}, + categorycode => $bor->{'categorycode'}, + category_type => $bor->{'category_type'}, + categoryname => $bor->{'description'}, + address => $address, + address2 => $bor->{'address2'}, + city => $bor->{'city'}, + state => $bor->{'state'}, + zipcode => $bor->{'zipcode'}, + country => $bor->{'country'}, + phone => $bor->{'phone'}, + phonepro => $bor->{'phonepro'}, + mobile => $bor->{'mobile'}, + email => $bor->{'email'}, + emailpro => $bor->{'emailpro'}, + branchcode => $bor->{'branchcode'}, + branchname => GetBranchName( $bor->{'branchcode'} ), + loop => \@loop, + is_child => ( $bor->{'category_type'} eq 'C' ), + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/member-password.pl b/members/member-password.pl index 310d641..9bf3635 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -104,34 +104,36 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $bor->{streettype} ); my $address = $bor->{'streetnumber'} . " $roadtype " . $bor->{'address'}; - $template->param( othernames => $bor->{'othernames'}, - surname => $bor->{'surname'}, - firstname => $bor->{'firstname'}, - borrowernumber => $bor->{'borrowernumber'}, - cardnumber => $bor->{'cardnumber'}, - categorycode => $bor->{'categorycode'}, - category_type => $bor->{'category_type'}, - categoryname => $bor->{'description'}, - address => $address, - address2 => $bor->{'address2'}, - city => $bor->{'city'}, - state => $bor->{'state'}, - zipcode => $bor->{'zipcode'}, - country => $bor->{'country'}, - phone => $bor->{'phone'}, - phonepro => $bor->{'phonepro'}, - mobile => $bor->{'mobile'}, - email => $bor->{'email'}, - emailpro => $bor->{'emailpro'}, - branchcode => $bor->{'branchcode'}, - branchname => GetBranchName($bor->{'branchcode'}), - userid => $bor->{'userid'}, - destination => $destination, - is_child => ($bor->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - minPasswordLength => $minpw, - RoutingSerials => C4::Context->preference('RoutingSerials'), - ); + $template->param( + othernames => $bor->{'othernames'}, + has_overdues => HasOverdues($borrowernumber), + surname => $bor->{'surname'}, + firstname => $bor->{'firstname'}, + borrowernumber => $bor->{'borrowernumber'}, + cardnumber => $bor->{'cardnumber'}, + categorycode => $bor->{'categorycode'}, + category_type => $bor->{'category_type'}, + categoryname => $bor->{'description'}, + address => $address, + address2 => $bor->{'address2'}, + city => $bor->{'city'}, + state => $bor->{'state'}, + zipcode => $bor->{'zipcode'}, + country => $bor->{'country'}, + phone => $bor->{'phone'}, + phonepro => $bor->{'phonepro'}, + mobile => $bor->{'mobile'}, + email => $bor->{'email'}, + emailpro => $bor->{'emailpro'}, + branchcode => $bor->{'branchcode'}, + branchname => GetBranchName( $bor->{'branchcode'} ), + userid => $bor->{'userid'}, + destination => $destination, + is_child => ( $bor->{'category_type'} eq 'C' ), + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + minPasswordLength => $minpw, + RoutingSerials => C4::Context->preference('RoutingSerials'), + ); if( scalar(@errors )){ $template->param( errormsg => 1 ); diff --git a/members/moremember.pl b/members/moremember.pl index 6a5adcc..2516c36 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -341,6 +341,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { # in template => instutitional (A for Adult, C for children) $template->param( $data->{'categorycode'} => 1 ); $template->param( + has_overdues => HasOverdues($borrowernumber), detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), roadtype => $roadtype, diff --git a/members/notices.pl b/members/notices.pl index be1e37c..625657b 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -65,14 +65,15 @@ my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{'stre $template->param(%$borrower); $template->param( - QUEUED_MESSAGES => $queued_messages, - borrowernumber => $borrowernumber, - sentnotices => 1, - branchname => GetBranchName($borrower->{'branchcode'}), - categoryname => $borrower->{'description'}, - roadtype => $roadtype, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), + QUEUED_MESSAGES => $queued_messages, + borrowernumber => $borrowernumber, + sentnotices => 1, + branchname => GetBranchName( $borrower->{'branchcode'} ), + categoryname => $borrower->{'description'}, + roadtype => $roadtype, + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/pay.pl b/members/pay.pl index 07217fd..20f834b 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -104,9 +104,10 @@ for (@names) { } $template->param( - finesview => 1, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), + finesview => 1, + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), ); add_accounts_to_template(); diff --git a/members/paycollect.pl b/members/paycollect.pl index 35b9121..c57c4c2 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -146,12 +146,13 @@ borrower_add_additional_fields($borrower); $template->param(%$borrower); $template->param( - borrowernumber => $borrowernumber, # some templates require global - borrower => $borrower, - total => $total_due, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), - ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'), + has_overdues => HasOverdues($borrowernumber), + borrowernumber => $borrowernumber, # some templates require global + borrower => $borrower, + total => $total_due, + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), + ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/readingrec.pl b/members/readingrec.pl index 62e653e..d5ce2fa 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -124,16 +124,17 @@ my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettyp $template->param(%$data); $template->param( - readingrecordview => 1, - borrowernumber => $borrowernumber, - categoryname => $data->{description}, - roadtype => $roadtype, - is_child => ( $data->{category_type} eq 'C' ), - branchname => $branches->{ $data->{branchcode} }->{branchname}, - loop_reading => $issues, - activeBorrowerRelationship => - ( C4::Context->preference('borrowerRelationship') ne '' ), - RoutingSerials => C4::Context->preference('RoutingSerials'), + readingrecordview => 1, + borrowernumber => $borrowernumber, + categoryname => $data->{description}, + roadtype => $roadtype, + is_child => ( $data->{category_type} eq 'C' ), + branchname => $branches->{ $data->{branchcode} }->{branchname}, + loop_reading => $issues, + activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), + RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), ); + output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/routing-lists.pl b/members/routing-lists.pl index b8187b3..8dc52a4 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -105,14 +105,15 @@ my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{stree $template->param(%$borrower); $template->param( - findborrower => $findborrower, - borrower => $borrower, - borrowernumber => $borrowernumber, - branch => $branch, - branchname => GetBranchName($borrower->{'branchcode'}), - categoryname => $borrower->{description}, - roadtype => $roadtype, - RoutingSerials => C4::Context->preference('RoutingSerials'), + findborrower => $findborrower, + borrower => $borrower, + borrowernumber => $borrowernumber, + branch => $branch, + branchname => GetBranchName( $borrower->{'branchcode'} ), + categoryname => $borrower->{description}, + roadtype => $roadtype, + RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), ); if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/statistics.pl b/members/statistics.pl index 42b0e65..cf08ec4 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -100,15 +100,16 @@ my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{stree $template->param(%$borrower); $template->param( - statisticsview => 1, - datas => $datas, - roadtype => $roadtype, - column_names => \@statistic_column_names, - count_total_issues => $count_total_issues, + statisticsview => 1, + datas => $datas, + roadtype => $roadtype, + column_names => \@statistic_column_names, + count_total_issues => $count_total_issues, count_total_issues_returned => $count_total_issues_returned, count_total_precedent_state => $count_total_precedent_state, - count_total_actual_state => $count_total_actual_state, - RoutingSerials => C4::Context->preference('RoutingSerials'), + count_total_actual_state => $count_total_actual_state, + RoutingSerials => C4::Context->preference('RoutingSerials'), + has_overdues => HasOverdues($borrowernumber), ); output_html_with_http_headers $input, $cookie, $template->output; -- 1.7.2.5