Lines 503-512
sub GetAuthorisedValues {
Link Here
|
503 |
my $dbh = C4::Context->dbh; |
503 |
my $dbh = C4::Context->dbh; |
504 |
my $select_clause = 'SELECT av.*'; |
504 |
my $select_clause = 'SELECT av.*'; |
505 |
my @where_args; |
505 |
my @where_args; |
506 |
if ($branch_limit && $no_limit) { |
506 |
if ( $branch_limit && $no_limit ) { |
507 |
$select_clause .= ', IF (branchcode = ? OR branchcode IS NULL, 0, 1) as restricted'; |
507 |
$select_clause .= ', IF (branchcode = ? OR branchcode IS NULL, 0, 1) as restricted'; |
508 |
push @where_args, $branch_limit; |
508 |
push @where_args, $branch_limit; |
509 |
} |
509 |
} |
|
|
510 |
|
510 |
my $query = qq{ |
511 |
my $query = qq{ |
511 |
$select_clause |
512 |
$select_clause |
512 |
FROM authorised_values av |
513 |
FROM authorised_values av |
Lines 519-528
sub GetAuthorisedValues {
Link Here
|
519 |
push @where_strings, "category = ?"; |
520 |
push @where_strings, "category = ?"; |
520 |
push @where_args, $category; |
521 |
push @where_args, $category; |
521 |
} |
522 |
} |
522 |
if($branch_limit && !defined $no_limit) { |
523 |
|
|
|
524 |
if ( $branch_limit && !defined $no_limit ) { |
523 |
push @where_strings, "( branchcode = ? OR branchcode IS NULL )"; |
525 |
push @where_strings, "( branchcode = ? OR branchcode IS NULL )"; |
524 |
push @where_args, $branch_limit; |
526 |
push @where_args, $branch_limit; |
525 |
} |
527 |
} |
|
|
528 |
|
526 |
if(@where_strings > 0) { |
529 |
if(@where_strings > 0) { |
527 |
$query .= " WHERE " . join(" AND ", @where_strings); |
530 |
$query .= " WHERE " . join(" AND ", @where_strings); |
528 |
} |
531 |
} |