Lines 148-153
__PACKAGE__->has_many(
Link Here
|
148 |
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-02-22 14:32:48 |
148 |
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-02-22 14:32:48 |
149 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hDlebhEn+f+thqwBo/LOqQ |
149 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hDlebhEn+f+thqwBo/LOqQ |
150 |
|
150 |
|
|
|
151 |
__PACKAGE__->load_components('+Koha::DBIx::Component::L10nSource'); |
152 |
|
153 |
sub insert { |
154 |
my $self = shift; |
155 |
|
156 |
my $result = $self->next::method(@_); |
157 |
|
158 |
my $group = sprintf('authorised_value:%s', $self->get_column('category')); |
159 |
$self->update_l10n_source( $group, |
160 |
$self->authorised_value . ':intranet', |
161 |
$self->lib ); |
162 |
$self->update_l10n_source( $group, |
163 |
$self->authorised_value . ':opac', |
164 |
$self->lib_opac ); |
165 |
|
166 |
return $result; |
167 |
} |
168 |
|
169 |
sub update { |
170 |
my $self = shift; |
171 |
|
172 |
my $is_lib_changed = $self->is_column_changed('lib'); |
173 |
my $is_lib_opac_changed = $self->is_column_changed('lib_opac'); |
174 |
|
175 |
my $result = $self->next::method(@_); |
176 |
|
177 |
my $group = sprintf('authorised_value:%s', $self->get_column('category')); |
178 |
if ($is_lib_changed) { |
179 |
$self->update_l10n_source( $group, |
180 |
$self->authorised_value . ':intranet', |
181 |
$self->lib ); |
182 |
} |
183 |
if ($is_lib_opac_changed) { |
184 |
$self->update_l10n_source( $group, |
185 |
$self->authorised_value . ':opac', |
186 |
$self->lib_opac ); |
187 |
} |
188 |
|
189 |
return $result; |
190 |
} |
191 |
|
192 |
sub delete { |
193 |
my $self = shift; |
194 |
|
195 |
my $result = $self->next::method(@_); |
196 |
|
197 |
my $group = sprintf('authorised_value:%s', $self->get_column('category')); |
198 |
$self->delete_l10n_source($group, sprintf('%s:intranet', $self->authorised_value)); |
199 |
$self->delete_l10n_source($group, sprintf('%s:opac', $self->authorised_value)); |
200 |
|
201 |
return $result; |
202 |
} |
151 |
|
203 |
|
152 |
# You can replace this text with custom code or comments, and it will be preserved on regeneration |
|
|
153 |
1; |
204 |
1; |