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