Bug 4041: Third step - Display address on patron's pages using the system preference
authorMarc Véron <veron@veron.ch>
Mon, 2 Mar 2015 20:33:20 +0000 (21:33 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 29 Apr 2015 14:25:11 +0000 (11:25 -0300)
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 <mirko@abunchofthings.net>
AMending without changes to put this patch at the end of the patch list / Marc

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
28 files changed:
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-de.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style-us.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
members/boraccount.pl
members/mancredit.pl
members/maninvoice.pl
members/moremember.pl
members/notices.pl
members/pay.pl
members/paycollect.pl
members/purchase-suggestions.pl
members/readingrec.pl
members/routing-lists.pl
members/statistics.pl
tools/viewlog.pl

index e131f5b..ab47895 100755 (executable)
@@ -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,
index 49a29cc..fdd8da5 100644 (file)
@@ -5,30 +5,20 @@
 }</style>
 <![endif]-->
 <ul class="patronbriefinfo">
-[% IF ( patronimages ) %]
-[% IF ( picture ) %]
-<li><img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% borrowernumber | uri %]" id="patronimage" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
-[% ELSE %]
-<li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
-[% END %]
-[% END %]
-    [% IF ( address or address2 ) %]
-        [% IF ( address ) %]
-            <li class="patronaddress1">[% address %]</li>
-        [% END %]
-        [% IF ( address2 ) %]
-            <li class="patronaddress2">[% address2 %]</li>
+    [% IF ( patronimages ) %]
+        [% IF ( picture ) %]
+            <li><img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% borrowernumber | uri %]" id="patronimage" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
+        [% ELSE %]
+            <li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% firstname %] [% surname %] ([% cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
         [% END %]
-    [% ELSE %]
-            <li><span class="empty" id="noaddressstored">No address stored.</span></li>
     [% END %]
-    <li class="patroncity">[% 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 %]
-        <span class="empty" id="nocitystored">No city stored.</span>
-    [% END %]</li>
-    <li class="patronphone">[% IF ( phone ) %]
+        [% INCLUDE 'member-display-address-style-us.inc' %]
+    [% END %]
+
+    [% IF ( phone ) %]<li class="patronphone">
         [% phone %]
     [% ELSE %]
         [% IF ( mobile ) %]
         [% ELSE %]
             [% IF ( phonepro ) %]
                 [% phonepro %]
-            [% ELSE %]
-                <span class="empty" id="nophonestored">No phone stored.</span>
             [% END %]
-        [% END %]
-    [% END %]</li>
+        [% END %]</li>
+    [% END %]
     [% IF ( email ) %]
         <li class="email"> <a href="mailto:[% email %]" title="[% email %]">[% email %]</a></li>
     [% ELSE %]
         [% IF ( emailpro ) %]
             <li class="email"> <a href="mailto:[% emailpro %]" title="[% emailpro %]">[% emailpro %]</a></li>
-        [% ELSE %]
-            <li> <span class="empty">No email stored.</span>    </li>
         [% END %]
     [% END %]
+
+    [% UNLESS ( address or address2 ) %]
+        <li><span class="empty" id="noaddressstored">No address stored.</span></li>
+    [% END %]
+    [% UNLESS ( city ) %]
+        <li><span class="empty" id="nocitystored">No city stored.</span></li>
+    [% END %]
+    [% UNLESS ( phone or mobile or phonepro) %]
+        <li> <span class="empty">No phone stored.</span></li>
+    [% END %]
+    [% UNLESS ( email or emailpro) %]
+        <li> <span class="empty">No email stored.</span></li>
+    [% END %]
+
     [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN extendedattributes %]
         [% IF ( extendedattribute.display_checkout ) %]
             [% IF ( extendedattribute.value ) %]
index 2a1da6b..4106933 100644 (file)
@@ -7,52 +7,54 @@ in the global namespace %]
 }</style>
 <![endif]-->
 <ul class="patronbriefinfo">
