Browse Source

Bug 33431: Fix remaining cases

This patch tweaks three remaining cases, that are not covered by tests.

To test:
1. Apply this patch
2. Make use of those places
=> SUCCESS: No behavior change

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
24.05.x
Tomás Cohen Arazi 1 year ago
committed by Katrin Fischer
parent
commit
a4ad43724c
Signed by: kfischer GPG Key ID: 0EF6E2C03357A834
  1. 12
      C4/Ris.pm
  2. 12
      acqui/addorderiso2709.pl
  3. 26
      circ/pendingreserves.pl

12
C4/Ris.pm

@ -63,7 +63,6 @@ package C4::Ris;
use Modern::Perl;
use List::MoreUtils qw( uniq );
use YAML::XS;
use Encode;
use vars qw(@ISA @EXPORT);
@ -117,16 +116,7 @@ sub marc2ris {
## else: other MARC formats do not specify the character encoding
## we assume it's *not* UTF-8
my $RisExportAdditionalFields = C4::Context->preference('RisExportAdditionalFields');
my $ris_additional_fields;
if ($RisExportAdditionalFields) {
$RisExportAdditionalFields = "$RisExportAdditionalFields\n\n";
$ris_additional_fields = eval { YAML::XS::Load(Encode::encode_utf8($RisExportAdditionalFields)); };
if ($@) {
warn "Unable to parse RisExportAdditionalFields : $@";
$ris_additional_fields = undef;
}
}
my $ris_additional_fields = C4::Context->yaml_preference('RisExportAdditionalFields');
## start RIS dataset
if ( $ris_additional_fields && $ris_additional_fields->{TY} ) {

12
acqui/addorderiso2709.pl

@ -23,7 +23,6 @@
use Modern::Perl;
use CGI qw ( -utf8 );
use YAML::XS;
use List::MoreUtils;
use Encode;
use Scalar::Util qw( looks_like_number );
@ -645,15 +644,8 @@ sub add_matcher_list {
sub get_infos_syspref {
my ($syspref_name, $record, $field_list) = @_;
my $syspref = C4::Context->preference($syspref_name);
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
my $yaml = eval {
YAML::XS::Load(Encode::encode_utf8($syspref));
};
if ( $@ ) {
warn "Unable to parse $syspref syspref : $@";
return ();
}
my $yaml = C4::Context->yaml_preference($syspref_name);
my $r;
for my $field_name ( @$field_list ) {
next unless exists $yaml->{$field_name};

26
circ/pendingreserves.pl

@ -21,7 +21,6 @@ use Modern::Perl;
use constant PULL_INTERVAL => 2;
use List::MoreUtils qw( uniq );
use YAML::XS;
use Encode;
use C4::Context;
@ -106,22 +105,15 @@ if ( $op eq 'cud-cancel_reserve' and $reserve_id ) {
C4::Items::ModItemTransfer( $item->itemnumber, $item->holdingbranch, $item->homebranch, 'LostReserve' );
}
if ( my $yaml = C4::Context->preference('UpdateItemWhenLostFromHoldList') ) {
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt
my $assignments;
eval { $assignments = YAML::XS::Load(Encode::encode_utf8($yaml)); };
if ($@) {
warn "Unable to parse UpdateItemWhenLostFromHoldList syspref : $@" if $@;
}
else {
eval {
while ( my ( $f, $v ) = each( %$assignments ) ) {
$item->$f($v);
}
$item->store;
};
warn "Unable to modify item itemnumber=" . $item->itemnumber . ": $@" if $@;
}
my $assignments = C4::Context->yaml_preference('UpdateItemWhenLostFromHoldList');
if ( $assignments ) {
eval {
while ( my ( $f, $v ) = each( %$assignments ) ) {
$item->$f($v);
}
$item->store;
};
warn "Unable to modify item itemnumber=" . $item->itemnumber . ": $@" if $@;
}
} elsif ( not $item ) {

Loading…
Cancel
Save