1 package Koha::AuthorisedValue;
3 # Copyright ByWater Solutions 2014
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
25 use base qw(Koha::Object Koha::Object::Limit::Library);
27 my $cache = Koha::Caches->get_instance();
31 Koha::AuthorisedValue - Koha Authorised value Object class
41 AuthorisedValue specific store to ensure relevant caches are flushed on change
50 if ( !$self->in_storage ) {
54 my %updated_columns = $self->_result->get_dirty_columns;
56 if ( exists $updated_columns{lib}
57 or exists $updated_columns{lib_opac} )
63 $self = $self->SUPER::store;
66 my $key = "AV_descriptions:".$self->category;
67 $cache->clear_from_cache($key);
75 AuthorisedValue specific C<delete> to clear relevant caches on delete.
81 my $key = "AV_descriptions:".$self->category;
82 $cache->clear_from_cache($key);
83 $self->SUPER::delete(@_);
86 =head3 opac_description
88 my $description = $av->opac_description();
92 sub opac_description {
93 my ( $self, $value ) = @_;
95 return $self->lib_opac() || $self->lib();
100 This method returns the mapping for representing a Koha::AuthorisedValue object
107 id => 'authorised_value_id',
108 category => 'category_name',
109 authorised_value => 'value',
110 lib => 'description',
111 lib_opac => 'opac_description',
112 imageurl => 'image_url',
116 =head2 Internal methods
123 return 'AuthorisedValue';
126 =head3 _library_limits
130 sub _library_limits {
132 class => 'AuthorisedValuesBranch',
134 library => 'branchcode'
140 Kyle M Hall <kyle@bywatersolutions.com>