Bug 33462: (Follow up) Fix Perl Tidy

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Sam Lau 2024-06-07 19:26:51 +00:00 committed by Katrin Fischer
parent 9aabf58434
commit ebb1591aa8
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 27 additions and 22 deletions

View File

@ -291,10 +291,11 @@ sub store {
# Make a copy of the plain text password for later use
$self->plain_text_password( $self->password );
if($self->category->effective_force_password_reset_when_set_by_staff and ($self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory"))){
if ( $self->category->effective_force_password_reset_when_set_by_staff
and ( $self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory") ) )
{
$self->password_expiration_date(dt_from_string);
}
else {
} else {
$self->password_expiration_date(
$self->password
? $self->category->get_password_expiry_date || undef

View File

@ -52,8 +52,7 @@ if ( $op eq 'add_form' ) {
);
if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
C4::Form::MessagingPreferences::set_form_values(
{ categorycode => $categorycode }, $template );
C4::Form::MessagingPreferences::set_form_values( { categorycode => $categorycode }, $template );
}
}
elsif ( $op eq 'cud-add_validate' ) {
@ -86,16 +85,16 @@ elsif ( $op eq 'cud-add_validate' ) {
my $can_be_guarantee = $input->param('can_be_guarantee');
my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff');
$reset_password = undef if $reset_password eq -1;
$change_password = undef if $change_password eq -1;
$min_password_length = undef unless length($min_password_length);
$require_strong_password = undef if $require_strong_password eq -1;
$reset_password = undef if $reset_password eq -1;
$change_password = undef if $change_password eq -1;
$min_password_length = undef unless length($min_password_length);
$require_strong_password = undef if $require_strong_password eq -1;
$force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1;
my $is_a_modif = $input->param("is_a_modif");
if ($is_a_modif) {
my $category = Koha::Patron::Categories->find( $categorycode );
my $category = Koha::Patron::Categories->find($categorycode);
$category->categorycode($categorycode);
$category->description($description);
$category->enrolmentperiod($enrolmentperiod);
@ -126,13 +125,12 @@ elsif ( $op eq 'cud-add_validate' ) {
$category->store;
$category->replace_library_limits( \@branches );
};
if ( $@ ) {
push @messages, {type => 'error', code => 'error_on_update' };
if ($@) {
push @messages, { type => 'error', code => 'error_on_update' };
} else {
push @messages, { type => 'message', code => 'success_on_update' };
}
}
else {
} else {
my $category = Koha::Patron::Category->new(
{
categorycode => $categorycode,
@ -168,7 +166,7 @@ elsif ( $op eq 'cud-add_validate' ) {
$category->replace_library_limits( \@branches );
};
if ( $@ ) {
if ($@) {
push @messages, { type => 'error', code => 'error_on_insert' };
} else {
push @messages, { type => 'message', code => 'success_on_insert' };
@ -176,12 +174,14 @@ elsif ( $op eq 'cud-add_validate' ) {
}
if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
C4::Form::MessagingPreferences::handle_form_action( $input,
{ categorycode => scalar $input->param('categorycode') }, $template );
C4::Form::MessagingPreferences::handle_form_action(
$input,
{ categorycode => scalar $input->param('categorycode') }, $template
);
}
$searchfield = q||;
$op = 'list';
$op = 'list';
}
elsif ( $op eq 'delete_confirm' ) {

View File

@ -7,14 +7,18 @@ return {
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
$dbh->do(q{
$dbh->do(
q{
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
VALUES ('ForcePasswordResetWhenSetByStaff', '0', NULL,'Force a staff created patron account to reset its password after its first OPAC login.', 'YesNo')
});
}
);
say $out "Added new system preference 'ForcePasswordResetWhenSetByStaff'";
if( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) {
$dbh->do("ALTER TABLE categories ADD COLUMN `force_password_reset_when_set_by_staff` TINYINT(1) NULL DEFAULT NULL AFTER `require_strong_password` -- if patrons of this category are required to reset password after being created by a staff member");
if ( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) {
$dbh->do(
"ALTER TABLE categories ADD COLUMN `force_password_reset_when_set_by_staff` TINYINT(1) NULL DEFAULT NULL AFTER `require_strong_password` -- if patrons of this category are required to reset password after being created by a staff member"
);
}
say $out "Added column to categories 'force_password_reset_when_set_by_staff'";