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

(-)a/Koha/Patron.pm (-3 / +4 lines)
Lines 291-300 sub store { Link Here
291
                # Make a copy of the plain text password for later use
291
                # Make a copy of the plain text password for later use
292
                $self->plain_text_password( $self->password );
292
                $self->plain_text_password( $self->password );
293
293
294
                if($self->category->effective_force_password_reset_when_set_by_staff and ($self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory"))){
294
                if ( $self->category->effective_force_password_reset_when_set_by_staff
295
                    and ( $self->categorycode ne C4::Context->preference("PatronSelfRegistrationDefaultCategory") ) )
296
                {
295
                    $self->password_expiration_date(dt_from_string);
297
                    $self->password_expiration_date(dt_from_string);
296
                }
298
                } else {
297
                else {
298
                    $self->password_expiration_date(
299
                    $self->password_expiration_date(
299
                          $self->password
300
                          $self->password
300
                        ? $self->category->get_password_expiry_date || undef
301
                        ? $self->category->get_password_expiry_date || undef
(-)a/admin/categories.pl (-15 / +15 lines)
Lines 52-59 if ( $op eq 'add_form' ) { Link Here
52
    );
52
    );
53
53
54
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
54
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
55
        C4::Form::MessagingPreferences::set_form_values(
55
        C4::Form::MessagingPreferences::set_form_values( { categorycode => $categorycode }, $template );
56
            { categorycode => $categorycode }, $template );
57
    }
56
    }
58
}
57
}
59
elsif ( $op eq 'cud-add_validate' ) {
58
elsif ( $op eq 'cud-add_validate' ) {
Lines 86-101 elsif ( $op eq 'cud-add_validate' ) { Link Here
86
    my $can_be_guarantee = $input->param('can_be_guarantee');
85
    my $can_be_guarantee = $input->param('can_be_guarantee');
87
    my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff');
86
    my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff');
88
87
89
    $reset_password = undef if $reset_password eq -1;
88
    $reset_password                         = undef if $reset_password eq -1;
90
    $change_password = undef if $change_password eq -1;
89
    $change_password                        = undef if $change_password eq -1;
91
    $min_password_length = undef unless length($min_password_length);
90
    $min_password_length                    = undef unless length($min_password_length);
92
    $require_strong_password = undef if $require_strong_password eq -1;
91
    $require_strong_password                = undef if $require_strong_password eq -1;
93
    $force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1;
92
    $force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1;
94
93
95
    my $is_a_modif = $input->param("is_a_modif");
94
    my $is_a_modif = $input->param("is_a_modif");
96
95
97
    if ($is_a_modif) {
96
    if ($is_a_modif) {
98
        my $category = Koha::Patron::Categories->find( $categorycode );
97
        my $category = Koha::Patron::Categories->find($categorycode);
99
        $category->categorycode($categorycode);
98
        $category->categorycode($categorycode);
100
        $category->description($description);
99
        $category->description($description);
101
        $category->enrolmentperiod($enrolmentperiod);
100
        $category->enrolmentperiod($enrolmentperiod);
Lines 126-138 elsif ( $op eq 'cud-add_validate' ) { Link Here
126
            $category->store;
125
            $category->store;
127
            $category->replace_library_limits( \@branches );
126
            $category->replace_library_limits( \@branches );
128
        };
127
        };
129
        if ( $@ ) {
128
        if ($@) {
130
            push @messages, {type => 'error', code => 'error_on_update' };
129
            push @messages, { type => 'error', code => 'error_on_update' };
131
        } else {
130
        } else {
132
            push @messages, { type => 'message', code => 'success_on_update' };
131
            push @messages, { type => 'message', code => 'success_on_update' };
133
        }
132
        }
134
    }
133
    } else {
135
    else {
136
        my $category = Koha::Patron::Category->new(
134
        my $category = Koha::Patron::Category->new(
137
            {
135
            {
138
                categorycode                           => $categorycode,
136
                categorycode                           => $categorycode,
Lines 168-174 elsif ( $op eq 'cud-add_validate' ) { Link Here
168
            $category->replace_library_limits( \@branches );
166
            $category->replace_library_limits( \@branches );
169
        };
167
        };
170
168
171
        if ( $@ ) {
169
        if ($@) {
172
            push @messages, { type => 'error', code => 'error_on_insert' };
170
            push @messages, { type => 'error', code => 'error_on_insert' };
173
        } else {
171
        } else {
174
            push @messages, { type => 'message', code => 'success_on_insert' };
172
            push @messages, { type => 'message', code => 'success_on_insert' };
Lines 176-187 elsif ( $op eq 'cud-add_validate' ) { Link Here
176
    }
174
    }
177
175
178
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
176
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
179
        C4::Form::MessagingPreferences::handle_form_action( $input,
177
        C4::Form::MessagingPreferences::handle_form_action(
180
            { categorycode => scalar $input->param('categorycode') }, $template );
178
            $input,
179
            { categorycode => scalar $input->param('categorycode') }, $template
180
        );
181
    }
181
    }
182
182
183
    $searchfield = q||;
183
    $searchfield = q||;
184
    $op = 'list';
184
    $op          = 'list';
185
}
185
}
186
elsif ( $op eq 'delete_confirm' ) {
186
elsif ( $op eq 'delete_confirm' ) {
187
187
(-)a/installer/data/mysql/atomicupdate/bug_33462.pl (-5 / +8 lines)
Lines 7-20 return { Link Here
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
        $dbh->do(q{
10
        $dbh->do(
11
            q{
11
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
12
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
12
VALUES ('ForcePasswordResetWhenSetByStaff', '0', NULL,'Force a staff created patron account to reset its password after its first OPAC login.', 'YesNo')
13
VALUES ('ForcePasswordResetWhenSetByStaff', '0', NULL,'Force a staff created patron account to reset its password after its first OPAC login.', 'YesNo')
13
        });
14
        }
15
        );
14
        say $out "Added new system preference 'ForcePasswordResetWhenSetByStaff'";
16
        say $out "Added new system preference 'ForcePasswordResetWhenSetByStaff'";
15
17
16
        if( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) {
18
        if ( !column_exists( 'categories', 'force_password_reset_when_set_by_staff' ) ) {
17
            $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");
19
            $dbh->do(
20
                "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"
21
            );
18
        }
22
        }
19
23
20
        say $out "Added column to categories 'force_password_reset_when_set_by_staff'";
24
        say $out "Added column to categories 'force_password_reset_when_set_by_staff'";
21
- 

Return to bug 33462