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