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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-8 / +54 lines)
Lines 23-28 $(document).ready(function(){ Link Here
23
  });
23
  });
24
24
25
  [% IF import_batch_id %]
25
  [% IF import_batch_id %]
26
      var checkedRecords = {};
26
      $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
27
      $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
27
          "bAutoWidth": false,
28
          "bAutoWidth": false,
28
          "bFilter": false,
29
          "bFilter": false,
Lines 31-44 $(document).ready(function(){ Link Here
31
          "sAjaxSource": 'batch_records_ajax.pl',
32
          "sAjaxSource": 'batch_records_ajax.pl',
32
          "sPaginationType": "full_numbers",
33
          "sPaginationType": "full_numbers",
33
          "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
34
          "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
35
          "aaSorting": [ [ 1, 'asc' ] ],
34
          "aoColumns": [
36
          "aoColumns": [
37
              {
38
                  "bSortable": false,
39
                  "mDataProp": null,
40
                  "sDefaultContent": ''
41
              },
35
              { "mDataProp": "import_record_id" },
42
              { "mDataProp": "import_record_id" },
36
              { "mDataProp": "citation" },
43
              { "mDataProp": "citation" },
37
              { "mDataProp": "status" },
44
              { "mDataProp": "status" },
38
              { "mDataProp": "overlay_status" },
45
              { "mDataProp": "overlay_status" },
39
              { "mDataProp": "match_citation" },
46
              { "mDataProp": "match_citation" },
40
              { "mDataProp": "diff_url" },
47
              { "mDataProp": "diff_url" },
41
              { "mDataProp": "matched" }
48
              { "mDataProp": "matched" },
49
              {
50
                  "bSortable": false,
51
                  "mDataProp": null,
52
                  "sDefaultContent": ''
53
              }
42
          ],
54
          ],
43
          "fnServerData": function ( sSource, aoData, fnCallback ) {
55
          "fnServerData": function ( sSource, aoData, fnCallback ) {
44
              aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
56
              aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
Lines 60-70 $(document).ready(function(){ Link Here
60
                var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
72
                var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
61
            [% END %]
73
            [% END %]
62
74
63
            $('td:eq(1)', nRow).html(
75
            var record_id = aData['import_record_id'];
64
                '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
76
            var $checkbox = $('<input type="checkbox"></input>');
65
            );
77
            $('td:eq(0)', nRow).append($checkbox);
78
            $checkbox.prop( 'checked', checkedRecords[record_id] );
79
            $checkbox.change( function() {
80
                if ( this.checked ) {
81
                    checkedRecords[record_id] = true;
82
                } else {
83
                    delete checkedRecords[record_id];
84
                }
85
            } );
66
86
67
            $('td:eq(2)', nRow).html(
87
            $('td:eq(2)', nRow).html(
88
                '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '" class="previewMARC">' + aData['citation'] + '</a>'
89
            );
90
91
            $('td:eq(3)', nRow).html(
68
                aData['status'] == 'imported' ? _("Imported") :
92
                aData['status'] == 'imported' ? _("Imported") :
69
                aData['status'] == 'ignored'  ? _("Ignored")  :
93
                aData['status'] == 'ignored'  ? _("Ignored")  :
70
                aData['status'] == 'reverted' ? _("Reverted") :
94
                aData['status'] == 'reverted' ? _("Reverted") :
Lines 73-79 $(document).ready(function(){ Link Here
73
                aData['status']
97
                aData['status']
74
            );
98
            );
75
99
76
            $('td:eq(3)', nRow).html(
100
            $('td:eq(4)', nRow).html(
77
                aData['overlay_status'] == 'no_match'      ? _("No match")       :
101
                aData['overlay_status'] == 'no_match'      ? _("No match")       :
78
                aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
102
                aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
79
                aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
103
                aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
Lines 93-106 $(document).ready(function(){ Link Here
93
                );
117
                );
94
            }
118
            }
95
            if (aData['diff_url']){
119
            if (aData['diff_url']){
96
                $('td:eq(5)', nRow).html(
120
                $('td:eq(6)', nRow).html(
97
                    '<a href="'+aData['diff_url']+'">View</a>'
121
                    '<a rel="gb_page_center[960,600]" href="'+aData['diff_url']+'">View</a>'
98
                );
122
                );
99
            }
123
            }
100
            $('td:eq(6)', nRow).html(
124
            $('td:eq(7)', nRow).html(
101
                '<a target="_blank" href="' + record_details_url
125
                '<a target="_blank" href="' + record_details_url
102
                    + aData['matched'] + '">' + aData['matched'] + '</a>'
126
                    + aData['matched'] + '">' + aData['matched'] + '</a>'
103
            );
127
            );
128
            $('td:eq(8)', nRow).html(
129
                '<a target="_blank" href="/cgi-bin/koha/cataloguing/editor.pl#batch:[% import_batch_id %]/' + record_id
130
                    + '">' + _("Edit") + '</a>'
131
            );
104
          },
132
          },
105
      }));
133
      }));
