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

(-)a/C4/ImportBatch.pm (-10 / +18 lines)
Lines 380-400 sub BatchStageMarcRecords { Link Here
380
    # of job
380
    # of job
381
    my $progress_interval = 0;
381
    my $progress_interval = 0;
382
    my $progress_callback = undef;
382
    my $progress_callback = undef;
383
    if ($#_ == 1) {
383
    if ($#_ >= 1) {
384
        $progress_interval = shift;
384
        $progress_interval = shift;
385
        $progress_callback = shift;
385
        $progress_callback = shift;
386
        $progress_interval = 0 unless $progress_interval =~ /^\d+$/ and $progress_interval > 0;
386
        $progress_interval = 0 unless $progress_interval =~ /^\d+$/ and $progress_interval > 0;
387
        $progress_interval = 0 unless 'CODE' eq ref $progress_callback;
387
        $progress_interval = 0 unless 'CODE' eq ref $progress_callback;
388
    } 
388
    }
389
    my $existing_batch_id = shift;
389
    
390
    
390
    my $batch_id = AddImportBatch( {
391
    my $batch_id;
391
            overlay_action => 'create_new',
392
392
            import_status => 'staging',
393
    if ( $existing_batch_id ) {
393
            batch_type => 'batch',
394
        $batch_id = $existing_batch_id;
394
            file_name => $file_name,
395
    } else {
395
            comments => $comments,
396
        $batch_id = AddImportBatch( {
396
            record_type => $record_type,
397
                overlay_action => 'create_new',
397
        } );
398
                import_status => 'staging',
399
                batch_type => 'batch',
400
                file_name => $file_name,
401
                comments => $comments,
402
                record_type => $record_type,
403
            } );
404
    }
405
398
    if ($parse_items) {
406
    if ($parse_items) {
399
        SetImportBatchItemAction($batch_id, 'always_add');
407
        SetImportBatchItemAction($batch_id, 'always_add');
400
    } else {
408
    } else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-1 / +5 lines)
Lines 343-349 Link Here
343
343
344
[% IF import_batch_id %]
344
[% IF import_batch_id %]
345
    <div id="toolbar" class="btn-toolbar">
345
    <div id="toolbar" class="btn-toolbar">
346
        <!--<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>-->
346
        <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>
347
        <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>
347
        <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>
348
    </div>
348
    </div>
349
349
Lines 650-655 Link Here
650
                    window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
650
                    window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
651
                    return false;
651
                    return false;
652
                });
652
                });
653
                $('#import-additional').click( function() {
654
                    window.open( '/cgi-bin/koha/tools/stage-marc-import.pl?existing_batch_id=' + [% import_batch_id %] );
655
                    return false;
656
                });
653
            [% END %]
657
            [% END %]
654
658
655
            $("body").on("click",".previewMARC", function(e){
659
            $("body").on("click",".previewMARC", function(e){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt (+2 lines)
Lines 63-68 Link Here
63
</p>
63
</p>
64
[% END %]
64
[% END %]
65
[% ELSE %]
65
[% ELSE %]
66
[% 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 %]
66
<ul>
67
<ul>
67
    <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>
68
    <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>
68
    <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>
69
    <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 102-107 Link Here
102
        <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
103
        <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
103
        <input type="hidden" name="runinbackground" id="runinbackground" value="" />
104
        <input type="hidden" name="runinbackground" id="runinbackground" value="" />
104
        <input type="hidden" name="completedJobID" id="completedJobID" value="" />
105
        <input type="hidden" name="completedJobID" id="completedJobID" value="" />
106
        <input type="hidden" name="existing_batch_id" id="existing_batch_id" value="[% existing_batch_id %]" />
105
	<ol><li>
107
	<ol><li>
106
		<label for="comments">Comments about this file: </label>
108
		<label for="comments">Comments about this file: </label>
107
		<input type="text" id="comments" name="comments" />
109
		<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
my $basketno                   = $input->param('basketno');
62
my $basketno                   = $input->param('basketno');
62
my $booksellerid               = $input->param('booksellerid');
63
my $booksellerid               = $input->param('booksellerid');
63
64
Lines 149-155 if ($completedJobID) { Link Here
149
        $marc_modification_template,
150
        $marc_modification_template,
150
        $comments,       '',
151
        $comments,       '',
151
        $parse_items,    0,
152
        $parse_items,    0,
152
        50, staging_progress_callback( $job, $dbh )
153
        50, staging_progress_callback( $job, $dbh ),
154
        $existing_batch_id
153
      );
155
      );
154
156
155
    my $num_with_matches = 0;
157
    my $num_with_matches = 0;
Lines 226-231 if ($completedJobID) { Link Here
226
        });
228
        });
227
        $template->param( plugins => \@plugins );
229
        $template->param( plugins => \@plugins );
228
    }
230
    }
231
232
    if ($existing_batch_id) {
233
        $template->param(
234
            existing_batch_id => $existing_batch_id,
235
            existing_batch => GetImportBatch($existing_batch_id),
236
        );
237
    }
229
}
238
}
230
239
231
output_html_with_http_headers $input, $cookie, $template->output;
240
output_html_with_http_headers $input, $cookie, $template->output;
232
- 

Return to bug 19265