Bug 22087: Use include file to display patrons address in search result

In order to display the city and country in the patron search result, we
need to use the member-display-address-style include file, to satisfy
AddressFormat.

Test plan:
Modify some patrons and fill the different address info
Search for them and notice that the city, zipcode and country are now
displayed.
Modify the value of AddressFormat and confirm that the display is
modified according to its value

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-04-06 16:00:13 +02:00
parent a8b9598584
commit 33f4bc949e
3 changed files with 80 additions and 72 deletions

View file

@ -2003,6 +2003,20 @@ li {
}
}
#searchresults {
.address {
ul {
margin: 0;
padding-left: 0;
li {
clear: none;
float: left;
list-style: none;
}
}
}
}
#searchheader {
background-color: #E6F0F2;
border: 1px solid #B9D8D9;

View file

@ -1,74 +1,74 @@
[% USE Koha %]
[% BLOCK 'display-address-style' %]
[% IF Koha.Preference( 'AddressFormat' ) %]
[% PROCESS "member-display-address-style-${ Koha.Preference( 'AddressFormat' ) }" %]
[% ELSE %]
[% PROCESS 'member-display-address-style-us' %]
[% END %]
[% END %]
[%~ USE Koha ~%]
[%~ BLOCK 'display-address-style' ~%]
[%~ IF Koha.Preference( 'AddressFormat' ) ~%]
[%~ PROCESS "member-display-address-style-${ Koha.Preference( 'AddressFormat' ) }" ~%]
[%~ ELSE ~%]
[%~ PROCESS 'member-display-address-style-us' ~%]
[%~ END ~%]
[%~ END ~%]
[% BLOCK 'member-display-address-style-us' %]
[% IF ( patron.address or patron.address2 ) %]
[% IF ( patron.address ) %]
[% SET roadtype_desc = '' %]
[% IF patron.streettype %]
[% SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', patron.streettype) %]
[% END %]
<li class="patronaddress1">[% if (patron.streetnumber) | html %][% patron.streetnumber |html %][% end | html %] [% patron.address | html %] [% IF roadtype_desc %][% roadtype_desc |html %] [% END %][% end | html %]</li>
[% END %]
[% IF ( patron.address2 ) %]
<li class="patronaddress2">[% patron.address2 |html %]</li>
[% END %]
[% END %]
[% IF ( patron.city ) %]
[%~ BLOCK 'member-display-address-style-us' ~%]
[%~ IF ( patron.address or patron.address2 ) ~%]
[%~ IF ( patron.address ) ~%]
[%~ SET roadtype_desc = '' ~%]
[%~ IF patron.streettype ~%]
[%~ SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', patron.streettype) ~%]
[%~ END ~%]
<li class="patronaddress1">[%~ if (patron.streetnumber) | html ~%][%~ patron.streetnumber |html ~%][%~ end | html ~%] [%~ patron.address | html ~%] [%~ IF roadtype_desc ~%][%~ roadtype_desc |html ~%] [%~ END ~%][%~ end | html ~%]</li>
[%~ END ~%]
[%~ IF ( patron.address2 ) ~%]
<li class="patronaddress2">[%~ patron.address2 |html ~%]</li>
[%~ END ~%]
[%~ END ~%]
[%~ IF ( patron.city ) ~%]
<li class="patroncity">
[% patron.city |html %][% IF ( patron.state ) %], [% patron.state |html %][% END %]
[% patron.zipcode |html %][% IF ( patron.country ) %], [% patron.country |html %][% END %]
[%~ patron.city |html ~%][%~ IF ( patron.state ) ~%], [%~ patron.state |html ~%][%~ END ~%]
[%~ patron.zipcode |html ~%][%~ IF ( patron.country ) ~%], [%~ patron.country |html ~%][%~ END ~%]
</li>
[% END %]
[% END %]
[%~ END ~%]
[%~ END ~%]
[% BLOCK 'member-display-address-style-de' %]
[% IF ( patron.address or patron.address2 ) %]
[% IF ( patron.address ) %]
[% SET roadtype_desc = '' %]
[% IF patron.streettype %]
[% SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', patron.streettype) %]
[% END %]
<li class="patronaddress1">[% patron.address | html %][%IF roadtype_desc %] [% roadtype_desc | html %][% END %][% IF patron.streetnumber %] [% patron.streetnumber | html %][% END %]</li>
[% END %]
[% IF ( patron.address2 ) %]
<li class="patronaddress2">[% patron.address2 | html %]</li>
[% END %]
[% END %]
[% IF ( patron.city ) %]
[%~ BLOCK 'member-display-address-style-de' ~%]
[%~ IF ( patron.address or patron.address2 ) ~%]
[%~ IF ( patron.address ) ~%]
[%~ SET roadtype_desc = '' ~%]
[%~ IF patron.streettype ~%]
[%~ SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', patron.streettype) ~%]
[%~ END ~%]
<li class="patronaddress1">[%~ patron.address | html ~%][%~IF roadtype_desc ~%] [%~ roadtype_desc | html ~%][%~ END ~%][%~ IF patron.streetnumber ~%] [%~ patron.streetnumber | html ~%][%~ END ~%]</li>
[%~ END ~%]
[%~ IF ( patron.address2 ) ~%]
<li class="patronaddress2">[%~ patron.address2 | html ~%]</li>
[%~ END ~%]
[%~ END ~%]
[%~ IF ( patron.city ) ~%]
<li class="patroncity">
[% IF ( patron.zipcode ) %][% patron.zipcode | html %] [% END %][% patron.city | html %][% IF ( patron.state ) %]</br>[% patron.state | html %][% END %]
[% IF ( patron.country ) %]<br />[% patron.country | html %][% END %]
[%~ IF ( patron.zipcode ) ~%][%~ patron.zipcode | html ~%] [%~ END ~%][%~ patron.city | html ~%][%~ IF ( patron.state ) ~%]</br>[%~ patron.state | html ~%][%~ END ~%]
[%~ IF ( patron.country ) ~%]<br />[%~ patron.country | html ~%][%~ END ~%]
</li>
[% END %]
[% END %]
[%~ END ~%]
[%~ END ~%]
[% BLOCK 'member-display-address-style-fr' %]
[% IF ( patron.address or patron.address2 ) %]
[% IF ( patron.address ) %]
[% SET roadtype_desc = '' %]
[% IF patron.streettype %]
[% SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', patron.streettype) %]
[% END %]
<li class="patronaddress1">[% IF patron.streetnumber %][% patron.streetnumber | html %] [% END %]
[%IF roadtype_desc %][% roadtype_desc | html %] [% END %]
[% patron.address | html %]
[%~ BLOCK 'member-display-address-style-fr' ~%]
[%~ IF ( patron.address or patron.address2 ) ~%]
[%~ IF ( patron.address ) ~%]
[%~ SET roadtype_desc = '' ~%]
[%~ IF patron.streettype ~%]
[%~ SET roadtype_desc = AuthorisedValues.GetByCode('ROADTYPE', patron.streettype) ~%]
[%~ END ~%]
<li class="patronaddress1">[%~ IF patron.streetnumber ~%][%~ patron.streetnumber | html ~%] [%~ END ~%]
[%~IF roadtype_desc ~%][%~ roadtype_desc | html ~%] [%~ END ~%]
[%~ patron.address | html ~%]
</li>
[% END %]
[% IF ( patron.address2 ) %]
<li class="patronaddress2">[% patron.address2 | html %]</li>
[% END %]
[% END %]
[% IF ( patron.city ) %]
[%~ END ~%]
[%~ IF ( patron.address2 ) ~%]
<li class="patronaddress2">[%~ patron.address2 | html ~%]</li>
[%~ END ~%]
[%~ END ~%]
[%~ IF ( patron.city ) ~%]
<li class="patroncity">
[% IF ( patron.zipcode ) %][% patron.zipcode | html %] [% END %][% patron.city | html %][% IF ( patron.state ) %]</br>[% patron.state | html %][% END %]
[% IF ( patron.country ) %]<br />[% patron.country | html %][% END %]
[%~ IF ( patron.zipcode ) ~%][%~ patron.zipcode | html ~%] [%~ END ~%][%~ patron.city | html ~%][%~ IF ( patron.state ) ~%]</br>[%~ patron.state | html ~%][%~ END ~%]
[%~ IF ( patron.country ) ~%]<br />[%~ patron.country | html ~%][%~ END ~%]
</li>
[% END %]
[% END %]
[%~ END ~%]
[%~ END ~%]

View file

@ -3,6 +3,7 @@
[% USE AuthorisedValues %]
[% USE KohaDates %]
[% USE Price %]
[% PROCESS 'member-display-address-style.inc' %]
{
"sEcho": [% sEcho | html %],
"iTotalRecords": [% iTotalRecords | html %],
@ -17,7 +18,7 @@
"dt_cardnumber":
"[% data.cardnumber | html | $To %]",
"dt_name":
"<a href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | html %]\" class=\"patron_preview\" data-borrowernumber=\"[% data.borrowernumber | html %]\" style='white-space:nowrap'>[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 | $To %]</a><br />[% INCLUDE escape_address data = data %][% IF data.email %]<br/>Email: <a href='mailto:[% data.email | html | $To %]'>[% data.email | html | $To %]</a>[% END %]",
"<a href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | html %]\" class=\"patron_preview\" data-borrowernumber=\"[% data.borrowernumber | html %]\" style='white-space:nowrap'>[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 | $To %]</a><br /><div class='address'><ul>[%~ PROCESS 'display-address-style' patron=data| $To ~%]</ul></div>[% IF data.email %]<br/>Email: <a href='mailto:[% data.email | html | $To %]'>[% data.email | html | $To %]</a>[% END %]",
"dt_dateofbirth":
"[% INCLUDE 'patron-age.inc' patron = data %]",
"dt_category":
@ -40,10 +41,3 @@
[% END %]
]
}
[% BLOCK escape_address %]
[%~ SET address = data.streetnumber _ ' ' %]
[%~ IF data.streettype %][% SET address = address _ AuthorisedValues.GetByCode( 'ROADTYPE', data.streettype ) _ ' ' %][% END %]
[%~ IF data.address %][% SET address = address _ data.address _ ' ' %][% END %]
[%~ IF data.address2 %][% SET address = address _ data.address2 _ ' ' %][% END %]
[%~ address | html | $To ~%]
[% END %]