-[% IF ( patronimages ) %]
-[% IF borrower.has_picture %]
-<li><img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% borrower.borrowernumber %]" id="patronimage" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
-[% ELSE %]
-<li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
-[% END %]
-[% END %]
-    [% IF ( borrower.address or borrower.address2 ) %]
-        [% IF ( borrower.address ) %]
-            <li class="patronaddress1">[% borrower.address %]</li>
-        [% END %]
-        [% IF ( borrower.address2 ) %]
-            <li class="patronaddress2">[% borrower.address2 %]</li>
+    [% IF ( patronimages ) %]
+        [% IF borrower.has_picture %]
+        <li><img src="/cgi-bin/koha/members/patronimage.pl?borrowernumber=[% borrower.borrowernumber %]" id="patronimage" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
+        [% ELSE %]
+            <li id="patronbasics"><img src="[% interface %]/[% theme %]/img/patron-blank.png" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
         [% END %]
-    [% ELSE %]
-            <li><span class="empty" id="noaddressstored">No address stored.</span></li>
     [% END %]
-    <li class="patroncity">
-    [% 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 %]
-        <span class="empty" id="nocitystored">No city stored.</span>
-    [% END %]</li>
-    <li class="patronphone">[% IF borrower.phone %]
-        [% borrower.phone %]
+        [% INCLUDE 'member-display-address-style-us.inc' %]
+    [% END %]
+
+    [% IF ( phone ) %]<li class="patronphone">
+        [% phone %]
     [% ELSE %]
-        [% IF borrower.mobile %]
-            [% borrower.mobile %]
+        [% IF ( mobile ) %]
+            [% mobile %]
         [% ELSE %]
-            [% IF borrower.phonepro %]
-                [% borrower.phonepro %]
-            [% ELSE %]
-                <span class="empty" id="nophonestored">No phone stored.</span>
+            [% IF ( phonepro ) %]
+                [% phonepro %]
             [% END %]
-        [% END %]
-    [% END %]</li>
-    [% IF borrower.email %]
-        <li class="email"> <a href="mailto:[% borrower.email %]" title="[% borrower.email %]">[% borrower.email %]</a></li>
+        [% END %]</li>
+    [% END %]
+    [% IF ( email ) %]
+        <li class="email"> <a href="mailto:[% email %]" title="[% email %]">[% email %]</a></li>
     [% ELSE %]
-        [% IF borrower.emailpro %]
-            <li class="email"> <a href="mailto:[% borrower.emailpro %]" title="[% borrower.emailpro %]">[% borrower.emailpro %]</a></li>
-        [% ELSE %]
-            <li> <span class="empty">No email stored.</span>    </li>
+        [% IF ( emailpro ) %]
+            <li class="email"> <a href="mailto:[% emailpro %]" title="[% emailpro %]">[% emailpro %]</a></li>
         [% END %]
     [% END %]
