}
: {};
my $join = $branchcode ? { join => 'authorised_values_branches' } : {};
- my $rs = $self->_resultset()
- ->search( { %$params, %$or, }, $join );
-
- my $class = ref($self);
- return wantarray ? $self->_wrap( $rs->all() ) : $class->_new_from_dbic($rs);
+ return $self->SUPER::search( { %$params, %$or, }, $join );
}
sub categories {
my $duplicate_entry = 0;
my @branches = grep { $_ ne q{} } $input->param('branches');
- if ( $id ) { # Update
+ my $already_exists = Koha::AuthorisedValues->search(
+ {
+ category => $new_category,
+ authorised_value => $new_authorised_value,
+ }
+ )->next;
+
+ if ( $already_exists and ( not $id or $already_exists->id != $id ) ) {
+ push @messages, {type => 'error', code => 'already_exists' };
+ }
+ elsif ( $id ) { # Update
my $av = Koha::AuthorisedValues->new->find( $id );
$av->lib( $input->param('lib') || undef );
Authorized value inserted successfully.
[% CASE 'success_on_delete' %]
Authorized value deleted successfully.
+ [% CASE 'already_exists' %]
+ This authorized value already exists.
[% CASE %]
[% m.code %]
[% END %]