--- /dev/null
+$DBversion = 'XXX';
+if( CheckVersion( $DBversion ) ) {
+ $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') });
+
+ NewVersion( $DBversion, 24913, "Add PatronSelfRegistrationConfirmEmail syspref");
+}
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'),
+('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo'),
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
('PatronSelfRegistrationEmailMustBeUnique', '0', 'If set, the field borrowers.email will be considered as a unique field on self registering', NULL, 'YesNo'),
('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'),
yes: "Display and prefill"
no: "Do not display and prefill"
- "password and login form after a patron has self registered."
+ -
+ - pref: PatronSelfRegistrationConfirmEmail
+ choices:
+ yes: Require
+ no: "Do not require"
+ - users to confirm their email address by entering it twice.
Advanced search options:
-
[% IF field == "duplicate_email" %]
<li>This email address already exists in our database.</li>
[% END %]
+ [% IF field == "email_match" %]
+ <li>Emails do not match! <a href="#borrower_repeat_email">confirm email address</a></li>
+ [% END %]
[% END %]
</ul>
<span>Please correct and resubmit.</span>
<input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email | html %]" />
[% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
</li>
+
+ [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %]
+ <li>
+ [% IF mandatory.defined('email') %]
+ <label for="borrower_repeat_email" class="required">Confirm primary email:</label>
+ [% ELSE %]
+ <label for="borrower_repeat_email">Confirm primary email:</label>
+ [% END %]
+
+ <input type="text" id="borrower_repeat_email" name="borrower_repeat_email" autocomplete=off>
+ [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
+ </li>
+ [% END %]
[% END %]
[% UNLESS hidden.defined('emailpro') %]
borrower_email: {
email: true
},
+ borrower_repeat_email: {
+ equalTo: '#borrower_email'
+ },
borrower_emailpro: {
email: true
},
$('#borrower_dateofbirth').val('');
return false;
});
+
+ [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %]
+ $("#borrower_email").bind("cut copy paste", function(e){
+ e.preventDefault();
+ $("#borrower_email").bind("contextmenu", function(e){
+ e.preventDefault();
+ });
+ });
+ $("#borrower_repeat_email").bind("cut copy paste", function(e){
+ e.preventDefault();
+ $("#borrower_repeat_email").bind("contextmenu", function(e){
+ e.preventDefault();
+ });
+ });
+ [% END %]
//]]>
</script>
[% INCLUDE 'calendar.inc' %]
if ( $patrons_with_same_email ) {
push @invalidFields, "duplicate_email";
}
+ } elsif ( C4::Context->preference("PatronSelfRegistrationConfirmEmail")
+ && $borrower->{'email'} ne $borrower->{'repeat_email'}
+ && !defined $borrower->{borrowernumber} ) {
+ push @invalidFields, "email_match";
}
+ # email passed all tests, so prevent attempting to store repeat_email
+ delete $borrower->{'repeat_email'};
}
if ($borrower->{'emailpro'}) {
push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'}));