Lines 73-78
$cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY );
Link Here
|
73 |
if ($op eq 'delete') { |
73 |
if ($op eq 'delete') { |
74 |
my $itemtype = $input->param('itemtype'); |
74 |
my $itemtype = $input->param('itemtype'); |
75 |
my $categorycode = $input->param('categorycode'); |
75 |
my $categorycode = $input->param('categorycode'); |
|
|
76 |
my $onsite_checkout = $input->param('onsite_checkout') eq '' ? undef : $input->param('onsite_checkout'); |
77 |
|
76 |
$debug and warn "deleting $1 $2 $branch"; |
78 |
$debug and warn "deleting $1 $2 $branch"; |
77 |
|
79 |
|
78 |
Koha::CirculationRules->set_rules( |
80 |
Koha::CirculationRules->set_rules( |
Lines 80-88
if ($op eq 'delete') {
Link Here
|
80 |
categorycode => $categorycode eq '*' ? undef : $categorycode, |
82 |
categorycode => $categorycode eq '*' ? undef : $categorycode, |
81 |
branchcode => $branch eq '*' ? undef : $branch, |
83 |
branchcode => $branch eq '*' ? undef : $branch, |
82 |
itemtype => $itemtype eq '*' ? undef : $itemtype, |
84 |
itemtype => $itemtype eq '*' ? undef : $itemtype, |
|
|
85 |
rules => { |
86 |
reservesallowed => undef, |
87 |
holds_per_record => undef, |
88 |
holds_per_day => undef, |
89 |
onshelfholds => undef, |
90 |
opacitemholds => undef, |
91 |
article_requests => undef, |
92 |
} |
93 |
} |
94 |
); |
95 |
Koha::CirculationRules->set_rules( |
96 |
{ |
97 |
categorycode => $categorycode eq '*' ? undef : $categorycode, |
98 |
branchcode => $branch eq '*' ? undef : $branch, |
99 |
itemtype => $itemtype eq '*' ? undef : $itemtype, |
100 |
onsite_checkout => $onsite_checkout eq '*' ? undef : $onsite_checkout, |
83 |
rules => { |
101 |
rules => { |
84 |
maxissueqty => undef, |
102 |
maxissueqty => undef, |
85 |
maxonsiteissueqty => undef, |
|
|
86 |
rentaldiscount => undef, |
103 |
rentaldiscount => undef, |
87 |
fine => undef, |
104 |
fine => undef, |
88 |
finedays => undef, |
105 |
finedays => undef, |
Lines 102-115
if ($op eq 'delete') {
Link Here
|
102 |
auto_renew => undef, |
119 |
auto_renew => undef, |
103 |
no_auto_renewal_after => undef, |
120 |
no_auto_renewal_after => undef, |
104 |
no_auto_renewal_after_hard_limit => undef, |
121 |
no_auto_renewal_after_hard_limit => undef, |
105 |
reservesallowed => undef, |
|
|
106 |
holds_per_record => undef, |
107 |
holds_per_day => undef, |
108 |
onshelfholds => undef, |
109 |
opacitemholds => undef, |
110 |
overduefinescap => undef, |
122 |
overduefinescap => undef, |
111 |
cap_fine_to_replacement_price => undef, |
123 |
cap_fine_to_replacement_price => undef, |
112 |
article_requests => undef, |
|
|
113 |
note => undef, |
124 |
note => undef, |
114 |
} |
125 |
} |
115 |
} |
126 |
} |
Lines 125-132
elsif ($op eq 'delete-branch-cat') {
Link Here
|
125 |
categorycode => undef, |
136 |
categorycode => undef, |
126 |
rules => { |
137 |
rules => { |
127 |
max_holds => undef, |
138 |
max_holds => undef, |
128 |
patron_maxissueqty => undef, |
139 |
} |
129 |
patron_maxonsiteissueqty => undef, |
140 |
} |
|
|
141 |
); |
142 |
Koha::CirculationRules->set_rules( |
143 |
{ |
144 |
branchcode => undef, |
145 |
categorycode => undef, |
146 |
onsite_checkout => 0, |
147 |
rules => { |
148 |
patron_maxissueqty => undef, |
149 |
} |
150 |
} |
151 |
); |
152 |
Koha::CirculationRules->set_rules( |
153 |
{ |
154 |
branchcode => undef, |
155 |
categorycode => undef, |
156 |
onsite_checkout => 1, |
157 |
rules => { |
158 |
patron_maxissueqty => undef, |
130 |
} |
159 |
} |
131 |
} |
160 |
} |
132 |
); |
161 |
); |
Lines 148-155
elsif ($op eq 'delete-branch-cat') {
Link Here
|
148 |
branchcode => undef, |
177 |
branchcode => undef, |
149 |
rules => { |
178 |
rules => { |
150 |
max_holds => undef, |
179 |
max_holds => undef, |
|
|
180 |
} |
181 |
} |
182 |
); |
183 |
Koha::CirculationRules->set_rules( |
184 |
{ |
185 |
categorycode => $categorycode, |
186 |
branchcode => undef, |
187 |
onsite_checkout => 0, |
188 |
rules => { |
189 |
patron_maxissueqty => undef, |
190 |
} |
191 |
} |
192 |
); |
193 |
Koha::CirculationRules->set_rules( |
194 |
{ |
195 |
categorycode => $categorycode, |
196 |
branchcode => undef, |
197 |
onsite_checkout => 1, |
198 |
rules => { |
151 |
patron_maxissueqty => undef, |
199 |
patron_maxissueqty => undef, |
152 |
patron_maxonsiteissueqty => undef, |
|
|
153 |
} |
200 |
} |
154 |
} |
201 |
} |
155 |
); |
202 |
); |
Lines 159-168
elsif ($op eq 'delete-branch-cat') {
Link Here
|
159 |
{ |
206 |
{ |
160 |
branchcode => $branch, |
207 |
branchcode => $branch, |
161 |
categorycode => undef, |
208 |
categorycode => undef, |
|
|
209 |
onsite_checkout => 0, |
210 |
rules => { |
211 |
patron_maxissueqty => undef, |
212 |
} |
213 |
} |
214 |
); |
215 |
Koha::CirculationRules->set_rules( |
216 |
{ |
217 |
branchcode => $branch, |
218 |
categorycode => undef, |
219 |
onsite_checkout => 1, |
162 |
rules => { |
220 |
rules => { |
163 |
max_holds => undef, |
221 |
max_holds => undef, |
164 |
patron_maxissueqty => undef, |
222 |
patron_maxissueqty => undef, |
165 |
patron_maxonsiteissueqty => undef, |
|
|
166 |
} |
223 |
} |
167 |
} |
224 |
} |
168 |
); |
225 |
); |
Lines 184-191
elsif ($op eq 'delete-branch-cat') {
Link Here
|
184 |
branchcode => $branch, |
241 |
branchcode => $branch, |
185 |
rules => { |
242 |
rules => { |
186 |
max_holds => undef, |
243 |
max_holds => undef, |
187 |
patron_maxissueqty => undef, |
244 |
} |
188 |
patron_maxonsiteissueqty => undef, |
245 |
} |
|
|
246 |
); |
247 |
Koha::CirculationRules->set_rules( |
248 |
{ |
249 |
categorycode => $categorycode, |
250 |
branchcode => $branch, |
251 |
onsite_checkout => 0, |
252 |
rules => { |
253 |
patron_maxissueqty => undef, |
254 |
} |
255 |
} |
256 |
); |
257 |
Koha::CirculationRules->set_rules( |
258 |
{ |
259 |
categorycode => $categorycode, |
260 |
branchcode => $branch, |
261 |
onsite_checkout => 1, |
262 |
rules => { |
263 |
patron_maxissueqty => undef, |
189 |
} |
264 |
} |
190 |
} |
265 |
} |
191 |
); |
266 |
); |
Lines 250-255
elsif ($op eq 'add') {
Link Here
|
250 |
my $br = $branch; # branch |
325 |
my $br = $branch; # branch |
251 |
my $bor = $input->param('categorycode'); # borrower category |
326 |
my $bor = $input->param('categorycode'); # borrower category |
252 |
my $itemtype = $input->param('itemtype'); # item type |
327 |
my $itemtype = $input->param('itemtype'); # item type |
|
|
328 |
my $onsite_checkout = $input->param('onsite_checkout'); |
253 |
my $fine = $input->param('fine'); |
329 |
my $fine = $input->param('fine'); |
254 |
my $finedays = $input->param('finedays'); |
330 |
my $finedays = $input->param('finedays'); |
255 |
my $maxsuspensiondays = $input->param('maxsuspensiondays') || ''; |
331 |
my $maxsuspensiondays = $input->param('maxsuspensiondays') || ''; |
Lines 258-264
elsif ($op eq 'add') {
Link Here
|
258 |
my $chargeperiod = $input->param('chargeperiod'); |
334 |
my $chargeperiod = $input->param('chargeperiod'); |
259 |
my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at'); |
335 |
my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at'); |
260 |
my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') ); |
336 |
my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') ); |
261 |
my $maxonsiteissueqty = strip_non_numeric( scalar $input->param('maxonsiteissueqty') ); |
|
|
262 |
my $renewalsallowed = $input->param('renewalsallowed'); |
337 |
my $renewalsallowed = $input->param('renewalsallowed'); |
263 |
my $renewalperiod = $input->param('renewalperiod'); |
338 |
my $renewalperiod = $input->param('renewalperiod'); |
264 |
my $norenewalbefore = $input->param('norenewalbefore'); |
339 |
my $norenewalbefore = $input->param('norenewalbefore'); |
Lines 287-297
elsif ($op eq 'add') {
Link Here
|
287 |
my $overduefinescap = $input->param('overduefinescap') || ''; |
362 |
my $overduefinescap = $input->param('overduefinescap') || ''; |
288 |
my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on'; |
363 |
my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on'; |
289 |
my $note = $input->param('note'); |
364 |
my $note = $input->param('note'); |
290 |
$debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price"; |
365 |
$debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $cap_fine_to_replacement_price"; |
291 |
|
366 |
|
292 |
my $rules = { |
367 |
my $rules = { |
293 |
maxissueqty => $maxissueqty, |
368 |
maxissueqty => $maxissueqty, |
294 |
maxonsiteissueqty => $maxonsiteissueqty, |
|
|
295 |
rentaldiscount => $rentaldiscount, |
369 |
rentaldiscount => $rentaldiscount, |
296 |
fine => $fine, |
370 |
fine => $fine, |
297 |
finedays => $finedays, |
371 |
finedays => $finedays, |
Lines 311-325
elsif ($op eq 'add') {
Link Here
|
311 |
auto_renew => $auto_renew, |
385 |
auto_renew => $auto_renew, |
312 |
no_auto_renewal_after => $no_auto_renewal_after, |
386 |
no_auto_renewal_after => $no_auto_renewal_after, |
313 |
no_auto_renewal_after_hard_limit => $no_auto_renewal_after_hard_limit, |
387 |
no_auto_renewal_after_hard_limit => $no_auto_renewal_after_hard_limit, |
|
|
388 |
overduefinescap => $overduefinescap, |
389 |
cap_fine_to_replacement_price => $cap_fine_to_replacement_price, |
390 |
note => $note, |
391 |
}; |
392 |
|
393 |
Koha::CirculationRules->set_rules( |
394 |
{ |
395 |
categorycode => $bor eq '*' ? undef : $bor, |
396 |
itemtype => $itemtype eq '*' ? undef : $itemtype, |
397 |
branchcode => $br eq '*' ? undef : $br, |
398 |
onsite_checkout => $onsite_checkout eq '*' ? undef : $onsite_checkout, |
399 |
rules => $rules, |
400 |
} |
401 |
); |
402 |
|
403 |
$rules = { |
314 |
reservesallowed => $reservesallowed, |
404 |
reservesallowed => $reservesallowed, |
315 |
holds_per_record => $holds_per_record, |
405 |
holds_per_record => $holds_per_record, |
316 |
holds_per_day => $holds_per_day, |
406 |
holds_per_day => $holds_per_day, |
317 |
onshelfholds => $onshelfholds, |
407 |
onshelfholds => $onshelfholds, |
318 |
opacitemholds => $opacitemholds, |
408 |
opacitemholds => $opacitemholds, |
319 |
overduefinescap => $overduefinescap, |
|
|
320 |
cap_fine_to_replacement_price => $cap_fine_to_replacement_price, |
321 |
article_requests => $article_requests, |
409 |
article_requests => $article_requests, |
322 |
note => $note, |
|
|
323 |
}; |
410 |
}; |
324 |
|
411 |
|
325 |
Koha::CirculationRules->set_rules( |
412 |
Koha::CirculationRules->set_rules( |
Lines 335-342
elsif ($op eq 'add') {
Link Here
|
335 |
elsif ($op eq "set-branch-defaults") { |
422 |
elsif ($op eq "set-branch-defaults") { |
336 |
my $categorycode = $input->param('categorycode'); |
423 |
my $categorycode = $input->param('categorycode'); |
337 |
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') ); |
424 |
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') ); |
338 |
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); |
425 |
my $patron_maxonsiteissueqty = strip_non_numeric( scalar $input->param('patron_maxonsiteissueqty') ); |
339 |
$patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty); |
|
|
340 |
my $holdallowed = $input->param('holdallowed'); |
426 |
my $holdallowed = $input->param('holdallowed'); |
341 |
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); |
427 |
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); |
342 |
my $returnbranch = $input->param('returnbranch'); |
428 |
my $returnbranch = $input->param('returnbranch'); |
Lines 358-366
elsif ($op eq "set-branch-defaults") {
Link Here
|
358 |
{ |
444 |
{ |
359 |
categorycode => undef, |
445 |
categorycode => undef, |
360 |
branchcode => undef, |
446 |
branchcode => undef, |
|
|
447 |
onsite_checkout => 0, |
361 |
rules => { |
448 |
rules => { |
362 |
patron_maxissueqty => $patron_maxissueqty, |
449 |
patron_maxissueqty => $patron_maxissueqty, |
363 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
450 |
} |
|
|
451 |
} |
452 |
); |
453 |
Koha::CirculationRules->set_rules( |
454 |
{ |
455 |
categorycode => undef, |
456 |
branchcode => undef, |
457 |
onsite_checkout => 1, |
458 |
rules => { |
459 |
patron_maxissueqty => $patron_maxonsiteissueqty, |
364 |
} |
460 |
} |
365 |
} |
461 |
} |
366 |
); |
462 |
); |
Lines 380-388
elsif ($op eq "set-branch-defaults") {
Link Here
|
380 |
{ |
476 |
{ |
381 |
categorycode => undef, |
477 |
categorycode => undef, |
382 |
branchcode => $branch, |
478 |
branchcode => $branch, |
|
|
479 |
onsite_checkout => 0, |
383 |
rules => { |
480 |
rules => { |
384 |
patron_maxissueqty => $patron_maxissueqty, |
481 |
patron_maxissueqty => $patron_maxissueqty, |
385 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
482 |
} |
|
|
483 |
} |
484 |
); |
485 |
Koha::CirculationRules->set_rules( |
486 |
{ |
487 |
categorycode => undef, |
488 |
branchcode => $branch, |
489 |
onsite_checkout => 1, |
490 |
rules => { |
491 |
patron_maxissueqty => $patron_maxonsiteissueqty, |
386 |
} |
492 |
} |
387 |
} |
493 |
} |
388 |
); |
494 |
); |
Lines 399-406
elsif ($op eq "set-branch-defaults") {
Link Here
|
399 |
elsif ($op eq "add-branch-cat") { |
505 |
elsif ($op eq "add-branch-cat") { |
400 |
my $categorycode = $input->param('categorycode'); |
506 |
my $categorycode = $input->param('categorycode'); |
401 |
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') ); |
507 |
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') ); |
402 |
my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty'); |
508 |
my $patron_maxonsiteissueqty = strip_non_numeric( scalar $input->param('patron_maxonsiteissueqty') ); |
403 |
$patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty); |
|
|
404 |
my $max_holds = $input->param('max_holds'); |
509 |
my $max_holds = $input->param('max_holds'); |
405 |
$max_holds =~ s/\s//g; |
510 |
$max_holds =~ s/\s//g; |
406 |
$max_holds = undef if $max_holds !~ /^\d+/; |
511 |
$max_holds = undef if $max_holds !~ /^\d+/; |
Lines 413-420
elsif ($op eq "add-branch-cat") {
Link Here
|
413 |
branchcode => undef, |
518 |
branchcode => undef, |
414 |
rules => { |
519 |
rules => { |
415 |
max_holds => $max_holds, |
520 |
max_holds => $max_holds, |
|
|
521 |
} |
522 |
} |
523 |
); |
524 |
Koha::CirculationRules->set_rules( |
525 |
{ |
526 |
categorycode => undef, |
527 |
branchcode => undef, |
528 |
onsite_checkout => 0, |
529 |
rules => { |
416 |
patron_maxissueqty => $patron_maxissueqty, |
530 |
patron_maxissueqty => $patron_maxissueqty, |
417 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
531 |
} |
|
|
532 |
} |
533 |
); |
534 |
Koha::CirculationRules->set_rules( |
535 |
{ |
536 |
categorycode => undef, |
537 |
branchcode => undef, |
538 |
onsite_checkout => 1, |
539 |
rules => { |
540 |
patron_maxissueqty => $patron_maxonsiteissueqty, |
418 |
} |
541 |
} |
419 |
} |
542 |
} |
420 |
); |
543 |
); |
Lines 425-432
elsif ($op eq "add-branch-cat") {
Link Here
|
425 |
branchcode => undef, |
548 |
branchcode => undef, |
426 |
rules => { |
549 |
rules => { |
427 |
max_holds => $max_holds, |
550 |
max_holds => $max_holds, |
|
|
551 |
} |
552 |
} |
553 |
); |
554 |
Koha::CirculationRules->set_rules( |
555 |
{ |
556 |
categorycode => $categorycode, |
557 |
branchcode => undef, |
558 |
onsite_checkout => 0, |
559 |
rules => { |
428 |
patron_maxissueqty => $patron_maxissueqty, |
560 |
patron_maxissueqty => $patron_maxissueqty, |
429 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
561 |
} |
|
|
562 |
} |
563 |
); |
564 |
Koha::CirculationRules->set_rules( |
565 |
{ |
566 |
categorycode => $categorycode, |
567 |
branchcode => undef, |
568 |
onsite_checkout => 1, |
569 |
rules => { |
570 |
patron_maxissueqty => $patron_maxonsiteissueqty, |
430 |
} |
571 |
} |
431 |
} |
572 |
} |
432 |
); |
573 |
); |
Lines 438-445
elsif ($op eq "add-branch-cat") {
Link Here
|
438 |
branchcode => $branch, |
579 |
branchcode => $branch, |
439 |
rules => { |
580 |
rules => { |
440 |
max_holds => $max_holds, |
581 |
max_holds => $max_holds, |
|
|
582 |
} |
583 |
} |
584 |
); |
585 |
Koha::CirculationRules->set_rules( |
586 |
{ |
587 |
categorycode => undef, |
588 |
branchcode => $branch, |
589 |
onsite_checkout => 0, |
590 |
rules => { |
441 |
patron_maxissueqty => $patron_maxissueqty, |
591 |
patron_maxissueqty => $patron_maxissueqty, |
442 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
592 |
} |
|
|
593 |
} |
594 |
); |
595 |
Koha::CirculationRules->set_rules( |
596 |
{ |
597 |
categorycode => undef, |
598 |
branchcode => $branch, |
599 |
onsite_checkout => 1, |
600 |
rules => { |
601 |
patron_maxissueqty => $patron_maxonsiteissueqty, |
443 |
} |
602 |
} |
444 |
} |
603 |
} |
445 |
); |
604 |
); |
Lines 450-457
elsif ($op eq "add-branch-cat") {
Link Here
|
450 |
branchcode => $branch, |
609 |
branchcode => $branch, |
451 |
rules => { |
610 |
rules => { |
452 |
max_holds => $max_holds, |
611 |
max_holds => $max_holds, |
|
|
612 |
} |
613 |
} |
614 |
); |
615 |
Koha::CirculationRules->set_rules( |
616 |
{ |
617 |
categorycode => $categorycode, |
618 |
branchcode => $branch, |
619 |
onsite_checkout => 0, |
620 |
rules => { |
453 |
patron_maxissueqty => $patron_maxissueqty, |
621 |
patron_maxissueqty => $patron_maxissueqty, |
454 |
patron_maxonsiteissueqty => $patron_maxonsiteissueqty, |
622 |
} |
|
|
623 |
} |
624 |
); |
625 |
Koha::CirculationRules->set_rules( |
626 |
{ |
627 |
categorycode => $categorycode, |
628 |
branchcode => $branch, |
629 |
onsite_checkout => 1, |
630 |
rules => { |
631 |
patron_maxissueqty => $patron_maxonsiteissueqty, |
455 |
} |
632 |
} |
456 |
} |
633 |
} |
457 |
); |
634 |
); |
Lines 562-568
my $definedbranch = $all_rules->count ? 1 : 0;
Link Here
|
562 |
my $rules = {}; |
739 |
my $rules = {}; |
563 |
while ( my $r = $all_rules->next ) { |
740 |
while ( my $r = $all_rules->next ) { |
564 |
$r = $r->unblessed; |
741 |
$r = $r->unblessed; |
565 |
$rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value}; |
742 |
$rules->{ $r->{onsite_checkout} // '' }->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value}; |
566 |
} |
743 |
} |
567 |
|
744 |
|
568 |
$template->param(show_branch_cat_rule_form => 1); |
745 |
$template->param(show_branch_cat_rule_form => 1); |