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 402-408 $(document).ready(function() { Link Here
402
    <legend id="contact_lgd">Contact</legend><ol>
445
    <legend id="contact_lgd">Contact</legend><ol>
403
        [% UNLESS nophone %]
446
        [% UNLESS nophone %]
404
      <li>
447
      <li>
405
      [% IF ( mandatoryphone ) %] 
448
      [% IF ( mandatoryphone ) %]
406
      <label for="phone" class="required">
449
      <label for="phone" class="required">
407
      [% ELSE %]
450
      [% ELSE %]
408
      <label for="phone">
451
      <label for="phone">
Lines 452-458 $(document).ready(function() { Link Here
452
        [% END %]
495
        [% END %]
453
        [% UNLESS noemailpro %]
496
        [% UNLESS noemailpro %]
454
    <li>
497
    <li>
455
      [% IF ( mandatoryemailpro ) %] 
498
      [% IF ( mandatoryemailpro ) %]
456
      <label for="emailpro" class="required">
499
      <label for="emailpro" class="required">
457
      [% ELSE %]
500
      [% ELSE %]
458
      <label for="emailpro">
501
      <label for="emailpro">
Lines 665-671 $(document).ready(function() { Link Here
665
				<label for="opacnote" class="required">
708
				<label for="opacnote" class="required">
666
			[% ELSE %]
709
			[% ELSE %]
667
				<label for="opacnote">
710
				<label for="opacnote">
668
			[% END %]	
711
            [% END %]
669
			OPAC note: </label>
712
			OPAC note: </label>
670
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
713
            <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% UNLESS opduplicate %][% opacnote %][% END %]</textarea>
671
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
714
			<div class="hint">This message appears on this patron's user page in the OPAC</div>
Lines 674-680 $(document).ready(function() { Link Here
674
        [% END %]
717
        [% END %]
675
        [% UNLESS noborrowernotes %]
718
        [% UNLESS noborrowernotes %]
676
		<li>
719
		<li>
677
			[% IF ( mandatoryborrowernotes ) %]	
720
            [% IF ( mandatoryborrowernotes ) %]
678
				<label for="borrowernotes" class="required">
721
				<label for="borrowernotes" class="required">
679
			[% ELSE %]
722
			[% ELSE %]
680
				<label for="borrowernotes">
723
				<label for="borrowernotes">
Lines 1021-1027 $(document).ready(function() { Link Here
1021
        <button type="submit" name="save" onclick="return check_form_borrowers();">
1064
        <button type="submit" name="save" onclick="return check_form_borrowers();">
1022
            <i class="fa fa-save"></i> Save
1065
            <i class="fa fa-save"></i> Save
1023
        </button>
1066
        </button>
1024
      [% IF ( opadd ) %]
1067
     [% IF ( opadd ) %]
1025
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1068
       <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1026
	   [% ELSE %]
1069
	   [% ELSE %]
1027
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
1070
	  <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
Lines 1029-1036 $(document).ready(function() { Link Here
1029
    </fieldset>
1072
    </fieldset>
1030
[% END %]
1073
[% END %]
1031
</fieldset>
1074
</fieldset>
1075
1032
</form>
1076
</form>
1033
  
1077
1078
[% IF quickadd && opadd  && !check_member %]
1079
    <form id="quick_add_form" class="toggler">
1080
        <fieldset class="rows quick_add"><legend>Quick add</legend>
1081
            <ol id="quick_add_list">
1082
            </ol>
1083
        </fieldset>
1084
1085
        <fieldset class="action">
1086
            <input type="button" class="save_quick_add"  value="Save" />
1087
           <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a>
1088
        </fieldset>
1089
1090
    </form>
1091
    <script>
1092
        $(document).ready(function () {
1093
            $("#entryform").hide();
1094
            [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1095
            var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]";
1096
            $("#entryform label").each(function () {
1097
                var input_label = $(this).attr('for');
1098
                if ( input_label == 'sex-female' ) { input_label='sex'; }
1099
                else if ( input_label == 'btitle' ) { input_label='title'; }
1100
                if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1101
                $(this).parent().clone().appendTo("#quick_add_list");
1102
                if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1103
                }
1104
             });
1105
            $("#quick_add_form").show();
1106
        });
1107
    </script>
1108
[% END %]
1034
</div>
1109
</div>
1035
</div>
1110
</div>
1036
1111
(-)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