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 379-384 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
379
('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
('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'),
380
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
380
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
381
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
381
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
382
('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' ),
382
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
383
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
383
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
384
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
384
('PayPalSandboxMode',  '1', NULL ,  'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.',  'YesNo'),
385
('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 9-16 Link Here
9
                [% FOREACH category IN categories %]<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;categorycode=[% category.categorycode %]">[% category.description %]</a></li>[% END %]
10
                [% FOREACH category IN categories %]<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;categorycode=[% category.categorycode %]">[% category.description %]</a></li>[% END %]
10
            </ul>
11
            </ul>
11
    </div>
12
    </div>
13
    [% IF Koha.Preference('PatronQuickAddFields') || Koha.Preference('BorrowerMandatoryField') %]
14
    <div class="btn-group">
15
        <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>
16
            <ul class="dropdown-menu">
17
                [% 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 %]
18
            </ul>
19
    </div>
20
    [% END %]
12
    [% IF CAN_user_tools_manage_patron_lists %]
21
    [% 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>
22
        <a class="btn btn-small" href="/cgi-bin/koha/patron_lists/lists.pl"><i class="fa fa-edit"></i>Patron lists</a>
14
    [% END %]
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 157-162 function select_user(borrowernumber, borrower) { Link Here
157
157
158
        hint.html(age_string);
158
        hint.html(age_string);
159
    }
159
    }
160
$(document).ready(function() {
161
        $(".toggle_quick_add").click(function(){
162
            var toggle_to = '';
163
            var toggle_from = '';
164
            if( $("#entryform:visible").length ) {
165
                toggle_to = "#quick_add_form label";
166
                toggle_from = "#entryform label";
167
            } else {
168
                toggle_to="#entryform label";
169
                toggle_from = "#quick_add_form label";
170
            }
171
            $(toggle_from).each(function() {
172
                var input_label = $(this).attr('for');
173
                if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
174
                $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
175
                return;
176
                }
177
                if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );}
178
            });
179
180
            $(".toggler").toggle();
181
//            return false;
182
        });
183
184
185
        $(".save_quick_add").click(function(){
186
            $("#quick_add_form").validate();
187
            if( $("#quick_add_form").valid()){
188
                $('.toggle_quick_add').click();
189
                $('#entryform input[name="save"]').click();
190
            }
191
            else {return false;}
192
        });
193
    });
160
194
161
        var MSG_SEPARATOR = _("Separator must be / in field %s");
195
        var MSG_SEPARATOR = _("Separator must be / in field %s");
