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

(-)a/Koha/Object.pm (-4 / +6 lines)
Lines 177-192 my $value = Koha::Object->_method_cache($method_name, @args); Link Here
177
sub _method_cache {
177
sub _method_cache {
178
    my ($self, $method_name, @args) = @_;
178
    my ($self, $method_name, @args) = @_;
179
179
180
    # Don't include in cache key. Must also be unset in
181
    # possible uncached call to $method_name below
182
    if (@args) {
183
        delete $args[0]->{cache};
184
    }
185
180
    my $cache_key = $self->_method_cache_key($method_name, @args);
186
    my $cache_key = $self->_method_cache_key($method_name, @args);
181
    my $value = $self->_instance_cache_get($cache_key);
187
    my $value = $self->_instance_cache_get($cache_key);
182
188
183
    return $value if defined $value;
189
    return $value if defined $value;
184
190
185
    if (@args) {
186
        delete $args[0]->{cache};
187
    }
188
    $value = $self->$method_name(@args);
191
    $value = $self->$method_name(@args);
189
190
    $self->_instance_cache_set($cache_key, $value);
192
    $self->_instance_cache_set($cache_key, $value);
191
193
192
    return $value;
194
    return $value;
(-)a/t/db_dependent/Circulation.t (-1 / +7 lines)
Lines 734-739 subtest "CanBookBeRenewed tests" => sub { Link Here
734
    is( $renewokay, 1, '(Bug 8236), Can renew, this item is overdue but not pref does not block');
734
    is( $renewokay, 1, '(Bug 8236), Can renew, this item is overdue but not pref does not block');
735
735
736
    t::lib::Mocks::mock_preference('OverduesBlockRenewing','block');
736
    t::lib::Mocks::mock_preference('OverduesBlockRenewing','block');
737
    # Clear cache after changing preference affecting has_overdues evaluation
738
    $renewing_borrower_obj->_method_cache_clear('has_overdues');
739
737
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_6);
740
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_6);
738
    is( $renewokay, 0, '(Bug 8236), Cannot renew, this item is not overdue but patron has overdues');
741
    is( $renewokay, 0, '(Bug 8236), Cannot renew, this item is not overdue but patron has overdues');
739
    is( $error, 'overdue', "Correct error returned");
742
    is( $error, 'overdue', "Correct error returned");
Lines 742-747 subtest "CanBookBeRenewed tests" => sub { Link Here
742
    is( $error, 'overdue', "Correct error returned");
745
    is( $error, 'overdue', "Correct error returned");
743
746
744
    t::lib::Mocks::mock_preference('OverduesBlockRenewing','blockitem');
747
    t::lib::Mocks::mock_preference('OverduesBlockRenewing','blockitem');
748
    # Clear cache after changing preference affecting has_overdues evaluation
749
    $renewing_borrower_obj->_method_cache_clear('has_overdues');
750
745
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_6);
751
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_6);
746
    is( $renewokay, 1, '(Bug 8236), Can renew, this item is not overdue');
752
    is( $renewokay, 1, '(Bug 8236), Can renew, this item is not overdue');
747
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_7);
753
    ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrower_obj, $issue_7);
Lines 1726-1731 subtest "GetUpcomingDueIssues" => sub { Link Here
1726
1732
1727
    my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
1733
    my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
1728
    my $datedue = dt_from_string( $issue->date_due() );
1734
    my $datedue = dt_from_string( $issue->date_due() );
1735
1729
    my $issue_2 = AddIssue( $a_borrower, $item_2->barcode, $two_days_ahead );
1736
    my $issue_2 = AddIssue( $a_borrower, $item_2->barcode, $two_days_ahead );
1730
    my $datedue2 = dt_from_string( $issue->date_due() );
1737
    my $datedue2 = dt_from_string( $issue->date_due() );
1731
1738
1732
- 

Return to bug 32476