From 6dce36de850443fd024608d8fe2ae05220363992 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Apr 2020 16:00:13 +0200 Subject: [PATCH] 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 --- .../intranet-tmpl/prog/css/src/staff-global.scss | 14 +++ .../en/includes/member-display-address-style.inc | 128 ++++++++++----------- .../en/modules/members/tables/members_results.tt | 10 +- 3 files changed, 80 insertions(+), 72 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index bf57675f2f..0c8a011c47 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc index 64edea9bc3..eed70063c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc @@ -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 %] -
  • [% if (patron.streetnumber) | html %][% patron.streetnumber |html %][% end | html %] [% patron.address | html %] [% IF roadtype_desc %][% roadtype_desc |html %] [% END %][% end | html %]
  • - [% END %] - [% IF ( patron.address2 ) %] -
  • [% patron.address2 |html %]
  • - [% 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 ~%] +
  • [%~ if (patron.streetnumber) | html ~%][%~ patron.streetnumber |html ~%][%~ end | html ~%] [%~ patron.address | html ~%] [%~ IF roadtype_desc ~%][%~ roadtype_desc |html ~%] [%~ END ~%][%~ end | html ~%]
  • + [%~ END ~%] + [%~ IF ( patron.address2 ) ~%] +
  • [%~ patron.address2 |html ~%]
  • + [%~ END ~%] + [%~ END ~%] + [%~ IF ( patron.city ) ~%]
  • - [% 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 ~%]
  • - [% 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 %] -
  • [% patron.address | html %][%IF roadtype_desc %] [% roadtype_desc | html %][% END %][% IF patron.streetnumber %] [% patron.streetnumber | html %][% END %]
  • - [% END %] - [% IF ( patron.address2 ) %] -
  • [% patron.address2 | html %]
  • - [% 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 ~%] +
  • [%~ patron.address | html ~%][%~IF roadtype_desc ~%] [%~ roadtype_desc | html ~%][%~ END ~%][%~ IF patron.streetnumber ~%] [%~ patron.streetnumber | html ~%][%~ END ~%]
  • + [%~ END ~%] + [%~ IF ( patron.address2 ) ~%] +
  • [%~ patron.address2 | html ~%]
  • + [%~ END ~%] + [%~ END ~%] + [%~ IF ( patron.city ) ~%]
  • - [% IF ( patron.zipcode ) %][% patron.zipcode | html %] [% END %][% patron.city | html %][% IF ( patron.state ) %]
    [% patron.state | html %][% END %] - [% IF ( patron.country ) %]
    [% patron.country | html %][% END %] + [%~ IF ( patron.zipcode ) ~%][%~ patron.zipcode | html ~%] [%~ END ~%][%~ patron.city | html ~%][%~ IF ( patron.state ) ~%]
    [%~ patron.state | html ~%][%~ END ~%] + [%~ IF ( patron.country ) ~%]
    [%~ patron.country | html ~%][%~ END ~%]
  • - [% 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 %] -
  • [% 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 ~%] +
  • [%~ IF patron.streetnumber ~%][%~ patron.streetnumber | html ~%] [%~ END ~%] + [%~IF roadtype_desc ~%][%~ roadtype_desc | html ~%] [%~ END ~%] + [%~ patron.address | html ~%]
  • - [% END %] - [% IF ( patron.address2 ) %] -
  • [% patron.address2 | html %]
  • - [% END %] - [% END %] - [% IF ( patron.city ) %] + [%~ END ~%] + [%~ IF ( patron.address2 ) ~%] +
  • [%~ patron.address2 | html ~%]
  • + [%~ END ~%] + [%~ END ~%] + [%~ IF ( patron.city ) ~%]
  • - [% IF ( patron.zipcode ) %][% patron.zipcode | html %] [% END %][% patron.city | html %][% IF ( patron.state ) %]
    [% patron.state | html %][% END %] - [% IF ( patron.country ) %]
    [% patron.country | html %][% END %] + [%~ IF ( patron.zipcode ) ~%][%~ patron.zipcode | html ~%] [%~ END ~%][%~ patron.city | html ~%][%~ IF ( patron.state ) ~%]
    [%~ patron.state | html ~%][%~ END ~%] + [%~ IF ( patron.country ) ~%]
    [%~ patron.country | html ~%][%~ END ~%]
  • - [% END %] -[% END %] + [%~ END ~%] +[%~ END ~%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt index 6bfeb08b9c..95e8db7fba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt @@ -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": - "[% 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 %]
    [% INCLUDE escape_address data = data %][% IF data.email %]
    Email: [% data.email | html | $To %][% END %]", + "[% 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 %]
      [%~ PROCESS 'display-address-style' patron=data| $To ~%]
    [% IF data.email %]
    Email: [% data.email | html | $To %][% 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 %] -- 2.11.0