From 717d14c74e1f3abafacd9b38db61019cc6e164d3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 3 Dec 2015 14:06:13 +0000 Subject: [PATCH] Bug 15295: Koha::Libraries - Remove CheckCategoryUnique MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This subroutine is not used anymore and was not really useful. The branchcategories table has a primary key defined on categorycode. Signed-off-by: Marc Véron Signed-off-by: Martin Renvoize http://bugs.koha-community.org/show_bug.cgi?id=15294 Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- C4/Branch.pm | 22 ---------------------- t/db_dependent/Branch.t | 7 +------ 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/C4/Branch.pm b/C4/Branch.pm index 4d344fbccb..c9c5505365 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -42,7 +42,6 @@ BEGIN { &GetBranchCategories &GetBranchesInCategory &ModBranchCategoryInfo - &CheckCategoryUnique &mybranch &GetBranchesCount ); @@ -492,27 +491,6 @@ sub ModBranchCategoryInfo { } } -=head2 CheckCategoryUnique - -if (CheckCategoryUnique($categorycode)){ - # do something -} - -=cut - -sub CheckCategoryUnique { - my $categorycode = shift; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("SELECT categorycode FROM branchcategories WHERE categorycode = ?"); - $sth->execute(uc( $categorycode) ); - if (my $data = $sth->fetchrow_hashref){ - return 0; - } - else { - return 1; - } -} - =head2 CheckBranchCategorycode $number_rows_affected = CheckBranchCategorycode($categorycode); diff --git a/t/db_dependent/Branch.t b/t/db_dependent/Branch.t index a7b889f477..bf95a037e3 100644 --- a/t/db_dependent/Branch.t +++ b/t/db_dependent/Branch.t @@ -21,7 +21,7 @@ use Modern::Perl; use C4::Context; use Data::Dumper; -use Test::More tests => 36; +use Test::More tests => 34; use C4::Branch; use Koha::Libraries; @@ -48,7 +48,6 @@ can_ok( GetBranchCategories GetBranchesInCategory ModBranchCategoryInfo - CheckCategoryUnique mybranch GetBranchesCount) ); @@ -334,10 +333,6 @@ is( 'BRC has been added to CAT1' ); -#Test CheckCategoryUnique -is( CheckCategoryUnique('CAT2'), 0, 'CAT2 exists' ); -is( CheckCategoryUnique('CAT_NO_EXISTS'), 1, 'CAT_NO_EXISTS doesnt exist' ); - #Test GetCategoryTypes my @category_types = GetCategoryTypes(); is_deeply(\@category_types, [ 'searchdomain', 'properties' ], 'received expected library category types'); -- 2.39.5