Bug 21794: Fix display of addresses on details tab in staff when city is empty

If the city field was not filled out on the main or alternate address,
the content of state, country and zipcode wouldn't display on the
Details tab in the patron account in staff.

To test:
- Enter main contact and alternate address without city
- Verify that the address information isn't shown on the details
  tab after saving
- Apply patch
- Verify that the information is displayed now
- Toggle AddressFormat and check display is correct for all settings
- Switch back to US address format
- Try several combinations of empty fields for city, zipcode, country
  and state. The punctuation and whitespace should always appear
  correctly.

Examples:
- Enter just country
- Enter zipcode and country
- ...

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Katrin Fischer 2021-08-24 00:34:13 +02:00 committed by Jonathan Druart
parent 90d6d1b4a7
commit ea9b9ba090
2 changed files with 10 additions and 10 deletions

View file

@ -23,10 +23,10 @@
<li class="patronaddress2">[%~ patron.address2 |html ~%]</li>
[%~ END ~%]
[%~ END ~%]
[%~ IF ( patron.city ) ~%]
[%~ IF ( patron.city || patron.zipcode || patron.state || patron.country ) ~%]
<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 ) %][%~ IF ( patron.city ) ~%], [% END ~%][% patron.state |html ~%][%~ END ~%]
[%~ IF ( patron.zipcode ) %][%~ " " _ patron.zipcode |html ~%][% END %][%~ IF ( patron.country ) %][%~ IF ( patron.zipcode || patron.state ) ~%], [% END ~%][% patron.country |html ~%][%~ END ~%]
</li>
[%~ END ~%]
[%~ END ~%]
@ -44,7 +44,7 @@
<li class="patronaddress2">[%~ patron.address2 | html ~%]</li>
[%~ END ~%]
[%~ END ~%]
[%~ IF ( patron.city ) ~%]
[%~ IF ( patron.city || patron.zipcode || patron.state || patron.country ) ~%]
<li class="patroncity">
[%~ IF ( patron.zipcode ) ~%][%~ patron.zipcode | html %] [% END ~%][%~ patron.city | html ~%][%~ IF ( patron.state ) ~%][% line_break | $raw %][%~ patron.state | html ~%][%~ END ~%]
[%~ IF ( patron.country ) ~%][% line_break | $raw %][%~ patron.country | html ~%][%~ END ~%]
@ -68,7 +68,7 @@
<li class="patronaddress2">[%~ patron.address2 | html ~%]</li>
[%~ END ~%]
[%~ END ~%]
[%~ IF ( patron.city ) ~%]
[%~ IF ( patron.city || patron.zipcode || patron.state || patron.country ) ~%]
<li class="patroncity">
[%~ IF ( patron.zipcode ) ~%][%~ patron.zipcode | html %] [% END ~%][%~ patron.city | html ~%][%~ IF ( patron.state ) ~%][% line_break | $raw %][%~ patron.state | html ~%][%~ END ~%]
[%~ IF ( patron.country ) ~%][% line_break | $raw %][%~ patron.country | html ~%][%~ END ~%]

View file

@ -20,10 +20,10 @@
<li class="patronaddress2">[% patron.B_address2 | html %]</li>
[% END %]
[% END %]
[% IF ( patron.B_city ) %]
[% IF ( patron.B_city || patron.B_state || patron.B_country || patron.B_zipcode ) %]
<li class="patroncity">
[% patron.B_city | html %][% IF ( patron.B_state ) %], [% patron.B_state | html %][% END %]
[% patron.B_zipcode | html %][% IF ( patron.B_country ) %], [% patron.B_country | html %][% END %]
[% patron.B_city | html %][% IF ( patron.B_state ) %][% IF ( patron.B_city ) %], [% END %][%~ patron.B_state | html ~%][%~ END ~%]
[% IF ( patron.B_zipcode ) %][%~ " " _ patron.B_zipcode |html ~%][% END %][% IF ( patron.B_country ) %][% IF ( patron.B_zipcode || patron.B_state ) %], [% END %][% patron.B_country | html %][% END %]
</li>
[% END %]
[% END %]
@ -41,7 +41,7 @@
<li class="patronaddress2">[% patron.B_address2 | html %]</li>
[% END %]
[% END %]
[% IF ( patron.B_city ) %]
[% IF ( patron.B_city || patron.B_state || patron.B_country || patron.B_zipcode ) %]
<li class="patroncity">
[%IF ( patron.B_zipcode ) %][% patron.B_zipcode | html %] [% END %][% patron.B_city | html %][% IF ( patron.B_state ) %]</br>[% patron.B_state | html %][% END %]
[% IF ( patron.B_country ) %]<br />[% patron.B_country | html %][% END %]
@ -65,7 +65,7 @@
<li class="patronaddress2">[% patron.B_address2 | html %]</li>
[% END %]
[% END %]
[% IF ( patron.B_city ) %]
[% IF ( patron.B_city || patron.B_state || patron.B_country || patron.B_zipcode ) %]
<li class="patroncity">
[%IF ( patron.B_zipcode ) %][% patron.B_zipcode | html %] [% END %]
[% patron.B_city | html %]