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 383-388 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
383
('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'),
383
('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'),
384
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
384
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
385
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
385
('EnablePayPalOpacPayments',  '0', NULL ,  'Enables the ability to pay fees and fines from  the OPAC via PayPal',  'YesNo' ),
386
('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' ),
386
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
387
('PayPalChargeDescription',  'Koha fee payment', NULL ,  'This preference defines what the user will see the charge listed as in PayPal',  'Free'),
387
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
388
('PayPalPwd',  '', NULL ,  'Your PayPal API password',  'Free'),
388
('PayPalSandboxMode',  '1', NULL ,  'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.',  'YesNo'),
389
('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 (-11 / +85 lines)
Lines 33-38 $(document).ready(function() { Link Here
33
	[% END %]
33
	[% END %]
34
});
34
});
35
35
36
$(document).ready(function() {
37
38
    var toggle_quick_add = $(".toggle_quick_add");
39
    $(toggle_quick_add).click(function(e){
40
        toggle_quick_add.toggle();
41
        e.preventDefault();
42
        var toggle_to = '';
43
        var toggle_from = '';
44
        if( $("#entryform:visible").length ) {
45
            toggle_to = "#quick_add_form label";
46
            toggle_from = "#entryform label";
47
        } else {
48
            toggle_to="#entryform label";
49
            toggle_from = "#quick_add_form label";
50
        }
51
        $(toggle_from).each(function() {
52
            var input_label = $(this).attr('for');
53
            if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
54
            $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
55
            return;
56
            }
57
            if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );}
58
        });
59
60
        $(".toggler").toggle();
61
    });
62
63
    $(".save_quick_add").click(function(){
64
        $("#quick_add_form").validate();
65
        if( $("#quick_add_form").valid()){
66
            $('.toggle_quick_add').click();
67
            $('#entryform button[name="save"]').click();
68
        }
69
        else {return false;}
70
    });
71
72
});
73
36
        var MSG_SEPARATOR = _("Separator must be / in field %s");
74
        var MSG_SEPARATOR = _("Separator must be / in field %s");
37
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
75
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
38
        var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
76
        var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
