View | Details | Raw Unified | Return to bug 17847
Collapse All | Expand All

(-)a/C4/Koha.pm (-39 lines)
Lines 900-943 sub GetNormalizedOCLCNumber { Link Here
900
    return
900
    return
901
}
901
}
902
902
903
sub GetAuthvalueDropbox {
904
    my ( $authcat, $default ) = @_;
905
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
906
    my $dbh = C4::Context->dbh;
907
908
    my $query = qq{
909
        SELECT *
910
        FROM authorised_values
911
    };
912
    $query .= qq{
913
          LEFT JOIN authorised_values_branches ON ( id = av_id )
914
    } if $branch_limit;
915
    $query .= qq{
916
        WHERE category = ?
917
    };
918
    $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
919
    $query .= " GROUP BY lib ORDER BY category, lib, lib_opac";
920
    my $sth = $dbh->prepare($query);
921
    $sth->execute( $authcat, $branch_limit ? $branch_limit : () );
922
923
924
    my $option_list = [];
925
    my @authorised_values = ( q{} );
926
    while (my $av = $sth->fetchrow_hashref) {
927
        push @{$option_list}, {
928
            value => $av->{authorised_value},
929
            label => $av->{lib},
930
            default => ($default eq $av->{authorised_value}),
931
        };
932
    }
933
934
    if ( @{$option_list} ) {
935
        return $option_list;
936
    }
937
    return;
938
}
939
940
941
=head2 GetDailyQuote($opts)
903
=head2 GetDailyQuote($opts)
942
904
943
Takes a hashref of options
905
Takes a hashref of options
944
- 

Return to bug 17847