Lines 45-50
use Koha::Patron::Modifications;
Link Here
|
45 |
use Koha::Patron::Categories; |
45 |
use Koha::Patron::Categories; |
46 |
use Koha::Token; |
46 |
use Koha::Token; |
47 |
use Koha::AuthorisedValues; |
47 |
use Koha::AuthorisedValues; |
|
|
48 |
|
49 |
use Koha::Patron::Allowlist::Public; |
50 |
|
51 |
my $ui_allowlist = Koha::Patron::Allowlist::Public->new(); |
52 |
|
48 |
my $cgi = CGI->new; |
53 |
my $cgi = CGI->new; |
49 |
my $dbh = C4::Context->dbh; |
54 |
my $dbh = C4::Context->dbh; |
50 |
|
55 |
|
Lines 127-133
if ( $action eq 'create' ) {
Link Here
|
127 |
|
132 |
|
128 |
my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) ); |
133 |
my @empty_mandatory_fields = (CheckMandatoryFields( \%borrower, $action ), CheckMandatoryAttributes( \%borrower, $attributes ) ); |
129 |
my $invalidformfields = CheckForInvalidFields(\%borrower); |
134 |
my $invalidformfields = CheckForInvalidFields(\%borrower); |
|
|
135 |
my $consent_dt = delete $borrower{gdpr_proc_consent}; |
130 |
delete $borrower{'password2'}; |
136 |
delete $borrower{'password2'}; |
|
|
137 |
|
138 |
$ui_allowlist->apply({ input => \%borrower }); |
139 |
|
131 |
my $cardnumber_error_code; |
140 |
my $cardnumber_error_code; |
132 |
if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) { |
141 |
if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) { |
133 |
# No point in checking the cardnumber if it's missing and mandatory, it'll just generate a |
142 |
# No point in checking the cardnumber if it's missing and mandatory, it'll just generate a |
Lines 218-224
if ( $action eq 'create' ) {
Link Here
|
218 |
); |
227 |
); |
219 |
|
228 |
|
220 |
$borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})); |
229 |
$borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})); |
221 |
my $consent_dt = delete $borrower{gdpr_proc_consent}; |
|
|
222 |
my $patron = Koha::Patron->new( \%borrower )->store; |
230 |
my $patron = Koha::Patron->new( \%borrower )->store; |
223 |
Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; |
231 |
Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; |
224 |
if ( $patron ) { |
232 |
if ( $patron ) { |
Lines 266-271
elsif ( $action eq 'update' ) {
Link Here
|
266 |
# Send back the data to the template |
274 |
# Send back the data to the template |
267 |
%borrower = ( %$borrower, %borrower ); |
275 |
%borrower = ( %$borrower, %borrower ); |
268 |
|
276 |
|
|
|
277 |
$ui_allowlist->apply({ input => \%borrower }); |
278 |
|
269 |
if (@empty_mandatory_fields || @$invalidformfields) { |
279 |
if (@empty_mandatory_fields || @$invalidformfields) { |
270 |
$template->param( |
280 |
$template->param( |
271 |
empty_mandatory_fields => \@empty_mandatory_fields, |
281 |
empty_mandatory_fields => \@empty_mandatory_fields, |