From a4c49bb42d725f64cb49bc217f220d1f032b69d4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Apr 2020 13:53:17 +0200 Subject: [PATCH] Bug 25070: Centralize member-alt-address-style There are 5 includes files per value of AddressFormat (us, de, fr). The code is duplicated for each language, the only thing that changes is the order. Wwith this patchset we are going to refactore them to avoid further regressions. The idea is to remove all code that is duplicated and remove the need of having 5*3 files. We are going to limit them to 5 files, 1 per use. Note that we could go even further, for instance member-display-alt-address-style and member-display-address-style are quite identical. Test plan (for the whole patchset): - Create a patron with all the address, contact and alternate info filled - Edit them and save - Look at the patron's info (top left) in the patron module, and the patron detail view. - Play with the different values of AddressFormat The order and the info must be displayed identically before and after this patchset. No change is expected. --- .../includes/member-alt-address-style-de.inc | 162 ------------ .../includes/member-alt-address-style-fr.inc | 162 ------------ .../includes/member-alt-address-style-us.inc | 160 ------------ .../en/includes/member-alt-address-style.inc | 244 ++++++++++++++++++ .../prog/en/modules/members/memberentrygen.tt | 7 +- 5 files changed, 246 insertions(+), 489 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-fr.inc delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style.inc 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 deleted file mode 100644 index 82532998ab..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc +++ /dev/null @@ -1,162 +0,0 @@ -
- Alternate address
    - - [% IF roadtypes %] -
  1. - [% IF ( mandatoryB_streettype ) %] -
  2. - [% END %] - - [% UNLESS noB_address %] -
  3. - [% IF ( mandatoryB_address ) %] -
  4. - [% END %] - - [% UNLESS noB_streetnumber %] -
  5. - [% IF ( mandatoryB_streetnumber ) %] -
  6. - [% END %] - - [% UNLESS noB_address2 %] -
  7. - [% IF ( mandatoryB_address2 ) %] -
  8. - [% END %] - [% UNLESS noB_zipcode %] -
  9. - [% IF ( mandatoryB_zipcode ) %] -
  10. - [% END %] - [% UNLESS noB_city %] -
  11. - [% IF ( mandatoryB_city ) %] -
  12. - [% END %] - [% UNLESS noB_state %] -
  13. - [% IF ( mandatoryB_state ) %] -
  14. - [% END %] - [% UNLESS noB_country %] -
  15. - [% IF ( mandatoryB_country ) %] -
  16. - [% END %] - [% UNLESS noB_phone %] -
  17. - [% IF ( mandatoryB_phone ) %] -
  18. - [% END %] - [% UNLESS noB_email %] -
  19. - [% IF ( mandatoryB_email ) %] -
  20. - [% END %] - [% UNLESS nocontactnote %] -
  21. - [% IF ( mandatorycontactnote ) %] -
  22. - [% END %] -
-
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-fr.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-fr.inc deleted file mode 100644 index 6f376e4771..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-fr.inc +++ /dev/null @@ -1,162 +0,0 @@ -
-Alternate address
    - -[% UNLESS noB_streetnumber %] -
  1. - [% IF ( mandatoryB_streetnumber ) %] -
  2. -[% END %] - -[% IF roadtypes %] -
  3. - [% IF ( mandatoryB_streettype ) %] -
  4. -[% END %] - -[% UNLESS noB_address %] -
  5. - [% IF ( mandatoryB_address ) %] -
  6. -[% END %] - -[% UNLESS noB_address2 %] -
  7. - [% IF ( mandatoryB_address2 ) %] -
  8. -[% END %] -[% UNLESS noB_zipcode %] -
  9. - [% IF ( mandatoryB_zipcode ) %] -
  10. -[% END %] -[% UNLESS noB_city %] -
  11. - [% IF ( mandatoryB_city ) %] -
  12. -[% END %] -[% UNLESS noB_state %] -
  13. - [% IF ( mandatoryB_state ) %] -
  14. -[% END %] -[% UNLESS noB_country %] -
  15. - [% IF ( mandatoryB_country ) %] -
  16. -[% END %] -[% UNLESS noB_phone %] -
  17. - [% IF ( mandatoryB_phone ) %] -
  18. -[% END %] -[% UNLESS noB_email %] -
  19. - [% IF ( mandatoryB_email ) %] -
  20. -[% END %] -[% UNLESS nocontactnote %] -
  21. - [% IF ( mandatorycontactnote ) %] -
  22. - [% END %] -
-
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc deleted file mode 100644 index ec3d6e274c..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc +++ /dev/null @@ -1,160 +0,0 @@ -
- Alternate address
    - [% UNLESS noB_streetnumber %] -
  1. - [% IF ( mandatoryB_streetnumber ) %] -
  2. - [% END %] - - [% IF roadtypes %] -
  3. - [% IF ( mandatoryB_streettype ) %] -
  4. - [% END %] - - [% UNLESS noB_address %] -
  5. - [% IF ( mandatoryB_address ) %] -
  6. - [% END %] - [% UNLESS noB_address2 %] -
  7. - [% IF ( mandatoryB_address2 ) %] -
  8. - [% END %] - [% UNLESS noB_city %] -
  9. - [% IF ( mandatoryB_city ) %] -
  10. - [% END %] - [% UNLESS noB_state %] -
  11. - [% IF ( mandatoryB_state ) %] -
  12. - [% END %] - [% UNLESS noB_zipcode %] -
  13. - [% IF ( mandatoryB_zipcode ) %] -
  14. - [% END %] - [% UNLESS noB_country %] -
  15. - [% IF ( mandatoryB_country ) %] -
  16. - [% END %] - [% UNLESS noB_phone %] -
  17. - [% IF ( mandatoryB_phone ) %] -
  18. - [% END %] - [% UNLESS noB_email %] -
  19. - [% IF ( mandatoryB_email ) %] -
  20. - [% END %] - [% UNLESS nocontactnote %] -
  21. - [% IF ( mandatorycontactnote ) %] -
  22. - [% END %] -
