use Koha::Patron::Modifications;
use Koha::Patron::Categories;
use Koha::Token;
-
+use Koha::AuthorisedValues;
my $cgi = CGI->new;
my $dbh = C4::Context->dbh;
my $mandatory = GetMandatoryFields($action);
-my $params = undef;
+my $params = {};
if ( $action eq 'create' || $action eq 'new' ) {
my @PatronSelfRegistrationLibraryList = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList');
- $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } };
+ $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } }
+ if @PatronSelfRegistrationLibraryList;
}
my @libraries = Koha::Libraries->search($params);
foreach my $attr (@$attributes) {
my $attribute = Koha::Patron::Attribute->new($attr);
- eval {$attribute->check_unique_id};
- if ( $@ ) {
+ if ( !$attribute->unique_ok ) {
my $attr_type = Koha::Patron::Attribute::Types->find($attr->{code});
$template->param(
extended_unique_id_failed_code => $attr->{code},
my %borrower = ParseCgiForBorrower($cgi);
%borrower = DelEmptyFields(%borrower);
+ $borrower{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory');
my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) );
my $invalidformfields = CheckForInvalidFields(\%borrower);
}
else {
if (
- C4::Context->boolean_preference(
+ C4::Context->preference(
'PatronSelfRegistrationVerifyByEmail')
)
{
},
);
- C4::Letters::EnqueueLetter(
+ my $message_id = C4::Letters::EnqueueLetter(
{
letter => $letter,
message_transport_type => 'email',
C4::Context->preference('KohaAdminEmailAddress'),
}
);
- my $num_letters_attempted = C4::Letters::SendQueuedMessages( {
- letter_code => 'OPAC_REG_VERIFY'
- } );
+ C4::Letters::SendQueuedMessages({ message_id => $message_id });
}
else {
( $template, $borrowernumber, $cookie ) = get_template_and_user(
}
);
- $borrower{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory');
$borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode}));
my $consent_dt = delete $borrower{gdpr_proc_consent};
my $patron = Koha::Patron->new( \%borrower )->store;
if ( $action eq 'create' || $action eq 'new' ) {
$mandatory_fields{'email'} = 1
- if C4::Context->boolean_preference(
+ if C4::Context->preference(
'PatronSelfRegistrationVerifyByEmail');
}