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 381-386 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
381
('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'),
381
('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'),
382
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
382
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
383
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
383
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
384
('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' ),
384
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
385
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
385
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
386
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
386
('PayPalSandboxMode',  '1', NULL ,  'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.',  'YesNo'),
387
('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 / +87 lines)
Lines 17-22 $(document).ready(function() { Link Here
17
	[% END %]
17
	[% END %]
18
});
18
});
19
19
20
$(document).ready(function() {
21
22
    var toggle_quick_add = $(".toggle_quick_add");
23
    $(toggle_quick_add).click(function(e){
24
        toggle_quick_add.toggle();
25
        e.preventDefault();
26
        var toggle_to = '';
27
        var toggle_from = '';
28
        if( $("#entryform:visible").length ) {
29
            toggle_to = "#quick_add_form label";
30
            toggle_from = "#entryform label";
31
        } else {
32
            toggle_to="#entryform label";
33
            toggle_from = "#quick_add_form label";
34
        }
35
        $(toggle_from).each(function() {
36
            var input_label = $(this).attr('for');
37
            if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
38
            $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
39
            return;
40
            }
41
            if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );}
42
        });
43
44
        $(".toggler").toggle();
45
    });
46
47
    $(".save_quick_add").click(function(){
48
        $("#quick_add_form").validate();
49
        if( $("#quick_add_form").valid()){
50
            $('.toggle_quick_add').click();
51
            $('#entryform button[name="save"]').click();
52
        }
53
        else {return false;}
54
    });
55
56
});
57
20
        var MSG_SEPARATOR = _("Separator must be / in field %s");
58
        var MSG_SEPARATOR = _("Separator must be / in field %s");
21
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
59
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
22
        var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
60
        var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