162
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
196
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
Lines 178-189 function select_user(borrowernumber, borrower) { Link Here
178
[% INCLUDE 'header.inc' %]
212
[% INCLUDE 'header.inc' %]
179
[% INCLUDE 'patron-search.inc' %]
213
[% INCLUDE 'patron-search.inc' %]
180
214
181
<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; 
215
<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;
182
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
216
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
183
<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>
217
<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>
184
</div>
218
</div>
185
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
219
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
186
   
220
187
   <div id="bd">
221
   <div id="bd">
188
	<div id="yui-main">
222
	<div id="yui-main">
189
	<div class="yui-b">
223
	<div class="yui-b">
Lines 204-210 function select_user(borrowernumber, borrower) { Link Here
204
238
205
	[% UNLESS ( no_add ) %]
239
	[% UNLESS ( no_add ) %]
206
    <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>
240
    <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>
207
  
241
208
	[% IF ( check_member ) %]
242
	[% IF ( check_member ) %]
209
			<div class="dialog alert">
243
			<div class="dialog alert">
210
				<h3>Duplicate patron record?</h3>
244
				<h3>Duplicate patron record?</h3>
Lines 237-248 function select_user(borrowernumber, borrower) { Link Here
237
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
271
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
238
            [% END %]
272
            [% END %]
239
			[% IF ( ERROR_age_limitations ) %]
273
			[% IF ( ERROR_age_limitations ) %]
240
				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.  
274
				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.
241
                    Ages allowed are [% age_low %]-[% age_high %].</li>
275
                    Ages allowed are [% age_low %]-[% age_high %].</li>
242
			[% END %]
276
			[% END %]
243
			[% IF ( ERROR_branch ) %]
277
			[% IF ( ERROR_branch ) %]
244
				<li id="ERROR_branch">Library is invalid.</li>
278
				<li id="ERROR_branch">Library is invalid.</li>
245
			[% END %]   
279
			[% END %]
246
			[% IF ( ERROR_dateofbirth ) %]
280
			[% IF ( ERROR_dateofbirth ) %]
247
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
281
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
248
			[% END %]
282
			[% END %]
Lines 275-281 function select_user(borrowernumber, borrower) { Link Here
275
	[% END %]
309
	[% END %]
276
310
277
311
278
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
312
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class='toggler' >
279
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
313
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
280
<!--    field always hidden in different form (1,2,3) -->
314
<!--    field always hidden in different form (1,2,3) -->
281
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
315
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
Lines 533-539 function select_user(borrowernumber, borrower) { Link Here
533
    <legend id="contact_lgd">Contact</legend><ol>
567
    <legend id="contact_lgd">Contact</legend><ol>
534
        [% UNLESS nophone %]
568
        [% UNLESS nophone %]
535
      <li>
569
      <li>
536
      [% IF ( mandatoryphone ) %] 
570
      [% IF ( mandatoryphone ) %]
537
      <label for="phone" class="required">
571
      <label for="phone" class="required">
538
      [% ELSE %]
572
      [% ELSE %]
539
      <label for="phone">
573
      <label for="phone">
Lines 583-589 function select_user(borrowernumber, borrower) { Link Here
583
        [% END %]
617
        [% END %]
584
        [% UNLESS noemailpro %]
618
        [% UNLESS noemailpro %]
585
    <li>
619
    <li>
586
      [% IF ( mandatoryemailpro ) %] 
620
      [% IF ( mandatoryemailpro ) %]
587
      <label for="emailpro" class="required">
621
      <label for="emailpro" class="required">
588
      [% ELSE %]
622
      [% ELSE %]
589
      <label for="emailpro">
623
      <label for="emailpro">
Lines 796-802 function select_user(borrowernumber, borrower) { Link Here
796
				<label for="opacnote" class="required">
830
				<label for="opacnote" class="required">
797
			[% ELSE %]
831
			[% ELSE %]
798
				<label for="opacnote">
832
				<label for="opacnote">
799
			[% END %]	
833
			[% END %]
800
			OPAC note: </label>
834
			OPAC note: </label>
801
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
835
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
802
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
836
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
Lines 805-811 function select_user(borrowernumber, borrower) { Link Here
805
        [% END %]
839
        [% END %]
806
        [% UNLESS noborrowernotes %]
840
        [% UNLESS noborrowernotes %]
807
		<li>
841
		<li>
808
			[% IF ( mandatoryborrowernotes ) %]	
842
			[% IF ( mandatoryborrowernotes ) %]
809
				<label for="borrowernotes" class="required">
843
				<label for="borrowernotes" class="required">
810
			[% ELSE %]
844
			[% ELSE %]
811
				<label for="borrowernotes">
845
				<label for="borrowernotes">
Lines 1148-1163 function select_user(borrowernumber, borrower) { Link Here
1148
1182
1149
[% UNLESS ( check_member ) %]
1183
[% UNLESS ( check_member ) %]
1150
    <fieldset class="action">
1184
    <fieldset class="action">
1185
        [% IF quickadd && opadd %]
1186
            <input type="button" class='toggle_quick_add' value="Quick-add/Full form" />
1187
        [% END %]
1151
        <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
1188
        <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
1152
      [% IF ( opadd ) %]
1189
     [% IF ( opadd ) %]
1153
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1190
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1154
	   [% ELSE %]
1191
	   [% ELSE %]
1155
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
1192
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
1156
	   [% END %]
1193
	   [% END %]
1157
    </fieldset>
1194
    </fieldset>
1158
[% END %]
1195
[% END %]
1196
1197
</form>
1198
1199
[% IF quickadd && opadd  && !check_member %]
1200
<form id="quick_add_form" class='toggler'>
1201
    <fieldset class="rows quick_add"><legend>Quick Add</legend>
1202
        <ol id="quick_add_list">
1203
        </ol>
1204
    </fieldset>
1205
1206
    <fieldset class="action">
1207
        <input type="button" class='toggle_quick_add' value="Quick-add/Full form"/>
1208
        <input type="button" class="save_quick_add"  value="Save" />
1209
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1210
    </fieldset>
1211
1159
</form>
1212
</form>
1160
  
1213
<script>
1214
    $(document).ready(function () {
1215
        $("#entryform").hide();
1216
        [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1217
        var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]";
1218
        $("#entryform label").each(function () {
1219
            var input_label = $(this).attr('for');
1220
            if ( input_label == 'sex-female' ) { input_label='sex'; }
1221
            else if ( input_label == 'btitle' ) { input_label='title'; }
1222
            if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1223
            $(this).parent().clone().appendTo("#quick_add_list");
1224
            if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1225
            }
1226
         });
1227
    });
1228
</script>
1229
[% END %]
1161
</div>
1230
</div>
1162
</div>
1231
</div>
1163
1232
(-)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