View | Details | Raw Unified | Return to bug 3534
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_3534_add_PatronQuickAdd_sysprefs.sql (+1 lines)
Line 0 Link Here
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 (+1 lines)
Lines 378-383 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
378
('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'),
378
('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'),
379
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
379
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
380
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
380
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
381
('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' ),
381
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
382
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
382
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
383
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
383
('PayPalSandboxMode',  '1', NULL ,  'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.',  'YesNo'),
384
('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 (+10 lines)
Lines 1-4 Link Here
1
[% USE Categories %]
1
[% USE Categories %]
2
[% USE Koha %]
2
[% SET categories = Categories.all %]
3
[% SET categories = Categories.all %]
3
4
4
[% UNLESS ( no_add ) %]
5
[% UNLESS ( no_add ) %]
Lines 12-16 Link Here
12
    [% IF CAN_user_tools_manage_patron_lists %]
13
    [% IF CAN_user_tools_manage_patron_lists %]
13
        <a class="btn btn-small" href="/cgi-bin/koha/patron_lists/lists.pl"><i class="fa fa-edit"></i>Patron lists</a>
14
        <a class="btn btn-small" href="/cgi-bin/koha/patron_lists/lists.pl"><i class="fa fa-edit"></i>Patron lists</a>
14
    [% END %]
15
    [% END %]
16
    [% IF Koha.Preference('PatronQuickAddFields') || Koha.Preference('BorrowerMandatoryField') %]
17
    <div class="btn-group">
18
        <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> Quick add New patron <span class="caret"></span></button>
19
            <ul class="dropdown-menu">
20
                [% FOREACH category IN categories %]<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;categorycode=[% category.categorycode %]&amp;quickadd=true">[% category.description %]</a></li>[% END %]
21
            </ul>
22
    </div>
23
    [% END %]
24
15
</div>
25
</div>
16
[% END %]
26
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+5 lines)
Lines 100-105 Patrons: Link Here
100
           class: integer
100
           class: integer
101
         - results per page in the staff client.
101
         - results per page in the staff client.
102
     -
102
     -
103
         - pref: PatronQuickAddFields
104
           class: multi
105
         - (separate columns with |)
106
         - "add these fields to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here"
107
     -
103
         - "Use the SMS::Send::"
108
         - "Use the SMS::Send::"
104
         - pref: SMSSendDriver
109
         - pref: SMSSendDriver
105
         - driver to send SMS messages.
110
         - driver to send SMS messages.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-12 / +81 lines)
Lines 155-160 function select_user(borrowernumber, borrower) { Link Here
155
155
156
        hint.html(age_string);
156
        hint.html(age_string);
157
    }
157
    }
158
$(document).ready(function() {
159
        $(".toggle_quick_add").click(function(){
160
            var toggle_to = '';
161
            var toggle_from = '';
162
            if( $("#entryform:visible").length ) {
163
                toggle_to = "#quick_add_form label";
164
                toggle_from = "#entryform label";
165
            } else {
166
                toggle_to="#entryform label";
167
                toggle_from = "#quick_add_form label";
168
            }
169
            $(toggle_from).each(function() {
170
                var input_label = $(this).attr('for');
171
                if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
172
                $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
173
                return;
174
                }
175
                if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );}
176
            });
177
178
            $(".toggler").toggle();
179
//            return false;
180
        });
181
182
183
        $(".save_quick_add").click(function(){
184
            $("#quick_add_form").validate();
185
            if( $("#quick_add_form").valid()){
186
                $('.toggle_quick_add').click();
187
                $('#entryform input[name="save"]').click();
188
            }
189
            else {return false;}
190
        });
191
    });
158
192
159
        var MSG_SEPARATOR = _("Separator must be / in field %s");
193
        var MSG_SEPARATOR = _("Separator must be / in field %s");
