Bugzilla – Attachment 50090 Details for
Bug 3534
Patron quick add form
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3534 - Patron quick add form
Bug-3534---Patron-quick-add-form.patch (text/plain), 6.88 KB, created by
Nick Clemens (kidclamp)
on 2016-04-08 18:49:29 UTC
(
hide
)
Description:
Bug 3534 - Patron quick add form
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2016-04-08 18:49:29 UTC
Size:
6.88 KB
patch
obsolete
>From 5a4cf7fbc022c12ed4c47cfa2533b51d34a6b6cf Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 4 Mar 2016 21:34:07 +0000 >Subject: [PATCH] Bug 3534 - Patron quick add form > >This patch adds two new system preferences: > PatronQuickAdd > PatronQuickAddFields > >When enabled the pref will add a new form to memberentrygen composed of >the fields in PatronQuickAddFields and BorrowerMandatoryField. There >will be a button allowing a user to switch from the quickadd to the full >form. > >The Quick add will only be displayed on add of a new patron, >future edits should display the full form. > >Test plan: > 1 - Apply patch > 2 - run updatedatabase.pl > 3 - Add a new patron and ensure nothing has changed > 4 - Enable quick add (do not add any fields) > 5 - Only required fields should be displayed > 6 - Ensure that values are populated when swtiching forms > 7 - Ensure you can save patron > 8 - Verify that subsequent edits use only full form > 9 - Add fields to PatronQuickAddFields >10 - check that fields are present in quick add form >11 - Ensure that you can save patron >12 - Test with various values in both MandatoryBorrowerFields and PatronQuickAddFields >--- > .../prog/en/modules/admin/preferences/patrons.pref | 7 +++ > .../prog/en/modules/members/memberentrygen.tt | 69 ++++++++++++++++++++-- > 2 files changed, 72 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 22c2b27..c1c72da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -100,6 +100,13 @@ Patrons: > class: integer > - results per page in the staff client. > - >+ - pref: PatronQuickAdd >+ choices: >+ yes: Use >+ no: "Don't use" >+ - "the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here:" >+ - pref: PatronQuickAddFields >+ - > - "Use the SMS::Send::" > - pref: SMSSendDriver > - driver to send SMS messages. >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 497c1a7..8542039 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -8,6 +8,32 @@ > //<![CDATA[ > $(document).ready(function() { > >+ $(".toggle_quick_add").click(function(){ >+ $(".toggler").toggle(); >+ return false; >+ }); >+ >+ $(".save_quick_add").click(function(){ >+ $("#quick_add_form label").each(function () { >+ var input_label = $(this).attr('for'); >+ if ( input_label == 'sex-male' || input_label == 'sex-none' ) { return; } >+ $("#entryform label[for='"+input_label+"']").parent().replaceWith( $(this).parent().clone() ); >+ if ( $(this).next().is('select') ) { >+ var cur_sel = $(this).next().val(); >+ $("#entryform label[for='"+input_label+"']").next().find('option[value="'+cur_sel+'"').prop('selected',true); >+ } >+ if ( $(this).next().is('textarea') ) { >+ var cur_text = $(this).next().val(); >+ $("#entryform label[for='"+input_label+"']").next().val( cur_text ); >+ } >+ }); >+ $("#quick_add_form input").each(function(){ >+ var cur_id = $(this).attr('id'); >+ $('#entryform #' + cur_id).val( $(this).val() ); >+ }); >+ $('#entryform input[name="save"]').click(); >+ }); >+ > [% IF categorycode %] > update_category_code( "[% categorycode %]" ); > [% ELSE %] >@@ -133,7 +159,7 @@ > [% END %] > > >-[% UNLESS ( check_member ) %]<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off"> >+[% UNLESS ( check_member ) %]<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class='toggler' > > <input type="hidden" name="nodouble" value="[% nodouble %]" /> [% END %] > <!-- field always hidden in different form (1,2,3) --> > <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" /> >@@ -796,7 +822,7 @@ > [% ELSE %] > <input type="password" id="password2" name="password2" size="20" value="" /> > [% END %] >- [% END %] >+ [% END % ] > [% END %] > [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %] > </li> >@@ -1014,16 +1040,51 @@ > > [% UNLESS ( check_member ) %] > <fieldset class="action"> >+ [% IF opadd %] >+ <input type="button" class='toggle_quick_add' value="Quick-add/Full form" /> >+ [% END %] > <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" /> >- [% IF ( opadd ) %] >+ [% IF ( opadd ) %] > <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a> > [% ELSE %] > <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a> > [% END %] > </fieldset> > [% END %] >+ > </form> >- >+ >+[% IF Koha.Preference('PatronQuickAdd') && opadd && !check_member %] >+<form id="quick_add_form" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class='toggler'> >+ <fieldset class="rows quick_add"><legend>Quick Add</legend> >+ <ol id="quick_add_list"> >+ </ol> >+ </fieldset> >+ >+ <fieldset class="action"> >+ <input type="button" class='toggle_quick_add' value="Quick-add/Full form"/> >+ <input type="button" class="save_quick_add" value="Save" /> >+ <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a> >+ </fieldset> >+ >+</form> >+<script> >+ $(document).ready(function () { >+ $("#entryform").hide(); >+ [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] >+ var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]"; >+ $("#entryform label").each(function () { >+ var input_label = $(this).attr('for'); >+ if ( input_label == 'sex-female' ) { input_label='sex'; } >+ else if ( input_label == 'btitle' ) { input_label='title'; } >+ if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ >+ $(this).parent().clone().appendTo("#quick_add_list"); >+ if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); >+ } >+ }); >+ }); >+</script> >+[% END %] > </div> > </div> > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3534
:
1396
|
50090
|
50091
|
50092
|
50093
|
50362
|
50410
|
50413
|
50414
|
50665
|
50666
|
50729
|
51382
|
51389
|
51445
|
51446
|
51960
|
51961
|
52192
|
52584
|
52585
|
52586
|
52934
|
52935
|
52936
|
52937
|
53109
|
53152
|
53171
|
53172
|
53173
|
53174
|
53175
|
84851