From 6ae0a6f224dd6cac812b4cfd35db0166202f9f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20=C5=A0iman?= Date: Fri, 2 Dec 2016 01:23:06 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 17718: Smartform API allowed in patron edit form Test plan: 1) Apply the patch 2) Setup preferences "SmartformEnable", "SmartformClientID" (register at smartform.cz or use "smartform" as the client ID) 3) Show/hide streetnumber as desired in BorrowerUnwantedField pref (eg. fill in "streetnumber|B_streetnumber") 4) Edit a patron 5) Start entering street in an address field 6) Select a street from autocomplete 7) Continue entering street number and select the right address 8) ZIP and city should get values from autocomplete 9) Disable SmartformEnable and repeat steps above 10) No autocompletion should occur Signed-off-by: Josef Moravec --- .../bug_17718-add_smartform_syspref.sql | 2 + installer/data/mysql/sysprefs.sql | 2 + .../en/includes/member-alt-address-style-de.inc | 44 +++++++++++++++++----- .../en/includes/member-alt-contact-style-de.inc | 36 +++++++++++++----- .../en/includes/member-main-address-style-de.inc | 24 ++++++++++++ .../prog/en/modules/admin/preferences/patrons.pref | 11 ++++++ .../prog/en/modules/members/memberentrygen.tt | 10 +++++ 7 files changed, 109 insertions(+), 20 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_17718-add_smartform_syspref.sql diff --git a/installer/data/mysql/atomicupdate/bug_17718-add_smartform_syspref.sql b/installer/data/mysql/atomicupdate/bug_17718-add_smartform_syspref.sql new file mode 100644 index 0000000..512688f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17718-add_smartform_syspref.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('SmartformEnable', '0', 'If ON, enable Smartform to simplify address entering during patron registration.', NULL, 'YesNo'); +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('SmartformClientID', '', 'Smartform service client ID', '', 'Free'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ef83c3d..064e729 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -466,6 +466,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'), ('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'), ('SlipCSS','',NULL,'Slips CSS url.','free'), +('SmartformEnable', '0', NULL, 'If ON, enable Smartform service to simplify address entering during patron registration.', 'YesNo'), +('SmartformClientID', '', '', 'Smartform service client ID', 'Free'), ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'), ('SMSSendPassword', '', '', 'Password used to send SMS messages', 'free'), ('SMSSendUsername', '', '', 'Username/Login used to send SMS messages', 'free'), 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 index dba4222..004193e 100644 --- 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 @@ -1,3 +1,4 @@ +[% USE Koha %]
Alternate address
    [% UNLESS noB_address %] @@ -8,7 +9,15 @@ + [% IF Koha.Preference('SmartformEnable') %] + [% IF ( noB_streetnumber ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + [% END %] [% IF ( mandatoryB_address ) %]Required[% END %] [% END %] @@ -43,7 +52,11 @@ + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + [% END %] [% IF ( mandatoryB_streetnumber ) %]Required[% END %] [% END %] @@ -61,16 +74,20 @@ [% END %] [% UNLESS noB_zipcode %] -
  1. - [% IF ( mandatoryB_zipcode ) %] -
  2. + [% IF ( mandatoryB_zipcode ) %] +
  3. + [% END %] + [% IF ( mandatoryB_zipcode ) %]Required[% END %] + [% END %] [% UNLESS noB_city %]
  4. @@ -80,7 +97,11 @@ - + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + + [% END %] [% IF ( mandatoryB_city ) %]Required[% END %]
  5. [% END %] @@ -144,4 +165,7 @@ [% END %]
+ [% IF Koha.Preference('SmartformEnable') %] + + [% 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 index 2b9fb71..d1fbb70 100644 --- 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 @@ -1,3 +1,4 @@ +[% USE Koha %]
Alternate contact
    [% UNLESS noaltcontactsurname %] @@ -32,7 +33,11 @@ + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + [% END %] [% IF ( mandatoryaltcontactaddress1 ) %]Required[% END %] [% END %] @@ -49,16 +54,20 @@ [% END %] [% UNLESS noaltcontactzipcode %] -
  1. - [% IF ( mandatoryaltcontactzipcode ) %] -
  2. + [% IF ( mandatoryaltcontactzipcode ) %] +
  3. + [% END %] + [% IF ( mandatoryaltcontactzipcode ) %]Required[% END %] + [% END %] [% UNLESS noaltcontactaddress3 %]
  4. @@ -68,7 +77,11 @@ - + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + + [% END %] [% IF ( mandatoryaltcontactaddress3 ) %]Required[% END %]
  5. [% END %] @@ -109,4 +122,7 @@ [% END %]
+ [% IF Koha.Preference('SmartformEnable') %] + + [% 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 index d047400..bb43dc2 100644 --- 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 @@ -1,3 +1,4 @@ +[% USE Koha %]
Main address
    [% UNLESS nostreettype %] @@ -31,7 +32,15 @@ + [% IF Koha.Preference('SmartformEnable') %] + [% IF ( nostreetnumber ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + [% END %] [% IF ( mandatoryaddress ) %]Required[% END %] [% END %] @@ -43,7 +52,11 @@ + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + [% END %] [% IF ( mandatorystreetnumber ) %]Required[% END %] [% END %] @@ -67,7 +80,11 @@ + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + [% END %] [% IF ( mandatoryzipcode ) %]Required[% END %] [% END %] @@ -79,7 +96,11 @@ + [% IF Koha.Preference('SmartformEnable') %] + + [% ELSE %] + [% END %] [% IF cities.count %]or choose