Bumping version to 3.10.0 and adding sponsors that are were not already written
[koha.git] / C4 / Branch.pm
index 1959a3d..d765c99 100644 (file)
@@ -46,6 +46,7 @@ BEGIN {
                &DelBranchCategory
                &CheckCategoryUnique
                &mybranch
+               &GetBranchesCount
        );
        @EXPORT_OK = qw( &onlymine &mybranch get_branch_code_from_name );
 }
@@ -154,7 +155,7 @@ sub mybranch {
     return C4::Context->userenv->{branch} || '';
 }
 
-sub GetBranchesLoop (;$$) {  # since this is what most pages want anyway
+sub GetBranchesLoop {  # since this is what most pages want anyway
     my $branch   = @_ ? shift : mybranch();     # optional first argument is branchcode of "my branch", if preselection is wanted.
     my $onlymine = @_ ? shift : onlymine();
     my $branches = GetBranches($onlymine);
@@ -372,7 +373,7 @@ the categories were already here, and minimally used.
 =cut
 
        #TODO  manage category types.  rename possibly to 'agency domains' ? as borrowergroups are called categories.
-sub GetCategoryTypes() {
+sub GetCategoryTypes {
        return ( 'searchdomain','properties');
 }
 
@@ -382,7 +383,7 @@ $branch = GetBranch( $query, $branches );
 
 =cut
 
-sub GetBranch ($$) {
+sub GetBranch {
     my ( $query, $branches ) = @_;    # get branch for this query from branches
     my $branch = $query->param('branch');
     my %cookie = $query->cookie('userenv');
@@ -415,7 +416,7 @@ Returns a href:  keys %$branches eq (branchcode,branchname) .
 
 =cut
 
-sub GetBranchesInCategory($) {
+sub GetBranchesInCategory {
     my ($categorycode) = @_;
        my @branches;
        my $dbh = C4::Context->dbh();
@@ -580,6 +581,15 @@ sub get_branch_code_from_name {
    return $sth->fetchrow_array;
 }
 
+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__