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

(-)a/installer/data/mysql/atomicupdate/bug_39579-patronselfregistrationagerestriction.pl (+17 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  => '39579',
6
    description => "Add system preference 'patronSelfRegistrationAgeRestriction'",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        $dbh->do( "
12
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
13
            ('PatronSelfRegistrationAgeRestriction', '', NULL, 'Patron\'s maximum age during self registration. If empty, no age restriction is applied.', 'Integer')
14
        " );
15
        say_success( $out, "Added new system preference 'PatronSelfRegistrationAgeRestriction'" );
16
    },
17
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 615-620 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
615
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
615
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
616
('PatronSelfModificationMandatoryField','',NULL,'Define the required fields when a patron is editing their information via the OPAC','free'),
616
('PatronSelfModificationMandatoryField','',NULL,'Define the required fields when a patron is editing their information via the OPAC','free'),
617
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
617
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
618
('PatronSelfRegistrationAgeRestriction', '', NULL, 'Patron\'s maximum age during self registration. If empty, no age restriction is applied.', 'Integer'),
618
('PatronSelfRegistrationAlert','0',NULL,'If enabled, an alter will be shown on staff interface home page when there are self-registered patrons.','YesNo'),
619
('PatronSelfRegistrationAlert','0',NULL,'If enabled, an alter will be shown on staff interface home page when there are self-registered patrons.','YesNo'),
619
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
620
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
620
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'),
621
('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/modules/admin/preferences/opac.pref (+5 lines)
Lines 894-899 OPAC: Link Here
894
                0: "Don't show"
894
                0: "Don't show"
895
                1: "Show"
895
                1: "Show"
896
            - an alert on staff interface home page when there are patrons in the category defined by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory">PatronSelfRegistrationDefaultCategory</a>.
896
            - an alert on staff interface home page when there are patrons in the category defined by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory">PatronSelfRegistrationDefaultCategory</a>.
897
        -
898
            - "Patron's maximum age when registering: "
899
            - pref: PatronSelfRegistrationAgeRestriction
900
              class: integer
901
            - "<br />Note: If empty, do not restrict patron's age during self registration"
897
    Suggestions:
902
    Suggestions:
898
        -
903
        -
899
            - pref: OpacSuggestionManagedBy
904
            - pref: OpacSuggestionManagedBy
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+3 lines)
Lines 115-120 Link Here
115
                                    [% IF field == "ERROR_age_limitations" %]
115
                                    [% IF field == "ERROR_age_limitations" %]
116
                                        <li>Patron's age is incorrect for their category.</li>
116
                                        <li>Patron's age is incorrect for their category.</li>
117
                                    [% END %]
117
                                    [% END %]
118
                                    [% IF field == "ERROR_age_limitations_self_registration" %]
119
                                        <li> Patron's age exceeds the maximum age allowed.</li>
120
                                    [% END %]
118
                                [% END %]
121
                                [% END %]
119
                            </ul>
122
                            </ul>
120
                            <span>Please correct and resubmit.</span>
123
                            <span>Please correct and resubmit.</span>
(-)a/opac/opac-memberentry.pl (-1 / +4 lines)
Lines 541-549 sub CheckForInvalidFields { Link Here
541
        my $age              = $patron->get_age;
541
        my $age              = $patron->get_age;
542
        my $borrowercategory = Koha::Patron::Categories->find( $borrower->{'categorycode'} );
542
        my $borrowercategory = Koha::Patron::Categories->find( $borrower->{'categorycode'} );
543
        my ( $low, $high ) = ( $borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit );
543
        my ( $low, $high ) = ( $borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit );
544
        my $upper_registration_age_restriction = C4::Context->preference("PatronSelfRegistrationAgeRestriction");
544
        if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
545
        if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
545
            push @invalidFields, 'ERROR_age_limitations';
546
            push @invalidFields, 'ERROR_age_limitations';
546
        }
547
        }
548
        if ( $upper_registration_age_restriction && $age > $upper_registration_age_restriction ) {
549
            push @invalidFields, 'ERROR_age_limitations_self_registration';
550
        }
547
    }
551
    }
548
552
549
    return \@invalidFields;
553
    return \@invalidFields;
550
- 

Return to bug 39579