|
Lines 26-31
use strict;
Link Here
|
| 26 |
use C4::Context; |
26 |
use C4::Context; |
| 27 |
use Koha::Caches; |
27 |
use Koha::Caches; |
| 28 |
use Koha::DateUtils qw(dt_from_string); |
28 |
use Koha::DateUtils qw(dt_from_string); |
|
|
29 |
use Koha::AuthorisedValues; |
| 29 |
use Koha::Libraries; |
30 |
use Koha::Libraries; |
| 30 |
use Koha::MarcSubfieldStructures; |
31 |
use Koha::MarcSubfieldStructures; |
| 31 |
use DateTime::Format::MySQL; |
32 |
use DateTime::Format::MySQL; |
|
Lines 54-60
BEGIN {
Link Here
|
| 54 |
&GetAuthorisedValues |
55 |
&GetAuthorisedValues |
| 55 |
&GetAuthorisedValueCategories |
56 |
&GetAuthorisedValueCategories |
| 56 |
&GetKohaAuthorisedValues |
57 |
&GetKohaAuthorisedValues |
| 57 |
&GetKohaAuthorisedValuesMapping |
|
|
| 58 |
&GetAuthorisedValueByCode |
58 |
&GetAuthorisedValueByCode |
| 59 |
&GetNormalizedUPC |
59 |
&GetNormalizedUPC |
| 60 |
&GetNormalizedISBN |
60 |
&GetNormalizedISBN |
|
Lines 1014-1063
sub GetKohaAuthorisedValues {
Link Here
|
| 1014 |
return $values; |
1014 |
return $values; |
| 1015 |
} |
1015 |
} |
| 1016 |
|
1016 |
|
| 1017 |
=head2 GetKohaAuthorisedValuesMapping |
|
|
| 1018 |
|
| 1019 |
Takes a hash as a parameter. The interface key indicates the |
| 1020 |
description to use in the mapping. |
| 1021 |
|
| 1022 |
Returns hashref of: |
| 1023 |
"{kohafield},{frameworkcode},{authorised_value}" => "{description}" |
| 1024 |
for all the kohafields, frameworkcodes, and authorised values. |
| 1025 |
|
| 1026 |
Returns undef if nothing is found. |
| 1027 |
|
| 1028 |
=cut |
| 1029 |
|
| 1030 |
sub GetKohaAuthorisedValuesMapping { |
| 1031 |
my ($parameter) = @_; |
| 1032 |
my $interface = $parameter->{'interface'} // ''; |
| 1033 |
|
| 1034 |
my $query_mapping = q{ |
| 1035 |
SELECT TA.kohafield,TA.authorised_value AS category, |
| 1036 |
TA.frameworkcode,TB.authorised_value, |
| 1037 |
IF(TB.lib_opac>'',TB.lib_opac,TB.lib) AS OPAC, |
| 1038 |
TB.lib AS Intranet,TB.lib_opac |
| 1039 |
FROM marc_subfield_structure AS TA JOIN |
| 1040 |
authorised_values as TB ON |
| 1041 |
TA.authorised_value=TB.category |
| 1042 |
WHERE TA.kohafield>'' AND TA.authorised_value>''; |
| 1043 |
}; |
| 1044 |
my $dbh = C4::Context->dbh; |
| 1045 |
my $sth = $dbh->prepare($query_mapping); |
| 1046 |
$sth->execute(); |
| 1047 |
my $avmapping; |
| 1048 |
if ($interface eq 'opac') { |
| 1049 |
while (my $row = $sth->fetchrow_hashref) { |
| 1050 |
$avmapping->{$row->{kohafield}.",".$row->{frameworkcode}.",".$row->{authorised_value}} = $row->{OPAC}; |
| 1051 |
} |
| 1052 |
} |
| 1053 |
else { |
| 1054 |
while (my $row = $sth->fetchrow_hashref) { |
| 1055 |
$avmapping->{$row->{kohafield}.",".$row->{frameworkcode}.",".$row->{authorised_value}} = $row->{Intranet}; |
| 1056 |
} |
| 1057 |
} |
| 1058 |
return $avmapping; |
| 1059 |
} |
| 1060 |
|
| 1061 |
=head2 xml_escape |
1017 |
=head2 xml_escape |
| 1062 |
|
1018 |
|
| 1063 |
my $escaped_string = C4::Koha::xml_escape($string); |
1019 |
my $escaped_string = C4::Koha::xml_escape($string); |