Bug 27830: OPAC library list does not use AddressFormat

This patch adds a new include file for displaying library addresses
according to the AddressFormat system preference. It differs from the
include file used for patrons in the staff interface because library
addresses don't use streetnumber or road types.

To test, apply the patch and rebuild the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Make sure you have fill address information entered for at least one
  library.
- In the OPAC, view the "Libraries" page.
- Check that the format of the library addresses is correct when using
  any of the three address formats: de, fr, and us.

Signed-off-by: David Nind <david@davidnind.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1e309c628)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2021-03-04 13:57:32 +00:00 committed by Fridolin Somers
parent b4ccde1133
commit 4ea78c4e06
3 changed files with 130 additions and 33 deletions

View File

@ -2618,4 +2618,8 @@ $star-selected: #EDB867;
}
}
.branchaddress {
margin-bottom: 1rem;
}
@import "responsive";

View File

@ -0,0 +1,114 @@
[%~ USE Koha ~%]
[%~ USE raw ~%]
[%~ BLOCK 'display-library-address' ~%]
[%~ SET line_break = "<br/>" ~%]
[%~ IF no_line_break %][% SET line_break = " " %][% END ~%]
[%~ IF Koha.Preference( 'AddressFormat' ) ~%]
[%~ PROCESS "display-library-address-${ Koha.Preference( 'AddressFormat' ) }" ~%]
[%~ ELSE ~%]
[%~ PROCESS 'display-library-address-us' ~%]
[%~ END ~%]
[%~ END ~%]
[%~ BLOCK 'display-library-address-us' ~%]
[%~ IF ( library.branchaddress1 or library.branchaddress2 ) ~%]
<span property="streetAddress">
[%~ IF ( library.branchaddress1 ) ~%]
<div class="branchaddress1">
[% library.branchaddress1 | html %]
</div>
[%~ END ~%]
[%~ IF ( library.branchaddress2 ) ~%]
<div class="branchaddress2">
[%~ library.branchaddress2 |html ~%]
</div>
[%~ END ~%]
[%~ IF ( library.branchaddress3 ) ~%]
<span class="branchaddress3">
[%~ library.branchaddress3 | html ~%]
</span>
[% line_break | $raw %]
[%~ END ~%]
</span>
[%~ END ~%]
[%~ IF ( library.branchcity ) ~%]
<div class="branchcity">
<span property="addressLocality">
[%~ library.branchcity |html ~%]
</span>
[%~ IF ( library.branchstate ) %]
<span property="addressRegion">
, [% library.branchstate |html ~%]
</span>
[%~ END ~%]
[%~ IF ( library.branchzip ) %]
<span property="postalCode">
[%~ " " _ library.branchzip |html ~%]
</span>
[%~ END ~%]
[%~ IF ( library.branchcountry ) %]
<div property="addressCountry">
[% library.branchcountry |html ~%]
</div>
[%~ END ~%]
</div>
[%~ END ~%]
[%~ END ~%]
[%~ BLOCK 'display-library-address-de' ~%]
[%~ IF ( library.branchaddress1 or library.branchaddress2 ) ~%]
<span property="streetAddress">
[%~ IF ( library.branchaddress1 ) ~%]
<div class="branchaddress1">
[%~ library.branchaddress1 | html ~%]
</div>
[%~ END ~%]
[%~ IF ( library.branchaddress2 ) ~%]
<div class="branchaddress2">
[%~ library.branchaddress2 | html ~%]
</div>
[%~ END ~%]
[%~ IF ( library.branchaddress3 ) ~%]
<span class="branchaddress3">
[%~ library.branchaddress3 | html ~%]
</span>
[% line_break | $raw %]
[%~ END ~%]
</span>
[%~ END ~%]
[%~ IF ( library.branchcity ) ~%]
<div class="branchcity">
[%~ IF ( library.branchzip ) ~%]<span property="postalCode">[%~ library.branchzip | html %]</span> [% END ~%]<span property="addressLocality">[%~ library.branchcity | html ~%]</span>[%~ IF ( library.branchstate ) ~%][% line_break | $raw %][%~ library.branchstate | html ~%][%~ END ~%]
[%~ IF ( library.branchcountry ) ~%][% line_break | $raw %][%~ library.branchcountry | html ~%][%~ END ~%]
</div>
[%~ END ~%]
[%~ END ~%]
[%~ BLOCK 'display-library-address-fr' ~%]
[%~ IF ( library.branchaddress1 or library.branchaddress2 ) ~%]
[%~ IF ( library.branchaddress1 ) ~%]
<span class="branchaddress1">
[%~ library.branchaddress1 | html ~%]
</span>
[% line_break | $raw %]
[%~ END ~%]
[%~ IF ( library.branchaddress2 ) ~%]
<span class="branchaddress2">
[%~ library.branchaddress2 | html ~%]
</span>
[% line_break | $raw %]
[%~ END ~%]
[%~ IF ( library.branchaddress3 ) ~%]
<span class="branchaddress3">
[%~ library.branchaddress3 | html ~%]
</span>
[% line_break | $raw %]
[%~ END ~%]
[%~ END ~%]
[%~ IF ( library.branchcity ) ~%]
<span class="branchcity">
[%~ IF ( library.branchzip ) ~%][%~ library.branchzip | html %] [% END ~%][%~ library.branchcity | html ~%][%~ IF ( library.branchstate ) ~%][% line_break | $raw %]<span property="addressRegion">[%~ library.branchstate | html ~%]</span>[%~ END ~%]
[%~ IF ( library.branchcountry ) ~%][% line_break | $raw %]<span property="addressCountry">[%~ library.branchcountry | html ~%]</span>[%~ END ~%]
</span>
[%~ END ~%]
[%~ END ~%]

