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> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
0a2d2f7810
commit
b24611936a
2 changed files with 25 additions and 20 deletions
|
@ -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,
|
||||
|
|
|
@ -112,12 +112,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> )
|
||||
|
|
Loading…
Reference in a new issue