From 8d071fa62f12b8896ddffc41438043614cd5797e Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 21 May 2020 10:34:58 -0400 Subject: [PATCH] Bug 20817: Rename get_infos_syspref to GetMarcFieldsToOrderValues --- Koha/Acquisition/Utils.pm | 8 ++++---- acqui/addorderiso2709.pl | 2 +- acqui/neworderempty.pl | 2 +- t/Acquisition/Utils.t | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Koha/Acquisition/Utils.pm b/Koha/Acquisition/Utils.pm index 2a816b3277..74ca963276 100644 --- a/Koha/Acquisition/Utils.pm +++ b/Koha/Acquisition/Utils.pm @@ -25,9 +25,9 @@ Koha::Acquisition::Utils - Additional Koha functions for dealing with orders and =head1 SUBROUTINES -=head3 get_infos_syspref($syspref_name, $record, $field_list) +=head3 GetMarcFieldsToOrderValues($syspref_name, $record, $field_list) -my $data = Koha::Acquisition::Utils::get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', etc.]); +my $data = Koha::Acquisition::Utils::GetMarcFieldsToOrderValues('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', etc.]); This subroutine accepts a syspref ( MarcFieldsToOrder ), a marc record, and an arrayref of fields to retrieve. @@ -38,7 +38,7 @@ given system preference. =cut -sub get_infos_syspref { +sub GetMarcFieldsToOrderValues { 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 @@ -76,7 +76,7 @@ The return value is a hashref of key value pairs, where the keys are the field l and the values are extracted from the MARC record based on the key to MARC field mapping from the given system preference. -The largest difference between get_infos_syspref and GetMarcItemFieldsToOrderValues is that the former deals +The largest difference between GetMarcFieldsToOrderValues and GetMarcItemFieldsToOrderValues is that the former deals with singular marc fields, while the latter works on multiple matching marc fields and returns -1 if it cannot find a matching number of all fields to be looked up. diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index dd4e7f1e38..b353d02a65 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -519,7 +519,7 @@ sub import_biblios_list { my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; - my $infos = Koha::Acquisition::Utils::get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2','replacementprice']); + my $infos = Koha::Acquisition::Utils::GetMarcFieldsToOrderValues('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2','replacementprice']); my $price = $infos->{price}; my $replacementprice = $infos->{replacementprice}; my $quantity = $infos->{quantity}; diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 2868832e8b..b46810dcdf 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -626,7 +626,7 @@ sub staged_items_field { my ($marcrecord, $encoding) = MARCfindbreeding($breedingid); die("Could not find the selected record in the reservoir, bailing") unless $marcrecord; - my $infos = Koha::Acquisition::Utils::get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2', 'replacementprice']); + my $infos = Koha::Acquisition::Utils::GetMarcFieldsToOrderValues('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2', 'replacementprice']); my $price = $infos->{price}; my $replacementprice = $infos->{replacementprice}; my $quantity = $infos->{quantity}; diff --git a/t/Acquisition/Utils.t b/t/Acquisition/Utils.t index a6d2eeca1e..6cc043ce84 100755 --- a/t/Acquisition/Utils.t +++ b/t/Acquisition/Utils.t @@ -33,7 +33,7 @@ $schema->storage->txn_begin; my $builder = t::lib::TestBuilder->new; my $dbh = C4::Context->dbh; -subtest "get_infos_syspref" => sub { +subtest "GetMarcFieldsToOrderValues" => sub { plan tests => 4; my $record = MARC::Record->new; @@ -51,7 +51,7 @@ test3: 520$a test4: 541$a }; t::lib::Mocks::mock_preference('MarcFieldsToOrder', $MarcFieldsToOrder); - my $data = Koha::Acquisition::Utils::get_infos_syspref( + my $data = Koha::Acquisition::Utils::GetMarcFieldsToOrderValues( 'MarcFieldsToOrder', $record, [ 'test1', 'test2', 'test3', 'test4' ] -- 2.24.1 (Apple Git-126)