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

(-)a/C4/Koha.pm (-33 lines)
Lines 55-61 BEGIN { Link Here
55
		&GetAuthorisedValues
55
		&GetAuthorisedValues
56
		&GetAuthorisedValueCategories
56
		&GetAuthorisedValueCategories
57
		&GetKohaAuthorisedValues
57
		&GetKohaAuthorisedValues
58
		&GetKohaAuthorisedValuesFromField
59
    &GetKohaAuthorisedValuesMapping
58
    &GetKohaAuthorisedValuesMapping
60
    &GetAuthorisedValueByCode
59
    &GetAuthorisedValueByCode
61
		&GetAuthValCode
60
		&GetAuthValCode
Lines 1133-1169 sub GetKohaAuthorisedValues { Link Here
1133
  }
1132
  }
1134
}
1133
}
1135
1134
1136
=head2 GetKohaAuthorisedValuesFromField
1137
1138
Takes $field, $subfield, $fwcode as parameters.
1139
1140
If $opac parameter is set to a true value, displays OPAC descriptions rather than normal ones when they exist.
1141
$subfield can be undefined
1142
1143
Returns hashref of Code => description
1144
1145
Returns undef if no authorised value category is defined for the given field and subfield 
1146
1147
=cut
1148
1149
sub GetKohaAuthorisedValuesFromField {
1150
  my ($field, $subfield, $fwcode,$opac) = @_;
1151
  $fwcode='' unless $fwcode;
1152
  my %values;
1153
  my $dbh = C4::Context->dbh;
1154
  my $avcode = GetAuthValCodeFromField($field, $subfield, $fwcode);
1155
  if ($avcode) {  
1156
	my $sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? ");
1157
   	$sth->execute($avcode);
1158
	while ( my ($val, $lib, $lib_opac) = $sth->fetchrow_array ) { 
1159
		$values{$val} = ($opac && $lib_opac) ? $lib_opac : $lib;
1160
   	}
1161
   	return \%values;
1162
  } else {
1163
	return;
1164
  }
1165
}
1166
1167
=head2 GetKohaAuthorisedValuesMapping
1135
=head2 GetKohaAuthorisedValuesMapping
1168
1136
1169
Takes a hash as a parameter. The interface key indicates the
1137
Takes a hash as a parameter. The interface key indicates the
1170
- 

Return to bug 17249