160
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
194
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
Lines 176-187 function select_user(borrowernumber, borrower) { Link Here
176
[% INCLUDE 'header.inc' %]
210
[% INCLUDE 'header.inc' %]
177
[% INCLUDE 'patron-search.inc' %]
211
[% INCLUDE 'patron-search.inc' %]
178
212
179
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; 
213
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo;
180
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
214
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
181
<strong>[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron ([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</strong>
215
<strong>[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron ([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</strong>
182
</div>
216
</div>
183
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
217
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
184
   
218
185
   <div id="bd">
219
   <div id="bd">
186
	<div id="yui-main">
220
	<div id="yui-main">
187
	<div class="yui-b">
221
	<div class="yui-b">
Lines 202-208 function select_user(borrowernumber, borrower) { Link Here
202
236
203
	[% UNLESS ( no_add ) %]
237
	[% UNLESS ( no_add ) %]
204
    <h1>[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron [% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</h1>
238
    <h1>[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron [% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</h1>
205
  
239
206
	[% IF ( check_member ) %]
240
	[% IF ( check_member ) %]
207
			<div class="dialog alert">
241
			<div class="dialog alert">
208
				<h3>Duplicate patron record?</h3>
242
				<h3>Duplicate patron record?</h3>
Lines 235-246 function select_user(borrowernumber, borrower) { Link Here
235
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
269
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
236
            [% END %]
270
            [% END %]
237
			[% IF ( ERROR_age_limitations ) %]
271
			[% IF ( ERROR_age_limitations ) %]
238
				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.  
272
				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.
239
                    Ages allowed are [% age_low %]-[% age_high %].</li>
273
                    Ages allowed are [% age_low %]-[% age_high %].</li>
240
			[% END %]
274
			[% END %]
241
			[% IF ( ERROR_branch ) %]
275
			[% IF ( ERROR_branch ) %]
242
				<li id="ERROR_branch">Library is invalid.</li>
276
				<li id="ERROR_branch">Library is invalid.</li>
243
			[% END %]   
277
			[% END %]
244
			[% IF ( ERROR_dateofbirth ) %]
278
			[% IF ( ERROR_dateofbirth ) %]
245
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
279
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
246
			[% END %]
280
			[% END %]
Lines 273-279 function select_user(borrowernumber, borrower) { Link Here
273
	[% END %]
307
	[% END %]
274
308
275
309
276
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
310
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class='toggler' >
277
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
311
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
278
<!--    field always hidden in different form (1,2,3) -->
312
<!--    field always hidden in different form (1,2,3) -->
279
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
313
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
Lines 531-537 function select_user(borrowernumber, borrower) { Link Here
531
    <legend id="contact_lgd">Contact</legend><ol>
565
    <legend id="contact_lgd">Contact</legend><ol>
532
        [% UNLESS nophone %]
566
        [% UNLESS nophone %]
533
      <li>
567
      <li>
534
      [% IF ( mandatoryphone ) %] 
568
      [% IF ( mandatoryphone ) %]
535
      <label for="phone" class="required">
569
      <label for="phone" class="required">
536
      [% ELSE %]
570
      [% ELSE %]
537
      <label for="phone">
571
      <label for="phone">
Lines 581-587 function select_user(borrowernumber, borrower) { Link Here
581
        [% END %]
615
        [% END %]
582
        [% UNLESS noemailpro %]
616
        [% UNLESS noemailpro %]
583
    <li>
617
    <li>
584
      [% IF ( mandatoryemailpro ) %] 
618
      [% IF ( mandatoryemailpro ) %]
585
      <label for="emailpro" class="required">
619
      <label for="emailpro" class="required">
586
      [% ELSE %]
620
      [% ELSE %]
587
      <label for="emailpro">
621
      <label for="emailpro">
Lines 794-800 function select_user(borrowernumber, borrower) { Link Here
794
				<label for="opacnote" class="required">
828
				<label for="opacnote" class="required">
795
			[% ELSE %]
829
			[% ELSE %]
796
				<label for="opacnote">
830
				<label for="opacnote">
797
			[% END %]	
831
			[% END %]
798
			OPAC note: </label>
832
			OPAC note: </label>
799
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
833
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
800
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
834
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
Lines 803-809 function select_user(borrowernumber, borrower) { Link Here
803
        [% END %]
837
        [% END %]
804
        [% UNLESS noborrowernotes %]
838
        [% UNLESS noborrowernotes %]
805
		<li>
839
		<li>
806
			[% IF ( mandatoryborrowernotes ) %]	
840
			[% IF ( mandatoryborrowernotes ) %]
807
				<label for="borrowernotes" class="required">
841
				<label for="borrowernotes" class="required">
808
			[% ELSE %]
842
			[% ELSE %]
809
				<label for="borrowernotes">
843
				<label for="borrowernotes">
Lines 1150-1165 function select_user(borrowernumber, borrower) { Link Here
1150
1184
1151
[% UNLESS ( check_member ) %]
1185
[% UNLESS ( check_member ) %]
1152
    <fieldset class="action">
1186
    <fieldset class="action">
1187
        [% IF quickadd && opadd %]
1188
            <input type="button" class='toggle_quick_add' value="Quick-add/Full form" />
1189
        [% END %]
1153
        <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
1190
        <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
1154
      [% IF ( opadd ) %]
1191
     [% IF ( opadd ) %]
1155
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1192
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1156
	   [% ELSE %]
1193
	   [% ELSE %]
1157
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
1194
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
1158
	   [% END %]
1195
	   [% END %]
1159
    </fieldset>
1196
    </fieldset>
1160
[% END %]
1197
[% END %]
1198
1199
</form>
1200
1201
[% IF quickadd && opadd  && !check_member %]
1202
<form id="quick_add_form" class='toggler'>
1203
    <fieldset class="rows quick_add"><legend>Quick Add</legend>
1204
        <ol id="quick_add_list">
1205
        </ol>
1206
    </fieldset>
1207
1208
    <fieldset class="action">
1209
        <input type="button" class='toggle_quick_add' value="Quick-add/Full form"/>
1210
        <input type="button" class="save_quick_add"  value="Save" />
1211
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1212
    </fieldset>
1213
1161
</form>
1214
</form>
1162
  
1215
<script>
1216
    $(document).ready(function () {
1217
        $("#entryform").hide();
1218
        [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1219
        var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]";
1220
        $("#entryform label").each(function () {
1221
            var input_label = $(this).attr('for');
1222
            if ( input_label == 'sex-female' ) { input_label='sex'; }
1223
            else if ( input_label == 'btitle' ) { input_label='title'; }
1224
            if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1225
            $(this).parent().clone().appendTo("#quick_add_list");
1226
            if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1227
            }
1228
         });
1229
    });
1230
</script>
1231
[% END %]
1163
</div>
1232
</div>
1164
</div>
1233
</div>
1165
1234
(-)a/members/memberentry.pl (-1 / +2 lines)
Lines 86-91 my $cardnumber = $input->param('cardnumber'); Link Here
86
my $check_member   = $input->param('check_member');
86
my $check_member   = $input->param('check_member');
87
my $nodouble       = $input->param('nodouble');
87
my $nodouble       = $input->param('nodouble');
88
my $duplicate      = $input->param('duplicate');
88
my $duplicate      = $input->param('duplicate');
89
my $quickadd       = $input->param('quickadd');
89
$nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate');    # FIXME hack to represent fact that if we're
90
$nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate');    # FIXME hack to represent fact that if we're
90
                                     # modifying an existing patron, it ipso facto
91
                                     # modifying an existing patron, it ipso facto
91
                                     # isn't a duplicate.  Marking FIXME because this
92
                                     # isn't a duplicate.  Marking FIXME because this
Lines 144-149 foreach (@field_check) { Link Here
144
	$template->param( "no$_" => 1);
145
	$template->param( "no$_" => 1);
145
}
146
}
146
$template->param( "add" => 1 ) if ( $op eq 'add' );
147
$template->param( "add" => 1 ) if ( $op eq 'add' );
148
$template->param( "quickadd" => 1 ) if ( $quickadd );
147
$template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' );
149
$template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' );
148
$template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 );
150
$template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 );
149
( $borrower_data = GetMember( 'borrowernumber' => $borrowernumber ) ) if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' );
151
( $borrower_data = GetMember( 'borrowernumber' => $borrowernumber ) ) if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' );
150
- 

Return to bug 3534