From 462d4c0b9a54385cdb4be96c7ab70bf494ec3c7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Wed, 18 Feb 2015 17:23:57 +0100 Subject: [PATCH] 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 Patch amended to move street number after address. /Marc Signed-off-by: Mirko Tietgen Amended do resolve conflict with updatedatabase.pl /Marc Rebased for current master /Marc Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/sysprefs.sql | 3 +- installer/data/mysql/updatedatabase.pl | 8 ++ .../includes/member-alt-address-style-de.inc | 111 ++++++++++++++++ .../includes/member-alt-contact-style-de.inc | 112 ++++++++++++++++ .../includes/member-main-address-style-de.inc | 124 ++++++++++++++++++ .../modules/admin/preferences/i18n_l10n.pref | 7 + .../prog/en/modules/members/memberentrygen.tt | 18 ++- 7 files changed, 379 insertions(+), 4 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-de.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f3b0847088..c026f42ba3 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -475,5 +475,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'), ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), -('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), +('addressformat','us','','Choose format to display postal addresses', 'Choice') ; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 5d1b7780e8..8a24c8217f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9980,6 +9980,14 @@ if ( CheckVersion($DBversion) ) { print "Upgrade to $DBversion done (Bug 9580: Cover image from Coce, a remote image URL cache)\n"; SetVersion($DBversion); } +$DBversion = "XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q| + INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('addressformat','us','Choose format to display postal addresses',NULL,'Choice') + |); + print "Upgrade to $DBversion done (Bug 4041: Address Format as a I18N/L10N system preference\n"; + SetVersion ($DBversion); +} $DBversion = "3.19.00.020"; if ( CheckVersion($DBversion) ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc new file mode 100644 index 0000000000..0f526ee5d3 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc @@ -0,0 +1,111 @@ +
+ Alternate address
    + [% UNLESS noB_address %] +
  1. + [% IF ( mandatoryB_address ) %] +
  2. + [% END %] + [% UNLESS noB_address2 %] +
  3. + [% IF ( mandatoryB_address2 ) %] +
  4. + [% END %] + [% UNLESS noB_zipcode %] +
  5. + [% IF ( mandatoryB_zipcode ) %] +
  6. + [% END %] + [% UNLESS noB_city %] +
  7. + [% IF ( mandatoryB_city ) %] +
  8. + [% END %] + [% UNLESS noB_state %] +
  9. + [% IF ( mandatoryB_state ) %] +
  10. + [% END %] + [% UNLESS noB_country %] +
  11. + [% IF ( mandatoryB_country ) %] +
  12. + [% END %] + [% UNLESS noB_phone %] +
  13. + [% IF ( mandatoryB_phone ) %] +
  14. + [% END %] + [% UNLESS noB_email %] +
  15. + [% IF ( mandatoryB_email ) %] +
  16. + [% END %] + [% UNLESS nocontactnote %] +
  17. + [% IF ( mandatorycontactnote ) %] +
  18. + [% END %] +
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-de.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-de.inc new file mode 100644 index 0000000000..2f47ce7fbf --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-de.inc @@ -0,0 +1,112 @@ +
+ Alternate contact
    + [% UNLESS noaltcontactsurname %] +
  1. + [% IF ( mandatoryaltcontactsurname ) %] +
  2. + [% END %] + [% UNLESS noaltcontactfirstname %] +
  3. + [% IF ( mandatoryaltcontactfirstname ) %] +
  4. + [% END %] + [% UNLESS noaltcontactaddress1 %] +
  5. + [% IF ( mandatoryaltcontactaddress1 ) %] +
  6. + [% END %] + [% UNLESS noaltcontactaddress2 %] +
  7. + [% IF ( mandatoryaltcontactaddress2 ) %] +
  8. + [% END %] + [% UNLESS noaltcontactzipcode %] +
  9. + [% IF ( mandatoryaltcontactzipcode ) %] +
  10. + [% END %] + [% UNLESS noaltcontactaddress3 %] +
  11. + [% IF ( mandatoryaltcontactaddress3 ) %] +
  12. + [% END %] + [% UNLESS noaltcontactstate %] +
  13. + [% IF ( mandatoryaltcontactstate ) %] +
  14. + [% END %] + [% UNLESS noaltcontactcountry %] +
  15. + [% IF ( mandatoryaltcontactcountry ) %] +
  16. + [% END %] + [% UNLESS noaltcontactphone %] +
  17. + [% IF ( mandatoryaltcontactphone ) %] +
  18. + [% END %] +
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc new file mode 100644 index 0000000000..254e2b99a6 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc @@ -0,0 +1,124 @@ +
+ Main address
    +[% UNLESS nostreettype %] + [% IF roadtypes %] +
  1. + [% IF ( mandatorystreettype ) %] +
  2. + [% END %] + [% END %] + [% UNLESS noaddress %] +
  3. + [% IF ( mandatoryaddress ) %] +
  4. + [% END %] + [% UNLESS nostreetnumber %] +
  5. + [% IF ( mandatorystreetnumber ) %] +
  6. + [% END %] + [% UNLESS noaddress2 %] +
  7. + [% IF ( mandatoryaddress2 ) %] +
  8. + [% END %] + [% UNLESS nozipcode %] +
  9. + [% IF ( mandatoryzipcode ) %] +
  10. + [% END %] + [% UNLESS nocity %] +
  11. + [% IF ( mandatorycity ) %] +
  12. + [% END %] + [% UNLESS nostate %] +
  13. + [% IF ( mandatorystate ) %] +
  14. + [% END %] + [% UNLESS nocountry %] +
  15. + [% IF ( mandatorycountry ) %] +
  16. + [% END %] +
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref index 32ef8f620a..67ebdcac24 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref @@ -45,3 +45,10 @@ I18N/L10N: class: long - "for lists of browsable letters. This should be a space separated list of uppercase letters." - "
Hint: Changing collation in the database for the 'surname' column of the 'borrowers' table is helpful to make browsing by last name work in members-home.pl when using an alphabet outside of A-Z" + - + - Format postal addresses using + - pref: addressformat + default: us + choices: + us: US style + de: German style diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 3b19b68036..edc90af9bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -470,7 +470,11 @@ [% END %] [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %] -[% INCLUDE 'member-main-address-style-us.inc' %] + [% IF Koha.Preference( 'addressformat' ) %] + [% INCLUDE "member-main-address-style-${ Koha.Preference( 'addressformat' ) }.inc" %] + [% ELSE %] + [% INCLUDE 'member-main-address-style-us.inc' %] + [% END %] [% END # nostreet && nocity etc group%] [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %] @@ -559,12 +563,20 @@ [% IF ( step_6 ) %] [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %] -[% INCLUDE 'member-alt-address-style-us.inc' %] + [% IF Koha.Preference( 'addressformat' ) %] + [% INCLUDE "member-alt-address-style-${ Koha.Preference( 'addressformat' ) }.inc" %] + [% ELSE %] + [% INCLUDE 'member-alt-address-style-us.inc' %] + [% END %] [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %] [% END %] [% IF ( step_2 ) %] [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %] -[% INCLUDE 'member-alt-contact-style-us.inc' %] + [% IF Koha.Preference( 'addressformat' ) %] + [% INCLUDE "member-alt-contact-style-${ Koha.Preference( 'addressformat' ) }.inc" %] + [% ELSE %] + [% INCLUDE 'member-alt-contact-style-us.inc' %] + [% END %] [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %] [% END %] -- 2.39.5