Bug 22566: Accept 'all' in the branch params
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commit2b392a6db2) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commit79736abef5) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
4ce2e23ca1
commit
a6ceb269b7
|
|
@ -124,20 +124,25 @@ my $ok = GetOptions(
|
|||
'admin-email|a=s' => \$admin_email,
|
||||
'branchcode|b=s' => sub {
|
||||
my ( $opt_name, $opt_value ) = @_;
|
||||
my $branches = Koha::Libraries->search( {},
|
||||
{ order_by => { -asc => 'branchname' } } );
|
||||
my $brnch = $branches->find($opt_value);
|
||||
if ($brnch) {
|
||||
$branch = $brnch;
|
||||
return $brnch;
|
||||
if ( $opt_value eq 'all' ) {
|
||||
$branch = 0;
|
||||
}
|
||||
else {
|
||||
printf("Option $opt_name should be one of (name -> code):\n");
|
||||
while ( my $candidate = $branches->next ) {
|
||||
printf( " %-40s -> %s\n",
|
||||
$candidate->branchname, $candidate->branchcode );
|
||||
my $branches = Koha::Libraries->search( {},
|
||||
{ order_by => { -asc => 'branchname' } } );
|
||||
my $brnch = $branches->find($opt_value);
|
||||
if ($brnch) {
|
||||
$branch = $brnch;
|
||||
return $brnch;
|
||||
}
|
||||
else {
|
||||
printf("Option $opt_name should be one of (name -> code):\n");
|
||||
while ( my $candidate = $branches->next ) {
|
||||
printf( " %-40s -> %s\n",
|
||||
$candidate->branchname, $candidate->branchcode );
|
||||
}
|
||||
exit 1;
|
||||
}
|
||||
exit 1;
|
||||
}
|
||||
},
|
||||
'execute|x' => \$execute,
|
||||
|
|
|
|||
Loading…
Reference in New Issue