Revert "Bug 17249: Remove GetKohaAuthorisedValuesFromField"
This reverts commit 65945e30f7.
This commit is contained in:
parent
687946bd9b
commit
e362ade666
32
C4/Koha.pm
32
C4/Koha.pm
|
|
@ -56,6 +56,7 @@ BEGIN {
|
|||
&GetAuthorisedValues
|
||||
&GetAuthorisedValueCategories
|
||||
&GetKohaAuthorisedValues
|
||||
&GetKohaAuthorisedValuesFromField
|
||||
&GetKohaAuthorisedValuesMapping
|
||||
&GetKohaAuthorisedValueLib
|
||||
&GetAuthorisedValueByCode
|
||||
|
|
@ -1134,6 +1135,37 @@ sub GetKohaAuthorisedValues {
|
|||
}
|
||||
}
|
||||
|
||||
=head2 GetKohaAuthorisedValuesFromField
|
||||
|
||||
Takes $field, $subfield, $fwcode as parameters.
|
||||
|
||||
If $opac parameter is set to a true value, displays OPAC descriptions rather than normal ones when they exist.
|
||||
$subfield can be undefined
|
||||
|
||||
Returns hashref of Code => description
|
||||
|
||||
Returns undef if no authorised value category is defined for the given field and subfield
|
||||
|
||||
=cut
|
||||
|
||||
sub GetKohaAuthorisedValuesFromField {
|
||||
my ($field, $subfield, $fwcode,$opac) = @_;
|
||||
$fwcode='' unless $fwcode;
|
||||
my %values;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $avcode = GetAuthValCodeFromField($field, $subfield, $fwcode);
|
||||
if ($avcode) {
|
||||
my $sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? ");
|
||||
$sth->execute($avcode);
|
||||
while ( my ($val, $lib, $lib_opac) = $sth->fetchrow_array ) {
|
||||
$values{$val} = ($opac && $lib_opac) ? $lib_opac : $lib;
|
||||
}
|
||||
return \%values;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
=head2 GetKohaAuthorisedValuesMapping
|
||||
|
||||
Takes a hash as a parameter. The interface key indicates the
|
||||
|
|
|
|||
Loading…
Reference in New Issue