View File

@ -1,6 +1,7 @@
[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% PROCESS 'display-library-address.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
[% IF ( LibraryNameTitle ) %]
@ -26,40 +27,18 @@
[% END %]
[% BLOCK library_info %]
<div property="address" typeof="PostalAddress">
<span property="streetAddress">
[% IF ( library.branchaddress1 ) %]
[% library.branchaddress1 | html %]
[% END %]
[% IF ( library.branchaddress2 ) %]
<br />[% library.branchaddress2 | html %]
[% END %]
[% IF ( library.branchaddress3 ) %]
<br />[% library.branchaddress3 | html %]
[% END %]
</span><br>
[% IF ( library.branchcity ) %]
<span property="addressLocality">[% library.branchcity | html %]</span>
[% END %]
[% IF ( library.branchstate ) %]
<span property="addressRegion">[% library.branchstate | html %]</span>
[% END %]
[% IF ( library.branchzip ) %]
<span property="postalCode">[% library.branchzip | html %]</span>
[% END %]
[% IF ( library.branchcountry ) %]
<br /><span property="addressCountry">[% library.branchcountry | html %]</span>
[% END %]
[% IF ( library.branchphone ) %]
<p>Phone: <a href="tel:[% library.branchphone | url %]" property="telephone">[% library.branchphone | html %]</a></p>
[% END %]
[% IF ( library.branchfax ) %]
<p>Fax: <span property="faxNumber">[% library.branchfax | html %]</span></p>
[% END %]
[% IF ( library.branchurl ) %]
<p><a href="[% library.branchurl | url %]" property="url">[% library.branchurl | html %]</a></p>
[% END %]
<div class="branchaddress" property="address" typeof="PostalAddress">
[% PROCESS 'display-library-address' %]
</div> <!-- /div property=address -->
[% IF ( library.branchphone ) %]
<p>Phone: <a href="tel:[% library.branchphone | url %]" property="telephone">[% library.branchphone | html %]</a></p>
[% END %]
[% IF ( library.branchfax ) %]
<p>Fax: <span property="faxNumber">[% library.branchfax | html %]</span></p>
[% END %]
[% IF ( library.branchurl ) %]
<p><a href="[% library.branchurl | url %]" property="url">[% library.branchurl | html %]</a></p>
[% END %]
[% END %]
<div class="main">