Bugzilla – Attachment 160283 Details for
Bug 33431
Make code use C4::Context->yaml_preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33431: Fix remaining cases
Bug-33431-Fix-remaining-cases.patch (text/plain), 4.21 KB, created by
David Nind
on 2023-12-23 08:45:44 UTC
(
hide
)
Description:
Bug 33431: Fix remaining cases
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-12-23 08:45:44 UTC
Size:
4.21 KB
patch
obsolete
>From 76d15d5d23d7f07406628e0f62bc818b68bede8b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 6 Apr 2023 11:27:14 -0300 >Subject: [PATCH] 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> >--- > C4/Ris.pm | 12 +----------- > acqui/addorderiso2709.pl | 12 ++---------- > circ/pendingreserves.pl | 26 +++++++++----------------- > 3 files changed, 12 insertions(+), 38 deletions(-) > >diff --git a/C4/Ris.pm b/C4/Ris.pm >index cf30a40b62..b03f1eaa70 100644 >--- a/C4/Ris.pm >+++ b/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} ) { >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index e79a0ae447..f5d098288a 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -23,7 +23,6 @@ > > use Modern::Perl; > use CGI qw ( -utf8 ); >-use YAML::XS; > use List::MoreUtils; > use Encode; > >@@ -635,15 +634,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}; >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 21016bc354..38f68cd37d 100755 >--- a/circ/pendingreserves.pl >+++ b/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 '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 ) { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33431
:
149236
|
149237
|
149238
|
160245
|
160246
|
160247
|
160281
|
160282
|
160283
|
160392
|
160393
|
160394
|
162381
|
162382
|
162384