1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Tools › Manage staged MARC records
3 [% IF ( import_batch_id ) %]
4 › Batch [% import_batch_id %]
7 [% INCLUDE 'doc-head-close.inc' %]
8 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
10 [% INCLUDE 'datatables.inc' %]
11 <script type="text/javascript">
13 $(document).ready(function(){
14 $("#staged-record-matching-rules select").change(function(){
15 var str = $(this).attr("id");
16 $("#reset_"+str).parent().show();
18 $("a.reset").click(function(){
19 var str = $(this).attr("id");
20 str = str.replace("reset_","")
21 $("#"+str+" option[selected='selected']").attr("selected","selected");
22 $(this).parent().hide();
25 [% IF import_batch_id %]
26 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
31 "sAjaxSource": 'batch_records_ajax.pl',
32 "sPaginationType": "full_numbers",
33 "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
35 { "mDataProp": "import_record_id" },
36 { "mDataProp": "citation" },
37 { "mDataProp": "status" },
38 { "mDataProp": "overlay_status" },
39 { "mDataProp": "match_citation" },
40 { "mDataProp": "diff_url" },
41 { "mDataProp": "matched" }
43 "fnServerData": function ( sSource, aoData, fnCallback ) {
44 aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
51 'success': function(json){
56 "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
57 [% IF ( record_type == 'auth' ) %]
58 var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
60 var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
63 $('td:eq(1)', nRow).html(
64 '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
67 $('td:eq(2)', nRow).html(
68 aData['status'] == 'imported' ? _("Imported") :
69 aData['status'] == 'ignored' ? _("Ignored") :
70 aData['status'] == 'reverted' ? _("Reverted") :
71 aData['status'] == 'staged' ? _("Staged") :
72 aData['status'] == 'error' ? _("Error") :
76 $('td:eq(3)', nRow).html(
77 aData['overlay_status'] == 'no_match' ? _("No match") :
78 aData['overlay_status'] == 'match_applied' ? _("Match applied") :
79 aData['overlay_status'] == 'auto_match' ? _("Match found") :
80 aData['overlay_status']
83 if ( aData['match_id'] ) {
84 [% IF ( record_type == 'auth' ) -%]
85 var matching_msg = _("Matches authority %s (score=%s):%s");
87 var matching_msg = _("Matches biblio %s (score=%s):%s");
89 $('td:eq(4)', nRow).html(
90 matching_msg.format(aData['match_id'], aData['score'],
91 '<a target="_blank" href="' + record_details_url
92 + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
95 if (aData['diff_url']){
96 $('td:eq(5)', nRow).html(
97 '<a href="'+aData['diff_url']+'">View</a>'
100 $('td:eq(6)', nRow).html(
101 '<a target="_blank" href="' + record_details_url
102 + aData['matched'] + '">' + aData['matched'] + '</a>'
106 $("#import_batch_form").on("submit",function(){
107 return submitBackgroundJob( document.getElementById("import_batch_form") );
109 $("#revert_batch_form").on("submit",function(){
110 return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) && submitBackgroundJob( document.getElementById("revert_batch_form") );
113 $("body").on("click",".previewMARC", function(e){
115 var ltitle = $(this).text();
116 var page = $(this).attr("href");
117 $("#marcPreviewLabel").text(ltitle);
118 $("#marcPreview .modal-body").load(page + " table");
119 $('#marcPreview').modal({show:true});
121 $("#marcPreview").on("hidden", function(){
122 $("#marcPreviewLabel").html("");
123 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
125 $(".batch_form").on("submit",function(){
126 if( $(this).hasClass("batch_delete") ){
127 return confirm( _("Are you sure you want to permanently delete this batch?") );
129 return confirm( _("Clear all reservoir records staged in this batch? This cannot be undone.") );
136 <style type="text/css">
137 #jobpanel,#jobstatus,#jobfailed { display : none; }
140 <body id="tools_manage-marc-import" class="tools">
141 [% INCLUDE 'header.inc' %]
142 [% INCLUDE 'cat-search.inc' %]
144 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
145 [% IF ( import_batch_id ) %]
147 <a href="[% script_name %]">Manage staged MARC records</a>
148 › Batch [% import_batch_id %]
150 › Manage staged MARC records
154 <div id="doc3" class="yui-t2">
160 <h1>Manage staged MARC records
161 [% IF ( import_batch_id ) %]
162 › Batch [% import_batch_id %]
165 [% IF ( label_batch_msg ) %]
169 <div class="dialog message">
171 <b><p>[% label_batch_msg %]</p></b>
175 [% IF ( did_clean ) %]
176 <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
179 [% IF ( did_delete ) %]
180 <div class="dialog message">Import batch deleted successfully</div>
183 [% UNLESS ( batch_list ) %]
184 [% UNLESS ( batch_info ) %]
185 <div class="dialog message">
186 <p>No records have been staged.</p>
187 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
192 [% IF ( batch_info ) %]
194 [% IF ( can_commit ) %]
195 <form action="[% script_name %]" method="post">
196 <input type="hidden" name="op" value="redo-matching" />
197 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
198 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
201 [% IF ( rematch_attempted ) %]
202 [% IF ( rematch_failed ) %]
203 <div class="dialog alert">Failed to apply different matching rule</div>
205 <div class="dialog message">Applied different matching rule. Number of records matched now
206 [% num_with_matches %]
210 [% IF ( changed_overlay_action ) %]
211 <div class="dialog message">Changed action if matching record found</div>
213 [% IF ( changed_nomatch_action ) %]
214 <div class="dialog message">Changed action if no match found</div>
216 [% IF ( changed_item_action ) %]
217 <div class="dialog message">Changed item processing option</div>
220 <fieldset class="rows" id="staged-record-matching-rules">
222 <li><span class="label">File name:</span> [% file_name %]</li>
223 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
224 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
225 <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
226 <li><span class="label">Status:</span>
227 [% IF ( import_status == 'cleaned' ) %]
229 [% ELSIF ( import_status == 'imported' ) %]
231 [% ELSIF ( import_status == 'importing' ) %]
233 [% ELSIF ( import_status == 'reverted' ) %]
235 [% ELSIF ( import_status == 'reverting' ) %]
237 [% ELSIF ( import_status == 'staged' ) %]
244 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
245 <option value="">Do not look for matching records</option>
246 [% FOREACH available_matcher IN available_matchers %]
247 [% IF ( available_matcher.selected ) %]
248 <option value="[% available_matcher.matcher_id %]" selected="selected">
249 [% available_matcher.code %] ([% available_matcher.description %])
252 <option value="[% available_matcher.matcher_id %]">
253 [% available_matcher.code %] ([% available_matcher.description %])
257 </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 ) %]
258 [% current_matcher_code %] ([% current_matcher_description %])
260 No matching rule in effect
264 [% IF ( can_commit ) %]
265 <label for="overlay_action">Action if matching record found:</label>
266 [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
268 <span class="label">Action if matching record found:</span>
269 [% IF ( overlay_action == 'replace' ) %]
270 Replace existing record with incoming record
271 [% ELSIF ( overlay_action == 'create_new' ) %]
273 [% ELSIF ( overlay_action == 'ignore' ) %]
274 Ignore incoming record (its items may still be processed)
281 [% IF ( can_commit ) %]
282 <label for="nomatch_action">Action if no match found:</label>
283 [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
285 <span class="label">Action if no match found:</span>
286 [% IF ( nomatch_action == 'create_new' ) %]
288 [% ELSIF ( nomatch_action == 'ignore' ) %]
289 Ignore incoming record (its items may still be processed)
296 [% IF ( record_type == 'biblio' ) %]
298 [% IF ( can_commit ) %]
299 <label for="item_action">Item processing:</label>
300 [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
302 <span class="label">Item processing:</span>
303 [% IF ( item_action == 'always_add' ) %]
305 [% ELSIF ( item_action == 'add_only_for_matches' ) %]
306 Add items only if matching bib was found
307 [% ELSIF ( item_action == 'add_only_for_new' ) %]
308 Add items only if no matching bib was found
309 [% ELSIF ( item_action == 'ignore' ) %]
318 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
323 [% IF ( can_commit ) %]
324 <form action="[% script_name %]" method="post" id="import_batch_form">
325 <input type="hidden" name="op" value="commit-batch" />
326 <input type="hidden" name="runinbackground" value="" />
327 <input type="hidden" name="completedJobID" value="" />
328 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
329 <fieldset class="action">
330 <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
332 [% IF ( record_type != 'auth' ) %]
333 Add new bibliographic records into this framework:
334 <select name="framework" id="frameworks">
335 <option value="">Default</option>
336 [% FOREACH framework IN frameworks %]
337 <option value="[% framework.frameworkcode %]">[% framework.frameworktext %]</option>
343 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
344 <div id="jobfailed"></div></div>
346 [% IF ( can_revert ) %]
347 <form action="[% script_name %]" method="post" id="revert_batch_form">
348 <input type="hidden" name="op" value="revert-batch" />
349 <input type="hidden" name="runinbackground" value="" />
350 <input type="hidden" name="completedJobID" value="" />
351 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
352 <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
354 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
355 <div id="jobfailed"></div></div>
358 [% IF ( did_commit ) %]
359 <div class="dialog message">Completed import of records</div>
361 <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
362 <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
363 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
364 [% IF ( record_type == 'biblio' ) %]
365 <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
366 <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
367 <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
371 [% IF ( did_revert ) %]
372 <div class="dialog message">Success: Import reversed</div>
374 <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
375 [% IF ( record_type == 'biblio' ) %]
376 <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
377 <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
379 <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
380 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
384 <br style="clear:both;" />
386 [% IF ( batch_list ) %]
390 [% FOREACH page IN pages %]
391 [% IF ( page.current_page ) %]
392 <span class="current">[% page.page_number %]</span>
394 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
411 [% FOREACH batch_lis IN batch_list %]
413 <td>[% batch_lis.import_batch_id %]</td>
414 <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
415 <td>[% batch_lis.comments %]</td>
416 <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
418 [% IF ( batch_lis.import_status == 'cleaned' ) %]
420 [% ELSIF ( batch_lis.import_status == 'imported' ) %]
422 [% ELSIF ( batch_lis.import_status == 'importing' ) %]
424 [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
426 [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
428 [% ELSIF ( batch_lis.import_status == 'staged' ) %]
431 [% batch_lis.import_status %]
434 <td>[% batch_lis.upload_timestamp %]</td>
435 <td>[% batch_lis.num_records %]</td>
436 <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&op=create_labels">(Create label batch)</a>[% END %]</td>
438 [% IF ( batch_lis.can_clean ) %]
439 <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" class="batch_form batch_clean" >
440 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
441 <input type="hidden" name="op" value="clean-batch" />
442 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-eraser"></i> Clean</button>
444 [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
445 <form method="post" action="/cgi-bin/koha/tools/manage-marc-import.pl" name="delete_batch_[% batch_lis.import_batch_id %]" id="delete_batch_[% batch_lis.import_batch_id %]" class="batch_form batch_delete">
446 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
447 <input type="hidden" name="op" value="delete-batch" />
448 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
458 [% FOREACH page IN pages %]
459 [% IF ( page.current_page ) %]
460 <span class="current">[% page.page_number %]</span>
462 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
469 [% IF import_batch_id %]
470 <table id="records-table">
477 <th>Match details</th>
478 <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
484 <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
485 <div class="modal-dialog">
486 <div class="modal-content">
487 <div class="modal-header">
488 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
489 <h3 id="marcPreviewLabel">MARC preview</h3>
491 <div class="modal-body">
492 <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
494 <div class="modal-footer">
495 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
505 [% INCLUDE 'tools-menu.inc' %]
508 [% INCLUDE 'intranet-bottom.inc' %]