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

(-)a/C4/Koha.pm (-39 lines)
Lines 967-1010 sub GetNormalizedOCLCNumber { Link Here
967
    return
967
    return
968
}
968
}
969
969
970
sub GetAuthvalueDropbox {
971
    my ( $authcat, $default ) = @_;
972
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
973
    my $dbh = C4::Context->dbh;
974
975
    my $query = qq{
976
        SELECT *
977
        FROM authorised_values
978
    };
979
    $query .= qq{
980
          LEFT JOIN authorised_values_branches ON ( id = av_id )
981
    } if $branch_limit;
982
    $query .= qq{
983
        WHERE category = ?
984
    };
985
    $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
986
    $query .= " GROUP BY lib ORDER BY category, lib, lib_opac";
987
    my $sth = $dbh->prepare($query);
988
    $sth->execute( $authcat, $branch_limit ? $branch_limit : () );
989
990
991
    my $option_list = [];
992
    my @authorised_values = ( q{} );
993
    while (my $av = $sth->fetchrow_hashref) {
994
        push @{$option_list}, {
995
            value => $av->{authorised_value},
996
            label => $av->{lib},
997
            default => ($default eq $av->{authorised_value}),
998
        };
999
    }
1000
1001
    if ( @{$option_list} ) {
1002
        return $option_list;
1003
    }
1004
    return;
1005
}
1006
1007
1008
=head2 GetDailyQuote($opts)
970
=head2 GetDailyQuote($opts)
1009
971
1010
Takes a hashref of options
972
Takes a hashref of options
1011
- 

Return to bug 17847