Lines 26-31
use Koha::CirculationRule;
Link Here
|
26 |
use base qw(Koha::Objects); |
26 |
use base qw(Koha::Objects); |
27 |
|
27 |
|
28 |
use constant GUESSED_ITEMTYPES_KEY => 'Koha_IssuingRules_last_guess'; |
28 |
use constant GUESSED_ITEMTYPES_KEY => 'Koha_IssuingRules_last_guess'; |
|
|
29 |
use constant EFFECTIVE_RULE_KEY => 'Koha_CirculationRule_get_effective_rule-'; |
29 |
|
30 |
|
30 |
=head1 NAME |
31 |
=head1 NAME |
31 |
|
32 |
|
Lines 190-195
sub get_effective_rule {
Link Here
|
190 |
"Required parameter 'rule_name' missing") |
191 |
"Required parameter 'rule_name' missing") |
191 |
unless $rule_name; |
192 |
unless $rule_name; |
192 |
|
193 |
|
|
|
194 |
my $cache = Koha::Caches->get_instance(); |
195 |
my $cache_key = EFFECTIVE_RULE_KEY.$rule_name; |
196 |
foreach ( $branchcode, $categorycode, $itemtype ) { |
197 |
$cache_key .= '-'.($_ ? $_ : ''); |
198 |
} |
199 |
my $cached = $cache->get_from_cache($cache_key); |
200 |
if ($cached) { |
201 |
my $cr = Koha::CirculationRule->new($cached); |
202 |
$cr->{_result}->in_storage(1); # Tell it exists in DB |
203 |
return $cr; |
204 |
} |
205 |
|
193 |
for my $v ( $branchcode, $categorycode, $itemtype ) { |
206 |
for my $v ( $branchcode, $categorycode, $itemtype ) { |
194 |
$v = undef if $v and $v eq '*'; |
207 |
$v = undef if $v and $v eq '*'; |
195 |
} |
208 |
} |
Lines 212-217
sub get_effective_rule {
Link Here
|
212 |
} |
225 |
} |
213 |
)->single; |
226 |
)->single; |
214 |
|
227 |
|
|
|
228 |
$cache->set_in_cache( $cache_key, $rule->unblessed ) if $rule; |
229 |
|
215 |
return $rule; |
230 |
return $rule; |
216 |
} |
231 |
} |
217 |
|
232 |
|