From 3117f621f112bd68b766db3a23c4a6b9982d8fb7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 3 Dec 2015 14:04:06 +0000 Subject: [PATCH] Bug 15295: Koha::Libraries - Remove DelBranch and DelBranchCategory These 2 subroutines are not used anymore, there were only used from the admin script rewrote on bug 15294. Signed-off-by: Martin Renvoize Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- C4/Branch.pm | 29 ----------------------------- t/db_dependent/Branch.t | 11 ++++------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/C4/Branch.pm b/C4/Branch.pm index 3d513e9691..4d344fbccb 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -42,8 +42,6 @@ BEGIN { &GetBranchCategories &GetBranchesInCategory &ModBranchCategoryInfo - &DelBranch - &DelBranchCategory &CheckCategoryUnique &mybranch &GetBranchesCount @@ -472,19 +470,6 @@ sub GetBranchInfo { return \@results; } -=head2 DelBranch - -&DelBranch($branchcode); - -=cut - -sub DelBranch { - my ($branchcode) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("delete from branches where branchcode = ?"); - $sth->execute($branchcode); -} - =head2 ModBranchCategoryInfo &ModBranchCategoryInfo($data); @@ -528,20 +513,6 @@ sub CheckCategoryUnique { } } - -=head2 DeleteBranchCategory - -DeleteBranchCategory($categorycode); - -=cut - -sub DelBranchCategory { - my ($categorycode) = @_; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("delete from branchcategories where categorycode = ?"); - $sth->execute($categorycode); -} - =head2 CheckBranchCategorycode $number_rows_affected = CheckBranchCategorycode($categorycode); diff --git a/t/db_dependent/Branch.t b/t/db_dependent/Branch.t index 9ca3f56de2..a7b889f477 100644 --- a/t/db_dependent/Branch.t +++ b/t/db_dependent/Branch.t @@ -24,6 +24,8 @@ use Data::Dumper; use Test::More tests => 36; use C4::Branch; +use Koha::Libraries; +use Koha::LibraryCategories; BEGIN { use FindBin; @@ -46,8 +48,6 @@ can_ok( GetBranchCategories GetBranchesInCategory ModBranchCategoryInfo - DelBranch - DelBranchCategory CheckCategoryUnique mybranch GetBranchesCount) @@ -118,9 +118,7 @@ $b2->{add} = 1; ModBranch($b2); is( GetBranchesCount(), $count + 2, "two branches added" ); -#Test DelBranch - -is( DelBranch( $b2->{branchcode} ), 1, "One row affected" ); +is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1, "One row affected" ); is( GetBranchesCount(), $count + 1, "branch BRB deleted" ); #Test GetBranchName @@ -220,8 +218,7 @@ is_deeply( $cat1detail, $cat1, 'CAT1 details are right' ); my $category = GetBranchCategory('LIBCATCODE'); is_deeply($category, \%new_category, 'fetched newly added library category'); -#Test DelBranchCategory -my $del = DelBranchCategory( $cat2->{categorycode} ); +my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete; is( $del, 1, 'One row affected' ); $categories = GetBranchCategories(); -- 2.39.5