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 227-233 Patrons: Link Here
227
               no: Allow all permitted users
234
               no: Allow all permitted users
228
         - "to access/change superlibrarian privileges."
235
         - "to access/change superlibrarian privileges."
229
         - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
236
         - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
230
237
     -
238
         - "The guarantor"
239
         - pref: "GuarantorHasToBePatron"
240
           choices:
241
               yes: "has to be"
242
               no: "doesn't have to be"
243
         - a patron. 
231
    Privacy:
244
    Privacy:
232
     -
245
     -
233
         - Use the following URL
246
         - Use the following URL
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+11 lines)
Lines 78-83 Link Here
78
		<div class="dialog alert">
78
		<div class="dialog alert">
79
			<p>The following fields are wrong. Please fix them.</p>
79
			<p>The following fields are wrong. Please fix them.</p>
80
			<ul>
80
			<ul>
81
            [% IF ( ERROR_child_no_guarantor ) %]
82
                <li id="ERROR_child_no_guarantor">A child patron needs a guarantor.</li>
83
            [% END %]
84
            [% IF ( ERROR_guarantor_is_guarantee ) %]
85
                <li id="ERROR_guarantor_is_guarantee">A guarantor cannot be a guarantee.</li>
86
            [% END %]
87
            [% IF ( ERROR_guarantor_not_patron ) %]
88
                <li id="ERROR_guarantor_not_patron ">Guarantor has to be a patron.</li>
89
            [% END %]
81
			[% IF ( ERROR_login_exist ) %]
90
			[% IF ( ERROR_login_exist ) %]
82
				<li id="ERROR_login_exist">Username/password already exists.</li>
91
				<li id="ERROR_login_exist">Username/password already exists.</li>
83
			[% END %]
92
			[% END %]
Lines 344-349 Link Here
344
	        </li>
353
	        </li>
345
[% ELSE %]
354
[% ELSE %]
346
 [% IF ( C ) %]
355
 [% IF ( C ) %]
356
 [% IF ( Koha.Preference('ChildNeedsGuarantor') && Koha.Preference('GuarantorHasToBePatron') ) %]<li id="guarantor_required"><span class="required">Required</span></li>[% END %]
347
 [% IF ( guarantorid ) %]
357
 [% IF ( guarantorid ) %]
348
 <li id="contact-details">
358
 <li id="contact-details">
349
 [% ELSE %]
359
 [% ELSE %]
Lines 367-372 Link Here
367
     [% ELSE %]
377
     [% ELSE %]
368
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
378
        <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
369
     [% END %]
379
     [% END %]
380
     [% IF ( Koha.Preference('ChildNeedsGuarantor') && !Koha.Preference('GuarantorHasToBePatron')) %]<span class="required">Required</span>[% END %]
370
 </li>
381
 </li>
371
        [% END %]
382
        [% END %]
372
        [% UNLESS nocontactfirstname %]
383
        [% UNLESS nocontactfirstname %]
(-)a/members/memberentry.pl (-1 / +13 lines)
Lines 265-270 if ( $guarantorid ) { Link Here
265
		        $newdata{$_} = $guarantordata->{$_};
265
		        $newdata{$_} = $guarantordata->{$_};
266
	        }
266
	        }
267
        }
267
        }
268
269
        push @errors, 'ERROR_guarantor_is_guarantee' if ( $guarantordata->{'guarantorid'} &&
270
                                                          ($op eq 'save' || $op eq 'insert') );
271
    }
272
}
273
274
my $valid_guarantor = $guarantorid ? $guarantorid : $newdata{'contactname'};
275
276
if($category_type eq 'C' && ($op eq 'save' ||  $op eq 'insert') && C4::Context->preference('ChildNeedsGuarantor')){
277
    if(!$valid_guarantor){ 
278
        push @errors, 'ERROR_child_no_guarantor';   
279
    }elsif(!$guarantorid && C4::Context->preference('GuarantorHasToBePatron')){
280
        push @errors, 'ERROR_guarantor_not_patron';
268
    }
281
    }
269
}
282
}
270
283
271
- 

Return to bug 12133