[Koha-patches] [PATCH] Allow all argument forms to GetBranchesLoops.
Joe Atzberger
joe.atzberger at liblime.com
Tue Dec 30 20:42:10 CET 2008
Allow arguments to be specified in the negative (i.e. 0).
Allow function to be called with no arguments.
This supercedes the patch titled:
Allow GetBranchesLoop to intuit IndependantBranches if not specified in argument.
---
C4/Branch.pm | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/C4/Branch.pm b/C4/Branch.pm
index 60e33ce..ff2f921 100644
--- a/C4/Branch.pm
+++ b/C4/Branch.pm
@@ -131,9 +131,9 @@ sub GetBranches {
return ( \%branches );
}
-sub GetBranchesLoop ($;$) { # since this is what most pages want anyway
- my $branch = shift or return undef;
- my $onlymine = shift || C4::Context->preference("IndependantBranches");
+sub GetBranchesLoop (;$$) { # since this is what most pages want anyway
+ my $branch = @_ ? shift : ''; # optional first argument is branchcode of "my branch", if preselection is wanted.
+ my $onlymine = @_ ? shift : C4::Context->preference("IndependantBranches");
my $branches = GetBranches($onlymine);
my @loop;
foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
--
1.5.5.GIT
More information about the Koha-patches
mailing list