@@ -, +, @@ --- ...g_3137-add_HideFieldsPatronAddForm_syspref.perl | 7 ++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 18 ++++ .../prog/en/modules/members/memberentrygen.tt | 117 ++++++++++++++++++++- 4 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_3137-add_HideFieldsPatronAddForm_syspref.perl --- a/installer/data/mysql/atomicupdate/bug_3137-add_HideFieldsPatronAddForm_syspref.perl +++ a/installer/data/mysql/atomicupdate/bug_3137-add_HideFieldsPatronAddForm_syspref.perl @@ -0,0 +1,7 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('HideFieldsPatronAddForm','',NULL,'Hide these fields by default when adding a new patron. These fields can still be expanded.','Multiple') }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -211,6 +211,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('GoogleOpenIDConnectDefaultBranch', '','','This branch code will be used to create Google OpenID Connect patrons.','Textarea'), ('GoogleOpenIDConnectDefaultCategory','','','This category code will be used to create Google OpenID Connect patrons.','Textarea'), ('GoogleOpenIDConnectDomain', '', NULL, 'Restrict Google OpenID Connect to this domain (or subdomains of this domain). Leave blank for all Google domains', 'Free'), +('HideFieldsPatronAddForm','',NULL,'Hide these fields by default when adding a new patron. These fields can still be expanded.','Multiple'), ('hidelostitems','0','','If ON, disables display of\"lost\" items in OPAC.','YesNo'), ('HidePatronName','0','','If this is switched on, patron\'s cardnumber will be shown instead of their name on the holds and catalog screens','YesNo'), ('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -1,6 +1,24 @@ Patrons: General: - + - When adding new patrons or editing existing patrons, hide the following fields from the full form (can still be expanded later) + - pref: HideFieldsPatronAddForm + multiple: + identity: "a. Organization/Patron identity" + guarantor: "b. Guarantor information" + primary_address: "c. Main address" + primary_contact: "d. Contact information" + alt_address: "e. Alternate address" + alt_contact: "f. Alternate contact" + lib_mgmt: "g. Library management" + lib_setup: "h. Library setup" + login: "i. OPAC/Staff login" + flags: "j. Patron account flags (existing patrons)" + debarments: "k. Patron restrictions (existing patrons)" + housebound: "l. Housebound roles" + additional: "m. Additional attributes and identifiers" + messaging: "n. Patron messaging preferences" + - - pref: AutoEmailOpacUser choices: yes: Send --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -20,7 +20,12 @@ [% IF categoryname %]([% categoryname | html %])[% END %] [% END %] - [% INCLUDE 'doc-head-close.inc' %] + +[% INCLUDE 'doc-head-close.inc' %] @@ -161,6 +166,31 @@ [% END %] + [% SET fieldstohide = Koha.Preference('HideFieldsPatronAddForm') %] + [% IF Koha.Preference('HideFieldsPatronAddForm') %][% UNLESS step %] +

+ Show hidden fields: + [% FOREACH field IN fieldstohide.split(',') %] + [% SWITCH field %] + [% CASE 'identity' %] Organization/Patron identity | + [% CASE 'guarantor' %] Guarantor information | + [% CASE 'primary_address' %] Main address | + [% CASE 'primary_contact' %] Contact information | + [% CASE 'alt_address' %] Alternate address | + [% CASE 'alt_contact' %] Alternate contact | + [% CASE 'lib_mgmt' %] Library management | + [% CASE 'lib_setup' %] Library setup | + [% CASE 'login' %] OPAC/Staff login | + [% CASE 'flags' %] Patron account flags | + [% CASE 'debarments' %] Patron restrictions | + [% CASE 'housebound' %] Housebound roles | + [% CASE 'additional' %] Additional attributes and identifiers | + [% CASE 'messaging' %] Patron messaging preferences | + [% END %] + [% END %] +

+ [% END %][% END %] +
[% UNLESS ( check_member ) %] [% IF quickadd && opadd %] @@ -497,7 +527,6 @@ [% END # /IF show_guarantor || guarantor %] - [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %] [% IF Koha.Preference( 'AddressFormat' ) %] [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %] @@ -1377,7 +1406,91 @@ } } var Sticky; + function showHideFields(){ + [% UNLESS step == 1 %] + [% IF fieldstohide.match('identity') %] + $("#memberentry_identity").find('legend').nextAll().toggle(); + [% END %] + [% IF show_guarantor || guarantor %] + [% IF fieldstohide.match('guarantor') %] + $("#memberentry_guarantor").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% IF fieldstohide.match('primary_address') %] + $("#memberentry_mainaddress").find('legend').nextAll().toggle(); + [% END %] + [% IF fieldstohide.match('primary_contact') %] + $("#memberentry_contact").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% UNLESS step == 6 %] + [% IF fieldstohide.match('alt_address') %] + $("#memberentry_address").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% UNLESS step == 2 %] + [% IF fieldstohide.match('alt_contact') %] + $("#memberentry_altaddress").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% UNLESS step == 3 %] + [% IF fieldstohide.match('lib_mgmt') %] + $("#memberentry_library_management").find('legend').nextAll().toggle(); + [% END %] + [% UNLESS nodateenrolled && noopacnote && noborrowernotes %] + [% IF fieldstohide.match('lib_setup') %] + $("#memberentry_subscription").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% UNLESS nouserid && nopassword %] + [% IF fieldstohide.match('login') %] + $("#memberentry_userid").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% UNLESS ( opadd || opduplicate ) %] + [% IF fieldstohide.match('flags') %] + $("#memberentry_account_flags").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% IF fieldstohide.match('debarments') %] + $("#memberentry_restrictions").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% UNLESS step == 7 %] + [% IF Koha.Preference('HouseboundModule') %] + [% IF fieldstohide.match('housebound') %] + $("#memberentry_housebound_roles").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% END %] + [% UNLESS step == 4 %] + [% IF Koha.Preference('ExtendedPatronAttributes') %] + [% IF fieldstohide.match('additional') %] + $("#memberentry_patron_attributes").find('legend').nextAll().toggle(); + [% END %] + [% END %] + [% END %] + [% UNLESS step == 5 %] + [% IF Koha.Preference('EnhancedMessagingPreferences') %] + [% IF fieldstohide.match('messaging') %] + $("#memberentry_messaging_prefs").find('legend').nextAll().toggle(); + $("#messaging_prefs_loading").toggle(); + [% END %] + [% END %] + [% END %] + } + $(document).ready(function() { + showHideFields(); + $("#toggle_hidden_fields").change(function(){ + showHideFields(); + }); + + $("legend").click(function(){ + $(this).nextAll().toggle(); + $("#messaging_prefs_loading").hide(); + }); + $("#saverecord").css({ 'margin-left': 0 }); Sticky = $("#toolbar"); --