|
Lines 85-126
elsif ($op eq 'delete-branch-cat') {
Link Here
|
| 85 |
my $categorycode = $input->param('categorycode'); |
85 |
my $categorycode = $input->param('categorycode'); |
| 86 |
if ($branch eq "*") { |
86 |
if ($branch eq "*") { |
| 87 |
if ($categorycode eq "*") { |
87 |
if ($categorycode eq "*") { |
| 88 |
my $sth_delete = $dbh->prepare("DELETE FROM default_circ_rules"); |
88 |
Koha::CirculationRules->set_rules( |
| 89 |
$sth_delete->execute(); |
89 |
{ |
|
|
90 |
categorycode => undef, |
| 91 |
branchcode => undef, |
| 92 |
itemtype => undef, |
| 93 |
rules => { |
| 94 |
patron_maxissueqty => undef, |
| 95 |
patron_maxonsiteissueqty => undef, |
| 96 |
holdallowed => undef, |
| 97 |
hold_fulfillment_policy => undef, |
| 98 |
returnbranch => undef, |
| 99 |
} |
| 100 |
} |
| 101 |
); |
| 102 |
} else { |
| 103 |
Koha::CirculationRules->set_rules( |
| 104 |
{ |
| 105 |
categorycode => $categorycode, |
| 106 |
branchcode => undef, |
| 107 |
itemtype => undef, |
| 108 |
rules => { |
| 109 |
max_holds => undef, |
| 110 |
patron_maxissueqty => undef, |
| 111 |
patron_maxonsiteissueqty => undef, |
| 112 |
} |
| 113 |
} |
| 114 |
); |
| 90 |
} |
115 |
} |
| 91 |
} elsif ($categorycode eq "*") { |
116 |
} elsif ($categorycode eq "*") { |
| 92 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_circ_rules |
117 |
Koha::CirculationRules->set_rules( |
| 93 |
WHERE branchcode = ?"); |
118 |
{ |
| 94 |
$sth_delete->execute($branch); |
119 |
categorycode => undef, |
| 95 |
} |
120 |
branchcode => $branch, |
| 96 |
Koha::CirculationRules->set_rules( |
121 |
itemtype => undef, |
| 97 |
{ |
122 |
rules => { |
| 98 |
categorycode => $categorycode eq '*' ? undef : $categorycode, |
123 |
patron_maxissueqty => undef, |
| 99 |
branchcode => $branch eq '*' ? undef : $branch, |
124 |
patron_maxonsiteissueqty => undef, |
| 100 |
itemtype => undef, |
125 |
holdallowed => undef, |
| 101 |
rules => { |
126 |
hold_fulfillment_policy => undef, |
| 102 |
max_holds => undef, |
127 |
returnbranch => undef, |
| 103 |
maxissueqty => undef, |
128 |
} |
| 104 |
maxonsiteissueqty => undef, |
|
|
| 105 |
} |
129 |
} |
| 106 |
} |
130 |
); |
| 107 |
); |
131 |
} else { |
|
|
132 |
Koha::CirculationRules->set_rules( |
| 133 |
{ |
| 134 |
categorycode => $categorycode, |
| 135 |
branchcode => $branch, |
| 136 |
itemtype => undef, |
| 137 |
rules => { |
| 138 |
max_holds => undef, |
| 139 |
patron_maxissueqty => undef, |
| 140 |
patron_maxonsiteissueqty => undef, |
| 141 |
} |
| 142 |
} |
| 143 |
); |
| 144 |
} |
| 108 |
} |
145 |
} |
| 109 |
elsif ($op eq 'delete-branch-item') { |
146 |
elsif ($op eq 'delete-branch-item') { |
| 110 |
my $itemtype = $input->param('itemtype'); |
147 |
my $itemtype = $input->param('itemtype'); |
| 111 |
if ($branch eq "*") { |
148 |
if ($branch eq "*") { |
| 112 |
if ($itemtype eq "*") { |
149 |
if ($itemtype eq "*") { |
| 113 |
my $sth_delete = $dbh->prepare("DELETE FROM default_circ_rules"); |
150 |
Koha::CirculationRules->set_rules( |
| 114 |
$sth_delete->execute(); |
151 |
{ |
|
|
152 |
categorycode => undef, |
| 153 |
branchcode => undef, |
| 154 |
itemtype => undef, |
| 155 |
rules => { |
| 156 |
patron_maxissueqty => undef, |
| 157 |
patron_maxonsiteissueqty => undef, |
| 158 |
holdallowed => undef, |
| 159 |
hold_fulfillment_policy => undef, |
| 160 |
returnbranch => undef, |
| 161 |
} |
| 162 |
} |
| 163 |
); |
| 115 |
} else { |
164 |
} else { |
| 116 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_item_rules |
165 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_item_rules |
| 117 |
WHERE itemtype = ?"); |
166 |
WHERE itemtype = ?"); |
| 118 |
$sth_delete->execute($itemtype); |
167 |
$sth_delete->execute($itemtype); |
| 119 |
} |
168 |
} |
| 120 |
} elsif ($itemtype eq "*") { |
169 |
} elsif ($itemtype eq "*") { |
| 121 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_circ_rules |
170 |
Koha::CirculationRules->set_rules( |
| 122 |
WHERE branchcode = ?"); |
171 |
{ |
| 123 |
$sth_delete->execute($branch); |
172 |
categorycode => undef, |
|
|
173 |
branchcode => $branch, |
| 174 |
itemtype => undef, |
| 175 |
rules => { |
| 176 |
patron_maxissueqty => undef, |
| 177 |
patron_maxonsiteissueqty => undef, |
| 178 |
holdallowed => undef, |
| 179 |
hold_fulfillment_policy => undef, |
| 180 |
returnbranch => undef, |
| 181 |
} |
| 182 |
} |
| 183 |
); |
| 124 |
} else { |
184 |
} else { |
| 125 |
my $sth_delete = $dbh->prepare("DELETE FROM branch_item_rules |
185 |
my $sth_delete = $dbh->prepare("DELETE FROM branch_item_rules |
| 126 |
WHERE branchcode = ? |
186 |
WHERE branchcode = ? |
|
Lines 225-240
elsif ($op eq 'add') {
Link Here
|
| 225 |
} |
285 |
} |
| 226 |
elsif ($op eq "set-branch-defaults") { |
286 |
elsif ($op eq "set-branch-defaults") { |
| 227 |
my $categorycode = $input->param('categorycode'); |
287 |
my $categorycode = $input->param('categorycode'); |
| 228 |
my $maxissueqty = $input->param('maxissueqty'); |
288 |
my $patron_maxissueqty = $input->param('patron_maxissueqty'); |
| 229 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
289 |
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); |
| 230 |
my $holdallowed = $input->param('holdallowed'); |
290 |
my $holdallowed = $input->param('holdallowed'); |
| 231 |
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); |
291 |
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); |
| 232 |
my $returnbranch = $input->param('returnbranch'); |
292 |
my $returnbranch = $input->param('returnbranch'); |
| 233 |
my $max_holds = $input->param('max_holds'); |
293 |
my $max_holds = $input->param('max_holds'); |
| 234 |
$maxissueqty =~ s/\s//g; |
294 |
$patron_maxissueqty =~ s/\s//g; |
| 235 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
295 |
$patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/; |
| 236 |
$maxonsiteissueqty =~ s/\s//g; |
296 |
$patron_maxonsiteissueqty =~ s/\s//g; |
| 237 |
$maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; |
297 |
$patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/; |
| 238 |
$holdallowed =~ s/\s//g; |
298 |
$holdallowed =~ s/\s//g; |
| 239 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
299 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
| 240 |
$max_holds =~ s/\s//g; |
300 |
$max_holds =~ s/\s//g; |
|
Lines 263-270
elsif ($op eq "set-branch-defaults") {
Link Here
|
| 263 |
itemtype => undef, |
323 |
itemtype => undef, |
| 264 |
branchcode => undef, |
324 |
branchcode => undef, |
| 265 |
rules => { |
325 |
rules => { |
| 266 |
maxissueqty => $maxissueqty, |
326 |
patron_maxissueqty => $patron_maxissueqty, |
| 267 |
maxonsiteissueqty => $maxonsiteissueqty, |
327 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
|
|
328 |
holdallowed => $holdallowed, |
| 329 |
hold_fulfillment_policy => $hold_fulfillment_policy, |
| 330 |
returnbranch => $returnbranch, |
| 268 |
} |
331 |
} |
| 269 |
} |
332 |
} |
| 270 |
); |
333 |
); |
|
Lines 292-299
elsif ($op eq "set-branch-defaults") {
Link Here
|
| 292 |
itemtype => undef, |
355 |
itemtype => undef, |
| 293 |
branchcode => $branch, |
356 |
branchcode => $branch, |
| 294 |
rules => { |
357 |
rules => { |
| 295 |
maxissueqty => $maxissueqty, |
358 |
patron_maxissueqty => $patron_maxissueqty, |
| 296 |
maxonsiteissueqty => $maxonsiteissueqty, |
359 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
|
|
360 |
holdallowed => $holdallowed, |
| 361 |
hold_fulfillment_policy => $hold_fulfillment_policy, |
| 362 |
returnbranch => $returnbranch, |
| 297 |
} |
363 |
} |
| 298 |
} |
364 |
} |
| 299 |
); |
365 |
); |
|
Lines 310-322
elsif ($op eq "set-branch-defaults") {
Link Here
|
| 310 |
} |
376 |
} |
| 311 |
elsif ($op eq "add-branch-cat") { |
377 |
elsif ($op eq "add-branch-cat") { |
| 312 |
my $categorycode = $input->param('categorycode'); |
378 |
my $categorycode = $input->param('categorycode'); |
| 313 |
my $maxissueqty = $input->param('maxissueqty'); |
379 |
my $patron_maxissueqty = $input->param('patron_maxissueqty'); |
| 314 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
380 |
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); |
| 315 |
my $max_holds = $input->param('max_holds'); |
381 |
my $max_holds = $input->param('max_holds'); |
| 316 |
$maxissueqty =~ s/\s//g; |
382 |
$patron_maxissueqty =~ s/\s//g; |
| 317 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
383 |
$patron_maxissueqty = undef if $patron_maxissueqty !~ /^\d+/; |
| 318 |
$maxonsiteissueqty =~ s/\s//g; |
384 |
$patron_maxonsiteissueqty =~ s/\s//g; |
| 319 |
$maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; |
385 |
$patron_maxonsiteissueqty = undef if $patron_maxonsiteissueqty !~ /^\d+/; |
| 320 |
$max_holds =~ s/\s//g; |
386 |
$max_holds =~ s/\s//g; |
| 321 |
$max_holds = undef if $max_holds !~ /^\d+/; |
387 |
$max_holds = undef if $max_holds !~ /^\d+/; |
| 322 |
|
388 |
|
|
Lines 329-336
elsif ($op eq "add-branch-cat") {
Link Here
|
| 329 |
branchcode => undef, |
395 |
branchcode => undef, |
| 330 |
rules => { |
396 |
rules => { |
| 331 |
max_holds => $max_holds, |
397 |
max_holds => $max_holds, |
| 332 |
maxissueqty => $maxissueqty, |
398 |
patron_maxissueqty => $patron_maxissueqty, |
| 333 |
maxonsiteissueqty => $maxonsiteissueqty, |
399 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
| 334 |
} |
400 |
} |
| 335 |
} |
401 |
} |
| 336 |
); |
402 |
); |
|
Lines 342-349
elsif ($op eq "add-branch-cat") {
Link Here
|
| 342 |
itemtype => undef, |
408 |
itemtype => undef, |
| 343 |
rules => { |
409 |
rules => { |
| 344 |
max_holds => $max_holds, |
410 |
max_holds => $max_holds, |
| 345 |
maxissueqty => $maxissueqty, |
411 |
patron_maxissueqty => $patron_maxissueqty, |
| 346 |
maxonsiteissueqty => $maxonsiteissueqty, |
412 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
| 347 |
} |
413 |
} |
| 348 |
} |
414 |
} |
| 349 |
); |
415 |
); |
|
Lines 356-363
elsif ($op eq "add-branch-cat") {
Link Here
|
| 356 |
branchcode => $branch, |
422 |
branchcode => $branch, |
| 357 |
rules => { |
423 |
rules => { |
| 358 |
max_holds => $max_holds, |
424 |
max_holds => $max_holds, |
| 359 |
maxissueqty => $maxissueqty, |
425 |
patron_maxissueqty => $patron_maxissueqty, |
| 360 |
maxonsiteissueqty => $maxonsiteissueqty, |
426 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
| 361 |
} |
427 |
} |
| 362 |
} |
428 |
} |
| 363 |
); |
429 |
); |
|
Lines 369-376
elsif ($op eq "add-branch-cat") {
Link Here
|
| 369 |
branchcode => $branch, |
435 |
branchcode => $branch, |
| 370 |
rules => { |
436 |
rules => { |
| 371 |
max_holds => $max_holds, |
437 |
max_holds => $max_holds, |
| 372 |
maxissueqty => $maxissueqty, |
438 |
patron_maxissueqty => $patron_maxissueqty, |
| 373 |
maxonsiteissueqty => $maxonsiteissueqty, |
439 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
| 374 |
} |
440 |
} |
| 375 |
} |
441 |
} |
| 376 |
); |
442 |
); |