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

(-)a/cataloguing/addbiblio.pl (-2 / +8 lines)
Lines 702-708 my $fa_barcode = $input->param('barcode'); Link Here
702
my $fa_branch             = $input->param('branch');
702
my $fa_branch             = $input->param('branch');
703
my $fa_stickyduedate      = $input->param('stickyduedate');
703
my $fa_stickyduedate      = $input->param('stickyduedate');
704
my $fa_duedatespec        = $input->param('duedatespec');
704
my $fa_duedatespec        = $input->param('duedatespec');
705
705
my $previewrecord = $input->param('preview');
706
my $userflags = 'edit_catalogue';
706
my $userflags = 'edit_catalogue';
707
707
708
my $changed_framework = $input->param('changed_framework');
708
my $changed_framework = $input->param('changed_framework');
Lines 774-779 my ( Link Here
774
if (($biblionumber) && !($breedingid)){
774
if (($biblionumber) && !($breedingid)){
775
    $record = GetMarcBiblio({ biblionumber => $biblionumber });
775
    $record = GetMarcBiblio({ biblionumber => $biblionumber });
776
}
776
}
777
777
if ($breedingid) {
778
if ($breedingid) {
778
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
779
    ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
779
}
780
}
Lines 843-849 if ( $op eq "addbiblio" ) { Link Here
843
            ModBiblio( $record, $biblionumber, $frameworkcode );
844
            ModBiblio( $record, $biblionumber, $frameworkcode );
844
        }
845
        }
845
        else {
846
        else {
846
            ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode );
847
            if ($previewrecord) {
848
                AddBiblioToBatch(1, 0, $record, 'biblio', int(rand(99999)), 0);
849
                print $input->redirect('/cgi-bin/koha/cataloguing/addbooks.pl');
850
            } else {
851
                ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode );
852
            }
847
        }
853
        }
848
        if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){
854
        if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){
849
	    if ($frameworkcode eq 'FA'){
855
	    if ($frameworkcode eq 'FA'){
(-)a/installer/data/mysql/atomicupdate/add_draft_record_batch.sql (+1 lines)
Line 0 Link Here
1
INSERT INTO import_batches (import_batch_id,record_type,file_name,comments) VALUES (1, 'biblio', 'draft_marc_records.mrc', 'MARC file containing draft MARC records created in the addbiblio.pl file but not saved to the Koha catalog');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (+10 lines)
Lines 85-90 Link Here
85
            return false;
85
            return false;
86
        });
86
        });
87
87
88
        $("#previewrecord").click(function(){
89
            $(".btn-group").removeClass("open");
90
            document.getElementById('preview').value = 1;
91
            onOption();
92
            return false;
93
        });
