Bug 11790: Remove dependency C4::Context from C4::Charset

C4::Context is only used to retrieve a syspref value.
This patch moves the use of C4::Context to a require.

Test plan:
Try to reach the SetMarcUnicodeFlag subroutine (batchmod, add/update a biblio, etc.)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested on French UNIMARC install
No errors adding/editing biblios
No koha-qa errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2015-04-24 17:03:09 +02:00 committed by Tomas Cohen Arazi
parent 4fd923e12e
commit 34fe5c2416

View file

@ -22,7 +22,6 @@ use warnings;
use MARC::Charset qw/marc8_to_utf8/;
use Text::Iconv;
use C4::Context;
use C4::Debug;
use Unicode::Normalize;
use Encode qw( decode encode is_utf8 );
@ -333,6 +332,7 @@ sub SetMarcUnicodeFlag {
substr($leader, 9, 1) = 'a';
$marc_record->leader($leader);
} elsif ($marc_flavour =~/UNIMARC/) {
require C4::Context;
my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
$defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3);
my $string;