From e04d1e618e65973e4ae48d7f27703bc776fdf34c Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 8 Aug 2023 10:39:10 +0000 Subject: [PATCH] Bug 34355: Make item addition dependent on MarcItemFieldsToOrder mappings and introduce MarcFieldsToOrder to cronjob Signed-off-by: Andrew Fuerste Henry --- Koha/MarcOrder.pm | 24 ++++++++++-------------- misc/cronjobs/marc_ordering_process.pl | 5 ++++- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Koha/MarcOrder.pm b/Koha/MarcOrder.pm index 525ae442a6..8373c99c89 100644 --- a/Koha/MarcOrder.pm +++ b/Koha/MarcOrder.pm @@ -125,18 +125,15 @@ sub create_order_lines_from_file { } ); - while ( my $import_record = $import_records->next ) { - my $result = add_biblio_from_import_record( - { - import_batch_id => $import_batch_id, - import_record => $import_record, - matcher_id => $params->{matcher_id}, - overlay_action => $params->{overlay_action}, - agent => $agent, - } - ); - warn "Duplicates found in $result->{duplicates_in_batch}, record was skipped." - if $result->{duplicates_in_batch}; + while( my $import_record = $import_records->next ){ + my $result = add_biblio_from_import_record({ + import_batch_id => $import_batch_id, + import_record => $import_record, + matcher_id => $params->{matcher_id}, + overlay_action => $params->{overlay_action}, + agent => $agent, + }); + warn "Duplicates found in $result->{duplicates_in_batch}, record was skipped." if $result->{duplicates_in_batch}; next if $result->{skip}; my $order_line_details = add_items_from_import_record( @@ -417,7 +414,6 @@ sub _verify_number_of_fields { $tags_count; # All counts of various fields should be equal if they exist } } - return { error => 0, count => $tags_count }; } @@ -1214,7 +1210,7 @@ sub _create_item_fields_from_syspref { push @uris, $infoset->{uri}; push @copynos, $infoset->{copyno}; push @budget_codes, $item_budget_id; - push @itemprices, $infoset->{itemprice}; + push @itemprices, $infoset->{price}; push @replacementprices, $infoset->{replacementprice}; push @itemcallnumbers, $infoset->{itemcallnumber}; } diff --git a/misc/cronjobs/marc_ordering_process.pl b/misc/cronjobs/marc_ordering_process.pl index 1491fa440d..301579dcd1 100755 --- a/misc/cronjobs/marc_ordering_process.pl +++ b/misc/cronjobs/marc_ordering_process.pl @@ -98,6 +98,9 @@ foreach my $acct (@accounts) { opendir my $dir, $working_dir or die "Can't open filepath"; my @files = grep { /\.(mrc|marcxml|mrk)/i } readdir $dir; closedir $dir; + print "No new files found\n" if scalar(@files) == 0; + + my $files_processed = 0; foreach my $filename (@files) { my $full_path = "$working_dir/$filename"; @@ -124,7 +127,7 @@ foreach my $acct (@accounts) { } } } - print "All files completed\n"; + say sprintf "%s files processed", $files_processed unless $files_processed == 0; print "Moving to next account\n\n"; } print "Process complete\n"; -- 2.39.2