Allow all argument forms to GetBranchesLoops.
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. Signed-off-by: Galen Charlton <galen.charlton@liblime.com> Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
This commit is contained in:
parent
1643d8517f
commit
98a1ea38dd
|
|
@ -133,9 +133,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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue