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

(-)a/installer/data/mysql/atomicupdate/bug_12133.perl (+16 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    $dbh->do( q{
5
        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
6
        VALUES('ChildNeedsGuarantor', 0, 'If ON, a child patron must have a guarantor when adding the patron.', '', 'YesNo')} );
7
8
    # or perform some test and warn
9
    # if( !column_exists( 'biblio', 'biblionumber' ) ) {
10
    #    warn "There is something wrong";
11
    # }
12
13
    # Always end with this (adjust the bug info)
14
    SetVersion( $DBversion );
15
    print "Upgrade to $DBversion done (Bug 12133 - Guarantor requirements when registering a patron)\n";
16
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +14 lines)
Lines 66-71 Patrons: Link Here
66
               softno: "Unless overridden by patron category, do not"
66
               softno: "Unless overridden by patron category, do not"
67
               hardno: "Do not"
67
               hardno: "Do not"
68
         - " check borrower checkout history to see if the current item has been checked out before."
68
         - " check borrower checkout history to see if the current item has been checked out before."
69
     -
70
         - "A child patron"
71
         - pref: "ChildNeedsGuarantor"
72
           choices:
73
               yes: "must have"
74
               no: "doesn't need"
75
         - a guarantor when adding the patron.
69
     -
76
     -
70
         - pref: EnhancedMessagingPreferences
77
         - pref: EnhancedMessagingPreferences
71
           choices:
78
           choices:
Lines 233-239 Patrons: Link Here
233
               no: Allow all permitted users
240
               no: Allow all permitted users
234
         - "to access/change superlibrarian privileges."
241
         - "to access/change superlibrarian privileges."
235
         - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
242
         - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
236
243
     -
244
         - "The guarantor"
245
         - pref: "GuarantorHasToBePatron"
246
           choices:
247
               yes: "has to be"
248
               no: "doesn't have to be"
249
         - a patron.
237
    Privacy:
250
    Privacy:
238
     -
251
     -
239
         - Use the following URL
252
         - Use the following URL
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +7 lines)
Lines 79-84 Link Here
79
		<div class="dialog alert">
79
		<div class="dialog alert">
80
			<p>The following fields are wrong. Please fix them.</p>
80
			<p>The following fields are wrong. Please fix them.</p>
81
			<ul>
81
			<ul>
82
            [% IF ( ERROR_child_no_guarantor ) %]
83
                <li id="ERROR_child_no_guarantor">A child patron needs a guarantor.</li>
84
            [% END %]
85
            [% IF ( ERROR_guarantor_is_guarantee ) %]
86
                <li id="ERROR_guarantor_is_guarantee">A guarantor cannot be a guarantee.</li>
87
            [% END %]
82
			[% IF ( ERROR_login_exist ) %]
88
			[% IF ( ERROR_login_exist ) %]
83
				<li id="ERROR_login_exist">Username/password already exists.</li>
89
				<li id="ERROR_login_exist">Username/password already exists.</li>
84
			[% END %]
90
			[% END %]
Lines 455-461 Link Here
455
    [% END %]
461
    [% END %]
456
[% END # nostreet && nocity etc group%]
462
[% END # nostreet && nocity etc group%]
457
463
458
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
464
[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax || Koha.Preference('GuarantorHasToBePatron')%]
459
    <fieldset class="rows" id="memberentry_contact">
465
    <fieldset class="rows" id="memberentry_contact">
460
        <legend id="contact_lgd">Contact</legend><ol>
466
        <legend id="contact_lgd">Contact</legend><ol>
461
467
(-)a/members/memberentry.pl (-3 / +18 lines)
Lines 106-113 my $userenv = C4::Context->userenv; Link Here
106
106
107
## Deal with guarantor stuff
107
## Deal with guarantor stuff
108
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
108
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
109
109
my $guarantorinfo = $input->param('guarantorinfo');
110
my $guarantor_id = $input->param('guarantor_id');
110
my $guarantor_id = $input->param('new_guarantor_id');
111
my $guarantor = undef;
111
my $guarantor = undef;
112
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;
112
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;
113
$template->param( guarantor => $guarantor );
113
$template->param( guarantor => $guarantor );
Lines 263-268 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
263
        $check_member = $patrons->next->borrowernumber;
263
        $check_member = $patrons->next->borrowernumber;
264
    }
264
    }
265
}
265
}
266
 
267
if ( $guarantor_id ) {
268
    if (my $guarantor = Koha::Patrons->find( $guarantor_id )) {
269
        my $guarantor_category = $guarantor->category->category_type;
270
        push @errors, 'ERROR_guarantor_is_guarantee' if ( ($guarantor_category eq 'C') &&
271
                                                          ($op eq 'save' || $op eq 'insert') );
272
    }
273
}
274
275
my $valid_guarantor = $guarantor_id ? $guarantor_id : $newdata{'contactname'};
276
277
if($category_type eq 'C' && ($op eq 'save' ||  $op eq 'insert') && C4::Context->preference('ChildNeedsGuarantor')){
278
    if(!$valid_guarantor){
279
        push @errors, 'ERROR_child_no_guarantor';
280
    }
281
}
266
282
267
###############test to take the right zipcode, country and city name ##############
283
###############test to take the right zipcode, country and city name ##############
268
# set only if parameter was passed from the form
284
# set only if parameter was passed from the form
269
- 

Return to bug 12133