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 147-152 $(document).ready(function(){ Link Here
147
          window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
147
          window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
148
          return false;
148
          return false;
149
      });
149
      });
150
      $('#import-additional').click( function() {
151
          window.open( '/cgi-bin/koha/tools/stage-marc-import.pl?existing_batch_id=' + [% import_batch_id %] );
152
          return false;
153
      });
150
    [% END %]
154
    [% END %]
151
    $("body").on("click",".previewMARC", function(e){
155
    $("body").on("click",".previewMARC", function(e){
152
        e.preventDefault();
156
        e.preventDefault();
Lines 507-513 Page Link Here
507
511
508
[% IF import_batch_id %]
512
[% IF import_batch_id %]
509
    <div id="toolbar" class="btn-toolbar">
513
    <div id="toolbar" class="btn-toolbar">
510
        <!--<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="import-additional" title="Import extra records into this batch"><i class="icon-plus"></i> <span>Import additional records</span></button>
511
        <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
        <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>
512
    </div>
516
    </div>
513
517
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt (+2 lines)
Lines 135-140 function cbUpload( status, fileid ) { Link Here
135
    [% END %]
135
    [% END %]
136
</ul>
136
</ul>
137
[% ELSE %]
137
[% ELSE %]
138
[% 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 %]
138
<ul>
139
<ul>
139
    <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>
140
    <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>
140
    <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>
141
    <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 170-175 function cbUpload( status, fileid ) { Link Here
170
        <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
171
        <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
171
        <input type="hidden" name="runinbackground" id="runinbackground" value="" />
172
        <input type="hidden" name="runinbackground" id="runinbackground" value="" />
172
        <input type="hidden" name="completedJobID" id="completedJobID" value="" />
173
        <input type="hidden" name="completedJobID" id="completedJobID" value="" />
174
        <input type="hidden" name="existing_batch_id" id="existing_batch_id" value="[% existing_batch_id %]" />
173
	<ol><li>
175
	<ol><li>
174
		<label for="comments">Comments about this file: </label>
176
		<label for="comments">Comments about this file: </label>
175
		<input type="text" id="comments" name="comments" />
177
		<input type="text" id="comments" name="comments" />
(-)a/tools/stage-marc-import.pl (-2 / +10 lines)
Lines 59-64 my $record_type = $input->param('record_type'); Link Here
59
my $encoding                   = $input->param('encoding') || 'UTF-8';
59
my $encoding                   = $input->param('encoding') || 'UTF-8';
60
my $format                     = $input->param('format') || 'ISO2709';
60
my $format                     = $input->param('format') || 'ISO2709';
61
my $marc_modification_template = $input->param('marc_modification_template_id');
61
my $marc_modification_template = $input->param('marc_modification_template_id');
62
my $existing_batch_id          = $input->param('existing_batch_id');
62
63
63
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
64
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
64
    {
65
    {
Lines 146-152 if ($completedJobID) { Link Here
146
        $marc_modification_template,
147
        $marc_modification_template,
147
        $comments,       '',
148
        $comments,       '',
148
        $parse_items,    0,
149
        $parse_items,    0,
149
        50, staging_progress_callback( $job, $dbh )
150
        50, staging_progress_callback( $job, $dbh ),
151
        $existing_batch_id
150
      );
152
      );
151
153
152
    my $num_with_matches = 0;
154
    my $num_with_matches = 0;
Lines 219-224 if ($completedJobID) { Link Here
219
        });
221
        });
220
        $template->param( plugins => \@plugins );
222
        $template->param( plugins => \@plugins );
221
    }
223
    }
224
225
    if ($existing_batch_id) {
226
        $template->param(
227
            existing_batch_id => $existing_batch_id,
228
            existing_batch => GetImportBatch($existing_batch_id),
229
        );
230
    }
222
}
231
}
223
232
224
output_html_with_http_headers $input, $cookie, $template->output;
233
output_html_with_http_headers $input, $cookie, $template->output;
225
- 

Return to bug 19265