Bugzilla – Attachment 33047 Details for
Bug 8836
Resurrect Rotating Collections
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8836 [QA Followup] - Prevent multiple collections from having the same title
Bug-8836-QA-Followup---Prevent-multiple-collection.patch (text/plain), 2.99 KB, created by
Kyle M Hall (khall)
on 2014-10-31 11:37:09 UTC
(
hide
)
Description:
Bug 8836 [QA Followup] - Prevent multiple collections from having the same title
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-10-31 11:37:09 UTC
Size:
2.99 KB
patch
obsolete
>From 78a9a236f7205f291d40b3336ce47184c3412421 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 31 Oct 2014 06:46:53 -0400 >Subject: [PATCH] Bug 8836 [QA Followup] - Prevent multiple collections from having the same title > >--- > C4/RotatingCollections.pm | 12 ++++++++++++ > .../rotating_collections/editCollections.tt | 4 ++++ > 2 files changed, 16 insertions(+), 0 deletions(-) > >diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm >index f287994..1299f2e 100644 >--- a/C4/RotatingCollections.pm >+++ b/C4/RotatingCollections.pm >@@ -27,6 +27,7 @@ use Modern::Perl; > use C4::Context; > use C4::Circulation; > use C4::Reserves qw(CheckReserves); >+use Koha::Database; > > use DBI; > >@@ -84,9 +85,14 @@ BEGIN { > sub CreateCollection { > my ( $title, $description ) = @_; > >+ my $schema = Koha::Database->new()->schema(); >+ my $duplicate_titles = $schema->resultset('Collection')->count({ colTitle => $title }); >+ > ## Check for all neccessary parameters > if ( !$title ) { > return ( 0, 1, "NO_TITLE" ); >+ } elsif ( $duplicate_titles ) { >+ return ( 0, 2, "DUPLICATE_TITLE" ); > } > > $description ||= q{}; >@@ -127,6 +133,9 @@ Updates a collection > sub UpdateCollection { > my ( $colId, $title, $description ) = @_; > >+ my $schema = Koha::Database->new()->schema(); >+ my $duplicate_titles = $schema->resultset('Collection')->count({ colTitle => $title, -not => { colId => $colId } }); >+ > ## Check for all neccessary parameters > if ( !$colId ) { > return ( 0, 1, "NO_ID" ); >@@ -134,6 +143,9 @@ sub UpdateCollection { > if ( !$title ) { > return ( 0, 2, "NO_TITLE" ); > } >+ if ( $duplicate_titles ) { >+ return ( 0, 3, "DUPLICATE_TITLE" ); >+ } > > my $dbh = C4::Context->dbh; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt >index 1247e5b..9504b61 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt >@@ -37,6 +37,8 @@ > <p> > [% IF failureMessage == "NO_TITLE" %] > No title entered. >+ [% ELSIF failureMessage == "DUPLICATE_TITLE" %] >+ Title already in use. > [% ELSIF failureMessage == "NO_DESCRIPTION" %] > No description entered. > [% ELSE %] >@@ -70,6 +72,8 @@ > <p> > [% IF failureMessage == "NO_ID" %] > No collection id given. >+ [% ELSIF failureMessage == "DUPLICATE_TITLE" %] >+ Title already in use. > [% ELSE %] > [% failureMessage %] > [% END %] >-- >1.7.2.5
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 8836
:
12560
|
16746
|
19118
|
19119
|
19337
|
19339
|
21008
|
21009
|
21010
|
21011
|
23966
|
23967
|
23968
|
23969
|
23970
|
23971
|
23976
|
28140
|
28141
|
30838
|
30921
|
31087
|
32361
|
32362
|
32588
|
32589
|
32690
|
32691
|
32693
|
32773
|
32774
|
32973
|
32974
|
32975
|
32976
|
32994
|
32999
|
33000
|
33001
|
33002
|
33045
|
33046
|
33047
|
33048
|
33050
|
33051
|
33058
|
33059
|
33060
|
33061
|
33062
|
33063
|
33064
|
33065
|
33066
|
33068
|
33070
|
33095
|
33096
|
33097
|
33098
|
33099
|
33100
|
33101
|
33102
|
33103
|
33330
|
33331
|
33374