Bug 15295: Koha::Libraries - Remove DelBranch and DelBranchCategory
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 3 Dec 2015 14:04:06 +0000 (14:04 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Thu, 14 Jan 2016 15:45:30 +0000 (15:45 +0000)
These 2 subroutines are not used anymore, there were only used from the
admin script rewrote on bug 15294.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
C4/Branch.pm
t/db_dependent/Branch.t

index 3d513e9..4d344fb 100644 (file)
@@ -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);
index 9ca3f56..a7b889f 100644 (file)
@@ -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();