|
Lines 230-235
our $RULE_KINDS = {
Link Here
|
| 230 |
has_priority => { |
230 |
has_priority => { |
| 231 |
scope => [ 'branchcode', 'categorycode' ], |
231 |
scope => [ 'branchcode', 'categorycode' ], |
| 232 |
}, |
232 |
}, |
|
|
233 |
|
| 233 |
# Not included (deprecated?): |
234 |
# Not included (deprecated?): |
| 234 |
# * accountsent |
235 |
# * accountsent |
| 235 |
# * reservecharge |
236 |
# * reservecharge |
|
Lines 299-317
sub get_effective_rule {
Link Here
|
| 299 |
$search_params, |
300 |
$search_params, |
| 300 |
{ |
301 |
{ |
| 301 |
order_by => $order_by, |
302 |
order_by => $order_by, |
| 302 |
rows => 1, |
303 |
rows => 1, |
| 303 |
} |
304 |
} |
| 304 |
)->single; |
305 |
)->single; |
| 305 |
|
306 |
|
| 306 |
if ( grep { $_ eq $rule_name } ( 'maxissueqty', 'maxonsiteissueqty' ) ) { |
307 |
if ( grep { $_ eq $rule_name } ( 'maxissueqty', 'maxonsiteissueqty' ) ) { |
| 307 |
if ( defined $priority_rule ) { |
308 |
if ( defined $priority_rule ) { |
| 308 |
if ( $priority_rule->rule_value > $rule->rule_value ) { |
309 |
return ( $priority_rule->rule_value > $rule->rule_value ) ? $rule : $priority_rule; |
| 309 |
return $rule; |
|
|
| 310 |
} |
| 311 |
return $priority_rule; |
| 312 |
} |
310 |
} |
| 313 |
} |
311 |
return $rule; |
| 314 |
else { |
312 |
} else { |
| 315 |
return defined $priority_rule ? $priority_rule : $rule; |
313 |
return defined $priority_rule ? $priority_rule : $rule; |
| 316 |
} |
314 |
} |
| 317 |
} |
315 |
} |
|
Lines 344-351
sub get_effective_rule_value {
Link Here
|
| 344 |
my $has_priority = $params->{has_priority}; |
342 |
my $has_priority = $params->{has_priority}; |
| 345 |
|
343 |
|
| 346 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance; |
344 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance; |
| 347 |
my $cache_key = sprintf "CircRules:%s:%s:%s:%s:%s", $rule_name // q{}, |
345 |
my $cache_key = sprintf "CircRules:%s:%s:%s:%s:%s", $rule_name // q{}, |
| 348 |
$categorycode // q{}, $branchcode // q{}, $itemtype // q{} ,$has_priority // q{}; |
346 |
$categorycode // q{}, $branchcode // q{}, $itemtype // q{}, $has_priority // q{}; |
| 349 |
|
347 |
|
| 350 |
my $cached = $memory_cache->get_from_cache($cache_key); |
348 |
my $cached = $memory_cache->get_from_cache($cache_key); |
| 351 |
return $cached if $cached; |
349 |
return $cached if $cached; |
| 352 |
- |
|
|