# Copyright 2000-2002 Katipo Communications
+# copyright 2010 BibLibre
#
# This file is part of Koha.
#
sub GetBranchcodesWithOverdueRules {
my $dbh = C4::Context->dbh;
- my $rqoverduebranches = $dbh->prepare("SELECT DISTINCT branchcode FROM overduerules WHERE delay1 IS NOT NULL AND branchcode <> ''");
+ my $rqoverduebranches = $dbh->prepare("SELECT DISTINCT branchcode FROM overduerules WHERE delay1 IS NOT NULL AND branchcode <> '' ORDER BY branchcode");
$rqoverduebranches->execute;
my @branches = map { shift @$_ } @{ $rqoverduebranches->fetchall_arrayref };
+ if (!$branches[0]) {
+ my $availbranches = C4::Branch::GetBranches();
+ @branches = keys %$availbranches;
+ }
return @branches;
}