Bugzilla – Attachment 66899 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.44 KB, created by
Nick Clemens (kidclamp)
on 2017-09-06 17:57:55 UTC
(
hide
)
Description:
Bug 19265: Rancor - import records into existing batch
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-09-06 17:57:55 UTC
Size:
6.44 KB
patch
obsolete
>From 5d7d17bd345066cbbba68099c06ee0c2fb6b9e5c 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 >--- > 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 0f9ff45..6d74f1f 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -379,21 +379,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 3a03b47..875ddca 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 >@@ -147,6 +147,10 @@ $(document).ready(function(){ > 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){ > e.preventDefault(); >@@ -507,7 +511,7 @@ Page > > [% 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> > >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 3229ea6..9a27b0c 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 >@@ -135,6 +135,7 @@ function cbUpload( status, fileid ) { > [% END %] > </ul> > [% 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> >@@ -170,6 +171,7 @@ function cbUpload( status, fileid ) { > <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 07a921f..25c0efb 100755 >--- a/tools/stage-marc-import.pl >+++ b/tools/stage-marc-import.pl >@@ -59,6 +59,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 ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >@@ -146,7 +147,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; >@@ -219,6 +221,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