106
        $("#import_batch_form").on("submit",function(){
134
        $("#import_batch_form").on("submit",function(){
Lines 109-114 $(document).ready(function(){ Link Here
109
        $("#revert_batch_form").on("submit",function(){
137
        $("#revert_batch_form").on("submit",function(){
110
            return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) &&   submitBackgroundJob( document.getElementById("revert_batch_form") );
138
            return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) &&   submitBackgroundJob( document.getElementById("revert_batch_form") );
111
        });
139
        });
140
      $('#export-selected').click( function() {
141
          var options = {
142
              import_record_id: $.map( checkedRecords, function( undef, key ) { return key; } ).join('|'),
143
          };
144
145
          if ( options.import_record_id.length == 0 ) return false;_
146
147
          window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) );
148
          return false;
149
      });
112
    [% END %]
150
    [% END %]
113
    $("body").on("click",".previewMARC", function(e){
151
    $("body").on("click",".previewMARC", function(e){
114
        e.preventDefault();
152
        e.preventDefault();
Lines 162-167 $(document).ready(function(){ Link Here
162
 &rsaquo; Batch [% import_batch_id %]
200
 &rsaquo; Batch [% import_batch_id %]
163
[% END %]
201
[% END %]
164
</h1>
202
</h1>
203
165
[% IF ( label_batch_msg ) %]
204
[% IF ( label_batch_msg ) %]
166
[% IF ( alert ) %]
205
[% IF ( alert ) %]
167
<div class="alert">
206
<div class="alert">
Lines 467-475 Page Link Here
467
[% END %]
506
[% END %]
468
507
469
[% IF import_batch_id %]
508
[% IF import_batch_id %]
509
    <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>-->
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>
512
    </div>
513
470
    <table id="records-table">
514
    <table id="records-table">
471
        <thead>
515
        <thead>
472
            <tr>
516
            <tr>
517
                <th>&nbsp;</th>
473
                <th>#</th>
518
                <th>#</th>
474
                <th>Citation</th>
519
                <th>Citation</th>
475
                <th>Status</th>
520
                <th>Status</th>
Lines 477-482 Page Link Here
477
                <th>Match details</th>
522
                <th>Match details</th>
478
                <th><abbr title="Differences between the original biblio and the imported">Diff</abbr></th>
523
                <th><abbr title="Differences between the original biblio and the imported">Diff</abbr></th>
479
                <th>Record</th>
524
                <th>Record</th>
525
                <th>Action</th>
480
            </tr>
526
            </tr>
481
        </thead>
527
        </thead>
482
    </table>
528
    </table>
(-)a/svc/cataloguing/import_batches (-1 / +6 lines)
Lines 85-90 sub download_batch { Link Here
85
        };
85
        };
86
    }
86
    }
87
87
88
    my $import_record_ids = $query->param( 'import_record_id' );
89
90
    if ( $import_record_ids ) {
91
        $extra_conditions{'import_record.import_record_id'} = { -in => [ split /\|/, $import_record_ids ] };
92
    }
93
88
    my $records = $schema->resultset('ImportBiblio')->search(
94
    my $records = $schema->resultset('ImportBiblio')->search(
89
        {
95
        {
90
            'import_record.import_batch_id' => $batch_id,
96
            'import_record.import_batch_id' => $batch_id,
91
- 

Return to bug 19265