View | Details | Raw Unified | Return to bug 26393
Collapse All | Expand All

(-)a/Koha/CirculationRules.pm (+15 lines)
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
(-)a/admin/smart-rules.pl (-1 / +1 lines)
Lines 69-74 my $language = C4::Languages::getlanguage(); Link Here
69
69
70
my $cache = Koha::Caches->get_instance;
70
my $cache = Koha::Caches->get_instance;
71
$cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY );
71
$cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY );
72
$cache->clear_from_cache( Koha::CirculationRules::EFFECTIVE_RULE_KEY );
72
73
73
if ($op eq 'delete') {
74
if ($op eq 'delete') {
74
    my $itemtype     = $input->param('itemtype');
75
    my $itemtype     = $input->param('itemtype');
75
- 

Return to bug 26393