From 117ee49514c369c089f1940e1f7ca47bd8208e97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Mon, 2 Mar 2015 21:33:20 +0100 Subject: [PATCH] Bug 4041: Third step - Display address on patron's pages using the system preference This patch displays the address information in the left column of the patron's pages using the new system preference. The address is formatted in member-display-address-style-us.inc and member-display-address-style-de.inc To test: - Apply patch on top of 1st and 2nd patch - Select 'German style' in system preference 'addressformat' in I18N/L10N - Verify that the address information displays properly in the left column of all patron's pages. - Verify that the address displays properly in the main area of moremember.pl as well (Note: In right column, Alternate address /contact are not yet touched)) - Switch system preference to US style, repeat checks Signed-off-by: Mirko Tietgen AMending without changes to put this patch at the end of the patch list / Marc Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- circ/circulation.pl | 31 ++------ .../prog/en/includes/circ-menu.inc | 54 ++++++------- .../prog/en/includes/circ-menu.tt | 76 ++++++++++--------- .../member-display-address-style-de.inc | 12 +++ .../member-display-address-style-us.inc | 12 +++ .../prog/en/modules/members/boraccount.tt | 1 + .../prog/en/modules/members/mancredit.tt | 1 + .../prog/en/modules/members/maninvoice.tt | 1 + .../prog/en/modules/members/moremember.tt | 14 ++-- .../prog/en/modules/members/notices.tt | 1 + .../prog/en/modules/members/pay.tt | 4 +- .../prog/en/modules/members/paycollect.tt | 3 +- .../modules/members/purchase-suggestions.tt | 1 + .../prog/en/modules/members/routing-lists.tt | 1 + .../prog/en/modules/members/statistics.tt | 1 + .../prog/en/modules/tools/viewlog.tt | 1 + members/boraccount.pl | 29 ++----- members/mancredit.pl | 50 ++++-------- members/maninvoice.pl | 53 +++++-------- members/moremember.pl | 8 +- members/notices.pl | 20 +++-- members/pay.pl | 8 +- members/paycollect.pl | 7 +- members/purchase-suggestions.pl | 3 +- members/readingrec.pl | 24 +----- members/routing-lists.pl | 26 +------ members/statistics.pl | 11 ++- tools/viewlog.pl | 24 +----- 28 files changed, 187 insertions(+), 290 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-de.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc diff --git a/circ/circulation.pl b/circ/circulation.pl index e131f5b84f..ab478954b7 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -512,12 +512,6 @@ if($lib_messages_loop){ $template->param(flagged => 1 ); } my $bor_messages_loop = GetMessages( $borrowernumber, 'B', $branch ); if($bor_messages_loop){ $template->param(flagged => 1 ); } -# Computes full borrower address -my @fulladdress; -push @fulladdress, $borrower->{'streetnumber'} if ( $borrower->{'streetnumber'} ); -push @fulladdress, C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{'streettype'} ) if ( $borrower->{'streettype'} ); -push @fulladdress, $borrower->{'address'} if ( $borrower->{'address'} ); - my $fast_cataloging = 0; if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 @@ -536,6 +530,10 @@ my $relatives_issues_count = Koha::Database->new()->schema()->resultset('Issue') ->count( { borrowernumber => \@relatives } ); +my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); + +$template->param(%$borrower); + $template->param( lib_messages_loop => $lib_messages_loop, bor_messages_loop => $bor_messages_loop, @@ -547,28 +545,9 @@ $template->param( branchname => GetBranchName($borrower->{'branchcode'}), printer => $printer, printername => $printer, - firstname => $borrower->{'firstname'}, - surname => $borrower->{'surname'}, - showname => $borrower->{'showname'}, - category_type => $borrower->{'category_type'}, was_renewed => $query->param('was_renewed') ? 1 : 0, expiry => format_date($borrower->{'dateexpiry'}), - categorycode => $borrower->{'categorycode'}, - categoryname => $borrower->{description}, - address => join(' ', @fulladdress), - address2 => $borrower->{'address2'}, - email => $borrower->{'email'}, - emailpro => $borrower->{'emailpro'}, - borrowernotes => $borrower->{'borrowernotes'}, - city => $borrower->{'city'}, - state => $borrower->{'state'}, - zipcode => $borrower->{'zipcode'}, - country => $borrower->{'country'}, - phone => $borrower->{'phone'}, - mobile => $borrower->{'mobile'}, - phonepro => $borrower->{'phonepro'}, - cardnumber => $borrower->{'cardnumber'}, - othernames => $borrower->{'othernames'}, + roadtype => $roadtype, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 49a29ccbb4..fdd8da51e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -5,30 +5,20 @@ }
    -[% IF ( patronimages ) %] -[% IF ( picture ) %] -
  • [% firstname %] [% surname %] ([% cardnumber %])
  • -[% ELSE %] -
  • [% firstname %] [% surname %] ([% cardnumber %])
  • -[% END %] -[% END %] - [% IF ( address or address2 ) %] - [% IF ( address ) %] -
  • [% address %]
  • - [% END %] - [% IF ( address2 ) %] -
  • [% address2 %]
  • + [% IF ( patronimages ) %] + [% IF ( picture ) %] +
  • [% firstname %] [% surname %] ([% cardnumber %])
  • + [% ELSE %] +
  • [% firstname %] [% surname %] ([% cardnumber %])
  • [% END %] - [% ELSE %] -
  • No address stored.
  • [% END %] -
  • [% IF ( city ) %] - [% city %][% IF ( state ) %], [% state %][% END %] - [% zipcode %][% IF ( country ) %], [% country %][% END %] + [% IF Koha.Preference( 'addressformat' ) %] + [% INCLUDE "member-display-address-style-${ Koha.Preference( 'addressformat' ) }.inc" %] [% ELSE %] - No city stored. - [% END %]
  • -
  • [% IF ( phone ) %] + [% INCLUDE 'member-display-address-style-us.inc' %] + [% END %] + + [% IF ( phone ) %]
  • [% phone %] [% ELSE %] [% IF ( mobile ) %] @@ -36,20 +26,30 @@ [% ELSE %] [% IF ( phonepro ) %] [% phonepro %] - [% ELSE %] - No phone stored. [% END %] - [% END %] - [% END %]
  • + [% END %] + [% END %] [% IF ( email ) %] [% ELSE %] [% IF ( emailpro ) %] - [% ELSE %] -
  • No email stored.
  • [% END %] [% END %] + + [% UNLESS ( address or address2 ) %] +
  • No address stored.
  • + [% END %] + [% UNLESS ( city ) %] +
  • No city stored.
  • + [% END %] + [% UNLESS ( phone or mobile or phonepro) %] +
  • No phone stored.
  • + [% END %] + [% UNLESS ( email or emailpro) %] +
  • No email stored.
  • + [% END %] + [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN extendedattributes %] [% IF ( extendedattribute.display_checkout ) %] [% IF ( extendedattribute.value ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt index 2a1da6b662..4106933ec4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt @@ -7,52 +7,54 @@ in the global namespace %] }
      -[% IF ( patronimages ) %] -[% IF borrower.has_picture %] -
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • -[% ELSE %] -
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • -[% END %] -[% END %] - [% IF ( borrower.address or borrower.address2 ) %] - [% IF ( borrower.address ) %] -
    • [% borrower.address %]
    • - [% END %] - [% IF ( borrower.address2 ) %] -
    • [% borrower.address2 %]
    • + [% IF ( patronimages ) %] + [% IF borrower.has_picture %] +
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • + [% ELSE %] +
    • [% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])
    • [% END %] - [% ELSE %] -
    • No address stored.
    • [% END %] -
    • - [% IF borrower.city %] - [% borrower.city %][% IF borrower.state %], [% borrower.state %][% END %] - [% borrower.zipcode %][% IF ( borrower.country ) %], [% borrower.country %][% END %] + + [% IF Koha.Preference( 'addressformat' ) %] + [% INCLUDE "member-display-address-style-${ Koha.Preference( 'addressformat' ) }.inc" %] [% ELSE %] - No city stored. - [% END %]
    • -
    • [% IF borrower.phone %] - [% borrower.phone %] + [% INCLUDE 'member-display-address-style-us.inc' %] + [% END %] + + [% IF ( phone ) %]
    • + [% phone %] [% ELSE %] - [% IF borrower.mobile %] - [% borrower.mobile %] + [% IF ( mobile ) %] + [% mobile %] [% ELSE %] - [% IF borrower.phonepro %] - [% borrower.phonepro %] - [% ELSE %] - No phone stored. + [% IF ( phonepro ) %] + [% phonepro %] [% END %] - [% END %] - [% END %]
    • - [% IF borrower.email %] - + [% END %] + [% END %] + [% IF ( email ) %] + [% ELSE %] - [% IF borrower.emailpro %] - - [% ELSE %] -
    • No email stored.
    • + [% IF ( emailpro ) %] + [% END %] [% END %] + + [% UNLESS ( address or address2 ) %] +
    • No address stored.
    • + [% END %] + [% UNLESS ( city ) %] +
    • No city stored.
    • + [% END %] + [% UNLESS ( phone or mobile or phonepro) %] +
    • No phone stored.
    • + [% END %] + [% UNLESS ( email or emailpro) %] +
    • No email stored.
    • + [% END %] + + + [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN borrower.extendedattributes %] [% IF ( extendedattribute.display_checkout ) %] [% IF ( extendedattribute.value ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-de.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-de.inc new file mode 100644 index 0000000000..9524a5a581 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-de.inc @@ -0,0 +1,12 @@ +[% IF ( address or address2 ) %] + [% IF ( address ) %] +
    • [% address %][%if (roadtype) %] [% roadtype %][% end %][% if (streetnumber) %] [% streetnumber %][% end %]
    • + [% END %] + [% IF ( address2 ) %] +
    • [% address2 %]
    • + [% END %] +[% END %] +[% IF ( city ) %]
    • + [%IF (zipcode ) %][% zipcode %] [% END %][% city %][% IF ( state ) %]
      [% state %][% END %] + [% IF ( country ) %]
      [% country %][% END %]
    • +[% END %] 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 new file mode 100644 index 0000000000..a333a6abb8 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc @@ -0,0 +1,12 @@ +[% IF ( address or address2 ) %] + [% IF ( address ) %] +
    • [% if (streetnumber) %][% streetnumber %][% end %] [% address %][%if (roadtype) %] [% roadtype %][% end %]
    • + [% END %] + [% IF ( address2 ) %] +
    • [% address2 %]
    • + [% END %] +[% END %] +[% IF ( city ) %]
    • + [% city %][% IF ( state ) %], [% state %][% END %] + [% zipcode %][% IF ( country ) %], [% country %][% END %]
    • +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index 109bdfc9c5..e115c59ed8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt index 9b9d9c3156..65a61a59ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Create manual credit [% INCLUDE 'doc-head-close.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt index 555a972b98..7d35c73d51 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Create manual invoice [% 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 d25cdead60..9aa87a56ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -196,13 +196,13 @@ function validate1(date) { [% UNLESS ( I ) %][% IF ( othernames ) %]“[% othernames %]”[% END %] -

      - [% address %]
      - [% IF ( address2 ) %][% address2 %]
      [% END %] - [% IF ( city ) %][% city %][% END %] - [% IF ( state ) %][% state %][% END %] - [% IF ( zipcode ) %][% zipcode %]
      [% END %] - [% IF ( country ) %][% country %][% END %]

      +
      + [% IF Koha.Preference( 'addressformat' ) %] + [% INCLUDE "member-display-address-style-${ Koha.Preference( 'addressformat' ) }.inc" %] + [% ELSE %] + [% INCLUDE 'member-display-address-style-us.inc' %] + [% END %] +
        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 50c7d0efb0..72cb4666a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% 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 f8bb6fef89..18b857cdac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Pay Fines for [% borrower.firstname %] [% borrower.surname %] [% INCLUDE 'doc-head-close.inc' %] @@ -170,9 +171,8 @@ function enableCheckboxActions(){
      -
      -[% INCLUDE 'circ-menu.tt' %] +[% INCLUDE 'circ-menu.inc' %]
      [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index 9cec275dee..cb6902c148 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Collect fine payment for [% borrower.firstname %] [% borrower.surname %] [% INCLUDE 'doc-head-close.inc' %] @@ -226,7 +227,7 @@ function moneyFormat(textObj) {
      -[% INCLUDE 'circ-menu.tt' %] +[% INCLUDE 'circ-menu.inc' %]
      [% INCLUDE 'intranet-bottom.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 768bca93c5..3bc88850de 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,3 +1,4 @@ +[% USE Koha %] [% 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/routing-lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt index c0e0bf9d99..87ed8f0780 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,3 +1,4 @@ +[% USE Koha %] [% 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 e118b60333..6beafe54cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% 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 b70c67e01c..6215ccd745 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% INCLUDE 'doc-head-open.inc' %] <title> Koha › Tools › diff --git a/members/boraccount.pl b/members/boraccount.pl index ca042dbabe..37e0adb4dc 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -104,39 +104,22 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -# Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; + +#workaround for Bug 4041 to get rid of duplicated code in circ-menu.tt, use circ-menu.inc instad +$template->param(%$data); $template->param( finesview => 1, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, borrowernumber => $borrowernumber, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), + roadtype => $roadtype, + branchname => GetBranchName($data->{'branchcode'}), total => sprintf("%.2f",$total), totalcredit => $totalcredit, is_child => ($data->{'category_type'} eq 'C'), reverse_col => $reverse_col, accounts => $accts, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), + activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); diff --git a/members/mancredit.pl b/members/mancredit.pl index d00d6e1995..9fc3891180 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -83,44 +83,26 @@ if ($add){ my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} + if (C4::Context->preference('ExtendedPatronAttributes')) { + my $attributes = GetBorrowerAttributes($borrowernumber); + $template->param( + ExtendedPatronAttributes => 1, + extendedattributes => $attributes + ); + } -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; + my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); + $template->param(%$data); $template->param( - finesview => 1, + finesview => 1, borrowernumber => $borrowernumber, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), - is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - RoutingSerials => C4::Context->preference('RoutingSerials'), + 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'), ); output_html_with_http_headers $input, $cookie, $template->output; } diff --git a/members/maninvoice.pl b/members/maninvoice.pl index abead05d2b..164b83309f 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -109,43 +109,24 @@ if ($add){ my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - -# Computes full borrower address -my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; + if (C4::Context->preference('ExtendedPatronAttributes')) { + my $attributes = GetBorrowerAttributes($borrowernumber); + $template->param( + ExtendedPatronAttributes => 1, + extendedattributes => $attributes + ); + } - $template->param( - finesview => 1, - borrowernumber => $borrowernumber, - firstname => $data->{'firstname'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, - categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, - branchname => GetBranchName($data->{'branchcode'}), - is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), + 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'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/moremember.pl b/members/moremember.pl index a0024cbf43..3a54ec9eca 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -335,9 +335,6 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification")); } -# Computes full borrower address -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; - # in template <TMPL_IF name="I"> => instutitional (A for Adult, C for children) $template->param( $data->{'categorycode'} => 1 ); $template->param( @@ -356,8 +353,8 @@ $template->param( overdues_exist => $overdues_exist, StaffMember => ($category_type eq 'S'), is_child => ($category_type eq 'C'), - samebranch => $samebranch, - quickslip => $quickslip, + samebranch => $samebranch, + quickslip => $quickslip, activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), @@ -366,7 +363,6 @@ $template->param( PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20, relatives_issues_count => $relatives_issues_count, relatives_borrowernumbers => \@relatives, - address => $address ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/notices.pl b/members/notices.pl index 6861825a9e..be1e37c31c 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -52,7 +52,6 @@ $template->param( picture => 1 ) if $picture; # Getting the messages my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber}); -$template->param( %{$borrower} ); if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); @@ -62,19 +61,18 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -# Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{'streettype'} ); -my $address = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; +$template->param(%$borrower); $template->param( - QUEUED_MESSAGES => $queued_messages, - borrowernumber => $borrowernumber, - sentnotices => 1, - branchname => GetBranchName($borrower->{'branchcode'}), - categoryname => $borrower->{'description'}, - address => $address, - 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'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/pay.pl b/members/pay.pl index 8eaf929ff2..1ac140d2de 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -133,6 +133,10 @@ sub add_accounts_to_template { } } borrower_add_additional_fields($borrower); + + #workaround for Bug 4041 to get rid of duplicated code in circ-menu.tt, use circ-menu.inc instad + $template->param(%$borrower); + $template->param( accounts => $accounts, borrower => $borrower, @@ -226,10 +230,8 @@ sub borrower_add_additional_fields { if ($picture) { $b_ref->{has_picture} = 1; } - - # Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); - $b_ref->{address} = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; + $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 f6697da128..ad0026f678 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -143,6 +143,10 @@ if ( $total_paid and $total_paid ne '0.00' ) { borrower_add_additional_fields($borrower); +#workaround for Bug 4041 to get rid of duplicated code in circ-menu.tt, use circ-menu.inc instad +$template->param(%$borrower); + + $template->param( borrowernumber => $borrowernumber, # some templates require global borrower => $borrower, @@ -182,9 +186,8 @@ sub borrower_add_additional_fields { $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); } - # Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); - $b_ref->{address} = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; + $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 4c58c3e877..31ba6b64c0 100755 --- a/members/purchase-suggestions.pl +++ b/members/purchase-suggestions.pl @@ -64,8 +64,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { # Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); -my $address = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; -$template->param( address => $address ); +$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 e36963531e..62e653e876 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -120,34 +120,14 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { } -# Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); -my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; +$template->param(%$data); $template->param( readingrecordview => 1, - title => $data->{title}, - initials => $data->{initials}, - surname => $data->{surname}, - othernames => $data->{othernames}, borrowernumber => $borrowernumber, - firstname => $data->{firstname}, - cardnumber => $data->{cardnumber}, - categorycode => $data->{categorycode}, - category_type => $data->{category_type}, categoryname => $data->{description}, - address => $address, - address2 => $data->{address2}, - city => $data->{city}, - state => $data->{state}, - zipcode => $data->{zipcode}, - country => $data->{country}, - phone => $data->{phone}, - phonepro => $data->{phonepro}, - mobile => $data->{mobile}, - email => $data->{email}, - emailpro => $data->{emailpro}, - branchcode => $data->{branchcode}, + 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 ec9102f427..b8187b37bc 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -101,38 +101,18 @@ if ($borrowernumber) { ################################################################################## -# Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); -my $address = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; +$template->param(%$borrower); $template->param( - findborrower => $findborrower, borrower => $borrower, borrowernumber => $borrowernumber, branch => $branch, branchname => GetBranchName($borrower->{'branchcode'}), - title => $borrower->{'title'}, - initials => $borrower->{'initials'}, - firstname => $borrower->{'firstname'}, - surname => $borrower->{'surname'}, - othernames => $borrower->{'othernames'}, - categorycode => $borrower->{'categorycode'}, categoryname => $borrower->{description}, - address => $address, - address2 => $borrower->{'address2'}, - phone => $borrower->{'phone'}, - phonepro => $borrower->{'phonepro'}, - mobile => $borrower->{'mobile'}, - email => $borrower->{'email'}, - emailpro => $borrower->{'emailpro'}, - borrowernotes => $borrower->{'borrowernotes'}, - city => $borrower->{'city'}, - state => $borrower->{'state'}, - zipcode => $borrower->{'zipcode'}, - country => $borrower->{'country'}, - cardnumber => $borrower->{'cardnumber'}, - RoutingSerials => C4::Context->preference('RoutingSerials'), + roadtype => $roadtype, + RoutingSerials => C4::Context->preference('RoutingSerials'), ); if (C4::Context->preference('ExtendedPatronAttributes')) { diff --git a/members/statistics.pl b/members/statistics.pl index de9a6a349f..42b0e651a0 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -96,15 +96,14 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'}); $template->param( picture => 1 ) if $picture; -# Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} ); -my $address = $borrower->{'streetnumber'} . " $roadtype " . $borrower->{'address'}; +$template->param(%$borrower); $template->param( - statisticsview => 1, - datas => $datas, - address => $address, - column_names => \@statistic_column_names, + 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, diff --git a/tools/viewlog.pl b/tools/viewlog.pl index 4d5d42fa8a..a382fc8ae5 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -85,34 +85,14 @@ if ( $src eq 'circ' ) { ); } - # Computes full borrower address my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} ); - my $address = $data->{'streetnumber'} . " $roadtype " . $data->{'address'}; + $template->param(%$data); $template->param( menu => 1, - title => $data->{'title'}, - initials => $data->{'initials'}, - surname => $data->{'surname'}, - othernames => $data->{'othernames'}, borrowernumber => $borrowernumber, - firstname => $data->{'firstname'}, - cardnumber => $data->{'cardnumber'}, - categorycode => $data->{'categorycode'}, - category_type => $data->{'category_type'}, categoryname => $data->{'description'}, - address => $address, - address2 => $data->{'address2'}, - city => $data->{'city'}, - state => $data->{'state'}, - zipcode => $data->{'zipcode'}, - country => $data->{'country'}, - phone => $data->{'phone'}, - phonepro => $data->{'phonepro'}, - mobile => $data->{'mobile'}, - email => $data->{'email'}, - emailpro => $data->{'emailpro'}, - branchcode => $data->{'branchcode'}, + roadtype => $roadtype, branchname => GetBranchName( $data->{'branchcode'} ), RoutingSerials => C4::Context->preference('RoutingSerials'), ); -- 2.39.5