Bugzilla – Attachment 43557 Details for
Bug 10363
Move authorised value related code into its own package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10363: FIX regression - prevent duplicate
PASSED-QA-Bug-10363-FIX-regression---prevent-dupli.patch (text/plain), 2.60 KB, created by
Katrin Fischer
on 2015-10-18 09:03:02 UTC
(
hide
)
Description:
[PASSED QA] Bug 10363: FIX regression - prevent duplicate
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-10-18 09:03:02 UTC
Size:
2.60 KB
patch
obsolete
>From 352f76e189fb754608d08192624d30165711fa62 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Aug 2015 14:43:20 +0100 >Subject: [PATCH] [PASSED QA] Bug 10363: FIX regression - prevent duplicate > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/AuthorisedValues.pm | 6 +----- > admin/authorised_values.pl | 12 +++++++++++- > .../intranet-tmpl/prog/en/modules/admin/authorised_values.tt | 2 ++ > 3 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm >index f81eea7..e690d8c 100644 >--- a/Koha/AuthorisedValues.pm >+++ b/Koha/AuthorisedValues.pm >@@ -59,11 +59,7 @@ sub search { > } > : {}; > 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 { >diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl >index 620ddc7..7534353 100755 >--- a/admin/authorised_values.pl >+++ b/admin/authorised_values.pl >@@ -103,7 +103,17 @@ if ($op eq 'add_form') { > 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 ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >index 19f36d0..3901ba3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >@@ -184,6 +184,8 @@ $(document).ready(function() { > Authorized value inserted successfully. > [% CASE 'success_on_delete' %] > Authorized value deleted successfully. >+ [% CASE 'already_exists' %] >+ This authorized value already exists. > [% CASE %] > [% m.code %] > [% END %] >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10363
:
18430
|
18431
|
18432
|
18751
|
18752
|
18753
|
20729
|
21833
|
21834
|
21835
|
21836
|
25284
|
25285
|
25286
|
25287
|
30583
|
30584
|
30585
|
30710
|
30711
|
30712
|
31565
|
32632
|
32633
|
32634
|
33416
|
33417
|
33422
|
33423
|
33860
|
33861
|
33862
|
33889
|
33949
|
35838
|
35839
|
35840
|
35841
|
41290
|
41291
|
41292
|
41293
|
41294
|
41302
|
41343
|
41344
|
41345
|
43112
|
43113
|
43114
|
43550
|
43551
|
43552
|
43553
|
43554
|
43555
|
43556
| 43557 |
43558
|
43559
|
43696
|
43827