&GetBranchesInCategory
&ModBranchCategoryInfo
&mybranch
- &GetBranchesCount
);
@EXPORT_OK = qw( &onlymine &mybranch );
}
$sth->execute($data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'},$data->{'show_in_pulldown'},uc( $data->{'categorycode'} ) );
}
}
-sub GetBranchesCount {
- my $dbh = C4::Context->dbh();
- my $query = "SELECT COUNT(*) AS branches_count FROM branches";
- my $sth = $dbh->prepare( $query );
- $sth->execute();
- my $row = $sth->fetchrow_hashref();
- return $row->{'branches_count'};
-}
-
1;
__END__
#use warnings; FIXME - Bug 2505
use C4::Context;
-use C4::Branch qw(GetBranchesCount);
+use C4::Branch; # Can be removed?
use Koha::Cache;
use Koha::DateUtils qw(dt_from_string);
+use Koha::Libraries;
use DateTime::Format::MySQL;
use Business::ISBN;
use autouse 'Data::cselectall_arrayref' => qw(Dumper);
];
unless ( C4::Context->preference("singleBranchMode")
- || GetBranchesCount() == 1 )
+ || Koha::Libraries->search->count == 1 )
{
my $DisplayLibraryFacets = C4::Context->preference('DisplayLibraryFacets');
if ( $DisplayLibraryFacets eq 'both'
];
unless ( C4::Context->preference("singleBranchMode")
- || GetBranchesCount() == 1 )
+ || Koha::Libraries->search->count == 1 )
{
my $DisplayLibraryFacets = C4::Context->preference('DisplayLibraryFacets');
if ( $DisplayLibraryFacets eq 'both'
GetBranchesInCategory
ModBranchCategoryInfo
mybranch
- GetBranchesCount)
+ )
);
# Start test
-my $count = GetBranchesCount();
+my $count = Koha::Libraries->search->count;
like( $count, '/^\d+$/', "the count is a number" );
#add 2 branches
$b2->{add} = 1;
ModBranch($b2);
-is( GetBranchesCount(), $count + 2, "two branches added" );
+is( Koha::Libraries->search->count, $count + 2, "two branches added" );
is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1, "One row affected" );
-is( GetBranchesCount(), $count + 1, "branch BRB deleted" );
+is( Koha::Libraries->search->count, $count + 1, "branch BRB deleted" );
#Test GetBranchName
is( GetBranchName( $b1->{branchcode} ),
#Test Getbranches
my $branches = GetBranches();
is( scalar( keys %$branches ),
- GetBranchesCount(), "GetBranches returns the right number of branches" );
+ Koha::Libraries->search->count, "GetBranches returns the right number of branches" );
#Test ModBranch
};
ModBranch($b1);
-is( GetBranchesCount(), $count + 1,
+is( Koha::Libraries->search->count, $count + 1,
"A branch has been modified, no new branch added" );
$branchdetail = GetBranchDetail( $b1->{branchcode} );
$b1->{issuing} = undef;
$b2->{CAT1} = 1;
ModBranch($b2);
-is( GetBranchesCount(), $count + 2, 'BRB added' );
+is( Koha::Libraries->search->count, $count + 2, 'BRB added' );
#Test GetBranchInfo
my $b1info = GetBranchInfo( $b1->{branchcode} );
#Test GetBranchesLoop
my $loop = GetBranchesLoop;
-is( scalar(@$loop), GetBranchesCount(), 'There is the right number of branches' );
+is( scalar(@$loop), Koha::Libraries->search->count, 'There is the right number of branches' );
# End transaction
$dbh->rollback;