94
88
        $("#saveandview").click(function(){
95
        $("#saveandview").click(function(){
89
            $(".btn-group").removeClass("open");
96
            $(".btn-group").removeClass("open");
90
            redirect("view");
97
            redirect("view");
Lines 345-350 function AreMandatoriesNotOk(){ Link Here
345
function Check(){
352
function Check(){
346
    var StrAlert = AreMandatoriesNotOk();
353
    var StrAlert = AreMandatoriesNotOk();
347
    if( ! StrAlert ){
354
    if( ! StrAlert ){
355
348
        document.f.submit();
356
        document.f.submit();
349
        return true;
357
        return true;
350
    } else {
358
    } else {
Lines 467-472 function Changefwk() { Link Here
467
                    <li><a id="saveandview" href="#">Save and view record</a></li>
475
                    <li><a id="saveandview" href="#">Save and view record</a></li>
468
                    <li><a id="saveanditems" href="#">Save and edit items</a></li>
476
                    <li><a id="saveanditems" href="#">Save and edit items</a></li>
469
                    <li><a id="saveandcontinue" href="#">Save and continue editing</a></li>
477
                    <li><a id="saveandcontinue" href="#">Save and continue editing</a></li>
478
                    <li><a id="previewrecord" name="previewrecord" href="#">Save without cataloging</a></li>
470
                </ul>
479
                </ul>
471
            </div>
480
            </div>
472
        [% END %]
481
        [% END %]
Lines 554-559 function Changefwk() { Link Here
554
        <input type="hidden" name="mode" value="popup" />
563
        <input type="hidden" name="mode" value="popup" />
555
[% END %]
564
[% END %]
556
        <input type="hidden" name="op" value="addbiblio" />
565
        <input type="hidden" name="op" value="addbiblio" />
566
        <input type="hidden" id="preview" name="preview" />
557
        <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode %]" />
567
        <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode %]" />
558
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
568
        <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
559
        <input type="hidden" name="breedingid" value="[% breedingid %]" />
569
        <input type="hidden" name="breedingid" value="[% breedingid %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt (+4 lines)
Lines 180-186 Link Here
180
                      <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
180
                      <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
181
                      <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
181
                      <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
182
                      [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
182
                      [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
183
                        [% IF breeding_loo.file == "draft_marc_records.mrc" %]
184
                            <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]"><i class="fa fa-plus"></i> Continue editing draft record</a></li>     
185
                        [% ELSE %]
183
                        <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]"><i class="fa fa-plus"></i> Add biblio</a></li>
186
                        <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]"><i class="fa fa-plus"></i> Add biblio</a></li>
187
                        [% END %]
184
                      [% END %]
188
                      [% END %]
185
                    </ul>
189
                    </ul>
186
                  </div>
190
                  </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-10 / +80 lines)
Lines 32-38 Link Here
32
	<div id="yui-main">
32
	<div id="yui-main">
33
	<div class="yui-b">
33
	<div class="yui-b">
34
34
35
<h1>Manage staged MARC records
35
<h1 id="managed_records">Manage staged MARC records
36
[% IF ( import_batch_id ) %]
36
[% IF ( import_batch_id ) %]
37
 &rsaquo; Batch [% import_batch_id %]
37
 &rsaquo; Batch [% import_batch_id %]
38
[% END %]
38
[% END %]
Lines 60-66 Link Here
60
   <div class="dialog message">
60
   <div class="dialog message">
61
     <p>No records have been staged.</p>
61
     <p>No records have been staged.</p>
62
     <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
62
     <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
63
   </div>
63
   /div>
64
   [% END %]
64
   [% END %]
65
[% END %]
65
[% END %]
66
66
Lines 270-275 Link Here
270
    [% END %]
270
    [% END %]
271
</div>
271
</div>
272
  [% END %]
272
  [% END %]
273
<div class="statictabs">
274
  <ul>
275
    <li><a id="marcfileslink">Marc files</a></li>
276
    <li><a id="draftrecordslink" name="draft_record_to_display" value="1">Draft records</a></li>
277
  </ul>
278
279
  <div class="tabs-container">
280
<div id="marcfiles">
273
<table>
281
<table>
274
  <tr>
282
  <tr>
275
    <th>#</th>
283
    <th>#</th>
Lines 284-291 Link Here
284
  </tr>
292
  </tr>
285
  [% FOREACH batch_lis IN batch_list %]
293
  [% FOREACH batch_lis IN batch_list %]
286
    <tr>
294
    <tr>
287
    <td>[% batch_lis.import_batch_id %]</td>
295
    <td class="import_batch_id">[% batch_lis.import_batch_id %]</td>
288
    <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
296
    <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;display_file_content=1">[% batch_lis.file_name %]</a></td>
289
    <td>[% batch_lis.comments %]</td>
297
    <td>[% batch_lis.comments %]</td>
290
    <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
298
    <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
291
    <td>
299
    <td>
Lines 307-313 Link Here
307
    </td>
315
    </td>
308
    <td>[% batch_lis.upload_timestamp %]</td>
316
    <td>[% batch_lis.upload_timestamp %]</td>
309
    <td>[% batch_lis.num_records %]</td>
317
    <td>[% batch_lis.num_records %]</td>
310
    <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
318
    <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;display_file_content=1&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
311
    <td class="actions">
319
    <td class="actions">
312
        [% IF ( batch_lis.can_clean ) %]
320
        [% IF ( batch_lis.can_clean ) %]
313
          <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" class="batch_form batch_clean" >
321
          <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" class="batch_form batch_clean" >
Lines 326-331 Link Here
326
  </tr>
334
  </tr>
327
  [% END %]
335
  [% END %]
328
</table>
336
</table>
337
</div>
338
339
<div id="draftrecords" onload="document.getElementById("draftrecords").style.display ='none';">
340
    <p> To edit or save these draft records click the 'Edit' link beside the appropriate record. </p>
341
    <table id="records-table">
342
        <thead>
343
           <tr>
344
             <th>#</th>
345
             <th>Citation</th>
346
             <th>Status</th>
347
             <th>Match type</th>
348
             <th>Match details</th>
349
             <th><abbr title="Differences between the original biblio and the imported">Diff</abbr></th>
350
             <th>Record</th>
351
             <th>Catalog link</th>
352
           </tr>
353
         </thead>
354
    </table>
355
</div>
356
</div>
357
</div>
358
329
  [% IF ( pages ) %]
359
  [% IF ( pages ) %]
330
<div class="pages">
360
<div class="pages">
331
    [% FOREACH page IN pages %]
361
    [% FOREACH page IN pages %]
Lines 396-402 Link Here
396
                $(this).parent().hide();
426
                $(this).parent().hide();
397
            });
427
            });
398
428
399
            [% IF import_batch_id %]
429
            [% IF !(import_batch_id) %]
430
                document.getElementById('draftrecords').style.display = 'none';
431
                var marcfileslink = document.getElementById("marcfileslink");
432
                marcfileslink.style.backgroundColor = "#FFF";
433
            [% END %]
434
435
            var marcfiles = document.getElementById("marcfiles");
436
            var draftrecords = document.getElementById("draftrecords");
437
            var draftrecordslink = document.getElementById("draftrecordslink");
438
            var marcfileslink = document.getElementById("marcfileslink");
439
440
            $("#draftrecordslink").click(function(e){
441
                draftrecords.style.display = "block";
442
                draftrecordslink.style.backgroundColor = "#FFF";
443
                marcfileslink.style.backgroundColor= "#e6f0f2";
444
                marcfiles.style.display = "none";
445
                if (document.getElementById("draftrecords").style.display === 'block') {
446
                    [% draft_record_to_display = 1 %]
447
                }
448
            });
449
450
            $("#marcfileslink").click(function(e){
451
                draftrecords.style.display = "none";
452
                marcfiles.style.display = "block";
453
                draftrecordslink.style.backgroundColor = "#e6f0f2";
454
                marcfileslink.style.backgroundColor= "#FFF";
455
            });
456
457
            [% IF (import_batch_id || draft_record_to_display) %]
400
                $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
458
                $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
401
                    "bAutoWidth": false,
459
                    "bAutoWidth": false,
402
                    "bFilter": false,
460
                    "bFilter": false,
Lines 412-422 Link Here
412
                        { "mDataProp": "overlay_status" },
470
                        { "mDataProp": "overlay_status" },
413
                        { "mDataProp": "match_citation" },
471
                        { "mDataProp": "match_citation" },
414
                        { "mDataProp": "diff_url" },
472
                        { "mDataProp": "diff_url" },
415
                        { "mDataProp": "matched" }
473
                        { "mDataProp": "matched" },
474
                        [% IF !(import_batch_id) %] { "mDataProp": "catalog_link" } [% END %]
416
                    ],
475
                    ],
417
                    "fnServerData": function ( sSource, aoData, fnCallback ) {
476
                    [% IF (import_batch_id) %]
418
                        aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
477
                        "fnServerData": function ( sSource, aoData, fnCallback ) {
419
478
                            aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
479
                    [% ELSE %]
480
                        "fnServerData": function ( sSource, aoData, fnCallback ) {
481
                            aoData.push( { "name": "import_batch_id", "value": [% draft_record_to_display %] } );
482
                    [% END %]
420
                        $.ajax({
483
                        $.ajax({
421
                            'dataType': 'json',
484
                            'dataType': 'json',
422
                            'type': 'POST',
485
                            'type': 'POST',
Lines 475-480 Link Here
475
                          '<a target="_blank" href="' + record_details_url
538
                          '<a target="_blank" href="' + record_details_url
476
                              + aData['matched'] + '">' + aData['matched'] + '</a>'
539
                              + aData['matched'] + '">' + aData['matched'] + '</a>'
477
                      );
540
                      );
541
                      [% IF !(import_batch_id) %]
542
                        if (aData['catalog_link']){
543
                           $('td:eq(7)', nRow).html(
544
                              '<a href="' + aData['catalog_link'] + '">' + "Edit" + '</a>'
545
                            );
546
                         }
547
                      [% END %]
478
                    },
548
                    },
479
                }));
549
                }));
