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

(-)a/installer/data/mysql/atomicupdate/bug_xxxxx.pl (+26 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "XXXXX",
6
    description => "Add a new syspref for PatronAgeRestriction",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        # Do you stuffs here
12
        $dbh->do(
13
            q{
14
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('PatronAgeRestriction', '', NULL, 'Patron\'s maximum age during registration. If empty, no age restriction is applied.', 'Integer')
15
        }
16
        );
17
        say $out "Added new syspref 'PatronAgeRestriction'";
18
19
        $dbh->do(
20
            q{
21
            UPDATE IGNORE systempreferences SET `explanation` = 'Patron\'s maximum age during self registration. If empty, honor PatronAgeRestriction.' WHERE `variable` = 'PatronSelfRegistrationAgeRestriction'
22
        }
23
        );
24
        say $out "Updated explanation for syspref 'PatronSelfRegistrationAgeRestriction'";
25
    },
26
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +2 lines)
Lines 624-629 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
624
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
624
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
625
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
625
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
626
('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made available to XSLT sheets. Otherwise they will be removed.','YesNo'),
626
('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made available to XSLT sheets. Otherwise they will be removed.','YesNo'),
627
('PatronAgeRestriction', '', NULL, 'Patron\'s maximum age during registration. If empty, no age restriction is applied.', 'Integer'),
627
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
628
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
628
('PatronAutoComplete','1',NULL,'to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
629
('PatronAutoComplete','1',NULL,'to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
629
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
630
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
Lines 634-640 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
634
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','Free'),
635
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','Free'),
635
('PatronSelfModificationMandatoryField','',NULL,'Define the required fields when a patron is editing their information via the OPAC','Free'),
636
('PatronSelfModificationMandatoryField','',NULL,'Define the required fields when a patron is editing their information via the OPAC','Free'),
636
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
637
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
637
('PatronSelfRegistrationAgeRestriction', '', NULL, 'Patron\'s maximum age during self registration. If empty, no age restriction is applied.', 'Integer'),
638
('PatronSelfRegistrationAgeRestriction', '', NULL, 'Patron\'s maximum age during self registration. If empty, honor PatronAgeRestriction.', 'Integer'),
638
('PatronSelfRegistrationAlert','0',NULL,'If enabled, an alter will be shown on staff interface home page when there are self-registered patrons.','YesNo'),
639
('PatronSelfRegistrationAlert','0',NULL,'If enabled, an alter will be shown on staff interface home page when there are self-registered patrons.','YesNo'),
639
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','Free'),
640
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','Free'),
640
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','Free'),
641
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc (-1 / +9 lines)
Lines 5-11 Link Here
5
[% SET return_claims = patron.return_claims %]
5
[% SET return_claims = patron.return_claims %]
6
[% SET logged_in_branchcode = Branches.GetLoggedInBranchcode() %]
6
[% SET logged_in_branchcode = Branches.GetLoggedInBranchcode() %]
7
7
8
[% IF ( has_modifications || warndeparture || returnbeforeexpiry || expired || patron.gonenoaddress || patron.lost || userdebarred || odues || ( return_claims.count > ClaimReturnedWarningThreshold ) || age_limitations || limited_category || charges || charges_guarantors_guarantees || charges_guarantees || credits || patron.account_locked ) %]
8
[% IF ( has_modifications || warndeparture || returnbeforeexpiry || expired || patron.gonenoaddress || patron.lost || userdebarred || odues || ( return_claims.count > ClaimReturnedWarningThreshold ) || age_out_of_range || age_limitations || limited_category || charges || charges_guarantors_guarantees || charges_guarantees || credits || patron.account_locked ) %]
9
    <h3>Attention</h3>
9
    <h3>Attention</h3>
10
    <ul>
10
    <ul>
11
        [% IF ( has_modifications ) %]
11
        [% IF ( has_modifications ) %]
Lines 137-142 Link Here
137
            </li>
137
            </li>
138
        [% END %]
138
        [% END %]
139
139
140
        [% IF age_out_of_range %]
141
            <li class="invalid_age">
142
                <span class="circ-hlt">Patron's age exceeds the maximum age allowed.</span>
143
                Maximum permitted age is [% age_max | html %]
144
                <a href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&amp;borrowernumber=[% patron.borrowernumber | uri %]&amp;step=3" class="btn btn-default btn-xs">Change category</a>
145
            </li>
146
        [% END %]
147
140
        [% IF limited_category %]
148
        [% IF limited_category %]
141
            <li class="limited_category">
149
            <li class="limited_category">
142
                <span class="circ-hlt">The patron's current category ([% Categories.GetName(patron.categorycode) | html %]) is limited to other libraries.</span>
150
                <span class="circ-hlt">The patron's current category ([% Categories.GetName(patron.categorycode) | html %]) is limited to other libraries.</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 921-927 OPAC: Link Here
921
            - "Patron's maximum age when registering: "
921
            - "Patron's maximum age when registering: "
922
            - pref: PatronSelfRegistrationAgeRestriction
922
            - pref: PatronSelfRegistrationAgeRestriction
923
              class: integer
923
              class: integer
924
            - "<br />Note: If empty, do not restrict patron's age during self registration"
924
            - "<br />Note: If empty, honor the PatronAgeRestriction preference."
925
    Suggestions:
925
    Suggestions:
926
        -
926
        -
927
            - pref: OpacSuggestionManagedBy
927
            - pref: OpacSuggestionManagedBy
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+5 lines)
Lines 324-329 Patrons: Link Here
324
           type: modalselect
324
           type: modalselect
325
           source: borrowers
325
           source: borrowers
326
         - "will be added to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here. If applicable the guarantor form will be shown as well, individual fields in that form will be ignored."
326
         - "will be added to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here. If applicable the guarantor form will be shown as well, individual fields in that form will be ignored."
327
     -
328
         - "Patron's maximum age when registering: "
329
         - pref: PatronAgeRestriction
330
           class: integer
331
         - "<br />Note: If this field is left empty, no age restriction is applied."
327
     -
332
     -
328
         - "When adding new patrons or editing existing patrons, collapse the following fields from the full form (can still be expanded later):"
333
         - "When adding new patrons or editing existing patrons, collapse the following fields from the full form (can still be expanded later):"
329
         - pref: CollapseFieldsPatronAddForm
334
         - pref: CollapseFieldsPatronAddForm
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+3 lines)
Lines 148-153 Link Here
148
                                [% IF ( ERROR_age_limitations ) %]
