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

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

Return to bug 17249