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.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

http://bugs.koha-community.org/show_bug.cgi?id=15294

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Jonathan Druart 2015-12-03 14:06:13 +00:00 committed by Brendan Gallagher
parent 3117f621f1
commit 717d14c74e
2 changed files with 1 additions and 28 deletions

View file

@ -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);

View file

@ -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');