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

(-)a/installer/data/mysql/atomicupdate/bug_12133.perl (+20 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
    $dbh->do( q{
9
        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
10
        VALUES('GuarantorHasToBePatron', 0, 'If ON guarantor has to be a patron.', '', 'YesNo')
11
    } );
12
    # or perform some test and warn
13
    # if( !column_exists( 'biblio', 'biblionumber' ) ) {
14
    #    warn "There is something wrong";
15
    # }
16
17
    # Always end with this (adjust the bug info)
18
    SetVersion( $DBversion );
19
    print "Upgrade to $DBversion done (Bug 12133 - Guarantor requirements when registering a patron)\n";
20
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +14 lines)
Lines 106-112 Patrons: Link Here
106
           class: integer
106
           class: integer
107
         - days. Leave empty to disable this behavior.
107
         - days. Leave empty to disable this behavior.
108
         - "<br><strong>NOTE:</strong> This system preference requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it."
108
         - "<br><strong>NOTE:</strong> This system preference requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it."
109
109
     -
110
         - "A child patron"
111
         - pref: "ChildNeedsGuarantor"
112
           choices:
113
               yes: "must have"
114
               no: "doesn't need"
115
         - a guarantor when adding the patron.
110
    Membership expiry:
116
    Membership expiry:
111
     -
117
     -
112
         - When renewing borrowers, base the new expiry date on
118
         - When renewing borrowers, base the new expiry date on
Lines 329-334 Patrons: Link Here
329
               1: Allow
335
               1: Allow
330
               0: "Don't allow"
336
               0: "Don't allow"
331
         - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC.
337
         - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC.
338
     -
339
         - "The guarantor"
340
         - pref: "GuarantorHasToBePatron"
341
           choices:
342
               1: "has to be"
343
               0: "doesn't have to be"
344
         - a patron.
332
    Privacy:
345
    Privacy:
333
     -
346
     -
334
         - Use the following URL
347
         - Use the following URL
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +7 lines)
Lines 139-144 legend:hover { Link Here
139
                            <div class="dialog alert">
139
                            <div class="dialog alert">
140
                                <p>The following fields are wrong. Please fix them.</p>
140
                                <p>The following fields are wrong. Please fix them.</p>
141
                                <ul>
141
                                <ul>
142
                                    [% IF ( ERROR_child_no_guarantor ) %]
143
                                        <li id="ERROR_child_no_guarantor">A child patron needs a guarantor.</li>
144
                                    [% END %]
145
                                    [% IF ( ERROR_guarantor_is_guarantee ) %]
146
                                        <li id="ERROR_guarantor_is_guarantee">A guarantor cannot be a guarantee.</li>
147
                                    [% END %]
142
                                    [% IF ( ERROR_login_exist ) %]
148
                                    [% IF ( ERROR_login_exist ) %]
143
                                        <li id="ERROR_login_exist">Username/password already exists.</li>
149
                                        <li id="ERROR_login_exist">Username/password already exists.</li>
144
                                    [% END %]
150
                                    [% END %]
Lines 655-661 legend:hover { Link Here
655
                                    [% PROCESS 'main-address-style' %]
661
                                    [% PROCESS 'main-address-style' %]
656
                                [% END # /UNLESS nostreet && nocity etc group%]
662
                                [% END # /UNLESS nostreet && nocity etc group%]
657
663
658
                                [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
664
                                [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax || Koha.Preference('GuarantorHasToBePatron') %]
659
                                    <fieldset class="rows" id="memberentry_contact">
665
                                    <fieldset class="rows" id="memberentry_contact">
660
                                        <legend id="contact_lgd">Contact information</legend>
666
                                        <legend id="contact_lgd">Contact information</legend>
661
                                        <ol>
667
                                        <ol>
(-)a/members/memberentry.pl (-2 / +18 lines)
Lines 103-109 my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1; Link Here
103
my $empty_relationship_allowed = grep {$_ eq ""} @relations;
103
my $empty_relationship_allowed = grep {$_ eq ""} @relations;
104
$template->param( empty_relationship_allowed => $empty_relationship_allowed );
104
$template->param( empty_relationship_allowed => $empty_relationship_allowed );
105
105
106
my $guarantor_id = $input->param('guarantor_id');
106
my $guarantorinfo = $input->param('guarantorinfo');
107
my $guarantor_id = $input->param('new_guarantor_id');
107
my $guarantor = undef;
108
my $guarantor = undef;
108
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;
109
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;
109
$template->param( guarantor => $guarantor );
110
$template->param( guarantor => $guarantor );
Lines 279-284 if ( ( $op eq 'insert' ) and !$nodouble ) { Link Here
279
    }
280
    }
280
}
281
}
281
282
283
if ( $guarantor_id ) {
284
    if (my $guarantor = Koha::Patrons->find( $guarantor_id )) {
285
        my $guarantor_category = $guarantor->category->category_type;
286
        push @errors, 'ERROR_guarantor_is_guarantee' if ( ($guarantor_category eq 'C') &&
287
                                                          ($op eq 'save' || $op eq 'insert') );
288
    }
289
}
290
291
my $valid_guarantor = $guarantor_id ? $guarantor_id : $newdata{'contactname'};
292
293
if($category_type eq 'C' && ($op eq 'save' ||  $op eq 'insert') && C4::Context->preference('ChildNeedsGuarantor')){
294
    if(!$valid_guarantor){
295
        push @errors, 'ERROR_child_no_guarantor';
296
    }
297
}
298
282
###############test to take the right zipcode, country and city name ##############
299
###############test to take the right zipcode, country and city name ##############
283
# set only if parameter was passed from the form
300
# set only if parameter was passed from the form
284
$newdata{'city'}    = $input->param('city')    if defined($input->param('city'));
301
$newdata{'city'}    = $input->param('city')    if defined($input->param('city'));
285
- 

Return to bug 12133