From 60411e003b7b23c0d1bd1a6a3213aadffc2022cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?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 --- installer/data/mysql/sysprefs.sql | 3 +- installer/data/mysql/updatedatabase.pl | 9 ++ .../en/includes/member-alt-address-style-de.inc | 111 ++++++++++++++++++ .../en/includes/member-alt-contact-style-de.inc | 112 ++++++++++++++++++ .../en/includes/member-main-address-style-de.inc | 124 ++++++++++++++++++++ .../en/modules/admin/preferences/i18n_l10n.pref | 7 ++ .../prog/en/modules/members/memberentrygen.tt | 18 ++- 7 files changed, 380 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 9020b4b..80738c3 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -473,5 +473,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 0ed56c6..824b456 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9793,6 +9793,15 @@ if(CheckVersion($DBversion)) { 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); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 0000000..0f526ee --- /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 0000000..2f47ce7 --- /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 0000000..254e2b9 --- /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 dde2f09..9e49423 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 @@ -44,3 +44,10 @@ I18N/L10N: - pref: alphabet class: long - for lists of browsable letters. This should be a space separated list of uppercase letters. + - + - 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 2c41a5c..c412ca5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -433,7 +433,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 %] @@ -522,12 +526,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 %] -- 1.7.10.4