@@ -, +, @@ --- .../en/includes/member-alt-address-style-de.inc | 39 +++++++++++++++------- .../en/includes/member-alt-address-style-fr.inc | 14 ++++++++ .../en/includes/member-alt-address-style-us.inc | 18 ++++++++-- .../en/includes/member-alt-contact-style-de.inc | 16 ++++++++- .../en/includes/member-alt-contact-style-fr.inc | 20 +++++++++-- .../en/includes/member-alt-contact-style-us.inc | 20 +++++++++-- .../en/includes/member-main-address-style-de.inc | 2 +- .../en/includes/member-main-address-style-fr.inc | 20 ++++++----- .../en/includes/member-main-address-style-us.inc | 2 +- .../prog/en/modules/members/memberentrygen.tt | 11 +++--- koha-tmpl/intranet-tmpl/prog/js/members.js | 15 +++++---- 11 files changed, 131 insertions(+), 46 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-de.inc @@ -1,17 +1,5 @@
Alternate address
    - [% UNLESS noB_address %] -
  1. - [% IF ( mandatoryB_address ) %] -
  2. - [% END %] [% IF roadtypes %]
  3. @@ -35,6 +23,19 @@
  4. [% END %] + [% UNLESS noB_address %] +
  5. + [% IF ( mandatoryB_address ) %] +
  6. + [% END %] + [% UNLESS noB_streetnumber %]
  7. [% IF ( mandatoryB_streetnumber ) %] @@ -81,6 +82,20 @@ [% END %] City: + [% IF cities.count %]or choose + + [% END %] [% IF ( mandatoryB_city ) %]Required[% END %]
  8. [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-fr.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-fr.inc @@ -82,6 +82,20 @@ [% END %] City: + [% IF cities.count %]or choose + + [% END %] [% IF ( mandatoryB_city ) %]Required[% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-address-style-us.inc @@ -68,7 +68,21 @@ [% END %] City: - [% IF ( mandatoryB_city ) %]Required[% END %] + [% IF cities.count %]or choose + + [% END %] + [% IF ( mandatoryB_city ) %]Required[% END %] [% END %] [% UNLESS noB_state %] @@ -138,7 +152,7 @@ - + [% IF ( mandatorycontactnote ) %]Required[% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-de.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-de.inc @@ -68,7 +68,21 @@ - + + [% IF cities.count %]or choose + + [% END %] [% IF ( mandatoryaltcontactaddress3 ) %]Required[% END %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-fr.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-fr.inc @@ -63,12 +63,26 @@ [% UNLESS noaltcontactaddress3 %]
  9. [% IF ( mandatoryaltcontactaddress3 ) %] -
  10. [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-us.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-alt-contact-style-us.inc @@ -51,12 +51,26 @@ [% UNLESS noaltcontactaddress3 %]
  11. [% IF ( mandatoryaltcontactaddress3 ) %] -
  12. [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc @@ -81,7 +81,7 @@ City: [% IF cities.count %]or choose - [% FOREACH c IN cities %] [% IF c.city_name == patron.city && c.city_state == patron.state && c.city_zipcode == patron.zipcode %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-fr.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-fr.inc @@ -2,14 +2,16 @@ Main address
      [% UNLESS nostreettype %] [% UNLESS nostreetnumber %] - [% IF ( mandatorystreetnumber ) %] - [% IF cities.count %]or choose - [% FOREACH c IN cities %] [% IF c.city_name == patron.city && c.city_state == patron.state && c.city_zipcode == patron.zipcode %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc @@ -69,7 +69,7 @@ City: [% IF cities.count %]or choose - [% FOREACH c IN cities %] [% IF c.city_name == patron.city && c.city_state == patron.state && c.city_zipcode == patron.zipcode %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -141,7 +141,7 @@ [% IF opadd %] [% ELSE %] - + [% END %] Cancel @@ -425,12 +425,9 @@ [% END %] [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %] - [% SWITCH Koha.Preference( 'AddressFormat' ) %] - [% CASE 'de' %] - [% INCLUDE 'member-main-address-style-de.inc' %] - [% CASE # us %] - [% INCLUDE 'member-main-address-style-us.inc' %] - [% END %] + [% IF Koha.Preference( 'AddressFormat' ) %] + [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %] + [% END %] [% END # nostreet && nocity etc group%] [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %] --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ a/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -293,14 +293,15 @@ $(document).ready(function(){ $("#quick_add_form #guarantorsearch, #guarantorsearch").val(LABEL_SET_TO_PATRON); }); - $(document.body).on('change','select[name="select_city"]',function(){ - $('select[name="select_city"]').val( $(this).val() ); + $(document.body).on('change','.select_city',function(){ + var selected_city = $(this).val(); + var addressfield = $(this).data("addressfield"); var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/); - $(this).val().match(myRegEx); - $('input[name="zipcode"]').val( RegExp.$1 ); - $('input[name="city"]').val( RegExp.$2 ); - $('input[name="state"]').val( RegExp.$3 ); - $('input[name="country"]').val( RegExp.$4 ); + var matches = selected_city.match( myRegEx ); + $("#" + addressfield + "zipcode").val( matches[1] ); + $("#" + addressfield + "city").val( matches[2] ); + $("#" + addressfield + "state").val( matches[3] ); + $("#" + addressfield + "country").val( matches[4] ); }); dateformat = $("#dateofbirth").siblings(".hint").first().html(); --