Bug 15707: Display error if group title is already used
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Edit: I added !$branchcode && to the checked condition so we can add multiple libraries back. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
1c4d57a790
commit
f32cdb7211
2 changed files with 18 additions and 9 deletions
|
@ -48,6 +48,10 @@ if ( $action eq 'add' ) {
|
||||||
my $description = $cgi->param('description') || undef;
|
my $description = $cgi->param('description') || undef;
|
||||||
my $branchcode = $cgi->param('branchcode') || undef;
|
my $branchcode = $cgi->param('branchcode') || undef;
|
||||||
|
|
||||||
|
if ( !$branchcode && Koha::Library::Groups->search( { title => $title } )->count() ) {
|
||||||
|
$template->param( error_duplicate_title => $title );
|
||||||
|
}
|
||||||
|
else {
|
||||||
my $group = Koha::Library::Group->new(
|
my $group = Koha::Library::Group->new(
|
||||||
{
|
{
|
||||||
parent_id => $parent_id,
|
parent_id => $parent_id,
|
||||||
|
@ -58,6 +62,7 @@ if ( $action eq 'add' ) {
|
||||||
)->store();
|
)->store();
|
||||||
|
|
||||||
$template->param( added => $group );
|
$template->param( added => $group );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif ( $action eq 'edit' ) {
|
elsif ( $action eq 'edit' ) {
|
||||||
my $id = $cgi->param('id') || undef;
|
my $id = $cgi->param('id') || undef;
|
||||||
|
|
|
@ -108,6 +108,10 @@
|
||||||
[% deleted.library | $KohaSpan class = 'name' %] has been removed from group.
|
[% deleted.library | $KohaSpan class = 'name' %] has been removed from group.
|
||||||
[% END %]
|
[% END %]
|
||||||
</div>
|
</div>
|
||||||
|
[% ELSIF error_duplicate_title %]
|
||||||
|
<div class="dialog alert error-duplicate-group-title">
|
||||||
|
A group with the title [% error_duplicate_title | $KohaSpan class = 'name' %] already exists.
|
||||||
|
</div>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
<div id="doc3" class="yui-t2">
|
<div id="doc3" class="yui-t2">
|
||||||
|
|
Loading…
Reference in a new issue