Merge remote-tracking branch 'origin/new/bug_7412'
[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 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></td>
16             [% END %]
17         </tr>
18     [% END %]
19 [% END %]
20 [% INCLUDE 'doc-head-open.inc' %]
21 <title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
22 [% IF ( import_batch_id ) %]
23  &rsaquo; Batch [% import_batch_id %]
24 [% END %]
25 </title>
26 [% INCLUDE 'greybox.inc' %]
27 [% INCLUDE 'doc-head-close.inc' %]
28 <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
29 <script type="text/JavaScript" language="JavaScript">
30 //<![CDATA[
31 $(document).ready(function(){
32   $("#staged-record-matching-rules select").change(function(){
33       var str = $(this).attr("id");
34       $("#reset_"+str).parent().show();
35   });
36   $("a.reset").click(function(){
37       var str = $(this).attr("id");
38       str = str.replace("reset_","")
39       $("#"+str+" option[selected='selected']").attr("selected","selected");
40       $(this).parent().hide();
41   });
42 });
43 //]]>
44 </script>
45 <style type="text/css">
46         #jobpanel,#jobstatus,#jobfailed { display : none; }
47         #jobstatus { margin:.4em; }
48         #jobprogress{ width:200px;height:10px;border:1px solid #666;background:url('/intranet-tmpl/prog/img/progress.png') -300px 0px no-repeat; } span.change-status { font-style:italic; color:#666; display:none; }</style>
49 </head>
50 <body id="tools_manage-marc-import" class="tools">
51 [% INCLUDE 'header.inc' %]
52 [% INCLUDE 'cat-search.inc' %]
53
54 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> 
55 [% IF ( import_batch_id ) %]
56  &rsaquo;
57  <a href="[% script_name %]">Manage staged MARC records</a>
58  &rsaquo; Batch [% import_batch_id %]
59 [% ELSE %]
60  &rsaquo; Manage staged MARC records
61 [% END %]
62 </div>
63
64 <div id="doc3" class="yui-t2">
65    
66    <div id="bd">
67         <div id="yui-main">
68         <div class="yui-b">
69
70 <h1>Manage staged MARC records
71 [% IF ( import_batch_id ) %]
72  &rsaquo; Batch [% import_batch_id %]
73 [% END %]
74 </h1>
75 [% IF ( label_batch_msg ) %]
76 [% IF ( alert ) %]
77 <div class="alert">
78 [% ELSE %]
79 <div class="dialog">
80 [% END %]
81 <b><p>[% label_batch_msg %]</p></b>
82 </div>
83 [% END %]
84
85 [% IF ( did_clean ) %]
86   <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
87 [% END %]
88
89 [% UNLESS ( batch_list ) %]
90    [% UNLESS ( batch_info ) %]
91    <div class="dialog message">
92      <p>No records have been staged.</p>
93      <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
94    </div>
95    [% END %]
96 [% END %]
97
98 [% IF ( batch_info ) %]
99
100 [% IF ( can_commit ) %]
101 <form action="[% script_name %]" method="post">
102 <input type="hidden" name="op" value="redo-matching" />
103 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
104 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
105 [% END %]
106
107   [% IF ( rematch_attempted ) %]
108     [% IF ( rematch_failed ) %]
109       <div class="dialog alert">Failed to apply different matching rule</div>
110     [% ELSE %]
111       <div class="dialog message">Applied different matching rule.  Number of records matched now
112        [% num_with_matches %]
113       </div>
114     [% END %]
115   [% END %]
116   [% IF ( changed_overlay_action ) %]
117       <div class="dialog message">Changed action if matching record found</div>
118   [% END %]
119   [% IF ( changed_nomatch_action ) %]
120       <div class="dialog message">Changed action if no match found</div>
121   [% END %]
122   [% IF ( changed_item_action ) %]
123       <div class="dialog message">Changed item processing option</div>
124   [% END %]
125
126 <fieldset class="rows" id="staged-record-matching-rules">
127   <ol>
128     <li><span class="label">File name:</span> [% file_name %]</li>
129     <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
130     <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
131     <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
132     <li><span class="label">Status:</span> [% import_status %]</li>
133     <li> 
134 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
135        <option value="">Do not look for matching records</option> 
136        [% FOREACH available_matcher IN available_matchers %]
137           [% IF ( available_matcher.selected ) %]
138           <option value="[% available_matcher.matcher_id %]" selected="selected">
139              [% available_matcher.code %] ([% available_matcher.description %])
140           </option>
141           [% ELSE %]
142           <option value="[% available_matcher.matcher_id %]">
143             [% available_matcher.code %] ([% available_matcher.description %])
144           </option>
145           [% END %]
146        [% END %]
147     </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 ) %]
148   [% current_matcher_code %] ([% current_matcher_description %])
149 [% ELSE %]
150   No matching rule in effect
151 [% END %][% END %]
152     </li>
153     <li>[% IF ( can_commit ) %] <label for="overlay_action">Action if matching record found:</label>
154      [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>[% ELSE %]<span class="label">Action if matching record found:</span>[% overlay_action %][% END %]</li>
155      
156     <li>[% IF ( can_commit ) %]<label for="nomatch_action">Action if no match found:</label>
157      [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>[% ELSE %]<span class="label">Action if no match found:</span>[% nomatch_action %][% END %]</li>
158     
159     <li>[% IF ( can_commit ) %]<label for="item_action">Item processing:</label>
160      [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>[% ELSE %]<span class="label">Item processing:</span>[% item_action %][% END %]</li>
161   </ol>
162 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
163 </fieldset>
164
165
166 <div>
167   [% IF ( can_commit ) %]
168   <form action="[% script_name %]" method="post">
169     <input type="hidden" name="op" value="commit-batch" />
170     <input type="hidden" name="runinbackground" value="" />
171     <input type="hidden" name="completedJobID" value="" />
172     <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
173     <fieldset class="action">
174     <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" onclick="return submitBackgroundJob(this.form);" />
175     <br/>
176     Add new bibliographic records into this framework:
177     <select name="framework" id="frameworks">
178       <option value="">Default</option>
179       [% FOREACH framework IN frameworks %]
180           <option value="[% framework.value %]">[% framework.label %]</option>
181       [% END %]
182     </select>
183     </fieldset>
184   </form>
185   <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
186      <div id="jobfailed"></div></div>
187   [% END %]
188   [% IF ( can_revert ) %]
189   <form action="[% script_name %]" method="post">
190     <input type="hidden" name="op" value="revert-batch" />
191     <input type="hidden" name="runinbackground" value="" />
192     <input type="hidden" name="completedJobID" value="" />
193     <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
194     <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" onclick="return submitBackgroundJob(this.form);" /></fieldset>
195   </form>
196   <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
197      <div id="jobfailed"></div></div>
198   [% END %]
199 </div>
200   [% IF ( did_commit ) %]
201   <div class="dialog message">Completed import of records</div>
202   <table>
203   <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
204   <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
205   <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
206   <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
207   <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
208   </table>
209   [% END %]
210   [% IF ( did_revert ) %]
211   <div class="dialog message">Success: Import reversed</div>
212   <table>
213   <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
214   <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
215   <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
216   <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
217   <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
218   </table>
219   [% END %]
220 [% END %]
221 <br style="clear:both;" />
222
223 [% IF ( batch_list ) %]
224   [% IF ( pages ) %]
225 <div class="pages">
226 Page 
227     [% FOREACH page IN pages %]
228       [% IF ( page.current_page ) %]
229       <span class="current">[% page.page_number %]</span>
230       [% ELSE %]
231       <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
232       [% END %]
233     [% END %]
234 </div>
235   [% END %]
236 <table>
237   <tr>
238     <th>#</th>
239     <th>File name</th>
240     <th>Comments</th>
241     <th>Type</th>
242     <th>Status</th>
243     <th>Staged</th>
244     <th># Records</th>
245     <th># Items</th>
246     <th>Action</th>
247   </tr>
248   [% FOREACH batch_lis IN batch_list %]
249   [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
250     <td>[% batch_lis.import_batch_id %]</td>
251     <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
252     <td>[% batch_lis.comments %]</td>
253     <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
254     <td>[% batch_lis.import_status %]</td>
255     <td>[% batch_lis.upload_timestamp %]</td>
256     <td>[% batch_lis.num_records %]</td>
257     <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>
258     <td>[% IF ( batch_lis.can_clean ) %]
259           <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
260             <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
261             <input type="hidden" name="op" value="clean-batch" />
262             <input type="submit" class="button" value="Clean" onclick="return confirm(_('Clear all reservoir records staged in this batch?  This cannot be undone.'));" />
263           </form>
264         [% END %]
265     </td>
266   </tr>
267   [% END %]
268 </table>
269   [% IF ( pages ) %]
270 <div class="pages">
271 Page 
272     [% FOREACH page IN pages %]
273       [% IF ( page.current_page ) %]
274       <span class="current">[% page.page_number %]</span>
275       [% ELSE %]
276       <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
277       [% END %]
278     [% END %]
279 </div>
280   [% END %]
281 [% END %]
282
283 [% IF ( record_list ) %]
284   [% IF ( pages ) %]
285 <div class="pages">
286 Page 
287     [% FOREACH page IN pages %]
288       [% IF ( page.current_page ) %]
289       <span class="current">[% page.page_number %]</span>
290       [% ELSE %]
291       <a class="nav" href="[% page.script_name %]?import_batch_id=[% import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
292       [% END %]
293     [% END %]
294 </div>
295   [% END %]
296 <table>
297   <tr>
298     <th>#</th>
299     <th>Citation</th>
300     <th>Status</th>
301     <th>Match?</th>
302     <th>Record</th>
303
304   </tr>
305   [% FOREACH record_lis IN record_list %]
306   [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
307     <td>[% record_lis.record_sequence %]</td>
308     <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% record_lis.import_record_id %]" rel="gb_page_center[600,500]">[% record_lis.citation %]</a></td>
309     <td>[% record_lis.status %]</td>
310     <td>[% record_lis.overlay_status %]</td>
311     <td>[% IF ( record_lis.final_match_id ) %]
312         [% PROCESS final_match_link record=record_lis %]
313         [% END %]
314     </td>
315   </tr>
316     [% PROCESS match_link record=record_lis %]
317   [% END %]
318 </table>
319   [% IF ( pages ) %]
320 <div class="pages">
321 Page 
322     [% FOREACH page IN pages %]
323       [% IF ( page.current_page ) %]
324       <span class="current">[% page.page_number %]</span>
325       [% ELSE %]
326       <a class="nav" href="[% page.script_name %]?import_batch_id=[% import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
327       [% END %]
328     [% END %]
329 </div>
330   [% END %]
331 [% ELSE %]
332   [% IF ( batch_info ) %]
333     <div class="dialog alert">There are no records in this batch to import.
334     <a href="/cgi-bin/koha/tools/manage-marc-import.pl">Manage staged MARC records</a>.</div>
335
336   [% END %]
337 [% END %]
338
339 </div>
340 </div>
341 <div class="yui-b">
342 [% INCLUDE 'tools-menu.inc' %]
343 </div>
344 </div>
345 [% INCLUDE 'intranet-bottom.inc' %]