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

(-)a/installer/data/mysql/atomicupdate/bug_24913-add_PatronSelfRegistrationConfirmEmail_syspref.perl (+6 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo') });
4
5
    NewVersion( $DBversion, 24913, "Add PatronSelfRegistrationConfirmEmail syspref");
6
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 491-496 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
491
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
491
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
492
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
492
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
493
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'),
493
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'),
494
('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo'),
494
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
495
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
495
('PatronSelfRegistrationEmailMustBeUnique', '0', 'If set, the field borrowers.email will be considered as a unique field on self registering', NULL, 'YesNo'),
496
('PatronSelfRegistrationEmailMustBeUnique', '0', 'If set, the field borrowers.email will be considered as a unique field on self registering', NULL, 'YesNo'),
496
('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'),
497
('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+6 lines)
Lines 881-886 OPAC: Link Here
881
                  yes: "Display and prefill"
881
                  yes: "Display and prefill"
882
                  no: "Do not display and prefill"
882
                  no: "Do not display and prefill"
883
            - "password and login form after a patron has self registered."
883
            - "password and login form after a patron has self registered."
884
        -
885
            - pref: PatronSelfRegistrationConfirmEmail
886
              choices:
887
                  yes: Require
888
                  no: "Do not require"
889
            - users to confirm their email address by entering it twice.
884
890
885
    Advanced search options:
891
    Advanced search options:
886
        -
892
        -
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+34 lines)
Lines 93-98 Link Here
93
                                [% IF field == "duplicate_email" %]
93
                                [% IF field == "duplicate_email" %]
94
                                    <li>This email address already exists in our database.</li>
94
                                    <li>This email address already exists in our database.</li>
95
                                [% END %]
95
                                [% END %]
96
                                [% IF field == "email_match" %]
97
                                    <li>Emails do not match! <a href="#borrower_repeat_email">confirm email address</a></li>
98
                                [% END %]
96
                            [% END %]
99
                            [% END %]
97
                        </ul>
100
                        </ul>
98
                        <span>Please correct and resubmit.</span>
101
                        <span>Please correct and resubmit.</span>
Lines 554-559 Link Here
554
                                    <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email | html %]" />
557
                                    <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email | html %]" />
555
                                    [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
558
                                    [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
556
                                </li>
559
                                </li>
560
561
                                [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %]
562
                                    <li>
563
                                        [% IF mandatory.defined('email') %]
564
                                            <label for="borrower_repeat_email" class="required">Confirm primary email:</label>
565
                                        [% ELSE %]
566
                                            <label for="borrower_repeat_email">Confirm primary email:</label>
567
                                        [% END %]
568
569
                                        <input type="text" id="borrower_repeat_email" name="borrower_repeat_email" autocomplete=off>
570
                                        [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
571
                                    </li>
572
                                [% END %]
557
                            [% END %]
573
                            [% END %]
558
574
559
                            [% UNLESS hidden.defined('emailpro') %]
575
                            [% UNLESS hidden.defined('emailpro') %]
Lines 1004-1009 Link Here
1004
                    borrower_email: {
1020
                    borrower_email: {
1005
                        email: true
1021
                        email: true
1006
                    },
1022
                    },
1023
                    borrower_repeat_email: {
1024
                        equalTo: '#borrower_email'
1025
                    },
1007
                    borrower_emailpro: {
1026
                    borrower_emailpro: {
1008
                        email: true
1027
                        email: true
1009
                    },
1028
                    },
Lines 1129-1134 Link Here
1129
        $('#borrower_dateofbirth').val('');
1148
        $('#borrower_dateofbirth').val('');
1130
        return false;
1149
        return false;
1131
    });
1150
    });
1151
1152
    [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %]
1153
        $("#borrower_email").bind("cut copy paste", function(e){
1154
            e.preventDefault();
1155
            $("#borrower_email").bind("contextmenu", function(e){
1156
                e.preventDefault();
1157
            });
1158
        });
1159
        $("#borrower_repeat_email").bind("cut copy paste", function(e){
1160
            e.preventDefault();
1161
            $("#borrower_repeat_email").bind("contextmenu", function(e){
1162
                e.preventDefault();
1163
            });
1164
        });
1165
    [% END %]
1132
    //]]>
1166
    //]]>
1133
    </script>
1167
    </script>
1134
[% INCLUDE 'calendar.inc' %]
1168
[% INCLUDE 'calendar.inc' %]
(-)a/opac/opac-memberentry.pl (-1 / +6 lines)
Lines 433-439 sub CheckForInvalidFields { Link Here
433
            if ( $patrons_with_same_email ) {
433
            if ( $patrons_with_same_email ) {
434
                push @invalidFields, "duplicate_email";
434
                push @invalidFields, "duplicate_email";
435
            }
435
            }
436
        } elsif ( C4::Context->preference("PatronSelfRegistrationConfirmEmail")
437
            && $borrower->{'email'} ne $borrower->{'repeat_email'}
438
            && !defined $borrower->{borrowernumber} ) {
439
            push @invalidFields, "email_match";
436
        }
440
        }
441
        # email passed all tests, so prevent attempting to store repeat_email
442
        delete $borrower->{'repeat_email'};
437
    }
443
    }
438
    if ($borrower->{'emailpro'}) {
444
    if ($borrower->{'emailpro'}) {
439
        push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'}));
445
        push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'}));
440
- 

Return to bug 24913