Lines 78-119
elsif ($op eq 'delete-branch-cat') {
Link Here
|
78 |
my $categorycode = $input->param('categorycode'); |
78 |
my $categorycode = $input->param('categorycode'); |
79 |
if ($branch eq "*") { |
79 |
if ($branch eq "*") { |
80 |
if ($categorycode eq "*") { |
80 |
if ($categorycode eq "*") { |
81 |
my $sth_delete = $dbh->prepare("DELETE FROM default_circ_rules"); |
81 |
Koha::CirculationRules->set_rules( |
82 |
$sth_delete->execute(); |
82 |
{ |
|
|
83 |
categorycode => undef, |
84 |
branchcode => undef, |
85 |
itemtype => undef, |
86 |
rules => { |
87 |
patron_maxissueqty => undef, |
88 |
patron_maxonsiteissueqty => undef, |
89 |
holdallowed => undef, |
90 |
hold_fulfillment_policy => undef, |
91 |
returnbranch => undef, |
92 |
} |
93 |
} |
94 |
); |
95 |
} else { |
96 |
Koha::CirculationRules->set_rules( |
97 |
{ |
98 |
categorycode => $categorycode, |
99 |
branchcode => undef, |
100 |
itemtype => undef, |
101 |
rules => { |
102 |
max_holds => undef, |
103 |
patron_maxissueqty => undef, |
104 |
patron_maxonsiteissueqty => undef, |
105 |
} |
106 |
} |
107 |
); |
83 |
} |
108 |
} |
84 |
} elsif ($categorycode eq "*") { |
109 |
} elsif ($categorycode eq "*") { |
85 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_circ_rules |
110 |
Koha::CirculationRules->set_rules( |
86 |
WHERE branchcode = ?"); |
111 |
{ |
87 |
$sth_delete->execute($branch); |
112 |
categorycode => undef, |
88 |
} |
113 |
branchcode => $branch, |
89 |
Koha::CirculationRules->set_rules( |
114 |
itemtype => undef, |
90 |
{ |
115 |
rules => { |
91 |
categorycode => $categorycode eq '*' ? undef : $categorycode, |
116 |
patron_maxissueqty => undef, |
92 |
branchcode => $branch eq '*' ? undef : $branch, |
117 |
patron_maxonsiteissueqty => undef, |
93 |
itemtype => undef, |
118 |
holdallowed => undef, |
94 |
rules => { |
119 |
hold_fulfillment_policy => undef, |
95 |
max_holds => undef, |
120 |
returnbranch => undef, |
96 |
maxissueqty => undef, |
121 |
} |
97 |
maxonsiteissueqty => undef, |
|
|
98 |
} |
122 |
} |
99 |
} |
123 |
); |
100 |
); |
124 |
} else { |
|
|
125 |
Koha::CirculationRules->set_rules( |
126 |
{ |
127 |
categorycode => $categorycode, |
128 |
branchcode => $branch, |
129 |
itemtype => undef, |
130 |
rules => { |
131 |
max_holds => undef, |
132 |
patron_maxissueqty => undef, |
133 |
patron_maxonsiteissueqty => undef, |
134 |
} |
135 |
} |
136 |
); |
137 |
} |
101 |
} |
138 |
} |
102 |
elsif ($op eq 'delete-branch-item') { |
139 |
elsif ($op eq 'delete-branch-item') { |
103 |
my $itemtype = $input->param('itemtype'); |
140 |
my $itemtype = $input->param('itemtype'); |
104 |
if ($branch eq "*") { |
141 |
if ($branch eq "*") { |
105 |
if ($itemtype eq "*") { |
142 |
if ($itemtype eq "*") { |
106 |
my $sth_delete = $dbh->prepare("DELETE FROM default_circ_rules"); |
143 |
Koha::CirculationRules->set_rules( |
107 |
$sth_delete->execute(); |
144 |
{ |
|
|
145 |
categorycode => undef, |
146 |
branchcode => undef, |
147 |
itemtype => undef, |
148 |
rules => { |
149 |
patron_maxissueqty => undef, |
150 |
patron_maxonsiteissueqty => undef, |
151 |
holdallowed => undef, |
152 |
hold_fulfillment_policy => undef, |
153 |
returnbranch => undef, |
154 |
} |
155 |
} |
156 |
); |
108 |
} else { |
157 |
} else { |
109 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_item_rules |
158 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_item_rules |
110 |
WHERE itemtype = ?"); |
159 |
WHERE itemtype = ?"); |
111 |
$sth_delete->execute($itemtype); |
160 |
$sth_delete->execute($itemtype); |
112 |
} |
161 |
} |
113 |
} elsif ($itemtype eq "*") { |
162 |
} elsif ($itemtype eq "*") { |
114 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_circ_rules |
163 |
Koha::CirculationRules->set_rules( |
115 |
WHERE branchcode = ?"); |
164 |
{ |
116 |
$sth_delete->execute($branch); |
165 |
categorycode => undef, |
|
|
166 |
branchcode => $branch, |
167 |
itemtype => undef, |
168 |
rules => { |
169 |
patron_maxissueqty => undef, |
170 |
patron_maxonsiteissueqty => undef, |
171 |
holdallowed => undef, |
172 |
hold_fulfillment_policy => undef, |
173 |
returnbranch => undef, |
174 |
} |
175 |
} |
176 |
); |
117 |
} else { |
177 |
} else { |
118 |
my $sth_delete = $dbh->prepare("DELETE FROM branch_item_rules |
178 |
my $sth_delete = $dbh->prepare("DELETE FROM branch_item_rules |
119 |
WHERE branchcode = ? |
179 |
WHERE branchcode = ? |
Lines 218-233
elsif ($op eq 'add') {
Link Here
|
218 |
} |
278 |
} |
219 |
elsif ($op eq "set-branch-defaults") { |
279 |
elsif ($op eq "set-branch-defaults") { |
220 |
my $categorycode = $input->param('categorycode'); |
280 |
my $categorycode = $input->param('categorycode'); |
221 |
my $maxissueqty = $input->param('maxissueqty'); |
281 |
my $patron_maxissueqty = $input->param('patron_maxissueqty'); |
222 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
282 |
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); |
223 |
my $holdallowed = $input->param('holdallowed'); |
283 |
my $holdallowed = $input->param('holdallowed'); |
224 |
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); |
284 |
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); |
225 |
my $returnbranch = $input->param('returnbranch'); |
285 |
my $returnbranch = $input->param('returnbranch'); |
226 |
my $max_holds = $input->param('max_holds'); |
286 |
my $max_holds = $input->param('max_holds'); |
227 |
$maxissueqty =~ s/\s//g; |
287 |
$patron_maxissueqty =~ s/\s//g; |
228 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
288 |
$patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/; |
229 |
$maxonsiteissueqty =~ s/\s//g; |
289 |
$patron_maxonsiteissueqty =~ s/\s//g; |
230 |
$maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; |
290 |
$patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/; |
231 |
$holdallowed =~ s/\s//g; |
291 |
$holdallowed =~ s/\s//g; |
232 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
292 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
233 |
$max_holds =~ s/\s//g; |
293 |
$max_holds =~ s/\s//g; |
Lines 256-263
elsif ($op eq "set-branch-defaults") {
Link Here
|
256 |
itemtype => undef, |
316 |
itemtype => undef, |
257 |
branchcode => undef, |
317 |
branchcode => undef, |
258 |
rules => { |
318 |
rules => { |
259 |
maxissueqty => $maxissueqty, |
319 |
patron_maxissueqty => $patron_maxissueqty, |
260 |
maxonsiteissueqty => $maxonsiteissueqty, |
320 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
|
|
321 |
holdallowed => $holdallowed, |
322 |
hold_fulfillment_policy => $hold_fulfillment_policy, |
323 |
returnbranch => $returnbranch, |
261 |
} |
324 |
} |
262 |
} |
325 |
} |
263 |
); |
326 |
); |
Lines 285-292
elsif ($op eq "set-branch-defaults") {
Link Here
|
285 |
itemtype => undef, |
348 |
itemtype => undef, |
286 |
branchcode => $branch, |
349 |
branchcode => $branch, |
287 |
rules => { |
350 |
rules => { |
288 |
maxissueqty => $maxissueqty, |
351 |
patron_maxissueqty => $patron_maxissueqty, |
289 |
maxonsiteissueqty => $maxonsiteissueqty, |
352 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
|
|
353 |
holdallowed => $holdallowed, |
354 |
hold_fulfillment_policy => $hold_fulfillment_policy, |
355 |
returnbranch => $returnbranch, |
290 |
} |
356 |
} |
291 |
} |
357 |
} |
292 |
); |
358 |
); |
Lines 303-315
elsif ($op eq "set-branch-defaults") {
Link Here
|
303 |
} |
369 |
} |
304 |
elsif ($op eq "add-branch-cat") { |
370 |
elsif ($op eq "add-branch-cat") { |
305 |
my $categorycode = $input->param('categorycode'); |
371 |
my $categorycode = $input->param('categorycode'); |
306 |
my $maxissueqty = $input->param('maxissueqty'); |
372 |
my $patron_maxissueqty = $input->param('patron_maxissueqty'); |
307 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
373 |
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); |
308 |
my $max_holds = $input->param('max_holds'); |
374 |
my $max_holds = $input->param('max_holds'); |
309 |
$maxissueqty =~ s/\s//g; |
375 |
$patron_maxissueqty =~ s/\s//g; |
310 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
376 |
$patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/; |
311 |
$maxonsiteissueqty =~ s/\s//g; |
377 |
$patron_maxonsiteissueqty =~ s/\s//g; |
312 |
$maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; |
378 |
$patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/; |
313 |
$max_holds =~ s/\s//g; |
379 |
$max_holds =~ s/\s//g; |
314 |
$max_holds = undef if $max_holds !~ /^\d+/; |
380 |
$max_holds = undef if $max_holds !~ /^\d+/; |
315 |
|
381 |
|
Lines 322-329
elsif ($op eq "add-branch-cat") {
Link Here
|
322 |
branchcode => undef, |
388 |
branchcode => undef, |
323 |
rules => { |
389 |
rules => { |
324 |
max_holds => $max_holds, |
390 |
max_holds => $max_holds, |
325 |
maxissueqty => $maxissueqty, |
391 |
patron_maxissueqty => $patron_maxissueqty, |
326 |
maxonsiteissueqty => $maxonsiteissueqty, |
392 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
327 |
} |
393 |
} |
328 |
} |
394 |
} |
329 |
); |
395 |
); |
Lines 335-342
elsif ($op eq "add-branch-cat") {
Link Here
|
335 |
itemtype => undef, |
401 |
itemtype => undef, |
336 |
rules => { |
402 |
rules => { |
337 |
max_holds => $max_holds, |
403 |
max_holds => $max_holds, |
338 |
maxissueqty => $maxissueqty, |
404 |
patron_maxissueqty => $patron_maxissueqty, |
339 |
maxonsiteissueqty => $maxonsiteissueqty, |
405 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
340 |
} |
406 |
} |
341 |
} |
407 |
} |
342 |
); |
408 |
); |
Lines 349-356
elsif ($op eq "add-branch-cat") {
Link Here
|
349 |
branchcode => $branch, |
415 |
branchcode => $branch, |
350 |
rules => { |
416 |
rules => { |
351 |
max_holds => $max_holds, |
417 |
max_holds => $max_holds, |
352 |
maxissueqty => $maxissueqty, |
418 |
patron_maxissueqty => $patron_maxissueqty, |
353 |
maxonsiteissueqty => $maxonsiteissueqty, |
419 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
354 |
} |
420 |
} |
355 |
} |
421 |
} |
356 |
); |
422 |
); |
Lines 362-369
elsif ($op eq "add-branch-cat") {
Link Here
|
362 |
branchcode => $branch, |
428 |
branchcode => $branch, |
363 |
rules => { |
429 |
rules => { |
364 |
max_holds => $max_holds, |
430 |
max_holds => $max_holds, |
365 |
maxissueqty => $maxissueqty, |
431 |
patron_maxissueqty => $patron_maxissueqty, |
366 |
maxonsiteissueqty => $maxonsiteissueqty, |
432 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
367 |
} |
433 |
} |
368 |
} |
434 |
} |
369 |
); |
435 |
); |