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