View | Details | Raw Unified | Return to bug 15295
Collapse All | Expand All

(-)a/C4/Branch.pm (-29 lines)
Lines 42-49 BEGIN { Link Here
42
		&GetBranchCategories
42
		&GetBranchCategories
43
		&GetBranchesInCategory
43
		&GetBranchesInCategory
44
		&ModBranchCategoryInfo
44
		&ModBranchCategoryInfo
45
		&DelBranch
46
		&DelBranchCategory
47
	        &CheckCategoryUnique
45
	        &CheckCategoryUnique
48
		&mybranch
46
		&mybranch
49
		&GetBranchesCount
47
		&GetBranchesCount
Lines 472-490 sub GetBranchInfo { Link Here
472
    return \@results;
470
    return \@results;
473
}
471
}
474
472
475
=head2 DelBranch
476
477
&DelBranch($branchcode);
478
479
=cut
480
481
sub DelBranch {
482
    my ($branchcode) = @_;
483
    my $dbh = C4::Context->dbh;
484
    my $sth = $dbh->prepare("delete from branches where branchcode = ?");
485
    $sth->execute($branchcode);
486
}
487
488
=head2 ModBranchCategoryInfo
473
=head2 ModBranchCategoryInfo
489
474
490
&ModBranchCategoryInfo($data);
475
&ModBranchCategoryInfo($data);
Lines 528-547 sub CheckCategoryUnique { Link Here
528
    }
513
    }
529
}
514
}
530
515
531
    
532
=head2 DeleteBranchCategory
533
534
DeleteBranchCategory($categorycode);
535
536
=cut
537
538
sub DelBranchCategory {
539
    my ($categorycode) = @_;
540
    my $dbh = C4::Context->dbh;
541
    my $sth = $dbh->prepare("delete from branchcategories where categorycode = ?");
542
    $sth->execute($categorycode);
543
}
544
545
=head2 CheckBranchCategorycode
516
=head2 CheckBranchCategorycode
546
517
547
$number_rows_affected = CheckBranchCategorycode($categorycode);
518
$number_rows_affected = CheckBranchCategorycode($categorycode);
(-)a/t/db_dependent/Branch.t (-8 / +4 lines)
Lines 24-29 use Data::Dumper; Link Here
24
use Test::More tests => 36;
24
use Test::More tests => 36;
25
25
26
use C4::Branch;
26
use C4::Branch;
27
use Koha::Libraries;
28
use Koha::LibraryCategories;
27
29
28
BEGIN {
30
BEGIN {
29
    use FindBin;
31
    use FindBin;
Lines 46-53 can_ok( Link Here
46
      GetBranchCategories
48
      GetBranchCategories
47
      GetBranchesInCategory
49
      GetBranchesInCategory
48
      ModBranchCategoryInfo
50
      ModBranchCategoryInfo
49
      DelBranch
50
      DelBranchCategory
51
      CheckCategoryUnique
51
      CheckCategoryUnique
52
      mybranch
52
      mybranch
53
      GetBranchesCount)
53
      GetBranchesCount)
Lines 118-126 $b2->{add} = 1; Link Here
118
ModBranch($b2);
118
ModBranch($b2);
119
is( GetBranchesCount(), $count + 2, "two branches added" );
119
is( GetBranchesCount(), $count + 2, "two branches added" );
120
120
121
#Test DelBranch
121
is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1,          "One row affected" );
122
123
is( DelBranch( $b2->{branchcode} ), 1,          "One row affected" );
124
is( GetBranchesCount(),             $count + 1, "branch BRB deleted" );
122
is( GetBranchesCount(),             $count + 1, "branch BRB deleted" );
125
123
126
#Test GetBranchName
124
#Test GetBranchName
Lines 220-227 is_deeply( $cat1detail, $cat1, 'CAT1 details are right' ); Link Here
220
my $category = GetBranchCategory('LIBCATCODE');
218
my $category = GetBranchCategory('LIBCATCODE');
221
is_deeply($category, \%new_category, 'fetched newly added library category');
219
is_deeply($category, \%new_category, 'fetched newly added library category');
222
220
223
#Test DelBranchCategory
221
my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete;
224
my $del = DelBranchCategory( $cat2->{categorycode} );
225
is( $del, 1, 'One row affected' );
222
is( $del, 1, 'One row affected' );
226
223
227
$categories = GetBranchCategories();
224
$categories = GetBranchCategories();
228
- 

Return to bug 15295