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>
9 [% IF ( record_lis.match_id ) %]
12 [% IF ( record.record_type == 'biblio' ) %]
13 <td colspan="5">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 colspan="5">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>
20 [% ELSIF ( record.record_type == 'auth') %]
21 <tr data-authid="[% record_lis.import_record_id %]">
23 <td colspan="4"><a href="#" class="merge_auth">Search for a record to merge in a new window</a></td>
28 [% INCLUDE 'doc-head-open.inc' %]
29 <title>Koha › Tools › Manage staged MARC records
30 [% IF ( import_batch_id ) %]
31 › Batch [% import_batch_id %]
34 [% INCLUDE 'doc-head-close.inc' %]
35 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
36 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
37 [% INCLUDE 'datatables.inc' %]
38 <script type="text/javascript">
40 var MSG_CONFIRM_CLEAN = _("Clear all reservoir records staged in this batch? This cannot be undone.");
41 var MSG_CONFIRM_UNDO_IMPORT = _("Are you sure you want to undo the import of this batch into the catalog?");
42 var MSG_CONFIRM_DELETE = _("Are you sure you want to permanently delete this batch?");
44 $(document).ready(function(){
45 $("#staged-record-matching-rules select").change(function(){
46 var str = $(this).attr("id");
47 $("#reset_"+str).parent().show();
49 $("a.reset").click(function(){
50 var str = $(this).attr("id");
51 str = str.replace("reset_","")
52 $("#"+str+" option[selected='selected']").attr("selected","selected");
53 $(this).parent().hide();
56 [% IF import_batch_id %]
57 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
62 "sAjaxSource": 'batch_records_ajax.pl',
63 "sPaginationType": "full_numbers",
64 "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
66 { "mDataProp": "import_record_id" },
67 { "mDataProp": "citation" },
68 { "mDataProp": "status" },
69 { "mDataProp": "overlay_status" },
70 { "mDataProp": "match_citation" },
71 { "mDataProp": "diff_url" },
72 { "mDataProp": "matched" }
74 "fnServerData": function ( sSource, aoData, fnCallback ) {
75 aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
82 'success': function(json){
87 "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
88 [% IF ( record_type == 'auth' ) %]
89 var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
91 var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
94 $('td:eq(1)', nRow).html(
95 '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
98 $('td:eq(2)', nRow).html(
99 aData['status'] == 'imported' ? _("Imported") :
100 aData['status'] == 'ignored' ? _("Ignored") :
101 aData['status'] == 'reverted' ? _("Reverted") :
102 aData['status'] == 'staged' ? _("Staged") :
103 aData['status'] == 'error' ? _("Error") :
107 $('td:eq(3)', nRow).html(
108 aData['overlay_status'] == 'no_match' ? _("No match") :
109 aData['overlay_status'] == 'match_applied' ? _("Match applied") :
110 aData['overlay_status'] == 'auto_match' ? _("Match found") :
111 aData['overlay_status']
114 if ( aData['match_id'] ) {
115 [% IF ( record_type == 'auth' ) -%]
116 var matching_msg = _("Matches authority %s (score=%s):%s");
118 var matching_msg = _("Matches biblio %s (score=%s):%s");
120 $('td:eq(4)', nRow).html(
121 matching_msg.format(aData['match_id'], aData['score'],
122 '<a target="_blank" href="' + record_details_url
123 + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
126 if (aData['diff_url']){
127 $('td:eq(5)', nRow).html(
128 '<a href="'+aData['diff_url']+'">View</a>'
131 $('td:eq(6)', nRow).html(
132 '<a target="_blank" href="' + record_details_url
133 + aData['matched'] + '">' + aData['matched'] + '</a>'
138 $("body").on("click",".previewMARC", function(e){
140 var ltitle = $(this).text();
141 var page = $(this).attr("href");
142 $("#marcPreviewLabel").text(ltitle);
143 $("#marcPreview .modal-body").load(page + " table");
144 $('#marcPreview').modal({show:true});
146 $("#marcPreview").on("hidden", function(){
147 $("#marcPreviewLabel").html("");
148 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
154 <style type="text/css">
155 #jobpanel,#jobstatus,#jobfailed { display : none; }
156 #jobstatus { margin:.4em; }
157 #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; }#marcPreview { width : 80%; margin-left : -40%; } @media (max-width: 767px) { #marcPreview { margin: 0; width : auto; } }
160 <body id="tools_manage-marc-import" class="tools">
161 [% INCLUDE 'header.inc' %]
162 [% INCLUDE 'cat-search.inc' %]
164 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
165 [% IF ( import_batch_id ) %]
167 <a href="[% script_name %]">Manage staged MARC records</a>
168 › Batch [% import_batch_id %]
170 › Manage staged MARC records
174 <div id="doc3" class="yui-t2">
180 <h1>Manage staged MARC records
181 [% IF ( import_batch_id ) %]
182 › Batch [% import_batch_id %]
185 [% IF ( label_batch_msg ) %]
189 <div class="dialog message">
191 <b><p>[% label_batch_msg %]</p></b>
195 [% IF ( did_clean ) %]
196 <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
199 [% IF ( did_delete ) %]
200 <div class="dialog message">Import batch deleted successfully</div>
203 [% UNLESS ( batch_list ) %]
204 [% UNLESS ( batch_info ) %]
205 <div class="dialog message">
206 <p>No records have been staged.</p>
207 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
212 [% IF ( batch_info ) %]
214 [% IF ( can_commit ) %]
215 <form action="[% script_name %]" method="post">
216 <input type="hidden" name="op" value="redo-matching" />
217 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
218 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
221 [% IF ( rematch_attempted ) %]
222 [% IF ( rematch_failed ) %]
223 <div class="dialog alert">Failed to apply different matching rule</div>
225 <div class="dialog message">Applied different matching rule. Number of records matched now
226 [% num_with_matches %]
230 [% IF ( changed_overlay_action ) %]
231 <div class="dialog message">Changed action if matching record found</div>
233 [% IF ( changed_nomatch_action ) %]
234 <div class="dialog message">Changed action if no match found</div>
236 [% IF ( changed_item_action ) %]
237 <div class="dialog message">Changed item processing option</div>
240 <fieldset class="rows" id="staged-record-matching-rules">
242 <li><span class="label">File name:</span> [% file_name %]</li>
243 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
244 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
245 <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
246 <li><span class="label">Status:</span>
247 [% IF ( import_status == 'cleaned' ) %]
249 [% ELSIF ( import_status == 'imported' ) %]
251 [% ELSIF ( import_status == 'importing' ) %]
253 [% ELSIF ( import_status == 'reverted' ) %]
255 [% ELSIF ( import_status == 'reverting' ) %]
257 [% ELSIF ( import_status == 'staged' ) %]
264 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
265 <option value="">Do not look for matching records</option>
266 [% FOREACH available_matcher IN available_matchers %]
267 [% IF ( available_matcher.selected ) %]
268 <option value="[% available_matcher.matcher_id %]" selected="selected">
269 [% available_matcher.code %] ([% available_matcher.description %])
272 <option value="[% available_matcher.matcher_id %]">
273 [% available_matcher.code %] ([% available_matcher.description %])
277 </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 ) %]
278 [% current_matcher_code %] ([% current_matcher_description %])
280 No matching rule in effect
284 [% IF ( can_commit ) %]
285 <label for="overlay_action">Action if matching record found:</label>
286 [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
288 <span class="label">Action if matching record found:</span>
289 [% IF ( overlay_action == 'replace' ) %]
290 Replace existing record with incoming record
291 [% ELSIF ( overlay_action == 'create_new' ) %]
293 [% ELSIF ( overlay_action == 'ignore' ) %]
294 Ignore incoming record (its items may still be processed)
301 [% IF ( can_commit ) %]
302 <label for="nomatch_action">Action if no match found:</label>
303 [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
305 <span class="label">Action if no match found:</span>
306 [% IF ( nomatch_action == 'create_new' ) %]
308 [% ELSIF ( nomatch_action == 'ignore' ) %]
309 Ignore incoming record (its items may still be processed)
316 [% IF ( record_type == 'biblio' ) %]
318 [% IF ( can_commit ) %]
319 <label for="item_action">Item processing:</label>
320 [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
322 <span class="label">Item processing:</span>
323 [% IF ( item_action == 'always_add' ) %]
325 [% ELSIF ( item_action == 'add_only_for_matches' ) %]
326 Add items only if matching bib was found
327 [% ELSIF ( item_action == 'add_only_for_new' ) %]
328 Add items only if no matching bib was found
329 [% ELSIF ( item_action == 'ignore' ) %]
338 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
343 [% IF ( can_commit ) %]
344 <form action="[% script_name %]" method="post">
345 <input type="hidden" name="op" value="commit-batch" />
346 <input type="hidden" name="runinbackground" value="" />
347 <input type="hidden" name="completedJobID" value="" />
348 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
349 <fieldset class="action">
350 <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" onclick="return submitBackgroundJob(this.form);" />
352 [% IF ( record_type != 'auth' ) %]
353 Add new bibliographic records into this framework:
354 <select name="framework" id="frameworks">
355 <option value="">Default</option>
356 [% FOREACH framework IN frameworks %]
357 <option value="[% framework.value %]">[% framework.label %]</option>
363 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
364 <div id="jobfailed"></div></div>
366 [% IF ( can_revert ) %]
367 <form action="[% script_name %]" method="post">
368 <input type="hidden" name="op" value="revert-batch" />
369 <input type="hidden" name="runinbackground" value="" />
370 <input type="hidden" name="completedJobID" value="" />
371 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
372 <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" onclick="return confirm(MSG_CONFIRM_UNDO_IMPORT) && submitBackgroundJob(this.form);" /></fieldset>
374 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
375 <div id="jobfailed"></div></div>
378 [% IF ( did_commit ) %]
379 <div class="dialog message">Completed import of records</div>
381 <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
382 <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
383 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
384 [% IF ( record_type == 'biblio' ) %]
385 <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
386 <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
387 <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
391 [% IF ( did_revert ) %]
392 <div class="dialog message">Success: Import reversed</div>
394 <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
395 [% IF ( record_type == 'biblio' ) %]
396 <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
397 <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
399 <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
400 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
404 <br style="clear:both;" />
406 [% IF ( batch_list ) %]
410 [% FOREACH page IN pages %]
411 [% IF ( page.current_page ) %]
412 <span class="current">[% page.page_number %]</span>
414 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
431 [% FOREACH batch_lis IN batch_list %]
433 <td>[% batch_lis.import_batch_id %]</td>
434 <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
435 <td>[% batch_lis.comments %]</td>
436 <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
438 [% IF ( batch_lis.import_status == 'cleaned' ) %]
440 [% ELSIF ( batch_lis.import_status == 'imported' ) %]
442 [% ELSIF ( batch_lis.import_status == 'importing' ) %]
444 [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
446 [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
448 [% ELSIF ( batch_lis.import_status == 'staged' ) %]
451 [% batch_lis.import_status %]
454 <td>[% batch_lis.upload_timestamp %]</td>
455 <td>[% batch_lis.num_records %]</td>
456 <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>
458 [% IF ( batch_lis.can_clean ) %]
459 <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
460 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
461 <input type="hidden" name="op" value="clean-batch" />
462 <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_CLEAN);"><i class="fa fa-eraser"></i> Clean</button>
464 [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
465 <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 %]">
466 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
467 <input type="hidden" name="op" value="delete-batch" />
468 <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);"><i class="fa fa-trash"></i> Delete</button>
478 [% FOREACH page IN pages %]
479 [% IF ( page.current_page ) %]
480 <span class="current">[% page.page_number %]</span>
482 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
489 [% IF import_batch_id %]
490 <table id="records-table">
497 <th>Match details</th>
498 <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
504 <div id="marcPreview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
505 <div class="modal-header">
506 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
507 <h3 id="marcPreviewLabel">MARC preview</h3>
509 <div class="modal-body">
510 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
512 <div class="modal-footer">
513 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
521 [% INCLUDE 'tools-menu.inc' %]
524 [% INCLUDE 'intranet-bottom.inc' %]