Bug 4041 - Address Format as a I18N/L10N system preference
Summary: Address Format as a I18N/L10N system preference
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: PC All
: P5 - low enhancement (vote)
Assignee: Marc Véron
QA Contact: Bugs List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3765 3766 15542 16729 16779
  Show dependency treegraph
 
Reported: 2010-01-13 01:04 UTC by Nicole C. Engard
Modified: 2016-06-20 14:31 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 4041 - First step (staff interface): Extract address blocks to include files (29.66 KB, patch)
2015-02-17 21:42 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.50 KB, patch)
2015-02-18 16:37 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.50 KB, patch)
2015-03-01 17:42 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - First step (staff interface): Extract address blocks to include files (29.69 KB, patch)
2015-03-01 20:05 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.53 KB, patch)
2015-03-01 20:16 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.58 KB, patch)
2015-03-01 21:00 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.58 KB, patch)
2015-03-01 21:07 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.63 KB, patch)
2015-03-01 21:10 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 4041 - Third step - Display address on patron's pages using the system preference (42.29 KB, patch)
2015-03-02 20:53 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Third step - Display address on patron's pages using the system preference (42.35 KB, patch)
2015-03-02 21:16 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (20.73 KB, patch)
2015-03-27 09:07 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Third step - Display address on patron's pages using the system preference (42.42 KB, patch)
2015-03-27 09:17 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (21.04 KB, patch)
2015-04-10 15:34 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 4041 - First step (staff interface): Extract address blocks to include files (29.76 KB, patch)
2015-04-10 17:29 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 4041 - Third step - Display address on patron's pages using the system preference (42.18 KB, patch)
2015-04-10 17:30 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 4041 - Second Step: Add system preference and "German style" address formats for staff (21.11 KB, patch)
2015-04-10 17:30 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 4041 [QA Followup] (37.35 KB, patch)
2015-04-10 17:30 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 4041 [QA Followup] - Change addressformat to AddressFormat (8.24 KB, patch)
2015-04-10 17:30 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 4041 [QA Followup] - Change addressformat to AddressFormat (8.46 KB, patch)
2015-04-20 13:44 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 4041 [QA Followup] - Change addressformat to AddressFormat (8.46 KB, patch)
2015-04-29 03:55 UTC, Marc Véron
Details | Diff | Splinter Review
[Follow-up] Bug 4041 - Explain address format style in system preferences (1.21 KB, patch)
2015-04-29 04:23 UTC, Marc Véron
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:22:28 UTC


---- Reported by nengard@gmail.com 2010-01-13 13:04:56 ----

In America addresses go 'street number' 'street name' 'street type' -- in France it goes 'street number' 'street type' 'street name' -- in Spain it goes 'street type' 'street name' 'street number'.

This is coming across as a display problem on the patron records.  So I'm wondering if there is a way that we can set up the templates to display the address in the way that the librarian chooses.  Right now there are a few bugs related to the fact that the street number and/order street type doesn't even display - when I went to fix them I realize (with Owen's help) that I might be causing some internationalization issues.

There are only 6 ( factorial(3) ) possibilities. A drop-down menu on system preferences? (I18N/L10N?)

This is both a bug and an enhancement request I guess - so I don't know how to categorize it.



---- Additional Comments From oleonard@myacpl.org 2010-01-13 13:26:39 ----

Another format to keep in mind: P.O. Boxes.

PO Box 627




---- Additional Comments From nengard@gmail.com 2010-01-13 13:50:52 ----

I'm thinking in the PO Box instance that Address1 is the only field you'd fill in ... right?



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:22 UTC  ---

This bug was previously known as _bug_ 4041 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=4041

Actual time not defined. Setting to 0.0

Comment 1 Paul Poulain 2012-11-29 16:00:22 UTC
still relevant, and I think it's more an enhancement than a bugfix. Should be easier with T::T plugins !
Comment 2 Katrin Fischer 2014-12-30 09:30:19 UTC
We just ran into this again, giving it a little nudge :)

