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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-429 / +482 lines)
Lines 3-11 Link Here
3
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
5
<title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
6
[% IF ( import_batch_id ) %]
6
    [% IF ( import_batch_id ) %]
7
 &rsaquo; Batch [% import_batch_id | html %]
7
        &rsaquo; Batch [% import_batch_id | html %]
8
[% END %]
8
    [% END %]
9
</title>
9
</title>
10
[% INCLUDE 'doc-head-close.inc' %]
10
[% INCLUDE 'doc-head-close.inc' %]
11
<style>
11
<style>
Lines 13-401 Link Here
13
    span.change-status { font-style:italic; color:#666; display:none; }
13
    span.change-status { font-style:italic; color:#666; display:none; }
14
</style>
14
</style>
15
</head>
15
</head>
16
16
<body id="tools_manage-marc-import" class="tools">
17
<body id="tools_manage-marc-import" class="tools">
17
[% INCLUDE 'header.inc' %]
18
    [% INCLUDE 'header.inc' %]
18
[% INCLUDE 'cat-search.inc' %]
19
    [% INCLUDE 'cat-search.inc' %]
19
20
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> 
21
[% IF ( import_batch_id ) %]
22
 &rsaquo;
23
 <a href="[% script_name | url %]">Manage staged MARC records</a>
24
 &rsaquo; Batch [% import_batch_id | html %]
25
[% ELSE %]
26
 &rsaquo; Manage staged MARC records
27
[% END %]
28
</div>
29
20
30
<div class="main container-fluid">
21
    <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
31
    <div class="row">
22
        [% IF ( import_batch_id ) %]
32
        <div class="col-sm-10 col-sm-push-2">
23
            &rsaquo;
33
            <main>
24
            <a href="[% script_name | url %]">Manage staged MARC records</a>
25
            &rsaquo; Batch [% import_batch_id | html %]
26
        [% ELSE %]
27
            &rsaquo; Manage staged MARC records
28
        [% END %]
29
    </div>
34
30
35
<h1>Manage staged MARC records
31
    <div class="main container-fluid">
36
[% IF ( import_batch_id ) %]
32
        <div class="row">
37
 &rsaquo; Batch [% import_batch_id | html %]
33
            <div class="col-sm-10 col-sm-push-2">
38
[% END %]
34
                <main>
39
</h1>
35
                    <h1>Manage staged MARC records
40
[% IF ( label_batch_msg ) %]
36
                        [% IF ( import_batch_id ) %]
41
[% IF ( alert ) %]
37
                            &rsaquo; Batch [% import_batch_id | html %]
42
<div class="alert">
38
                        [% END %]
43
[% ELSE %]
39
                    </h1>
44
<div class="dialog message">
45
[% END %]
46
<b><p>[% label_batch_msg | html %]</p></b>
47
</div>
48
[% END %]
49
40
50
[% IF ( did_clean ) %]
41
                    [% IF ( label_batch_msg ) %]
51
  <div class="dialog message">Cleaned import batch #[% import_batch_id | html %]</div>
42
                        [% IF ( alert ) %]
52
[% END %]
43
                            <div class="alert">
44
                        [% ELSE %]
45
                            <div class="dialog message">
46
                        [% END %]
47
                            <b><p>[% label_batch_msg | html %]</p></b>
48
                        </div>
49
                    [% END %]
53
50
54
[% IF ( did_delete ) %]
51
                    [% IF ( did_clean ) %]
55
  <div class="dialog message">Import batch deleted successfully</div>
52
                        <div class="dialog message">Cleaned import batch #[% import_batch_id | html %]</div>
56
[% END %]
53
                    [% END %]
57
54
58
[% UNLESS ( batch_list ) %]
55
                    [% IF ( did_delete ) %]
59
   [% UNLESS ( batch_info ) %]
56
                        <div class="dialog message">Import batch deleted successfully</div>
60
   <div class="dialog message">
57
                    [% END %]
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>
63
   </div>
64
   [% END %]
65
[% END %]
66
58
67
[% IF ( batch_info ) %]
59
                    [% UNLESS ( batch_list ) %]
60
                        [% UNLESS ( batch_info ) %]
61
                            <div class="dialog message">
62
                                <p>No records have been staged.</p>
63
                                <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
64
                            </div>
65
                        [% END %]
66
                    [% END %]
68
67
69
[% IF ( can_commit ) %]
68
                    [% IF ( batch_info ) %]
70
<form action="[% script_name | html %]" method="post">
69
                        [% IF ( can_commit ) %]
71
<input type="hidden" name="op" value="redo-matching" />
70
                            <form action="[% script_name | html %]" method="post">
72
<input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
71
                                <input type="hidden" name="op" value="redo-matching" />
73
<input type="hidden" name="current_matcher_id" value="[% current_matcher_id | html %]" />
72
                                <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
74
[% END %]
73
                                <input type="hidden" name="current_matcher_id" value="[% current_matcher_id | html %]" />
74
                        [% END %]
75
75
76
  [% IF ( rematch_attempted ) %]
76
                        [% IF ( rematch_attempted ) %]
77
    [% IF ( rematch_failed ) %]
77
                            [% IF ( rematch_failed ) %]
78
      <div class="dialog alert">Failed to apply different matching rule</div>
78
                                <div class="dialog alert">Failed to apply different matching rule</div>
79
    [% ELSE %]
79
                            [% ELSE %]
80
      <div class="dialog message">Applied different matching rule.  Number of records matched now
80
                                <div class="dialog message">Applied different matching rule. Number of records matched now
81
       [% num_with_matches | html %]
81
                                    [% num_with_matches | html %]
82
      </div>
82
                                </div>
83
    [% END %]
83
                            [% END %]
84
  [% END %]
84
                        [% END %]
85
  [% IF ( changed_overlay_action ) %]
86
      <div class="dialog message">Changed action if matching record found</div>
87
  [% END %]
88
  [% IF ( changed_nomatch_action ) %]
89
      <div class="dialog message">Changed action if no match found</div>
90
  [% END %]
91
  [% IF ( changed_item_action ) %]
92
      <div class="dialog message">Changed item processing option</div>
93
  [% END %]
94
95
<fieldset class="rows" id="staged-record-matching-rules">
96
  <ol>
97
    <li><span class="label">File name:</span> [% file_name | html %]</li>
98
    <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments | html %][% ELSE %](none)[% END %]</li>
99
    <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
100
    <li><span class="label">Staged:</span> [% upload_timestamp | html %]</li>
101
    <li><span class="label">Status:</span>
102
      [% IF ( import_status == 'cleaned' ) %]
103
         Cleaned
104
      [% ELSIF ( import_status == 'imported' ) %]
105
        Imported
106
      [% ELSIF ( import_status == 'importing' ) %]
107
        Importing
108
      [% ELSIF ( import_status == 'reverted' ) %]
109
         Reverted
110
      [% ELSIF ( import_status == 'reverting' ) %]
111
         Reverting
112
      [% ELSIF ( import_status == 'staged' ) %]
113
          Staged
114
      [% ELSE %]
115
          [% import_status | html %]
116
      [% END %]
117
      </li>
118
    <li>
119
[% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
120
       <option value="">Do not look for matching records</option> 
121
       [% FOREACH available_matcher IN available_matchers %]
122
          [% IF ( available_matcher.selected ) %]
123
          <option value="[% available_matcher.matcher_id | html %]" selected="selected">
124
             [% available_matcher.code | html %] ([% available_matcher.description | html %])
125
          </option>
126
          [% ELSE %]
127
          <option value="[% available_matcher.matcher_id | html %]">
128
            [% available_matcher.code | html %] ([% available_matcher.description | html %])
129
          </option>
130
          [% END %]
131
       [% END %]
132
    </select> <span class="change-status">Changed. <a href="#" class="reset" id="reset_new_matcher_id">Reset</a></span>[% ELSE %]<span class="label">Matching rule applied</span>[% IF ( current_matcher_id ) %]
133
  [% current_matcher_code | html %] ([% current_matcher_description | html %])
134
[% ELSE %]
135
  No matching rule in effect
136
[% END %][% END %]
137
    </li>
138
    <li>
139
        [% IF ( can_commit ) %]
140
            <label for="overlay_action">Action if matching record found:</label>
141
            [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
142
        [% ELSE %]
143
            <span class="label">Action if matching record found:</span>
144
            [% IF ( overlay_action == 'replace' ) %]
145
                Replace existing record with incoming record
146
            [% ELSIF ( overlay_action == 'create_new' ) %]
147
                Add incoming record
148
            [% ELSIF ( overlay_action == 'ignore' ) %]
149
                Ignore incoming record (its items may still be processed)
150
            [% ELSE %]
151
                [% overlay_action | html %]
152
            [% END %]
153
        [% END %]</li>
154
     
155
    <li>
156
        [% IF ( can_commit ) %]
157
            <label for="nomatch_action">Action if no match found:</label>
158
            [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
159
        [% ELSE %]
160
            <span class="label">Action if no match found:</span>
161
            [% IF ( nomatch_action == 'create_new' ) %]
162
                Add incoming record
163
            [% ELSIF ( nomatch_action == 'ignore' ) %]
164
                Ignore incoming record (its items may still be processed)
165
            [% ELSE %]
166
                [% nomatch_action | html %]
167
            [% END %]
168
        [% END %]
169
    </li>
170
85
171
    [% IF ( record_type == 'biblio' ) %]
86
                        [% IF ( changed_overlay_action ) %]
172
    <li>
87
                            <div class="dialog message">Changed action if matching record found</div>
173
        [% IF ( can_commit ) %]
88
                        [% END %]
174
            <label for="item_action">Item processing:</label>
175
            [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
176
        [% ELSE %]
177
            <span class="label">Item processing:</span>
178
            [% IF ( item_action == 'always_add' ) %]
179
                Always add items
180
            [% ELSIF ( item_action == 'add_only_for_matches' ) %]
181
                Add items only if matching bib was found
182
            [% ELSIF ( item_action == 'add_only_for_new' ) %]
183
                Add items only if no matching bib was found
184
            [% ELSIF ( item_action == 'ignore' ) %]
185
                Ignore items
186
            [% ELSE %]
187
                [% item_action | html %]
188
            [% END %]
189
        [% END %]
190
    </li>
191
    [% END %]
192
  </ol>
193
[% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
194
</fieldset>
195
196
197
<div>
198
  [% IF ( can_commit ) %]
199
  <form action="[% script_name | html %]" method="post" id="import_batch_form">
200
    <input type="hidden" name="op" value="commit-batch" />
201
    <input type="hidden" name="runinbackground" value="" />
202
    <input type="hidden" name="completedJobID" value="" />
203
    <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
204
    <fieldset class="action">
205
    [% IF ( record_type != 'auth' ) %]
206
    Add new bibliographic records into this framework:
207
    <select name="framework" id="frameworks">
208
      <option value="">Default</option>
209
      [% FOREACH framework IN frameworks %]
210
          <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
211
      [% END %]
212
    </select>
213
    [% END %]
214
    <br/>
215
    <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
216
    </fieldset>
217
  </form>
218
  <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
219
     <div id="jobfailed"></div></div>
220
  [% END %]
221
  [% IF ( can_revert ) %]
222
  <form action="[% script_name | html %]" method="post" id="revert_batch_form">
223
    <input type="hidden" name="op" value="revert-batch" />
224
    <input type="hidden" name="runinbackground" value="" />
225
    <input type="hidden" name="completedJobID" value="" />
226
    <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
227
    <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
228
  </form>
229
  <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
230
     <div id="jobfailed"></div></div>
231
  [% END %]
232
</div>
233
  [% IF ( did_commit ) %]
234
  <div class="dialog message">Completed import of records</div>
235
  <table>
236
  <tr><td>Number of records added</td><td>[% num_added | html %]</td></tr>
237
  <tr><td>Number of records updated</td><td>[% num_updated | html %]</td></tr>
238
  <tr><td>Number of records ignored</td><td>[% num_ignored | html %]</td></tr>
239
  [% IF ( record_type == 'biblio' ) %]
240
      <tr><td>Number of items added</td><td>[% num_items_added | html %]</td></tr>
241
      <tr><td>Number of items replaced</td><td>[% num_items_replaced | html %]</td></tr>
242
      <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored | html %]</td></tr>
243
  [% END %]
244
  </table>
245
  [% END %]
246
  [% IF ( did_revert ) %]
247
  <div class="dialog message">Success: Import reversed</div>
248
  <table>
249
  <tr><td>Number of records deleted</td><td>[% num_deleted | html %]</td></tr>
250
  [% IF ( record_type == 'biblio' ) %]
251
    <tr><td>Number of items deleted</td><td>[% num_items_deleted | html %]</td></tr>
252
    <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors | html %]</td></tr>
253
  [% END %]
254
  <tr><td>Number of records changed back</td><td>[% num_reverted | html %]</td></tr>
255
  <tr><td>Number of records ignored</td><td>[% num_ignored | html %]</td></tr>
256
  </table>
257
  [% END %]
258
[% END %]
259
<br style="clear:both;" />
260
261
[% IF ( batch_list ) %]
262
  [% IF ( pages ) %]
263
<div class="pages">
264
    [% FOREACH page IN pages %]
265
      [% IF ( page.current_page ) %]
266
      <span class="current">[% page.page_number | html %]</span>
267
      [% ELSE %]
268
      <a href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a>
269
      [% END %]
270
    [% END %]
271
</div>
272
  [% END %]
273
<table>
274
  <tr>
275
    <th>#</th>
276
    <th>File name</th>
277
    <th>Comments</th>
278
    <th>Type</th>
279
    <th>Status</th>
280
    <th>Staged</th>
281
    <th># Records</th>
282
    <th># Items</th>
283
    <th>Action</th>
284
  </tr>
285
  [% FOREACH batch_lis IN batch_list %]
286
    <tr>
287
    <td>[% batch_lis.import_batch_id | html %]</td>
288
    <td><a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]">[% batch_lis.file_name | html %]</a></td>
289
    <td>[% batch_lis.comments | html %]</td>
290
    <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
291
    <td>
292
      [% IF ( batch_lis.import_status == 'cleaned' ) %]
293
         Cleaned
294
      [% ELSIF ( batch_lis.import_status == 'imported' ) %]
295
        Imported
296
      [% ELSIF ( batch_lis.import_status == 'importing' ) %]
297
        Importing
298
      [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
299
         Reverted
300
      [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
301
         Reverting
302
      [% ELSIF ( batch_lis.import_status == 'staged' ) %]
303
          Staged
304
      [% ELSE %]
305
          [% batch_lis.import_status | html %]
306
      [% END %]
307
    </td>
308
    <td>[% batch_lis.upload_timestamp | html %]</td>
309
    <td>[% batch_lis.num_records | html %]</td>
310
    <td>[% batch_lis.num_items | html %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
311
    <td class="actions">
312
        [% IF ( batch_lis.can_clean ) %]
313
          <form method="post" action="[% batch_lis.script_name | html %]" name="clean_batch_[% batch_lis.import_batch_id | html %]" id="clean_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_clean" >
314
            <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
315
            <input type="hidden" name="op" value="clean-batch" />
316
            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-eraser"></i> Clean</button>
317
          </form>
318
        [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
319
          <form method="post" action="/cgi-bin/koha/tools/manage-marc-import.pl" name="delete_batch_[% batch_lis.import_batch_id | html %]" id="delete_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_delete">
320
            <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
321
            <input type="hidden" name="op" value="delete-batch" />
322
            <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
323
          </form>
324
        [% END %]
325
    </td>
326
  </tr>
327
  [% END %]
328
</table>
329
  [% IF ( pages ) %]
330
<div class="pages">
331
    [% FOREACH page IN pages %]
332
      [% IF ( page.current_page ) %]
333
      <span class="current">[% page.page_number | html %]</span>
334
      [% ELSE %]
335
      <a href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a>
336
      [% END %]
337
    [% END %]
338
</div>
339
  [% END %]
340
[% END %]
341
89
342
[% IF import_batch_id %]
90
                        [% IF ( changed_nomatch_action ) %]
343
    <table id="records-table">
91
                            <div class="dialog message">Changed action if no match found</div>
344
        <thead>
92
                        [% END %]
345
            <tr>
93
346
                <th>#</th>
94
                        [% IF ( changed_item_action ) %]
347
                <th>Citation</th>
95
                            <div class="dialog message">Changed item processing option</div>
348
                <th>Status</th>
96
                        [% END %]
349
                <th>Match type</th>
97
350
                <th>Match details</th>
98
                        <fieldset class="rows" id="staged-record-matching-rules">
351
                <th><abbr title="Differences between the original bibliographic record and the imported">Diff</abbr></th>
99
                            <ol>
352
                <th>Record</th>
100
                                <li><span class="label">File name:</span> [% file_name | html %]</li>
353
            </tr>
101
                                <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments | html %][% ELSE %](none)[% END %]</li>
354
        </thead>
102
                                <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
355
    </table>
103
                                <li><span class="label">Staged:</span> [% upload_timestamp | html %]</li>
356
104
                                <li><span class="label">Status:</span>
357
    <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
105
                                    [% IF ( import_status == 'cleaned' ) %]
358
        <div class="modal-dialog">
106
                                        Cleaned
359
        <div class="modal-content">
107
                                    [% ELSIF ( import_status == 'imported' ) %]
360
        <div class="modal-header">
108
                                        Imported
361
            <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
109
                                    [% ELSIF ( import_status == 'importing' ) %]
362
            <h3 id="marcPreviewLabel">MARC preview</h3>
110
                                        Importing
363
        </div>
111
                                    [% ELSIF ( import_status == 'reverted' ) %]
364
        <div class="modal-body">
112
                                        Reverted
365
            <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
113
                                    [% ELSIF ( import_status == 'reverting' ) %]
366
        </div>
114
                                        Reverting
367
        <div class="modal-footer">
115
                                    [% ELSIF ( import_status == 'staged' ) %]
368
            <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
116
                                        Staged
369
        </div>
117
                                    [% ELSE %]
370
        </div>
118
                                        [% import_status | html %]
371
        </div>
119
                                    [% END %]
372
    </div>
120
                                </li>
373
[% END %]
121
                                <li>
122
                                    [% IF ( can_commit ) %]
123
                                        <label for="new_matcher_id">Matching rule applied:</label>
124
                                        <select name="new_matcher_id" id="new_matcher_id">
125
                                            <option value="">Do not look for matching records</option>
126
                                            [% FOREACH available_matcher IN available_matchers %]
127
                                                [% IF ( available_matcher.selected ) %]
128
                                                    <option value="[% available_matcher.matcher_id | html %]" selected="selected">
129
                                                        [% available_matcher.code | html %] ([% available_matcher.description | html %])
130
                                                    </option>
131
                                                [% ELSE %]
132
                                                    <option value="[% available_matcher.matcher_id | html %]">
133
                                                        [% available_matcher.code | html %] ([% available_matcher.description | html %])
134
                                                    </option>
135
                                                [% END %]
136
                                            [% END %]
137
                                        </select>
138
                                        <span class="change-status">Changed. <a href="#" class="reset" id="reset_new_matcher_id">Reset</a></span>
139
                                    [% ELSE %]
140
                                        <span class="label">Matching rule applied</span>
141
                                        [% IF ( current_matcher_id ) %]
142
                                            [% current_matcher_code | html %] ([% current_matcher_description | html %])
143
                                        [% ELSE %]
144
                                            No matching rule in effect
145
                                        [% END %]
146
                                    [% END %]
147
                                </li>
148
                                <li>
149
                                    [% IF ( can_commit ) %]
150
                                        <label for="overlay_action">Action if matching record found:</label>
151
                                        [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
152
                                    [% ELSE %]
153
                                        <span class="label">Action if matching record found:</span>
154
                                        [% IF ( overlay_action == 'replace' ) %]
155
                                            Replace existing record with incoming record
156
                                        [% ELSIF ( overlay_action == 'create_new' ) %]
157
                                            Add incoming record
158
                                        [% ELSIF ( overlay_action == 'ignore' ) %]
159
                                            Ignore incoming record (its items may still be processed)
160
                                        [% ELSE %]
161
                                            [% overlay_action | html %]
162
                                        [% END %]
163
                                    [% END %]
164
                                </li>
165
                                <li>
166
                                    [% IF ( can_commit ) %]
167
                                        <label for="nomatch_action">Action if no match found:</label>
168
                                        [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
169
                                    [% ELSE %]
170
                                        <span class="label">Action if no match found:</span>
171
                                        [% IF ( nomatch_action == 'create_new' ) %]
172
                                            Add incoming record
173
                                        [% ELSIF ( nomatch_action == 'ignore' ) %]
174
                                            Ignore incoming record (its items may still be processed)
175
                                        [% ELSE %]
176
                                            [% nomatch_action | html %]
177
                                        [% END %]
178
                                    [% END %]
179
                                </li>
180
                                [% IF ( record_type == 'biblio' ) %]
181
                                    <li>
182
                                        [% IF ( can_commit ) %]
183
                                            <label for="item_action">Item processing:</label>
184
                                            [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
185
                                        [% ELSE %]
186
                                            <span class="label">Item processing:</span>
187
                                            [% IF ( item_action == 'always_add' ) %]
188
                                                Always add items
189
                                            [% ELSIF ( item_action == 'add_only_for_matches' ) %]
190
                                                Add items only if matching bib was found
191
                                            [% ELSIF ( item_action == 'add_only_for_new' ) %]
192
                                                Add items only if no matching bib was found
193
                                            [% ELSIF ( item_action == 'ignore' ) %]
194
                                                Ignore items
195
                                            [% ELSE %]
196
                                                [% item_action | html %]
197
                                            [% END %]
198
                                        [% END %]
199
                                    </li>
200
                                [% END %]
201
                            </ol>
202
                            [% IF ( can_commit ) %]
203
                                    <fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset>
204
                                </form>
205
                            [% END %]
206
                        </fieldset>
207
208
                        <div>
209
                            [% IF ( can_commit ) %]
210
                                <form action="[% script_name | html %]" method="post" id="import_batch_form">
211
                                    <input type="hidden" name="op" value="commit-batch" />
212
                                    <input type="hidden" name="runinbackground" value="" />
213
                                    <input type="hidden" name="completedJobID" value="" />
214
                                    <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
215
                                    <fieldset class="action">
216
                                        [% IF ( record_type != 'auth' ) %]
217
                                            Add new bibliographic records into this framework:
218
                                            <select name="framework" id="frameworks">
219
                                                <option value="">Default</option>
220
                                                [% FOREACH framework IN frameworks %]
221
                                                    <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
222
                                                [% END %]
223
                                            </select>
224
                                        [% END %]
225
                                        <br />
226
                                        <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
227
                                    </fieldset>
228
                                </form>
229
                                <div id="jobpanel">
230
                                    <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
231
                                    <div id="jobfailed"></div>
232
                                </div>
233
                            [% END %]
234
                            [% IF ( can_revert ) %]
235
                                <form action="[% script_name | html %]" method="post" id="revert_batch_form">
236
                                    <input type="hidden" name="op" value="revert-batch" />
237
                                    <input type="hidden" name="runinbackground" value="" />
238
                                    <input type="hidden" name="completedJobID" value="" />
239
                                    <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
240
                                    <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
241
                                </form>
242
                                <div id="jobpanel">
243
                                    <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
244
                                    <div id="jobfailed"></div>
245
                                </div>
246
                            [% END %]
247
                        </div>
248
249
                        [% IF ( did_commit ) %]
250
                            <div class="dialog message">Completed import of records</div>
251
                            <table>
252
                                <tr>
253
                                    <td>Number of records added</td>
254
                                    <td>[% num_added | html %]</td>
255
                                </tr>
256
                                <tr>
257
                                    <td>Number of records updated</td>
258
                                    <td>[% num_updated | html %]</td>
259
                                </tr>
260
                                <tr>
261
                                    <td>Number of records ignored</td>
262
                                    <td>[% num_ignored | html %]</td>
263
                                </tr>
264
                                [% IF ( record_type == 'biblio' ) %]
265
                                    <tr>
266
                                        <td>Number of items added</td>
267
                                        <td>[% num_items_added | html %]</td>
268
                                    </tr>
269
                                    <tr>
270
                                        <td>Number of items replaced</td>
271
                                        <td>[% num_items_replaced | html %]</td>
272
                                    </tr>
273
                                    <tr>
274
                                        <td>Number of items ignored because of duplicate barcode</td>
275
                                        <td>[% num_items_errored | html %]</td>
276
                                    </tr>
277
                                [% END %]
278
                            </table>
279
                        [% END %]
280
281
                        [% IF ( did_revert ) %]
282
                            <div class="dialog message">Success: Import reversed</div>
283
                            <table>
284
                                <tr>
285
                                    <td>Number of records deleted</td>
286
                                    <td>[% num_deleted | html %]</td>
287
                                </tr>
288
                                [% IF ( record_type == 'biblio' ) %]
289
                                    <tr>
290
                                        <td>Number of items deleted</td>
291
                                        <td>[% num_items_deleted | html %]</td>
292
                                    </tr>
293
                                    <tr>
294
                                        <td>Number of records not deleted due to items on loan</td>
295
                                        <td>[% num_errors | html %]</td>
296
                                    </tr>
297
                                [% END %]
298
                                <tr>
299
                                    <td>Number of records changed back</td>
300
                                    <td>[% num_reverted | html %]</td>
301
                                </tr>
302
                                <tr>
303
                                    <td>Number of records ignored</td>
304
                                    <td>[% num_ignored | html %]</td>
305
                                </tr>
306
                            </table>
307
                        [% END %]
308
309
                    [% END %]
374
310
375
            </main>
311
                    <br style="clear:both;" />
376
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
377
312
378
        <div class="col-sm-2 col-sm-pull-10">
313
                    [% IF ( batch_list ) %]
379
            <aside>
314
                        [% IF ( pages ) %]
380
                [% INCLUDE 'tools-menu.inc' %]
315
                            <div class="pages">
381
            </aside>
316
                                [% FOREACH page IN pages %]
382
        </div> <!-- .col-sm-2.col-sm-pull-10 -->
317
                                    [% IF ( page.current_page ) %]
383
     </div> <!-- /.row -->
318
                                        <span class="current">[% page.page_number | html %]</span>
319
                                    [% ELSE %]
320
                                        <a href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a>
321
                                    [% END %]
322
                                [% END %]
323
                            </div>
324
                        [% END %]
325
326
                        <table>
327
                            <tr>
328
                                <th>#</th>
329
                                <th>File name</th>
330
                                <th>Comments</th>
331
                                <th>Type</th>
332
                                <th>Status</th>
333
                                <th>Staged</th>
334
                                <th># Records</th>
335
                                <th># Items</th>
336
                                <th>Action</th>
337
                            </tr>
338
                            [% FOREACH batch_lis IN batch_list %]
339
                                <tr>
340
                                    <td>[% batch_lis.import_batch_id | html %]</td>
341
                                    <td><a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]">[% batch_lis.file_name | html %]</a></td>
342
                                    <td>[% batch_lis.comments | html %]</td>
343
                                    <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
344
                                    <td>
345
                                        [% IF ( batch_lis.import_status == 'cleaned' ) %]
346
                                            Cleaned
347
                                        [% ELSIF ( batch_lis.import_status == 'imported' ) %]
348
                                            Imported
349
                                        [% ELSIF ( batch_lis.import_status == 'importing' ) %]
350
                                            Importing
351
                                        [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
352
                                            Reverted
353
                                        [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
354
                                            Reverting
355
                                        [% ELSIF ( batch_lis.import_status == 'staged' ) %]
356
                                            Staged
357
                                        [% ELSE %]
358
                                            [% batch_lis.import_status | html %]
359
                                        [% END %]
360
                                    </td>
361
                                    <td>[% batch_lis.upload_timestamp | html %]</td>
362
                                    <td>[% batch_lis.num_records | html %]</td>
363
                                    <td>[% batch_lis.num_items | html %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
364
                                    <td class="actions">
365
                                        [% IF ( batch_lis.can_clean ) %]
366
                                            <form method="post" action="[% batch_lis.script_name | html %]" name="clean_batch_[% batch_lis.import_batch_id | html %]" id="clean_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_clean">
367
                                                <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
368
                                                <input type="hidden" name="op" value="clean-batch" />
369
                                                <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-eraser"></i> Clean</button>
370
                                            </form>
371
                                        [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
372
                                            <form method="post" action="/cgi-bin/koha/tools/manage-marc-import.pl" name="delete_batch_[% batch_lis.import_batch_id | html %]" id="delete_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_delete">
373
                                                <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
374
                                                <input type="hidden" name="op" value="delete-batch" />
375
                                                <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
376
                                            </form>
377
                                        [% END %]
378
                                    </td>
379
                                </tr>
380
                            [% END %]
381
                        </table>
382
383
                        [% IF ( pages ) %]
384
                            <div class="pages">
385
                                [% FOREACH page IN pages %]
386
                                    [% IF ( page.current_page ) %]
387
                                        <span class="current">[% page.page_number | html %]</span>
388
                                    [% ELSE %]
389
                                        <a href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a>
390
                                    [% END %]
391
                                [% END %]
392
                            </div>
393
                        [% END %]
394
                    [% END %]
395
396
                    [% IF import_batch_id %]
397
                        <table id="records-table">
398
                            <thead>
399
                                <tr>
400
                                    <th>#</th>
401
                                    <th>Citation</th>
402
                                    <th>Status</th>
403
                                    <th>Match type</th>
404
                                    <th>Match details</th>
405
                                    <th><abbr title="Differences between the original bibliographic record and the imported">Diff</abbr></th>
406
                                    <th>Record</th>
407
                                </tr>
408
                            </thead>
409
                        </table>
410
411
                        <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
412
                            <div class="modal-dialog">
413
                                <div class="modal-content">
414
                                    <div class="modal-header">
415
                                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
416
                                        <h3 id="marcPreviewLabel">MARC preview</h3>
417
                                    </div>
418
                                    <div class="modal-body">
419
                                        <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
420
                                    </div>
421
                                    <div class="modal-footer">
422
                                        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
423
                                    </div>
424
                                </div>
425
                            </div>
426
                        </div>
427
                    [% END %]
428
                </main>
429
430
            </div> <!-- /.col-sm-10.col-sm-push-2 -->
431
            <div class="col-sm-2 col-sm-pull-10">
432
                <aside>
433
                    [% INCLUDE 'tools-menu.inc' %]
434
                </aside>
435
            </div> <!-- .col-sm-2.col-sm-pull-10 -->
436
        </div> <!-- /.row -->
384
437
385
[% MACRO jsinclude BLOCK %]
438
[% MACRO jsinclude BLOCK %]
386
    [% Asset.js("js/tools-menu.js") | $raw %]
439
    [% Asset.js("js/tools-menu.js") | $raw %]
387
    [% Asset.js("js/background-job-progressbar.js") | $raw %]
440
    [% Asset.js("js/background-job-progressbar.js") | $raw %]
388
    [% INCLUDE 'datatables.inc' %]
441
    [% INCLUDE 'datatables.inc' %]
389
    <script>
442
    <script>
390
        $(document).ready(function(){
443
        $(document).ready(function() {
391
            $("#staged-record-matching-rules select").change(function(){
444
            $("#staged-record-matching-rules select").change(function() {
392
                var str = $(this).attr("id");
445
                var str = $(this).attr("id");
393
                $("#reset_"+str).parent().show();
446
                $("#reset_" + str).parent().show();
394
            });
447
            });
395
            $("a.reset").click(function(){
448
            $("a.reset").click(function() {
396
                var str = $(this).attr("id");
449
                var str = $(this).attr("id");
397
                str = str.replace("reset_","")
450
                str = str.replace("reset_", "")
398
                $("#"+str+" option[selected='selected']").attr("selected","selected");
451
                $("#" + str + " option[selected='selected']").attr("selected", "selected");
399
                $(this).parent().hide();
452
                $(this).parent().hide();
400
            });
453
            });
401
454
Lines 417-513 Link Here
417
                        { "mDataProp": "diff_url" },
470
                        { "mDataProp": "diff_url" },
418
                        { "mDataProp": "matched" }
471
                        { "mDataProp": "matched" }
419
                    ],
472
                    ],
420
                    "fnServerData": function ( sSource, aoData, fnCallback ) {
473
                    "fnServerData": function(sSource, aoData, fnCallback) {
421
                        aoData.push( { "name": "import_batch_id", "value": [% import_batch_id | html %] } );
474
                        aoData.push({ "name": "import_batch_id", "value": [% import_batch_id | html %] });
422
475
423
                        $.ajax({
476
                        $.ajax({
424
                            'dataType': 'json',
477
                            'dataType': 'json',
425
                            'type': 'POST',
478
                            'type': 'POST',
426
                            'url': sSource,
479
                            'url': sSource,
427
                            'data': aoData,
480
                            'data': aoData,
428
                            'success': function(json){
481
                            'success': function(json) {
429
                                fnCallback(json);
482
                                fnCallback(json);
430
                            }
483
                            }
431
                        });
484
                        });
432
                    },
485
                    },
433
                    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
486
                    "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
434
                      [% IF ( record_type == 'auth' ) %]
487
                        [% IF(record_type == 'auth') %]
435
                          var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
488
                            var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
436
                      [% ELSE %]
489
                        [% ELSE %]
437
                          var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
490
                            var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
438
                      [% END %]
491
                        [% END %]
439
492
440
                      $('td:eq(1)', nRow).html(
493
                        $('td:eq(1)', nRow).html(
441
                          '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
494
                            '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
442
                      );
495
                        );
443
496
444
                      $('td:eq(2)', nRow).html(
497
                        $('td:eq(2)', nRow).html(
445
                          aData['status'] == 'imported' ? _("Imported") :
498
                            aData['status'] == 'imported' ? _("Imported") :
446
                          aData['status'] == 'ignored'  ? _("Ignored")  :
499
                            aData['status'] == 'ignored' ? _("Ignored") :
447
                          aData['status'] == 'reverted' ? _("Reverted") :
500
                            aData['status'] == 'reverted' ? _("Reverted") :
448
                          aData['status'] == 'staged'   ? _("Staged")   :
501
                            aData['status'] == 'staged' ? _("Staged") :
449
                          aData['status'] == 'error'    ? _("Error")    :
502
                            aData['status'] == 'error' ? _("Error") :
450
                          aData['status']
503
                            aData['status']
451
                      );
504
                        );
452
505
453
                      $('td:eq(3)', nRow).html(
506
                        $('td:eq(3)', nRow).html(
454
                          aData['overlay_status'] == 'no_match'      ? _("No match")       :
507
                            aData['overlay_status'] == 'no_match' ? _("No match") :
455
                          aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
508
                            aData['overlay_status'] == 'match_applied' ? _("Match applied") :
456
                          aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
509
                            aData['overlay_status'] == 'auto_match' ? _("Match found") :
457
                          aData['overlay_status']
510
                            aData['overlay_status']
458
                      );
511
                        );
459
512
460
                      if ( aData['match_id'] ) {
513
                        if (aData['match_id']) {
461
                          [% IF ( record_type == 'auth' ) -%]
514
                            [% IF(record_type == 'auth') -%]
462
                          var matching_msg = _("Matches authority %s (score=%s):%s");
515
                                var matching_msg = _("Matches authority %s (score=%s):%s");
463
                          [%- ELSE -%]
516
                            [%- ELSE -%]
464
                          var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
517
                                var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
465
                          [%- END %]
518
                            [%- END %]
466
                          $('td:eq(4)', nRow).html(
519
                            $('td:eq(4)', nRow).html(
467
                              matching_msg.format(aData['match_id'], aData['score'],
520
                                matching_msg.format(aData['match_id'], aData['score'],
468
                              '<a target="_blank" href="' + record_details_url
521
                                    '<a target="_blank" href="' + record_details_url
469
                              + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
522
                                    + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
470
                          );
523
                            );
471
                      }
524
                        }
472
                      if (aData['diff_url']){
525
                        if (aData['diff_url']) {
473
                          $('td:eq(5)', nRow).html(
526
                            $('td:eq(5)', nRow).html(
474
                              '<a href="'+aData['diff_url']+'">' + _("View") + '</a>'
527
                                '<a href="' + aData['diff_url'] + '">' + _("View") + '</a>'
475
                          );
528
                            );
476
                      }
529
                        }
477
                      $('td:eq(6)', nRow).html(
530
                        $('td:eq(6)', nRow).html(
478
                          '<a target="_blank" href="' + record_details_url
531
                            '<a target="_blank" href="' + record_details_url
479
                              + aData['matched'] + '">' + aData['matched'] + '</a>'
532
                            + aData['matched'] + '">' + aData['matched'] + '</a>'
480
                      );
533
                        );
481
                    },
534
                    },
482
                }));
535
                }));
483
                $("#import_batch_form").on("submit",function(){
536
                $("#import_batch_form").on("submit", function() {
484
                    return submitBackgroundJob( document.getElementById("import_batch_form") );
537
                    return submitBackgroundJob(document.getElementById("import_batch_form"));
485
                });
538
                });
486
                $("#revert_batch_form").on("submit",function(){
539
                $("#revert_batch_form").on("submit", function() {
487
                    return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) &&   submitBackgroundJob( document.getElementById("revert_batch_form") );
540
                    return confirm(_("Are you sure you want to undo the import of this batch into the catalog?")) && submitBackgroundJob(document.getElementById("revert_batch_form"));
488
                });
541
                });
489
            [% END %]
542
            [% END %]
490
            $("body").on("click",".previewMARC", function(e){
543
544
            $("body").on("click", ".previewMARC", function(e) {
491
                e.preventDefault();
545
                e.preventDefault();
492
                var ltitle = $(this).text();
546
                var ltitle = $(this).text();
493
                var page = $(this).attr("href");
547
                var page = $(this).attr("href");
494
                $("#marcPreviewLabel").text(ltitle);
548
                $("#marcPreviewLabel").text(ltitle);
495
                $("#marcPreview .modal-body").load(page + " table");
549
                $("#marcPreview .modal-body").load(page + " table");
496
                $('#marcPreview').modal({show:true});
550
                $('#marcPreview').modal({ show: true });
497
            });
551
            });
498
            $("#marcPreview").on("hidden.bs.modal", function(){
552
            $("#marcPreview").on("hidden.bs.modal", function() {
499
                $("#marcPreviewLabel").html("");
553
                $("#marcPreviewLabel").html("");
500
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
554
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
501
            });
555
            });
502
            $(".batch_form").on("submit",function(){
556
            $(".batch_form").on("submit", function() {
503
                if( $(this).hasClass("batch_delete") ){
557
                if ($(this).hasClass("batch_delete")) {
504
                    return confirm( _("Are you sure you want to permanently delete this batch?") );
558
                    return confirm(_("Are you sure you want to permanently delete this batch?"));
505
                } else {
559
                } else {
506
                    return confirm( _("Clear all reservoir records staged in this batch?  This cannot be undone.") );
560
                    return confirm(_("Clear all reservoir records staged in this batch?  This cannot be undone."));
507
                }
561
                }
508
            });
562
            });
509
        });
563
        });
564
510
    </script>
565
    </script>
511
[% END %]
566
[% END %]
512
513
[% INCLUDE 'intranet-bottom.inc' %]
567
[% INCLUDE 'intranet-bottom.inc' %]
514
- 

Return to bug 23221