Bugzilla – Attachment 85381 Details for
Bug 19265
Advanced Editor - Rancor - Add ability to export selected records from and import records into an import batch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19265: Rancor - import records into existing batch
Bug-19265-Rancor---import-records-into-existing-ba.patch (text/plain), 6.55 KB, created by
Alex Arnaud
on 2019-02-20 16:15:31 UTC
(
hide
)
Description:
Bug 19265: Rancor - import records into existing batch
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2019-02-20 16:15:31 UTC
Size:
6.55 KB
patch
obsolete
>From d1eb73149ee700b918cff15102dd7a54f4b99474 Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Tue, 24 Nov 2015 14:53:11 -0700 >Subject: [PATCH] Bug 19265: Rancor - import records into existing batch > >To test: >1 - Manage some staged records >2 - Note that there is now an 'Import additional records' button >3 - Click it >4 - You sould be able to import as usual, but note the target batch is >specified >5 - Complete the import >6 - Verify all previous functionality works > >Rebased-on: 2019-02-20 - Alex Arnaud <alex.arnaud@biblibre.com> >Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> >--- > C4/ImportBatch.pm | 28 ++++++++++++++-------- > .../prog/en/modules/tools/manage-marc-import.tt | 6 ++++- > .../prog/en/modules/tools/stage-marc-import.tt | 2 ++ > tools/stage-marc-import.pl | 11 ++++++++- > 4 files changed, 35 insertions(+), 12 deletions(-) > >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index b2d53ae..521b9fd 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -380,21 +380,29 @@ sub BatchStageMarcRecords { > # of job > my $progress_interval = 0; > my $progress_callback = undef; >- if ($#_ == 1) { >+ if ($#_ >= 1) { > $progress_interval = shift; > $progress_callback = shift; > $progress_interval = 0 unless $progress_interval =~ /^\d+$/ and $progress_interval > 0; > $progress_interval = 0 unless 'CODE' eq ref $progress_callback; >- } >+ } >+ my $existing_batch_id = shift; > >- my $batch_id = AddImportBatch( { >- overlay_action => 'create_new', >- import_status => 'staging', >- batch_type => 'batch', >- file_name => $file_name, >- comments => $comments, >- record_type => $record_type, >- } ); >+ my $batch_id; >+ >+ if ( $existing_batch_id ) { >+ $batch_id = $existing_batch_id; >+ } else { >+ $batch_id = AddImportBatch( { >+ overlay_action => 'create_new', >+ import_status => 'staging', >+ batch_type => 'batch', >+ file_name => $file_name, >+ comments => $comments, >+ record_type => $record_type, >+ } ); >+ } >+ > if ($parse_items) { > SetImportBatchItemAction($batch_id, 'always_add'); > } else { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >index 9b58229..228a88a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >@@ -343,7 +343,7 @@ > > [% IF import_batch_id %] > <div id="toolbar" class="btn-toolbar"> >- <!--<button class="btn btn-small" id="import-additional" title="Import extra records into this batch"><i class="icon-plus"></i> <span>Import additional records</span></button>--> >+ <button class="btn btn-small" id="import-additional" title="Import extra records into this batch"><i class="icon-plus"></i> <span>Import additional records</span></button> > <button class="btn btn-small" id="export-selected" title="Import extra records into this batch"><i class="fa fa-hdd-o"></i> <span>Export selected records</span></button> > </div> > >@@ -650,6 +650,10 @@ > window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) ); > return false; > }); >+ $('#import-additional').click( function() { >+ window.open( '/cgi-bin/koha/tools/stage-marc-import.pl?existing_batch_id=' + [% import_batch_id %] ); >+ return false; >+ }); > [% END %] > > $("body").on("click",".previewMARC", function(e){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >index e169bcd..f8531a6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >@@ -63,6 +63,7 @@ > </p> > [% END %] > [% ELSE %] >+[% IF ( existing_batch_id ) %]<div class="dialog alert"><h3>Importing records into existing batch</h3><p>Records will be added to the existing batch "[% existing_batch.file_name %]" (#[% existing_batch_id %]).</p></div>[% END %] > <ul> > <li>Select a MARC file to stage in the import reservoir. It will be parsed, and each valid record staged for later import into the catalog.</li> > <li>You can enter a name for this import. It may be useful, when creating a record, to remember where the suggested MARC data comes from!</li> >@@ -102,6 +103,7 @@ > <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" /> > <input type="hidden" name="runinbackground" id="runinbackground" value="" /> > <input type="hidden" name="completedJobID" id="completedJobID" value="" /> >+ <input type="hidden" name="existing_batch_id" id="existing_batch_id" value="[% existing_batch_id %]" /> > <ol><li> > <label for="comments">Comments about this file: </label> > <input type="text" id="comments" name="comments" /> >diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl >index d76c35a..a602f74 100755 >--- a/tools/stage-marc-import.pl >+++ b/tools/stage-marc-import.pl >@@ -58,6 +58,7 @@ my $record_type = $input->param('record_type'); > my $encoding = $input->param('encoding') || 'UTF-8'; > my $format = $input->param('format') || 'ISO2709'; > my $marc_modification_template = $input->param('marc_modification_template_id'); >+my $existing_batch_id = $input->param('existing_batch_id'); > my $basketno = $input->param('basketno'); > my $booksellerid = $input->param('booksellerid'); > >@@ -149,7 +150,8 @@ if ($completedJobID) { > $marc_modification_template, > $comments, '', > $parse_items, 0, >- 50, staging_progress_callback( $job, $dbh ) >+ 50, staging_progress_callback( $job, $dbh ), >+ $existing_batch_id > ); > > my $num_with_matches = 0; >@@ -226,6 +228,13 @@ if ($completedJobID) { > }); > $template->param( plugins => \@plugins ); > } >+ >+ if ($existing_batch_id) { >+ $template->param( >+ existing_batch_id => $existing_batch_id, >+ existing_batch => GetImportBatch($existing_batch_id), >+ ); >+ } > } > > output_html_with_http_headers $input, $cookie, $template->output; >-- >2.7.4
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 19265
:
66898
|
66899
|
66900
|
77245
|
77246
|
77247
|
77248
|
80993
|
80994
|
80995
|
80996
|
85372
|
85373
|
85374
|
85375
|
85380
| 85381 |
85382
|
85383