@@ -, +, @@ DelBranchCategory --- C4/Branch.pm | 29 ----------------------------- t/db_dependent/Branch.t | 11 ++++------- 2 files changed, 4 insertions(+), 36 deletions(-) --- a/C4/Branch.pm +++ a/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); --- a/t/db_dependent/Branch.t +++ a/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(); --