From 01aa88bcdff4b8ae3ff646cab7ebc380f8408f69 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 This subroutine is not used anymore and was not really useful. The branchcategories table has a primary key defined on categorycode. --- 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 4d344fb..c9c5505 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 a7b889f..bf95a03 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.1.0