148
                                [% IF ( ERROR_age_limitations ) %]
149
                                    <li id="ERROR_age_limitations">Patron's age is incorrect for their category. Ages allowed are [% age_low | html %]-[% age_high | html %].</li>
149
                                    <li id="ERROR_age_limitations">Patron's age is incorrect for their category. Ages allowed are [% age_low | html %]-[% age_high | html %].</li>
150
                                [% END %]
150
                                [% END %]
151
                                [% IF ( ERROR_age_out_of_range ) %]
152
                                    <li id="ERROR_age_out_of_range">Patron's age exceeds the maximum age allowed. Maximum permitted age is [% age_max | html %]</li>
153
                                [% END %]
151
                                [% IF ( ERROR_branch ) %]
154
                                [% IF ( ERROR_branch ) %]
152
                                    <li id="ERROR_branch">Library is invalid.</li>
155
                                    <li id="ERROR_branch">Library is invalid.</li>
153
                                [% END %]
156
                                [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-2 / +2 lines)
Lines 125-132 Link Here
125
                                    [% IF field == "ERROR_age_limitations" %]
125
                                    [% IF field == "ERROR_age_limitations" %]
126
                                        <li>Patron's age is incorrect for their category.</li>
126
                                        <li>Patron's age is incorrect for their category.</li>
127
                                    [% END %]
127
                                    [% END %]
128
                                    [% IF field == "ERROR_age_limitations_self_registration" %]
128
                                    [% IF field == "ERROR_age_out_of_range" %]
129
                                        <li> Patron's age exceeds the maximum age allowed.</li>
129
                                        <li>Patron's age exceeds the maximum age allowed.</li>
130
                                    [% END %]
130
                                    [% END %]
131
                                [% END %]
131
                                [% END %]
132
                            </ul>
132
                            </ul>
(-)a/members/memberentry.pl (+7 lines)
Lines 392-402 if ( $op eq 'cud-save' || $op eq 'cud-insert' ) { Link Here
392
        my $patron = Koha::Patron->new( { dateofbirth => $dateofbirth } );
392
        my $patron = Koha::Patron->new( { dateofbirth => $dateofbirth } );
393
        my $age    = $patron->get_age;
393
        my $age    = $patron->get_age;
394
        my ( $low, $high ) = ( $category->dateofbirthrequired, $category->upperagelimit );
394
        my ( $low, $high ) = ( $category->dateofbirthrequired, $category->upperagelimit );
395
        my $age_restriction = C4::Context->preference("PatronAgeRestriction");
396
395
        if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
397
        if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
396
            push @errors, 'ERROR_age_limitations';
398
            push @errors, 'ERROR_age_limitations';
397
            $template->param( age_low  => $low );
399
            $template->param( age_low  => $low );
398
            $template->param( age_high => $high );
400
            $template->param( age_high => $high );
399
        }
401
        }
402
403
        if ( $age_restriction && $age > $age_restriction ) {
404
            push @errors, 'ERROR_age_out_of_range';
405
            $template->param( age_max => $age_restriction );
406
        }
400
    }
407
    }
401
408
402
    if ( C4::Context->preference("IndependentBranches") ) {
409
    if ( C4::Context->preference("IndependentBranches") ) {
(-)a/opac/opac-memberentry.pl (-4 / +8 lines)
Lines 558-569 sub CheckForInvalidFields { Link Here
558
        my $age              = $patron->get_age;
558
        my $age              = $patron->get_age;
559
        my $borrowercategory = Koha::Patron::Categories->find( $borrower->{'categorycode'} );
559
        my $borrowercategory = Koha::Patron::Categories->find( $borrower->{'categorycode'} );
560
        my ( $low, $high ) = ( $borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit );
560
        my ( $low, $high ) = ( $borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit );
561
        my $upper_registration_age_restriction = C4::Context->preference("PatronSelfRegistrationAgeRestriction");
561
        my $age_restriction =
562
               C4::Context->preference("PatronSelfRegistrationAgeRestriction")
563
            || C4::Context->preference("PatronAgeRestriction")
564
            || undef;
565
562
        if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
566
        if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
563
            push @invalidFields, 'ERROR_age_limitations';
567
            push @invalidFields, 'ERROR_age_limitations';
564
        }
568
        }
565
        if ( $upper_registration_age_restriction && $age > $upper_registration_age_restriction ) {
569
566
            push @invalidFields, 'ERROR_age_limitations_self_registration';
570
        if ( $age_restriction && $age > $age_restriction ) {
571
            push @invalidFields, 'ERROR_age_out_of_range';
567
        }
572
        }
568
    }
573
    }
569
574
570
- 

Return to bug 41814