In Germany I think it would be:

<street name> <street number>
<zipcode> <city>

We don't use <street type> at the moment, I think often the part that would be street type is already part of the street name (-gasse, -straße).

The state is not needed for addresses within Germany.
Comment 3 paxed 2015-01-07 09:03:18 UTC
(In reply to Katrin Fischer from comment #2)
> We just ran into this again, giving it a little nudge :)
> 
> In Germany I think it would be:
> 
> <street name> <street number>
> <zipcode> <city>
> 
> We don't use <street type> at the moment, I think often the part that would
> be street type is already part of the street name (-gasse, -straße).
> 
> The state is not needed for addresses within Germany.

This also applies to Finland.
Comment 4 Marc Véron 2015-01-07 09:35:23 UTC
Same for Switzerland.
Comment 5 Marc Véron 2015-02-17 21:35:56 UTC
A possible solution could be to have the address blocks in different include files and to have a preference to choose them as appropriate.

I will attach a patch for the staff interface (memberentry.pl) that could be a starting point for this idea. It simply extracts the address blocks to 3 includes (see patch that follows). The behaviour while adding / editing a patron will be the same as before.

As a next step, different includes could be added for the different country styles, along with the functionality to select them using the syspref.

What do others think of this idea?
Comment 6 Marc Véron 2015-02-17 21:42:08 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2015-02-18 16:37:27 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2015-03-01 17:42:16 UTC Comment hidden (obsolete)
Comment 9 Marc Véron 2015-03-01 17:58:23 UTC
Updated to make patch "Second Step" apply.
Comment 10 Mirko Tietgen 2015-03-01 20:05:40 UTC Comment hidden (obsolete)
Comment 11 Mirko Tietgen 2015-03-01 20:16:43 UTC Comment hidden (obsolete)
Comment 12 Mirko Tietgen 2015-03-01 20:18:38 UTC
Works for me. Not sure about the naming of the styles, maybe something more generic would be possible.

»German style« should also move the street number for Main address.
Comment 13 Marc Véron 2015-03-01 21:00:53 UTC Comment hidden (obsolete)
Comment 14 Marc Véron 2015-03-01 21:03:06 UTC
I think my amendement on Patch "Second step" needs a new Sign-off.
Comment 15 Marc Véron 2015-03-01 21:07:18 UTC Comment hidden (obsolete)
Comment 16 Mirko Tietgen 2015-03-01 21:10:12 UTC Comment hidden (obsolete)
Comment 17 Marc Véron 2015-03-02 20:53:20 UTC Comment hidden (obsolete)
Comment 18 Mirko Tietgen 2015-03-02 21:16:28 UTC Comment hidden (obsolete)
Comment 19 Jonathan Druart 2015-03-10 15:36:44 UTC
Now "street type" is after the address.

I would like to see a letter or a syspref to address this problem.
We could imagine something like:

  [streettype] [address]
  [city]
  [phone]

and in the template:

  [% FOR field in fields %]
    [% SWITCH field %]
      [% CASE 'streettype' %]Street type: [% streettype %]
      [% CASE 'address' %]Address: [% address %]
      ...
    [% END %]
  [% END %]

