Lines 67-72
if ($op eq 'add_form') {
Link Here
|
67 |
}; |
67 |
}; |
68 |
} |
68 |
} |
69 |
|
69 |
|
|
|
70 |
my @category_names = Koha::AuthorisedValueCategories->search( |
71 |
{ category_name => { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } }, |
72 |
{ order_by => ['category_name'] } |
73 |
)->as_list; |
74 |
|
70 |
if ($id) { |
75 |
if ($id) { |
71 |
$template->param(action_modify => 1); |
76 |
$template->param(action_modify => 1); |
72 |
} elsif ( ! $category ) { |
77 |
} elsif ( ! $category ) { |
Lines 88-94
if ($op eq 'add_form') {
Link Here
|
88 |
); |
93 |
); |
89 |
} |
94 |
} |
90 |
$template->param( |
95 |
$template->param( |
91 |
branches_loop => \@branches_loop, |
96 |
branches_loop => \@branches_loop, |
|
|
97 |
category_names => \@category_names, |
92 |
); |
98 |
); |
93 |
|
99 |
|
94 |
} elsif ($op eq 'cud-add') { |
100 |
} elsif ($op eq 'cud-add') { |
Lines 151-156
if ($op eq 'add_form') {
Link Here
|
151 |
$searchfield = $new_category; |
157 |
$searchfield = $new_category; |
152 |
} elsif ($op eq 'cud-add_category' ) { |
158 |
} elsif ($op eq 'cud-add_category' ) { |
153 |
my $new_category = $input->param('category'); |
159 |
my $new_category = $input->param('category'); |
|
|
160 |
my $parent = $input->param('parent') || undef; |
154 |
|
161 |
|
155 |
my $already_exists = Koha::AuthorisedValueCategories->find( |
162 |
my $already_exists = Koha::AuthorisedValueCategories->find( |
156 |
{ |
163 |
{ |
Lines 166-174
if ($op eq 'add_form') {
Link Here
|
166 |
} |
173 |
} |
167 |
} |
174 |
} |
168 |
else { # Insert |
175 |
else { # Insert |
169 |
my $av = Koha::AuthorisedValueCategory->new( { |
176 |
my $av = Koha::AuthorisedValueCategory->new( |
170 |
category_name => $new_category, |
177 |
{ |
171 |
} ); |
178 |
category_name => $new_category, |
|
|
179 |
parent => $parent, |
180 |
} |
181 |
); |
172 |
|
182 |
|
173 |
eval { |
183 |
eval { |
174 |
$av->store; |
184 |
$av->store; |
Lines 206-226
if ($op eq 'add_form') {
Link Here
|
206 |
$op = 'list'; |
216 |
$op = 'list'; |
207 |
} |
217 |
} |
208 |
|
218 |
|
|
|
219 |
my $avc = Koha::AuthorisedValueCategories->find( $searchfield ); |
220 |
|
209 |
$template->param( |
221 |
$template->param( |
210 |
op => $op, |
222 |
op => $op, |
211 |
searchfield => $searchfield, |
223 |
searchfield => $searchfield, |
212 |
messages => \@messages, |
224 |
messages => \@messages, |
|
|
225 |
avc => $avc, |
213 |
); |
226 |
); |
214 |
|
227 |
|
215 |
if ( $op eq 'list' ) { |
228 |
if ( $op eq 'list' ) { |
216 |
# build categories list |
229 |
# build categories list |
217 |
my @category_names = Koha::AuthorisedValueCategories->search( |
230 |
my @category_names = Koha::AuthorisedValueCategories->search( |
218 |
{ |
231 |
{ category_name => { -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } }, |
219 |
category_name => |
232 |
{ order_by => ['category_name'] } |
220 |
{ -not_in => [ '', 'branches', 'itemtypes', 'cn_source' ] } |
233 |
)->as_list; |
221 |
}, |
|
|
222 |
{ order_by => ['category_name'] } |
223 |
)->get_column('category_name'); |
224 |
|
234 |
|
225 |
$searchfield ||= ""; |
235 |
$searchfield ||= ""; |
226 |
|
236 |
|