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