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

(-)a/C4/Koha.pm (-33 lines)
Lines 54-60 BEGIN { Link Here
54
		&GetAuthorisedValues
54
		&GetAuthorisedValues
55
		&GetAuthorisedValueCategories
55
		&GetAuthorisedValueCategories
56
		&GetKohaAuthorisedValues
56
		&GetKohaAuthorisedValues
57
		&GetKohaAuthorisedValuesFromField
58
    &GetKohaAuthorisedValuesMapping
57
    &GetKohaAuthorisedValuesMapping
59
    &GetAuthorisedValueByCode
58
    &GetAuthorisedValueByCode
60
		&GetAuthValCode
59
		&GetAuthValCode
Lines 1059-1095 sub GetKohaAuthorisedValues { Link Here
1059
  }
1058
  }
1060
}
1059
}
1061
1060
1062
=head2 GetKohaAuthorisedValuesFromField
1063
1064
Takes $field, $subfield, $fwcode as parameters.
1065
1066
If $opac parameter is set to a true value, displays OPAC descriptions rather than normal ones when they exist.
1067
$subfield can be undefined
1068
1069
Returns hashref of Code => description
1070
1071
Returns undef if no authorised value category is defined for the given field and subfield 
1072
1073
=cut
1074
1075
sub GetKohaAuthorisedValuesFromField {
1076
  my ($field, $subfield, $fwcode,$opac) = @_;
1077
  $fwcode='' unless $fwcode;
1078
  my %values;
1079
  my $dbh = C4::Context->dbh;
1080
  my $avcode = GetAuthValCodeFromField($field, $subfield, $fwcode);
1081
  if ($avcode) {  
1082
	my $sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? ");
1083
   	$sth->execute($avcode);
1084
	while ( my ($val, $lib, $lib_opac) = $sth->fetchrow_array ) { 
1085
		$values{$val} = ($opac && $lib_opac) ? $lib_opac : $lib;
1086
   	}
1087
   	return \%values;
1088
  } else {
1089
	return;
1090
  }
1091
}
1092
1093
=head2 GetKohaAuthorisedValuesMapping
1061
=head2 GetKohaAuthorisedValuesMapping
1094
1062
1095
Takes a hash as a parameter. The interface key indicates the
1063
Takes a hash as a parameter. The interface key indicates the
1096
- 

Return to bug 17249