Lines 527-536
sub GetAuthorisedValues {
Link Here
|
527 |
|
527 |
|
528 |
my $select_clause = 'SELECT av.*'; |
528 |
my $select_clause = 'SELECT av.*'; |
529 |
my @where_args; |
529 |
my @where_args; |
530 |
if ($branch_limit && $no_limit) { |
530 |
if ( $branch_limit && $no_limit ) { |
531 |
$select_clause .= ', IF (branchcode = ? OR branchcode IS NULL, 0, 1) as restricted'; |
531 |
$select_clause .= ', IF (branchcode = ? OR branchcode IS NULL, 0, 1) as restricted'; |
532 |
push @where_args, $branch_limit; |
532 |
push @where_args, $branch_limit; |
533 |
} |
533 |
} |
|
|
534 |
|
534 |
my $query = qq{ |
535 |
my $query = qq{ |
535 |
$select_clause |
536 |
$select_clause |
536 |
FROM authorised_values av |
537 |
FROM authorised_values av |
Lines 543-554
sub GetAuthorisedValues {
Link Here
|
543 |
push @where_strings, "category = ?"; |
544 |
push @where_strings, "category = ?"; |
544 |
push @where_args, $category; |
545 |
push @where_args, $category; |
545 |
} |
546 |
} |
546 |
if($branch_limit && !defined $no_limit) { |
547 |
|
|
|
548 |
if ( $branch_limit && !defined $no_limit ) { |
547 |
push @where_strings, "( branchcode = ? OR branchcode IS NULL )"; |
549 |
push @where_strings, "( branchcode = ? OR branchcode IS NULL )"; |
548 |
push @where_args, $branch_limit; |
550 |
push @where_args, $branch_limit; |
549 |
} |
551 |
} |
550 |
if ( @where_strings > 0 ) { |
552 |
|
551 |
$query .= " WHERE " . join( " AND ", @where_strings ); |
553 |
if(@where_strings > 0) { |
|
|
554 |
$query .= " WHERE " . join(" AND ", @where_strings); |
552 |
} |
555 |
} |
553 |
$query .= ' ORDER BY category, ' |
556 |
$query .= ' ORDER BY category, ' |
554 |
. ( |
557 |
. ( |