We would avoid code duplication and it will be more customizable.
Comment 20 Marc Véron 2015-03-10 17:00:24 UTC
(In reply to Jonathan Druart from comment #19)

In Germany and Switzerland, Street type is not used as a separate part, and it always would be after the name, often it is contained in the name.

We would write:
Baslerstrasse 50
for
50, rue de Bâle

And we would not make use of the street type (because it is often a part of the street name as Katrin pointed out above).

Drojf pointed out 
www.isotc211.org/address/iso19160.htm 
with a link to:
www.isotc211.org/address/docs/211n3188_Review_Summary_19160_Addressing.pdf

Very interesting, e.g.:
"The correct order of elements for a French address will not necessarily be correct for a US address, and vice versa. Moreover, many Asian address systems use the opposite order of address elements than European ones (...)".

It is almost impossible to cover all of the worldwide variations in a simple way. That's why I choose this approach. A new address format can easily be added (add new choice in preference and copy/edit includes with same postfix. Fallback is always US style). 

First I was thinking about kind of "configurator" like for "Notices and Slips" but it turned out to be a huge and complicated task (handling not only the display /output of addresses, but the field order for editing them as well including mandatory fields).
Comment 21 Marc Véron 2015-03-27 09:07:20 UTC Comment hidden (obsolete)
Comment 22 Marc Véron 2015-03-27 09:17:46 UTC Comment hidden (obsolete)
Comment 23 Marc Véron 2015-04-10 15:34:09 UTC Comment hidden (obsolete)
Comment 24 Kyle M Hall 2015-04-10 17:29:48 UTC
Created attachment 37667 [details] [review]
[PASSED QA] Bug 4041 - First step (staff interface): Extract address blocks to include files

This patch extracts the address blocks in memberentrygen.tt to include files.

To test: The overall functionality should remain the same with this patch.

In further steps, more country- or region-dependent includes could be added, along with functionality to select them using a system preference.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 25 Kyle M Hall 2015-04-10 17:30:07 UTC
Created attachment 37668 [details] [review]
[PASSED QA] Bug 4041 - Third step - Display address on patron's pages using the system preference

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>
Comment 26 Kyle M Hall 2015-04-10 17:30:17 UTC
Created attachment 37669 [details] [review]
[PASSED QA] Bug 4041 - Second Step: Add system preference and "German style" address formats for staff

To test:

Apply patch
Do a database update (e.g. by changing version number in kohaversion.pl)
Find new system preference 'addressformat' in I18N/L10N
Choose 'German style'
Go to Patrons and edit a patron / create new patron
Verify that Zip code appears above City
Change system preference to 'US style'
Verify that Zip code appears between State and Country.

BTW: New formats can be added by editing i18n_l10n.pref (add a new code, e.g. fr for "French style") and copy / modify the includes using the same code as postfix.
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Patch amended to move street number after address. /Marc

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Amended do resolve conflict with updatedatabase.pl  /Marc
Rebased for current master /Marc

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 27 Kyle M Hall 2015-04-10 17:30:27 UTC Comment hidden (obsolete)
Comment 28 Kyle M Hall 2015-04-10 17:30:35 UTC Comment hidden (obsolete)
Comment 29 Marc Véron 2015-04-20 13:44:43 UTC Comment hidden (obsolete)
Comment 30 Tomás Cohen Arazi 2015-04-28 18:42:26 UTC
Guys, could you please change it so a user who is not used to the "us format" or the "german format" can know what the syspref actually does?

I'll make it explicit just in case:

Please provide a followup (SYSPREF DESCRIPTION ONLY) so it says something like:

US format (Street Nº - City - ...)
German format (...)

Thanks, looking forward to integrate this one ASAP. Also, there's one patch (the last two) that needs to be deprecated.
Comment 31 Marc Véron 2015-04-29 03:55:08 UTC
Created attachment 38623 [details] [review]
[PASSED QA] Bug 4041 [QA Followup] - Change addressformat to AddressFormat

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

----
Amended to resolve conflict in sysprefs.sql / mveron
Comment 32 Marc Véron 2015-04-29 03:58:08 UTC
Comment on attachment 37670 [details] [review]
[PASSED QA] Bug 4041 [QA Followup]

Replaced by amended version to make it apply
Comment 33 Marc Véron 2015-04-29 04:23:57 UTC
Created attachment 38625 [details] [review]
[Follow-up] Bug 4041 - Explain address format style in system preferences

See comment #30 by Tomás Cohen Arazi
Comment 34 Tomás Cohen Arazi 2015-04-29 15:17:29 UTC
Enhancement pushed to master.

Thanks Marc!