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 83-98
elsif ( $op eq 'cud-add_validate' ) {
Link Here
|
83 |
my $can_be_guarantee = $input->param('can_be_guarantee'); |
82 |
my $can_be_guarantee = $input->param('can_be_guarantee'); |
84 |
my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff'); |
83 |
my $force_password_reset_when_set_by_staff = $input->param('force_password_reset_when_set_by_staff'); |
85 |
|
84 |
|
86 |
$reset_password = undef if $reset_password eq -1; |
85 |
$reset_password = undef if $reset_password eq -1; |
87 |
$change_password = undef if $change_password eq -1; |
86 |
$change_password = undef if $change_password eq -1; |
88 |
$min_password_length = undef unless length($min_password_length); |
87 |
$min_password_length = undef unless length($min_password_length); |
89 |
$require_strong_password = undef if $require_strong_password eq -1; |
88 |
$require_strong_password = undef if $require_strong_password eq -1; |
90 |
$force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1; |
89 |
$force_password_reset_when_set_by_staff = undef if $force_password_reset_when_set_by_staff eq -1; |
91 |
|
90 |
|
92 |
my $is_a_modif = $input->param("is_a_modif"); |
91 |
my $is_a_modif = $input->param("is_a_modif"); |
93 |
|
92 |
|
94 |
if ($is_a_modif) { |
93 |
if ($is_a_modif) { |
95 |
my $category = Koha::Patron::Categories->find( $categorycode ); |
94 |
my $category = Koha::Patron::Categories->find($categorycode); |
96 |
$category->categorycode($categorycode); |
95 |
$category->categorycode($categorycode); |
97 |
$category->description($description); |
96 |
$category->description($description); |
98 |
$category->enrolmentperiod($enrolmentperiod); |
97 |
$category->enrolmentperiod($enrolmentperiod); |
Lines 120-163
elsif ( $op eq 'cud-add_validate' ) {
Link Here
|
120 |
$category->store; |
119 |
$category->store; |
121 |
$category->replace_library_limits( \@branches ); |
120 |
$category->replace_library_limits( \@branches ); |
122 |
}; |
121 |
}; |
123 |
if ( $@ ) { |
122 |
if ($@) { |
124 |
push @messages, {type => 'error', code => 'error_on_update' }; |
123 |
push @messages, { type => 'error', code => 'error_on_update' }; |
125 |
} else { |
124 |
} else { |
126 |
push @messages, { type => 'message', code => 'success_on_update' }; |
125 |
push @messages, { type => 'message', code => 'success_on_update' }; |
127 |
} |
126 |
} |
128 |
} |
127 |
} else { |
129 |
else { |
128 |
my $category = Koha::Patron::Category->new( |
130 |
my $category = Koha::Patron::Category->new({ |
129 |
{ |
131 |
categorycode => $categorycode, |
130 |
categorycode => $categorycode, |
132 |
description => $description, |
131 |
description => $description, |
133 |
enrolmentperiod => $enrolmentperiod, |
132 |
enrolmentperiod => $enrolmentperiod, |
134 |
enrolmentperioddate => $enrolmentperioddate, |
133 |
enrolmentperioddate => $enrolmentperioddate, |
135 |
password_expiry_days => $password_expiry_days, |
134 |
password_expiry_days => $password_expiry_days, |
136 |
upperagelimit => $upperagelimit, |
135 |
upperagelimit => $upperagelimit, |
137 |
dateofbirthrequired => $dateofbirthrequired, |
136 |
dateofbirthrequired => $dateofbirthrequired, |
138 |
enrolmentfee => $enrolmentfee, |
137 |
enrolmentfee => $enrolmentfee, |
139 |
reservefee => $reservefee, |
138 |
reservefee => $reservefee, |
140 |
hidelostitems => $hidelostitems, |
139 |
hidelostitems => $hidelostitems, |
141 |
overduenoticerequired => $overduenoticerequired, |
140 |
overduenoticerequired => $overduenoticerequired, |
142 |
category_type => $category_type, |
141 |
category_type => $category_type, |
143 |
can_be_guarantee => $can_be_guarantee, |
142 |
can_be_guarantee => $can_be_guarantee, |
144 |
BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, |
143 |
BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, |
145 |
checkprevcheckout => $checkPrevCheckout, |
144 |
checkprevcheckout => $checkPrevCheckout, |
146 |
can_place_ill_in_opac => $can_place_ill_in_opac, |
145 |
can_place_ill_in_opac => $can_place_ill_in_opac, |
147 |
default_privacy => $default_privacy, |
146 |
default_privacy => $default_privacy, |
148 |
reset_password => $reset_password, |
147 |
reset_password => $reset_password, |
149 |
change_password => $change_password, |
148 |
change_password => $change_password, |
150 |
exclude_from_local_holds_priority => $exclude_from_local_holds_priority, |
149 |
exclude_from_local_holds_priority => $exclude_from_local_holds_priority, |
151 |
min_password_length => $min_password_length, |
150 |
min_password_length => $min_password_length, |
152 |
require_strong_password => $require_strong_password, |
151 |
require_strong_password => $require_strong_password, |
153 |
force_password_reset_when_set_by_staff => $force_password_reset_when_set_by_staff, |
152 |
force_password_reset_when_set_by_staff => $force_password_reset_when_set_by_staff, |
154 |
}); |
153 |
} |
|
|
154 |
); |
155 |
eval { |
155 |
eval { |
156 |
$category->store; |
156 |
$category->store; |
157 |
$category->replace_library_limits( \@branches ); |
157 |
$category->replace_library_limits( \@branches ); |
158 |
}; |
158 |
}; |
159 |
|
159 |
|
160 |
if ( $@ ) { |
160 |
if ($@) { |
161 |
push @messages, { type => 'error', code => 'error_on_insert' }; |
161 |
push @messages, { type => 'error', code => 'error_on_insert' }; |
162 |
} else { |
162 |
} else { |
163 |
push @messages, { type => 'message', code => 'success_on_insert' }; |
163 |
push @messages, { type => 'message', code => 'success_on_insert' }; |
Lines 165-176
elsif ( $op eq 'cud-add_validate' ) {
Link Here
|
165 |
} |
165 |
} |
166 |
|
166 |
|
167 |
if ( C4::Context->preference('EnhancedMessagingPreferences') ) { |
167 |
if ( C4::Context->preference('EnhancedMessagingPreferences') ) { |
168 |
C4::Form::MessagingPreferences::handle_form_action( $input, |
168 |
C4::Form::MessagingPreferences::handle_form_action( |
169 |
{ categorycode => scalar $input->param('categorycode') }, $template ); |
169 |
$input, |
|
|
170 |
{ categorycode => scalar $input->param('categorycode') }, $template |
171 |
); |
170 |
} |
172 |
} |
171 |
|
173 |
|
172 |
$searchfield = q||; |
174 |
$searchfield = q||; |
173 |
$op = 'list'; |
175 |
$op = 'list'; |
174 |
} |
176 |
} |
175 |
elsif ( $op eq 'delete_confirm' ) { |
177 |
elsif ( $op eq 'delete_confirm' ) { |
176 |
|
178 |
|