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