Lines 27-32
use C4::Context;
Link Here
|
27 |
use C4::Branch; # Can be removed? |
27 |
use C4::Branch; # Can be removed? |
28 |
use Koha::Cache; |
28 |
use Koha::Cache; |
29 |
use Koha::DateUtils qw(dt_from_string); |
29 |
use Koha::DateUtils qw(dt_from_string); |
|
|
30 |
use Koha::AuthorisedValues; |
30 |
use Koha::Libraries; |
31 |
use Koha::Libraries; |
31 |
use Koha::MarcSubfieldStructures; |
32 |
use Koha::MarcSubfieldStructures; |
32 |
use DateTime::Format::MySQL; |
33 |
use DateTime::Format::MySQL; |
Lines 56-62
BEGIN {
Link Here
|
56 |
&GetAuthorisedValues |
57 |
&GetAuthorisedValues |
57 |
&GetAuthorisedValueCategories |
58 |
&GetAuthorisedValueCategories |
58 |
&GetKohaAuthorisedValues |
59 |
&GetKohaAuthorisedValues |
59 |
&GetKohaAuthorisedValuesMapping |
|
|
60 |
&GetAuthorisedValueByCode |
60 |
&GetAuthorisedValueByCode |
61 |
&GetNormalizedUPC |
61 |
&GetNormalizedUPC |
62 |
&GetNormalizedISBN |
62 |
&GetNormalizedISBN |
Lines 1089-1138
sub GetKohaAuthorisedValues {
Link Here
|
1089 |
return $values; |
1089 |
return $values; |
1090 |
} |
1090 |
} |
1091 |
|
1091 |
|
1092 |
=head2 GetKohaAuthorisedValuesMapping |
|
|
1093 |
|
1094 |
Takes a hash as a parameter. The interface key indicates the |
1095 |
description to use in the mapping. |
1096 |
|
1097 |
Returns hashref of: |
1098 |
"{kohafield},{frameworkcode},{authorised_value}" => "{description}" |
1099 |
for all the kohafields, frameworkcodes, and authorised values. |
1100 |
|
1101 |
Returns undef if nothing is found. |
1102 |
|
1103 |
=cut |
1104 |
|
1105 |
sub GetKohaAuthorisedValuesMapping { |
1106 |
my ($parameter) = @_; |
1107 |
my $interface = $parameter->{'interface'} // ''; |
1108 |
|
1109 |
my $query_mapping = q{ |
1110 |
SELECT TA.kohafield,TA.authorised_value AS category, |
1111 |
TA.frameworkcode,TB.authorised_value, |
1112 |
IF(TB.lib_opac>'',TB.lib_opac,TB.lib) AS OPAC, |
1113 |
TB.lib AS Intranet,TB.lib_opac |
1114 |
FROM marc_subfield_structure AS TA JOIN |
1115 |
authorised_values as TB ON |
1116 |
TA.authorised_value=TB.category |
1117 |
WHERE TA.kohafield>'' AND TA.authorised_value>''; |
1118 |
}; |
1119 |
my $dbh = C4::Context->dbh; |
1120 |
my $sth = $dbh->prepare($query_mapping); |
1121 |
$sth->execute(); |
1122 |
my $avmapping; |
1123 |
if ($interface eq 'opac') { |
1124 |
while (my $row = $sth->fetchrow_hashref) { |
1125 |
$avmapping->{$row->{kohafield}.",".$row->{frameworkcode}.",".$row->{authorised_value}} = $row->{OPAC}; |
1126 |
} |
1127 |
} |
1128 |
else { |
1129 |
while (my $row = $sth->fetchrow_hashref) { |
1130 |
$avmapping->{$row->{kohafield}.",".$row->{frameworkcode}.",".$row->{authorised_value}} = $row->{Intranet}; |
1131 |
} |
1132 |
} |
1133 |
return $avmapping; |
1134 |
} |
1135 |
|
1136 |
=head2 xml_escape |
1092 |
=head2 xml_escape |
1137 |
|
1093 |
|
1138 |
my $escaped_string = C4::Koha::xml_escape($string); |
1094 |
my $escaped_string = C4::Koha::xml_escape($string); |