From ef63dceb7f9c860229f0d597cdc1a6e3741124b5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 11 Jan 2016 09:18:30 +0000 Subject: [PATCH] Bug 15542: Always display the patron's info the same way. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The patron's information displayed in the member module (includes/circ-menu.inc and includes/member-display-address-style-*.inc) are not always displayed the same way. Sometimes the streetnumber is missing, sometimes it's the streettype. Sometimes the streettype is after the address, sometimes before... Test plan: Go on a patron detail page, and open all the tabs on the left (Check out, Fines, Notices, etc.) Without this patch, the patron's info displayed will differ from one page to another. With this patch, they will be displayed the same everywhere. Followed test plan, works as expected. (Tested both patches together.) Signed-off-by: Marc Véron Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com (cherry picked from commit bde685fa9208aef6c7a7f14034e55c9dcd6e88a0) Signed-off-by: Julian Maurice Conflicts: members/summary-print.pl --- .../prog/en/includes/member-display-address-style-us.inc | 6 +++++- .../intranet-tmpl/prog/en/modules/members/discharge.tt | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt | 1 + .../intranet-tmpl/prog/en/modules/members/moremember.tt | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 1 + .../prog/en/modules/members/purchase-suggestions.tt | 1 + .../intranet-tmpl/prog/en/modules/members/readingrec.tt | 1 + .../intranet-tmpl/prog/en/modules/members/routing-lists.tt | 1 + .../intranet-tmpl/prog/en/modules/members/statistics.tt | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt | 1 + members/boraccount.pl | 3 --- members/discharge.pl | 2 ++ members/files.pl | 5 ----- members/mancredit.pl | 2 -- members/maninvoice.pl | 2 -- members/member-flags.pl | 7 ++----- members/member-password.pl | 7 ++----- members/moremember.pl | 2 -- members/notices.pl | 2 -- members/pay.pl | 2 -- members/paycollect.pl | 3 --- members/purchase-suggestions.pl | 4 ---- members/readingrec.pl | 2 -- members/routing-lists.pl | 2 -- members/statistics.pl | 2 -- members/summary-print.pl | 5 ----- tools/viewlog.pl | 2 -- 28 files changed, 21 insertions(+), 49 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc index a333a6abb8..4dbf999353 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc @@ -1,6 +1,10 @@ [% IF ( address or address2 ) %] [% IF ( address ) %] -
  • [% if (streetnumber) %][% streetnumber %][% end %] [% address %][%if (roadtype) %] [% roadtype %][% end %]
  • + [% SET roadtype_desc = '' %] + [% IF streettype %] + [% SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', streettype) %] + [% END %] +
  • [% if (streetnumber) %][% streetnumber %][% end %] [% IF roadtype_desc %][% roadtype_desc %] [% END %][% address %][% end %]
  • [% END %] [% IF ( address2 ) %]
  • [% address2 %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt index e239a3e57e..45757d2745 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › [% IF (unknowuser) %]Patron does not exist[% ELSE %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %] [% INCLUDE 'doc-head-close.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt index 5e7d143531..15bdc1b36a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Files for [% INCLUDE 'patron-title.inc' %] [% INCLUDE 'doc-head-close.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 802eeaf196..db4bf82538 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE KohaDates %] +[% USE AuthorisedValues %] [% USE ColumnsSettings %] [% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %] [% SET exports_enabled = 1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt index 72cb4666a4..f3f9c37cdd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE AuthorisedValues %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Sent notices for [% INCLUDE 'patron-title.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index e56bd613d7..6d3427dc6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Pay Fines for [% borrower.firstname %] [% borrower.surname %] [% INCLUDE 'doc-head-close.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt index 6cf4270c6c..aebe66508e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Purchase suggestions for [% INCLUDE 'patron-title.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index 6fb109e3de..59b845dcff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -1,5 +1,6 @@ [% USE KohaDates %] [% USE Koha %] +[% USE AuthorisedValues %] [% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Circulation History for [% INCLUDE 'patron-title.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt index 87ed8f0780..d9d540e3c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Subscription Routing Lists for [% INCLUDE 'patron-title.inc' %] [% INCLUDE 'doc-head-close.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt index 6beafe54cf..e39d87f80c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › [% IF ( unknowuser ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index 3ebed6ff99..fc7ab11f52 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] <title> Koha › Tools › diff --git a/members/boraccount.pl b/members/boraccount.pl index ea63f29b97..0200c5c48f 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -104,14 +104,11 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); - $template->param(%$data); $template->param( finesview => 1, borrowernumber => $borrowernumber, - roadtype => $roadtype, branchname => GetBranchName($data->{'branchcode'}), total => sprintf("%.2f",$total), totalcredit => $totalcredit, diff --git a/members/discharge.pl b/members/discharge.pl index ad8408be4c..6c0715bb62 100755 --- a/members/discharge.pl +++ b/members/discharge.pl @@ -115,6 +115,8 @@ if ( $input->param('borrowernumber') ) { category_type => $data->{'category_type'}, categoryname => $data->{'description'}, address => $data->{'address'}, + streetnumber => $data->{streetnumber}, + streettype => $data->{streettype}, address2 => $data->{'address2'}, city => $data->{'city'}, zipcode => $data->{'zipcode'}, diff --git a/members/files.pl b/members/files.pl index 8f8749221d..45ed50d7c2 100755 --- a/members/files.pl +++ b/members/files.pl @@ -118,16 +118,11 @@ else { my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; - # Computes full borrower address - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); - my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; - $template->param( files => Koha::Borrower::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), errors => \%errors, - address => $address, ); output_html_with_http_headers $cgi, $cookie, $template->output; } diff --git a/members/mancredit.pl b/members/mancredit.pl index 9fc3891180..b427e1c8ed 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -91,14 +91,12 @@ if ($add){ ); } - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); $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 ''), diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 164b83309f..c14af0f4e3 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -117,14 +117,12 @@ 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'), diff --git a/members/member-flags.pl b/members/member-flags.pl index 1206f129b6..e13d127a48 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -168,10 +168,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $bor->{streettype} ); -my $address = $bor->{'streetnumber'} . " $roadtype " . $bor->{'address'}; - $template->param( borrowernumber => $bor->{'borrowernumber'}, cardnumber => $bor->{'cardnumber'}, @@ -181,8 +177,9 @@ $template->param( categorycode => $bor->{'categorycode'}, category_type => $bor->{'category_type'}, categoryname => $bor->{'description'}, - address => $address, + address => $bor->{address}, address2 => $bor->{'address2'}, + streettype => $bor->{streettype}, city => $bor->{'city'}, state => $bor->{'state'}, zipcode => $bor->{'zipcode'}, diff --git a/members/member-password.pl b/members/member-password.pl index 28f5ea02ec..2cdad3402a 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -100,10 +100,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -# Computes full borrower address -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'}, @@ -112,8 +108,9 @@ my $address = $bor->{'streetnumber'} . " $roadtype " . $bor->{'address'}; categorycode => $bor->{'categorycode'}, category_type => $bor->{'category_type'}, categoryname => $bor->{'description'}, - address => $address, + address => $bor->{address}, address2 => $bor->{'address2'}, + streettype => $$bor->{streettype}, city => $bor->{'city'}, state => $bor->{'state'}, zipcode => $bor->{'zipcode'}, diff --git a/members/moremember.pl b/members/moremember.pl index 6198d87c46..3fc1e3cea1 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -248,7 +248,6 @@ my $relatives_issues_count = Koha::Database->new()->schema()->resultset('Issue') ->count( { borrowernumber => \@relatives } ); -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); my $today = DateTime->now( time_zone => C4::Context->tz); $today->truncate(to => 'day'); my $overdues_exist = 0; @@ -333,7 +332,6 @@ $template->param( $data->{'categorycode'} => 1 ); $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), - roadtype => $roadtype, borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, categoryname => $data->{'description'}, diff --git a/members/notices.pl b/members/notices.pl index 82b9a3fc25..f7e1f709c6 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -60,7 +60,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{'streettype'} ); $template->param(%$borrower); $template->param( @@ -69,7 +68,6 @@ $template->param( sentnotices => 1, branchname => GetBranchName($borrower->{'branchcode'}), categoryname => $borrower->{'description'}, - roadtype => $roadtype, activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); diff --git a/members/pay.pl b/members/pay.pl index 8a1b499db6..04991d87fd 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -228,8 +228,6 @@ sub borrower_add_additional_fields { if ($picture) { $b_ref->{has_picture} = 1; } - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); - $b_ref->{roadtype} = $roadtype; if (C4::Context->preference('ExtendedPatronAttributes')) { $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); diff --git a/members/paycollect.pl b/members/paycollect.pl index 35b912143e..7254a3aaea 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -184,9 +184,6 @@ sub borrower_add_additional_fields { $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); } - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); - $b_ref->{roadtype} = $roadtype; - $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} ); return; } diff --git a/members/purchase-suggestions.pl b/members/purchase-suggestions.pl index 31ba6b64c0..11e806ef82 100755 --- a/members/purchase-suggestions.pl +++ b/members/purchase-suggestions.pl @@ -62,10 +62,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); -$template->param( roadtype => $roadtype ); - my ($picture, $dberror) = GetPatronImage($borrowernumber); $template->param( picture => 1 ) if $picture; diff --git a/members/readingrec.pl b/members/readingrec.pl index 20860c2bf1..f9bda6cde7 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -117,14 +117,12 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { } -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); $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, diff --git a/members/routing-lists.pl b/members/routing-lists.pl index b8187b37bc..a68ef404d5 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -101,7 +101,6 @@ if ($borrowernumber) { ################################################################################## -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); $template->param(%$borrower); $template->param( @@ -111,7 +110,6 @@ $template->param( branch => $branch, branchname => GetBranchName($borrower->{'branchcode'}), categoryname => $borrower->{description}, - roadtype => $roadtype, RoutingSerials => C4::Context->preference('RoutingSerials'), ); diff --git a/members/statistics.pl b/members/statistics.pl index 42b0e651a0..e875cef6ac 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -96,13 +96,11 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); $template->param(%$borrower); $template->param( 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, diff --git a/members/summary-print.pl b/members/summary-print.pl index 7bed793d5f..1544d99b32 100755 --- a/members/summary-print.pl +++ b/members/summary-print.pl @@ -55,10 +55,6 @@ foreach my $accountline (@$accts) { } } -my $roadtype = - C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -$roadtype = '' if ( ! $roadtype ); - our $totalprice = 0; my $total_format = ''; $total_format = sprintf( "%.2f", $total ) if ($total); @@ -67,7 +63,6 @@ $template->param( %$data, borrowernumber => $borrowernumber, - address => $data->{'streetnumber'} . " $roadtype " . $data->{'address'}, accounts => $accts, totaldue => $total_format, diff --git a/tools/viewlog.pl b/tools/viewlog.pl index a8ac49fb16..f6816d7150 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -84,14 +84,12 @@ if ( $src eq 'circ' ) { ); } - my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); $template->param(%$data); $template->param( menu => 1, borrowernumber => $borrowernumber, categoryname => $data->{'description'}, - roadtype => $roadtype, branchname => GetBranchName( $data->{'branchcode'} ), RoutingSerials => C4::Context->preference('RoutingSerials'), ); -- 2.39.5