-
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style.inc new file mode 100644 index 0000000000..d50c8a8de3 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style.inc @@ -0,0 +1,244 @@ +[% USE Koha %] +[% BLOCK 'alt-address-style' %] +
+ Alternate address +
    + [% IF Koha.Preference( 'AddressFormat' ) %] + [% PROCESS "member-alt-address-style-${ Koha.Preference( 'AddressFormat' ) }" %] + [% ELSE %] + [% PROCESS 'member-alt-address-style-us' %] + [% END %] +
+
+[% END %] + +[% BLOCK 'member-alt-address-style-us' %] + [% PROCESS 'alt-address-style_B_streetnumber' %] + [% PROCESS 'alt-address-style_roadtypes' %] + [% PROCESS 'alt-address-style_B_address' %] + [% PROCESS 'alt-address-style_B_address2' %] + [% PROCESS 'alt-address-style_B_city' %] + [% PROCESS 'alt-address-style_B_state' %] + [% PROCESS 'alt-address-style_B_zipcode' %] + [% PROCESS 'alt-address-style_B_country' %] + [% PROCESS 'alt-address-style_B_phone' %] + [% PROCESS 'alt-address-style_B_email' %] + [% PROCESS 'alt-address-style_B_contactnote' %] +[% END %] + +[% BLOCK 'member-alt-address-style-de' %] + [% PROCESS 'alt-address-style_roadtypes' %] + [% PROCESS 'alt-address-style_B_address' %] + [% PROCESS 'alt-address-style_B_streetnumber' %] + [% PROCESS 'alt-address-style_B_address2' %] + [% PROCESS 'alt-address-style_B_zipcode' %] + [% PROCESS 'alt-address-style_B_city' %] + [% PROCESS 'alt-address-style_B_state' %] + [% PROCESS 'alt-address-style_B_country' %] + [% PROCESS 'alt-address-style_B_phone' %] + [% PROCESS 'alt-address-style_B_email' %] + [% PROCESS 'alt-address-style_B_contactnote' %] +[% END %] + +[% BLOCK 'member-alt-address-style-fr' %] + [% PROCESS 'alt-address-style_B_streetnumber' %] + [% PROCESS 'alt-address-style_roadtypes' %] + [% PROCESS 'alt-address-style_B_address' %] + [% PROCESS 'alt-address-style_B_address2' %] + [% PROCESS 'alt-address-style_B_zipcode' %] + [% PROCESS 'alt-address-style_B_city' %] + [% PROCESS 'alt-address-style_B_state' %] + [% PROCESS 'alt-address-style_B_country' %] + [% PROCESS 'alt-address-style_B_phone' %] + [% PROCESS 'alt-address-style_B_email' %] + [% PROCESS 'alt-address-style_B_contactnote' %] +[% END %] + +[% BLOCK 'alt-address-style_roadtypes' %] + [% IF roadtypes %] +
  • + [% IF ( mandatoryB_streettype ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_address' %] + [% UNLESS noB_address %] +
  • + [% IF ( mandatoryB_address ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_streetnumber' %] + [% UNLESS noB_streetnumber %] +
  • + [% IF ( mandatoryB_streetnumber ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_address2' %] + [% UNLESS noB_address2 %] +
  • + [% IF ( mandatoryB_address2 ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_zipcode' %] + [% UNLESS noB_zipcode %] +
  • + [% IF ( mandatoryB_zipcode ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_city' %] + [% UNLESS noB_city %] +
  • + [% IF ( mandatoryB_city ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_state' %] + [% UNLESS noB_state %] +
  • + [% IF ( mandatoryB_state ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_country' %] + [% UNLESS noB_country %] +
  • + [% IF ( mandatoryB_country ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_phone' %] + [% UNLESS noB_phone %] +
  • + [% IF ( mandatoryB_phone ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_email' %] + [% UNLESS noB_email %] +
  • + [% IF ( mandatoryB_email ) %] +
  • + [% END %] +[% END %] + +[% BLOCK 'alt-address-style_B_contactnote' %] + [% UNLESS nocontactnote %] +
  • + [% IF ( mandatorycontactnote ) %] +
  • + [% END %] +[% END %] 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 8cc1c9ec00..f42aeff396 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -5,6 +5,7 @@ [% USE Koha %] [% USE KohaDates %] [% USE Branches %] +[% PROCESS 'member-alt-address-style.inc' %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › @@ -739,11 +740,7 @@ legend:hover { [% IF ( step_6 ) %] [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %] - [% IF Koha.Preference( 'AddressFormat' ) %] - [% INCLUDE "member-alt-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %] - [% ELSE %] - [% INCLUDE 'member-alt-address-style-us.inc' %] - [% END %] + [% PROCESS 'alt-address-style' %] [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %] [% END # /IF ( step_6 ) %] -- 2.20.1