Lines 43-54 $(document).ready(function() { Link Here
43
[% INCLUDE 'header.inc' %]
81
[% INCLUDE 'header.inc' %]
44
[% INCLUDE 'patron-search.inc' %]
82
[% INCLUDE 'patron-search.inc' %]
45
83
46
<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; 
84
<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;
47
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
85
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
48
<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>
86
<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>
49
</div>
87
</div>
50
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
88
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
51
   
89
52
   <div id="bd">
90
   <div id="bd">
53
	<div id="yui-main">
91
	<div id="yui-main">
54
	<div class="yui-b">
92
	<div class="yui-b">
Lines 69-75 $(document).ready(function() { Link Here
69
107
70
	[% UNLESS ( no_add ) %]
108
	[% UNLESS ( no_add ) %]
71
    <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>
109
    <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>
72
  
110
111
    [% IF quickadd && opadd && !check_member %]
112
        <a href="#" class="toggle_quick_add"><i class="fa fa-plus-square"></i> Show full form</a>
113
        <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-minus-square"></i> Show brief form</a>
114
    [% END %]
115
73
	[% IF ( check_member ) %]
116
	[% IF ( check_member ) %]
74
			<div class="dialog alert">
117
			<div class="dialog alert">
75
				<h3>Duplicate patron record?</h3>
118
				<h3>Duplicate patron record?</h3>
Lines 102-113 $(document).ready(function() { Link Here
102
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
145
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
103
            [% END %]
146
            [% END %]
104
			[% IF ( ERROR_age_limitations ) %]
147
			[% IF ( ERROR_age_limitations ) %]
105
				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.  
148
            <li id="ERROR_age_limitations">Patron's age is incorrect for their category.
106
                    Ages allowed are [% age_low %]-[% age_high %].</li>
149
                    Ages allowed are [% age_low %]-[% age_high %].</li>
107
			[% END %]
150
			[% END %]
108
			[% IF ( ERROR_branch ) %]
151
			[% IF ( ERROR_branch ) %]
109
				<li id="ERROR_branch">Library is invalid.</li>
152
				<li id="ERROR_branch">Library is invalid.</li>
110
			[% END %]   
153
            [% END %]
111
			[% IF ( ERROR_dateofbirth ) %]
154
			[% IF ( ERROR_dateofbirth ) %]
112
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
155
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
113
			[% END %]
156
			[% END %]
Lines 140-146 $(document).ready(function() { Link Here
140
	[% END %]
183
	[% END %]
141
184
142
185
143
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
186
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler" >
144
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
187
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
145
<!--    field always hidden in different form (1,2,3) -->
188
<!--    field always hidden in different form (1,2,3) -->
146
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
189
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
Lines 398-404 $(document).ready(function() { Link Here
398
    <legend id="contact_lgd">Contact</legend><ol>
441
    <legend id="contact_lgd">Contact</legend><ol>
399
        [% UNLESS nophone %]
442
        [% UNLESS nophone %]
400
      <li>
443
      <li>
401
      [% IF ( mandatoryphone ) %] 
444
      [% IF ( mandatoryphone ) %]
402
      <label for="phone" class="required">
445
      <label for="phone" class="required">
403
      [% ELSE %]
446
      [% ELSE %]
404
      <label for="phone">
447
      <label for="phone">
Lines 448-454 $(document).ready(function() { Link Here
448
        [% END %]
491
        [% END %]
449
        [% UNLESS noemailpro %]
492
        [% UNLESS noemailpro %]
450
    <li>
493
    <li>
451
      [% IF ( mandatoryemailpro ) %] 
494
      [% IF ( mandatoryemailpro ) %]
452
      <label for="emailpro" class="required">
495
      <label for="emailpro" class="required">
453
      [% ELSE %]
496
      [% ELSE %]
454
      <label for="emailpro">
497
      <label for="emailpro">
Lines 661-667 $(document).ready(function() { Link Here
661
				<label for="opacnote" class="required">
704
				<label for="opacnote" class="required">
662
			[% ELSE %]
705
			[% ELSE %]
663
				<label for="opacnote">
706
				<label for="opacnote">
664
			[% END %]	
707
            [% END %]
665
			OPAC note: </label>
708
			OPAC note: </label>
666
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
709
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
667
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
710
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
Lines 670-676 $(document).ready(function() { Link Here
670
        [% END %]
713
        [% END %]
671
        [% UNLESS noborrowernotes %]
714
        [% UNLESS noborrowernotes %]
672
		<li>
715
		<li>
673
			[% IF ( mandatoryborrowernotes ) %]	
716
            [% IF ( mandatoryborrowernotes ) %]
674
				<label for="borrowernotes" class="required">
717
				<label for="borrowernotes" class="required">
675
			[% ELSE %]
718
			[% ELSE %]
676
				<label for="borrowernotes">
719
				<label for="borrowernotes">
Lines 1017-1023 $(document).ready(function() { Link Here
1017
        <button type="submit" name="save" onclick="return check_form_borrowers();">
1060
        <button type="submit" name="save" onclick="return check_form_borrowers();">
1018
            <i class="fa fa-save"></i> Save
1061
            <i class="fa fa-save"></i> Save
1019
        </button>
1062
        </button>
1020
      [% IF ( opadd ) %]
1063
     [% IF ( opadd ) %]
1021
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1064
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1022
	   [% ELSE %]
1065
	   [% ELSE %]
1023
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
1066
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
Lines 1025-1032 $(document).ready(function() { Link Here
1025
    </fieldset>
1068
    </fieldset>
1026
[% END %]
1069
[% END %]
1027
</fieldset>
1070
</fieldset>
1071
1028
</form>
1072
</form>
1029
  
1073
1074
[% IF quickadd && opadd  && !check_member %]
1075
    <form id="quick_add_form" class="toggler">
1076
        <fieldset class="rows quick_add"><legend>Quick add</legend>
1077
            <ol id="quick_add_list">
1078
            </ol>
1079
        </fieldset>
1080
1081
        <fieldset class="action">
1082
            <input type="button" class="save_quick_add"  value="Save" />
1083
           <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1084
        </fieldset>
1085
1086
    </form>
1087
    <script>
1088
        $(document).ready(function () {
1089
            $("#entryform").hide();
1090
            [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1091
            var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]";
1092
            $("#entryform label").each(function () {
1093
                var input_label = $(this).attr('for');
1094
                if ( input_label == 'sex-female' ) { input_label='sex'; }
1095
                else if ( input_label == 'btitle' ) { input_label='title'; }
1096
                if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1097
                $(this).parent().clone().appendTo("#quick_add_list");
1098
                if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1099
                }
1100
             });
1101
            $("#quick_add_form").show();
1102
        });
1103
    </script>
1104
[% END %]
1030
</div>
1105
</div>
1031
</div>
1106
</div>
1032
1107
(-)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