480
                $("#import_batch_form").on("submit",function(){
550
                $("#import_batch_form").on("submit",function(){
(-)a/tools/batch_records_ajax.pl (-3 / +4 lines)
Lines 38-43 use C4::Context; Link Here
38
use C4::Charset;
38
use C4::Charset;
39
use C4::Auth qw/check_cookie_auth/;
39
use C4::Auth qw/check_cookie_auth/;
40
use C4::ImportBatch;
40
use C4::ImportBatch;
41
use Data::Dumper;
41
42
42
my $input = new CGI;
43
my $input = new CGI;
43
44
Lines 107-116 foreach my $record (@$records) { Link Here
107
          || q{},
108
          || q{},
108
        score => $#$match > -1 ? $match->[0]->{'score'} : 0,
109
        score => $#$match > -1 ? $match->[0]->{'score'} : 0,
109
        match_id => $match_id,
110
        match_id => $match_id,
110
        diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id" : undef
111
        diff_url => $match_id ? "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=$import_batch_id&importid=$record->{import_record_id}&id=$match_id" : undef,
112
        catalog_link => "/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=$record->{import_record_id}",
111
      };
113
      };
112
}
114
}
113
115
warn Dumper(@list);
114
my $data;
116
my $data;
115
$data->{'iTotalRecords'}        = $batch->{'num_records'};
117
$data->{'iTotalRecords'}        = $batch->{'num_records'};
116
$data->{'iTotalDisplayRecords'} = $batch->{'num_records'};
118
$data->{'iTotalDisplayRecords'} = $batch->{'num_records'};
117
- 

Return to bug 20678