Lines 59-70 $(document).ready(function() { Link Here
59
[% INCLUDE 'header.inc' %]
97
[% INCLUDE 'header.inc' %]
60
[% INCLUDE 'patron-search.inc' %]
98
[% INCLUDE 'patron-search.inc' %]
61
99
62
<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; 
100
<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;
63
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
101
[% IF (firstname || surname ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]</a>  &rsaquo;[% END %]
64
<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>
102
<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>
65
</div>
103
</div>
66
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
104
[% IF ( opadd ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
67
   
105
68
   <div id="bd">
106
   <div id="bd">
69
	<div id="yui-main">
107
	<div id="yui-main">
70
	<div class="yui-b">
108
	<div class="yui-b">
Lines 85-91 $(document).ready(function() { Link Here
85
123
86
	[% UNLESS ( no_add ) %]
124
	[% UNLESS ( no_add ) %]
87
    <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>
125
    <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>
88
  
126
127
    [% IF quickadd && opadd && !check_member %]
128
        <a href="#" class="toggle_quick_add"><i class="fa fa-plus-square"></i> Show full form</a>
129
        <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-minus-square"></i> Show brief form</a>
130
    [% END %]
131
89
	[% IF ( check_member ) %]
132
	[% IF ( check_member ) %]
90
			<div class="dialog alert">
133
			<div class="dialog alert">
91
				<h3>Duplicate patron record?</h3>
134
				<h3>Duplicate patron record?</h3>
Lines 118-129 $(document).ready(function() { Link Here
118
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
161
                <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
119
            [% END %]
162
            [% END %]
120
			[% IF ( ERROR_age_limitations ) %]
163
			[% IF ( ERROR_age_limitations ) %]
121
				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.  
164
            <li id="ERROR_age_limitations">Patron's age is incorrect for their category.
122
                    Ages allowed are [% age_low %]-[% age_high %].</li>
165
                    Ages allowed are [% age_low %]-[% age_high %].</li>
123
			[% END %]
166
			[% END %]
124
			[% IF ( ERROR_branch ) %]
167
			[% IF ( ERROR_branch ) %]
125
				<li id="ERROR_branch">Library is invalid.</li>
168
				<li id="ERROR_branch">Library is invalid.</li>
126
			[% END %]   
169
            [% END %]
127
			[% IF ( ERROR_dateofbirth ) %]
170
			[% IF ( ERROR_dateofbirth ) %]
128
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
171
				<li id="ERROR_dateofbirth">Date of birth is invalid.</li>
129
			[% END %]
172
			[% END %]
Lines 156-162 $(document).ready(function() { Link Here
156
	[% END %]
199
	[% END %]
157
200
158
201
159
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
202
[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler" >
160
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
203
<input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
161
<!--    field always hidden in different form (1,2,3) -->
204
<!--    field always hidden in different form (1,2,3) -->
162
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
205
<input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
Lines 430-436 $(document).ready(function() { Link Here
430
    <legend id="contact_lgd">Contact</legend><ol>
473
    <legend id="contact_lgd">Contact</legend><ol>
431
        [% UNLESS nophone %]
474
        [% UNLESS nophone %]
432
      <li>
475
      <li>
433
      [% IF ( mandatoryphone ) %] 
476
      [% IF ( mandatoryphone ) %]
434
      <label for="phone" class="required">
477
      <label for="phone" class="required">
435
      [% ELSE %]
478
      [% ELSE %]
436
      <label for="phone">
479
      <label for="phone">
Lines 480-486 $(document).ready(function() { Link Here
480
        [% END %]
523
        [% END %]
481
        [% UNLESS noemailpro %]
524
        [% UNLESS noemailpro %]
482
    <li>
525
    <li>
483
      [% IF ( mandatoryemailpro ) %] 
526
      [% IF ( mandatoryemailpro ) %]
484
      <label for="emailpro" class="required">
527
      <label for="emailpro" class="required">
485
      [% ELSE %]
528
      [% ELSE %]
486
      <label for="emailpro">
529
      <label for="emailpro">
Lines 693-699 $(document).ready(function() { Link Here
693
				<label for="opacnote" class="required">
736
				<label for="opacnote" class="required">
694
			[% ELSE %]
737
			[% ELSE %]
695
				<label for="opacnote">
738
				<label for="opacnote">
696
			[% END %]	
739
            [% END %]
697
			OPAC note: </label>
740
			OPAC note: </label>
698
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
741
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
699
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
742
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
Lines 702-708 $(document).ready(function() { Link Here
702
        [% END %]
745
        [% END %]
703
        [% UNLESS noborrowernotes %]
746
        [% UNLESS noborrowernotes %]
704
		<li>
747
		<li>
705
			[% IF ( mandatoryborrowernotes ) %]	
748
            [% IF ( mandatoryborrowernotes ) %]
706
				<label for="borrowernotes" class="required">
749
				<label for="borrowernotes" class="required">
707
			[% ELSE %]
750
			[% ELSE %]
708
				<label for="borrowernotes">
751
				<label for="borrowernotes">
Lines 1044-1050 $(document).ready(function() { Link Here
1044
[% END %] [% END %]
1087
[% END %] [% END %]
1045
1088
1046
</form>
1089
</form>
1047
  
1090
1091
[% IF quickadd && opadd  && !check_member %]
1092
    <form id="quick_add_form" class="toggler">
1093
        <fieldset class="rows quick_add"><legend>Quick add</legend>
1094
            <ol id="quick_add_list">
1095
            </ol>
1096
        </fieldset>
1097
1098
        <fieldset class="action">
1099
            <input type="button" class="save_quick_add"  value="Save" />
1100
           <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1101
        </fieldset>
1102
1103
    </form>
1104
    <script>
1105
        $(document).ready(function () {
1106
            $("#entryform").hide();
1107
            [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1108
            var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]";
1109
            $("#entryform label").each(function () {
1110
                var input_label = $(this).attr('for');
1111
                if ( input_label == 'sex-female' ) { input_label='sex'; }
1112
                else if ( input_label == 'btitle' ) { input_label='title'; }
1113
                if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1114
                $(this).parent().clone().appendTo("#quick_add_list");
1115
                if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1116
                }
1117
             });
1118
            $("#quick_add_form").show();
1119
        });
1120
    </script>
1121
[% END %]
1048
</div>
1122
</div>
1049
</div>
1123
</div>
1050
1124
(-)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