|
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 |
|