View | Details | Raw Unified | Return to bug 19265
Collapse All | Expand All

(-)a/C4/ImportBatch.pm (-10 / +18 lines)
Lines 379-399 sub BatchStageMarcRecords { Link Here
379
    # of job
379
    # of job
380
    my $progress_interval = 0;
380
    my $progress_interval = 0;
381
    my $progress_callback = undef;
381
    my $progress_callback = undef;
382
    if ($#_ == 1) {
382
    if ($#_ >= 1) {
383
        $progress_interval = shift;
383
        $progress_interval = shift;
384
        $progress_callback = shift;
384
        $progress_callback = shift;
385
        $progress_interval = 0 unless $progress_interval =~ /^\d+$/ and $progress_interval > 0;
385
        $progress_interval = 0 unless $progress_interval =~ /^\d+$/ and $progress_interval > 0;
386
        $progress_interval = 0 unless 'CODE' eq ref $progress_callback;
386
        $progress_interval = 0 unless 'CODE' eq ref $progress_callback;
387
    } 
387
    }
388
    my $existing_batch_id = shift;
388
    
389
    
389
    my $batch_id = AddImportBatch( {
390
    my $batch_id;
390
            overlay_action => 'create_new',
391
391
            import_status => 'staging',
392
    if ( $existing_batch_id ) {
392
            batch_type => 'batch',
393
        $batch_id = $existing_batch_id;
393
            file_name => $file_name,
394
    } else {
394
            comments => $comments,
395
        $batch_id = AddImportBatch( {
395
            record_type => $record_type,
396
                overlay_action => 'create_new',
396
        } );
397
                import_status => 'staging',
398
                batch_type => 'batch',
399
                file_name => $file_name,
400
                comments => $comments,
401
                record_type => $record_type,
402
            } );
403
    }
404
397
    if ($parse_items) {
405
    if ($parse_items) {
398
        SetImportBatchItemAction($batch_id, 'always_add');
406
        SetImportBatchItemAction($batch_id, 'always_add');
399
    } else {
407
    } else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-1 / +5 lines)
Lines 150-155 $(document).ready(function(){ Link Here
150
          window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
150
          window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
151
          return false;
151
          return false;
152
      });
152
      });
153
      $('#import-additional').click( function() {
154
          window.open( '/cgi-bin/koha/tools/stage-marc-import.pl?existing_batch_id=' + [% import_batch_id %] );
155
          return false;
156
      });
153
    [% END %]
157
    [% END %]
154
    $("body").on("click",".previewMARC", function(e){
158
    $("body").on("click",".previewMARC", function(e){
155
        e.preventDefault();
159
        e.preventDefault();
Lines 510-516 $(document).ready(function(){ Link Here
510
514
511
[% IF import_batch_id %]
515
[% IF import_batch_id %]
512
    <div id="toolbar" class="btn-toolbar">
516
    <div id="toolbar" class="btn-toolbar">
513
        <!--<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>-->
517
        <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>
514
        <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>
518
        <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>
515
    </div>
519
    </div>
516
520
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt (+2 lines)
Lines 58-63 Link Here
58
    [% END %]
58
    [% END %]
59
</ul>
59
</ul>
60
[% ELSE %]
60
[% ELSE %]
61
[% 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 %]
61
<ul>
62
<ul>
62
    <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>
63
    <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>
63
    <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>
64
    <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>
Lines 93-98 Link Here
93
        <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
94
        <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
94
        <input type="hidden" name="runinbackground" id="runinbackground" value="" />
95
        <input type="hidden" name="runinbackground" id="runinbackground" value="" />
95
        <input type="hidden" name="completedJobID" id="completedJobID" value="" />
96
        <input type="hidden" name="completedJobID" id="completedJobID" value="" />
97
        <input type="hidden" name="existing_batch_id" id="existing_batch_id" value="[% existing_batch_id %]" />
96
	<ol><li>
98
	<ol><li>
97
		<label for="comments">Comments about this file: </label>
99
		<label for="comments">Comments about this file: </label>
98
		<input type="text" id="comments" name="comments" />
100
		<input type="text" id="comments" name="comments" />
(-)a/tools/stage-marc-import.pl (-2 / +10 lines)
Lines 58-63 my $record_type = $input->param('record_type'); Link Here
58
my $encoding                   = $input->param('encoding') || 'UTF-8';
58
my $encoding                   = $input->param('encoding') || 'UTF-8';
59
my $format                     = $input->param('format') || 'ISO2709';
59
my $format                     = $input->param('format') || 'ISO2709';
60
my $marc_modification_template = $input->param('marc_modification_template_id');
60
my $marc_modification_template = $input->param('marc_modification_template_id');
61
my $existing_batch_id          = $input->param('existing_batch_id');
61
62
62
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
63
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
63
    {
64
    {
Lines 145-151 if ($completedJobID) { Link Here
145
        $marc_modification_template,
146
        $marc_modification_template,
146
        $comments,       '',
147
        $comments,       '',
147
        $parse_items,    0,
148
        $parse_items,    0,
148
        50, staging_progress_callback( $job, $dbh )
149
        50, staging_progress_callback( $job, $dbh ),
150
        $existing_batch_id
149
      );
151
      );
150
152
151
    my $num_with_matches = 0;
153
    my $num_with_matches = 0;
Lines 218-223 if ($completedJobID) { Link Here
218
        });
220
        });
219
        $template->param( plugins => \@plugins );
221
        $template->param( plugins => \@plugins );
220
    }
222
    }
223
224
    if ($existing_batch_id) {
225
        $template->param(
226
            existing_batch_id => $existing_batch_id,
227
            existing_batch => GetImportBatch($existing_batch_id),
228
        );
229
    }
221
}
230
}
222
231
223
output_html_with_http_headers $input, $cookie, $template->output;
232
output_html_with_http_headers $input, $cookie, $template->output;
224
- 

Return to bug 19265