Bugzilla – Attachment 141506 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_biblios_list
Bug-31569-Remove-GetImportRecordsRange-from-import.patch (text/plain), 7.51 KB, created by
Katrin Fischer
on 2022-10-07 14:30:14 UTC
(
hide
)
Description:
Bug 31569: Remove GetImportRecordsRange from import_biblios_list
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-10-07 14:30:14 UTC
Size:
7.51 KB
patch
obsolete
>From 97b7e7629ed6517889ec4ac9ed6e8b5fe2b350d3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 15 Sep 2022 12:47:37 +0000 >Subject: [PATCH] Bug 31569: Remove GetImportRecordsRange from > import_biblios_list > >This patch changes the way records are loaded for display when adding to >a basket from a staged file > >To test: >1 - Stage a file of records for import >2 - Go to Acquisitions, find a vendor, create or find a basket >3 - Add to basket from staged file >4 - Choose the file >5 - Note the display of records >6 - Cancel >7 - Apply patch >8 - Stage from same file >9 - Note the display is unchanged > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > acqui/addorderiso2709.pl | 32 ++++++++----------- > .../prog/en/modules/acqui/addorderiso2709.tt | 13 ++++++-- > 2 files changed, 25 insertions(+), 20 deletions(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index aecb0ef8eb..0a85ca6c9a 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -51,6 +51,7 @@ use Koha::Acquisition::Baskets; > use Koha::Acquisition::Currencies; > use Koha::Acquisition::Orders; > use Koha::Acquisition::Booksellers; >+use Koha::Import::Records; > use Koha::Patrons; > > my $input = CGI->new; >@@ -442,7 +443,10 @@ sub import_biblios_list { > my ($template, $import_batch_id) = @_; > my $batch = GetImportBatch($import_batch_id,'staged'); > return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; >- my $biblios = GetImportRecordsRange($import_batch_id,'','',$batch->{import_status}); >+ my $import_records = Koha::Import::Records->search({ >+ import_batch_id => $import_batch_id, >+ status => $batch->{import_status} >+ }); > my @list = (); > my $item_error = 0; > >@@ -464,30 +468,22 @@ sub import_biblios_list { > } > > my $biblio_count = 0; >- foreach my $biblio (@$biblios) { >+ while ( my $import_record = $import_records->next ) { > my $item_id = 1; > $biblio_count++; >- my $citation = $biblio->{'title'}; >- $citation .= " $biblio->{'author'}" if $biblio->{'author'}; >- $citation .= " (" if $biblio->{'issn'} or $biblio->{'isbn'}; >- $citation .= $biblio->{'isbn'} if $biblio->{'isbn'}; >- $citation .= ", " if $biblio->{'issn'} and $biblio->{'isbn'}; >- $citation .= $biblio->{'issn'} if $biblio->{'issn'}; >- $citation .= ")" if $biblio->{'issn'} or $biblio->{'isbn'}; >- my $match = GetImportRecordMatches($biblio->{'import_record_id'}, 1); >+ my $match = GetImportRecordMatches($import_record->import_record_id, 1); > my %cellrecord = ( >- import_record_id => $biblio->{'import_record_id'}, >- citation => $citation, >+ import_record_id => $import_record->import_record_id, >+ import_biblio => $import_record->import_biblio, > import => 1, >- status => $biblio->{'status'}, >- record_sequence => $biblio->{'record_sequence'}, >- overlay_status => $biblio->{'overlay_status'}, >+ status => $import_record->status, >+ record_sequence => $import_record->record_sequence, >+ overlay_status => $import_record->overlay_status, > match_biblionumber => $#$match > -1 ? $match->[0]->{'biblionumber'} : 0, > match_citation => $#$match > -1 ? $match->[0]->{'title'} || '' . ' ' . $match->[0]->{'author'} || '': '', > match_score => $#$match > -1 ? $match->[0]->{'score'} : 0, > ); >- my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); >- my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; >+ my $marcrecord = $import_record->get_marc_record || die "couldn't translate marc information"; > > my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2','replacementprice']); > my $price = $infos->{price}; >@@ -584,7 +580,7 @@ sub import_biblios_list { > my $overlay_action = GetImportBatchOverlayAction($import_batch_id); > my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id); > my $item_action = GetImportBatchItemAction($import_batch_id); >- $template->param(biblio_list => \@list, >+ $template->param(import_biblio_list => \@list, > num_results => $num_records, > import_batch_id => $import_batch_id, > "overlay_action_${overlay_action}" => 1, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >index 3cb1ee24ea..afd306a5b9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >@@ -109,12 +109,21 @@ > <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" /> > <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" /> > >- [% FOREACH biblio IN biblio_list %] >+ [% FOREACH biblio IN import_biblio_list %] > <fieldset class="biblio unselected rows" style="float:none;"> > <legend> > <label for="record_[% biblio.import_record_id | html %]" style="width:auto;"> > <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id | html %]" value="[% biblio.import_record_id | html %]" /> >- <span class="citation">[% biblio.citation | html %]</span> >+ <span class="citation"> >+ [%- biblio.import_biblio.title | html -%] >+ [% biblio.import_biblio.author -%] >+ [% IF (biblio.import_biblio.isbn || biblio.import_biblio.issn) -%]( >+ [% biblio.import_biblio.isbn -%] >+ [%- IF (biblio.import_biblio.isbn && biblio.import_biblio.issn ) %] & [%- END -%] >+ [%- biblio.import_biblio.issn %] >+ ) >+ [%- END -%] >+ </span> > </label> > <span class="links" style="font-weight: normal;"> > ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id | uri %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&importid=[% biblio.import_record_id | html %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid | html %]&basketno=[% basketno | html %]&breedingid=[% biblio.import_record_id | html %]&import_batch_id=[% biblio.import_batch_id | html %]&biblionumber=[% biblio.match_biblionumber | html %]">Add order</a> ) >-- >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