+
+    [% UNLESS ( address or address2 ) %]
+        <li><span class="empty" id="noaddressstored">No address stored.</span></li>
+    [% END %]
+    [% UNLESS ( city ) %]
+        <li><span class="empty" id="nocitystored">No city stored.</span></li>
+    [% END %]
+    [% UNLESS ( phone or mobile or phonepro) %]
+        <li> <span class="empty">No phone stored.</span></li>
+    [% END %]
+    [% UNLESS ( email or emailpro) %]
+        <li> <span class="empty">No email stored.</span></li>
+    [% 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 (file)
index 0000000..9524a5a
--- /dev/null
@@ -0,0 +1,12 @@
+[% IF ( address or address2 ) %]
+    [% IF ( address ) %]
+        <li class="patronaddress1">[% address %][%if (roadtype) %] [% roadtype %][% end %][% if (streetnumber) %] [% streetnumber %][% end %]</li>
+    [% END %]
+    [% IF ( address2 ) %]
+        <li class="patronaddress2">[% address2 %]</li>
+    [% END %]
+[% END %]
+[% IF ( city ) %]<li class="patroncity">
+    [%IF (zipcode ) %][% zipcode %] [% END %][% city %][% IF ( state ) %]</br>[% state %][% END %]
+    [% IF ( country ) %]<br />[% country %][% END %]</li>
+[% 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 (file)
index 0000000..a333a6a
--- /dev/null
@@ -0,0 +1,12 @@
+[% IF ( address or address2 ) %]
+    [% IF ( address ) %]
+        <li class="patronaddress1">[% if (streetnumber) %][% streetnumber %][% end %] [% address %][%if (roadtype) %] [% roadtype %][% end %]</li>
+    [% END %]
+    [% IF ( address2 ) %]
+        <li class="patronaddress2">[% address2 %]</li>
+    [% END %]
+[% END %]
+[% IF ( city ) %]<li class="patroncity">
+        [% city %][% IF ( state ) %], [% state %][% END %]
+        [% zipcode %][% IF ( country ) %], [% country %][% END %]</li>
+[% END %]
index 109bdfc..e115c59 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</title>
index 9b9d9c3..65a61a5 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Create manual credit</title>
 [% INCLUDE 'doc-head-close.inc' %]
index 555a972..7d35c73 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Create manual invoice</title>
 [% INCLUDE 'doc-head-close.inc' %]
index d25cdea..9aa87a5 100644 (file)
@@ -196,13 +196,13 @@ function validate1(date) {
 
      [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
 
-<p class="address">
-        [% address %]<br />
-        [% IF ( address2 ) %][% address2 %]<br />[% END %]
-       [% IF ( city ) %][% city %][% END %] 
-       [% IF ( state ) %][% state %][% END %]
-       [% IF ( zipcode ) %][% zipcode %]<br />[% END %]
-       [% IF ( country ) %][% country %][% END %]</p>
+    <div class = "address">
+        [% IF Koha.Preference( 'addressformat' ) %]
+            [% INCLUDE "member-display-address-style-${ Koha.Preference( 'addressformat' ) }.inc" %]
+        [% ELSE %]
+            [% INCLUDE 'member-display-address-style-us.inc' %]
+        [% END %]
+    </div>
                    
        <div class="rows">
                <ol>
index 50c7d0e..72cb466 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Sent notices for [% INCLUDE 'patron-title.inc' %]</title>
index f8bb6fe..18b857c 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -170,9 +171,8 @@ function enableCheckboxActions(){
 
 </div>
 </div>
-
 <div class="yui-b">
-[% INCLUDE 'circ-menu.tt' %]
+[% INCLUDE 'circ-menu.inc' %]
 </div>
 </div>
 [% INCLUDE 'intranet-bottom.inc' %]
index 9cec275..cb6902c 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Collect fine payment for  [% borrower.firstname %] [% borrower.surname %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -226,7 +227,7 @@ function moneyFormat(textObj) {
 </div>
 
 <div class="yui-b">
-[% INCLUDE 'circ-menu.tt' %]
+[% INCLUDE 'circ-menu.inc' %]
 </div>
 </div>
 [% INCLUDE 'intranet-bottom.inc' %]
index 768bca9..3bc8885 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo; Purchase suggestions for [% INCLUDE 'patron-title.inc' %]</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
index c0e0bf9..87ed8f0 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Subscription Routing Lists for [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
index e118b60..6beafe5 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Patrons &rsaquo;
 [% IF ( unknowuser ) %]
index b70c67e..6215ccd 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>
        Koha &rsaquo; Tools &rsaquo;
index ca042db..37e0adb 100755 (executable)
@@ -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'),
 );
 
index d00d6e1..9fc3891 100755 (executable)
@@ -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;
 }
index abead05..164b833 100755 (executable)
@@ -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;
index a0024cb..3a54ec9 100755 (executable)
@@ -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;
index 6861825..be1e37c 100755 (executable)
@@ -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;
 
index 8eaf929..1ac140d 100755 (executable)
@@ -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);
index f6697da..ad0026f 100755 (executable)
@@ -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;
index 4c58c3e..31ba6b6 100755 (executable)
@@ -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;
index e369635..62e653e 100755 (executable)
@@ -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,
index ec9102f..b8187b3 100755 (executable)
@@ -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')) {
index de9a6a3..42b0e65 100755 (executable)
@@ -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,
index 4d5d42f..a382fc8 100755 (executable)
@@ -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'),
     );