Bugzilla – Attachment 140662 Details for
Bug 31569
Remove GetImportsRecordRange from acqui/addorderiso2709
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31569: Remove GetImportRecordsRange from import stage
Bug-31569-Remove-GetImportRecordsRange-from-import.patch (text/plain), 4.44 KB, created by
Nick Clemens (kidclamp)
on 2022-09-15 13:55:17 UTC
(
hide
)
Description:
Bug 31569: Remove GetImportRecordsRange from import stage
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-09-15 13:55:17 UTC
Size:
4.44 KB
patch
obsolete
>From a40533163d26c341fd28cc9454eb2ac30f4e918e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 15 Sep 2022 13:35:37 +0000 >Subject: [PATCH] Bug 31569: Remove GetImportRecordsRange from import stage > >This patch removes the use of GetimportRecordsRange from the importing >step > >To test: > 0 - Apply patch > 1 - Stage a marc file for import > 2 - Add to basket from a staged file > 3 - Select titles to import (don't select all) > 4 - Fill out necessary fields, be sure to select itemtype on items tab > 5 - Import > 6 - Confirm titles successfully added to basket > 7 - Confirm staged import not marked as imported > 8 - Add to basket from same file > 9 - Select rest of titles >10 - Import >11 - Confirm staged file now marked imported >--- > acqui/addorderiso2709.pl | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 0a85ca6c9a..712c63fc24 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -135,7 +135,9 @@ if ($op eq ""){ > > # retrieve the file you want to import > my $import_batch_id = $cgiparams->{'import_batch_id'}; >- my $biblios = GetImportRecordsRange($import_batch_id); >+ my $import_records = Koha::Import::Records->search({ >+ import_batch_id => $import_batch_id, >+ }); > my $duplinbatch; > my $imported = 0; > my @import_record_id_selected = $input->multi_param("import_record_id"); >@@ -149,14 +151,13 @@ if ($op eq ""){ > my $matcher_id = $input->param('matcher_id'); > my $active_currency = Koha::Acquisition::Currencies->get_active; > my $biblio_count = 0; >- for my $biblio (@$biblios){ >+ while( my $import_record = $import_records->next ){ > $biblio_count++; > my $duplifound = 0; > # Check if this import_record_id was selected >- next if not grep { $_ eq $$biblio{import_record_id} } @import_record_id_selected; >- my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); >- my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; >- my $match = GetImportRecordMatches( $biblio->{'import_record_id'}, 1 ); >+ next if not grep { $_ eq $import_record->import_record_id } @import_record_id_selected; >+ my $marcrecord = $import_record->get_marc_record || die "couldn't translate marc information"; >+ my $match = GetImportRecordMatches( $import_record->import_record_id, 1 ); > my $biblionumber=$#$match > -1?$match->[0]->{'biblionumber'}:0; > my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1; > my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id; >@@ -196,12 +197,12 @@ if ($op eq ""){ > } > } > ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); >- SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); >+ $import_record->status('imported')->store; > } else { >- SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); >+ $import_record->status('imported')->store; > } > >- SetMatchedBiblionumber( $biblio->{import_record_id}, $biblionumber ); >+ $import_record->import_biblio->matched_biblionumber($biblionumber)->store; > > # Add items from MarcItemFieldsToOrder > my @homebranches = $input->multi_param('homebranch_' . $biblio_count); >@@ -358,7 +359,7 @@ if ($op eq ""){ > $order->add_item( $itemnumber ); > } > } else { >- SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); >+ $import_record->status( 'imported' )->store; > } > } > $imported++; >@@ -366,8 +367,8 @@ if ($op eq ""){ > > # If all bibliographic records from the batch have been imported we modifying the status of the batch accordingly > SetImportBatchStatus( $import_batch_id, 'imported' ) >- if @{ GetImportRecordsRange( $import_batch_id, undef, undef, 'imported' )} >- == @{ GetImportRecordsRange( $import_batch_id )}; >+ if Koha::Import::Records->search({import_batch_id => $import_batch_id, status => 'imported' })->count >+ == Koha::Import::Records->search({import_batch_id => $import_batch_id})->count; > > # go to basket page > if ( $imported ) { >-- >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 31569
:
140659
|
140660
|
140661
|
140662
|
140663
|
140664
|
140665
|
140676
|
140677
|
140678
|
140679
|
140680
|
140681
|
140682
|
141504
|
141505
|
141506
|
141507
|
141508
|
141509
|
141510
|
141511
|
142031