@@ -, +, @@ PatronQuickAddFields 1 - Apply patch 2 - run updatedatabase.pl 3 - Add a new patron and ensure nothing has changed 4 - Populate either PatronQuickAddFields or BorrowerMandatory fields and note the new button for adding a patron 5 - Click the Quick add and choose a type 6 - Only required or quick add fields should be displayed 7 - Verify toggling forms copies information 8 - Ensure you cannot save patron without filling required fields (quick add fields should be optional) 9 - Ensure you can save patron with fields filled out --- .../bug_3534_add_PatronQuickAdd_sysprefs.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../prog/en/includes/patron-toolbar.inc | 10 +++ .../prog/en/modules/admin/preferences/patrons.pref | 5 ++ .../prog/en/modules/members/memberentrygen.tt | 96 +++++++++++++++++++--- members/memberentry.pl | 2 + 6 files changed, 104 insertions(+), 11 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_3534_add_PatronQuickAdd_sysprefs.sql --- a/installer/data/mysql/atomicupdate/bug_3534_add_PatronQuickAdd_sysprefs.sql +++ a/installer/data/mysql/atomicupdate/bug_3534_add_PatronQuickAdd_sysprefs.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronQuickAddFields', '', 'A list of fields separated by "|" to be displayed along with mandatory fields in the patron quick add form if chosen at patron entry', NULL, 'Free'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -383,6 +383,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PatronSelfRegistrationVerifyByEmail','0',NULL,'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate his or her account.','YesNo'), ('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'), ('EnablePayPalOpacPayments', '0', NULL , 'Enables the ability to pay fees and fines from the OPAC via PayPal', 'YesNo' ), +('PatronQuickAddFields', '', NULL , 'A list of fields separated by "|" to be displayed along with mandatory fields in the patron quick add form if chosen at patron entry', 'Free' ), ('PayPalChargeDescription', 'Koha fee payment', NULL , 'This preference defines what the user will see the charge listed as in PayPal', 'Free'), ('PayPalPwd', '', NULL , 'Your PayPal API password', 'Free'), ('PayPalSandboxMode', '1', NULL , 'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.', 'YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc @@ -1,4 +1,5 @@ [% USE Categories %] +[% USE Koha %] [% SET categories = Categories.all %] [% UNLESS ( no_add ) %] @@ -9,8 +10,17 @@ [% FOREACH category IN categories %]
  • [% category.description %]
  • [% END %] + [% IF Koha.Preference('PatronQuickAddFields') || Koha.Preference('BorrowerMandatoryField') %] +
    + + +
    + [% END %] [% IF CAN_user_tools_manage_patron_lists %] Patron lists [% END %] + [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -100,6 +100,11 @@ Patrons: class: integer - results per page in the staff client. - + - pref: PatronQuickAddFields + class: multi + - (separate columns with |) + - "add these fields to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here" + - - "Use the SMS::Send::" - pref: SMSSendDriver - driver to send SMS messages. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -33,6 +33,44 @@ $(document).ready(function() { [% END %] }); +$(document).ready(function() { + + var toggle_quick_add = $(".toggle_quick_add"); + $(toggle_quick_add).click(function(e){ + toggle_quick_add.toggle(); + e.preventDefault(); + var toggle_to = ''; + var toggle_from = ''; + if( $("#entryform:visible").length ) { + toggle_to = "#quick_add_form label"; + toggle_from = "#entryform label"; + } else { + toggle_to="#entryform label"; + toggle_from = "#quick_add_form label"; + } + $(toggle_from).each(function() { + var input_label = $(this).attr('for'); + if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) { + $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') ); + return; + } + if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() );} + }); + + $(".toggler").toggle(); + }); + + $(".save_quick_add").click(function(){ + $("#quick_add_form").validate(); + if( $("#quick_add_form").valid()){ + $('.toggle_quick_add').click(); + $('#entryform button[name="save"]').click(); + } + else {return false;} + }); + +}); + var MSG_SEPARATOR = _("Separator must be / in field %s"); var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); @@ -59,12 +97,12 @@ $(document).ready(function() { [% INCLUDE 'header.inc' %] [% INCLUDE 'patron-search.inc' %] -