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="[% themelang %]/js/background-job-progressbar.js"></script>
36 <link rel="stylesheet" type="text/css" href="[% themelang %]/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.");
42 $(document).ready(function(){
43 $("#staged-record-matching-rules select").change(function(){
44 var str = $(this).attr("id");
45 $("#reset_"+str).parent().show();
47 $("a.reset").click(function(){
48 var str = $(this).attr("id");
49 str = str.replace("reset_","")
50 $("#"+str+" option[selected='selected']").attr("selected","selected");
51 $(this).parent().hide();
54 [% IF import_batch_id %]
55 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
60 "sAjaxSource": 'batch_records_ajax.pl',
61 "sPaginationType": "full_numbers",
62 "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
64 { "mDataProp": "import_record_id" },
65 { "mDataProp": "citation" },
66 { "mDataProp": "status" },
67 { "mDataProp": "overlay_status" },
68 { "mDataProp": "match_citation" },
69 { "mDataProp": "diff_url" },
70 { "mDataProp": "matched" }
72 "fnServerData": function ( sSource, aoData, fnCallback ) {
73 aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
80 'success': function(json){
85 "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
86 [% IF ( record_type == 'auth' ) %]
87 var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
89 var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
92 $('td:eq(1)', nRow).html(
93 '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
96 $('td:eq(2)', nRow).html(
97 aData['status'] == 'imported' ? _("Imported") :
98 aData['status'] == 'ignored' ? _("Ignored") :
99 aData['status'] == 'reverted' ? _("Reverted") :
100 aData['status'] == 'staged' ? _("Staged") :
101 aData['status'] == 'error' ? _("Error") :
105 $('td:eq(3)', nRow).html(
106 aData['overlay_status'] == 'no_match' ? _("No match") :
107 aData['overlay_status'] == 'match_applied' ? _("Match applied") :
108 aData['overlay_status'] == 'auto_match' ? _("Match found") :
109 aData['overlay_status']
112 if ( aData['match_id'] ) {
113 [% IF ( record_type == 'auth' ) -%]
114 var matching_msg = _("Matches authority %s (score=%s):%s");
116 var matching_msg = _("Matches biblio %s (score=%s):%s");
118 $('td:eq(4)', nRow).html(
119 matching_msg.format(aData['match_id'], aData['score'],
120 '<a target="_blank" href="' + record_details_url
121 + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
124 if (aData['diff_url']){
125 $('td:eq(5)', nRow).html(
126 '<a href="'+aData['diff_url']+'">View</a>'
129 $('td:eq(6)', nRow).html(
130 '<a target="_blank" href="' + record_details_url
131 + aData['matched'] + '">' + aData['matched'] + '</a>'
136 $("body").on("click",".previewMARC", function(e){
138 var ltitle = $(this).text();
139 var page = $(this).attr("href");
140 $("#marcPreviewLabel").text(ltitle);
141 $("#marcPreview .modal-body").load(page + " table");
142 $('#marcPreview').modal({show:true});
144 $("#marcPreview").on("hidden", function(){
145 $("#marcPreviewLabel").html("");
146 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
152 <style type="text/css">
153 #jobpanel,#jobstatus,#jobfailed { display : none; }
154 #jobstatus { margin:.4em; }
155 #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; } }
158 <body id="tools_manage-marc-import" class="tools">
159 [% INCLUDE 'header.inc' %]
160 [% INCLUDE 'cat-search.inc' %]
162 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
163 [% IF ( import_batch_id ) %]
165 <a href="[% script_name %]">Manage staged MARC records</a>
166 › Batch [% import_batch_id %]
168 › Manage staged MARC records
172 <div id="doc3" class="yui-t2">
178 <h1>Manage staged MARC records
179 [% IF ( import_batch_id ) %]
180 › Batch [% import_batch_id %]
183 [% IF ( label_batch_msg ) %]
187 <div class="dialog message">
189 <b><p>[% label_batch_msg %]</p></b>
193 [% IF ( did_clean ) %]
194 <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
197 [% UNLESS ( batch_list ) %]
198 [% UNLESS ( batch_info ) %]
199 <div class="dialog message">
200 <p>No records have been staged.</p>
201 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
206 [% IF ( batch_info ) %]
208 [% IF ( can_commit ) %]
209 <form action="[% script_name %]" method="post">
210 <input type="hidden" name="op" value="redo-matching" />
211 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
212 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
215 [% IF ( rematch_attempted ) %]
216 [% IF ( rematch_failed ) %]
217 <div class="dialog alert">Failed to apply different matching rule</div>
219 <div class="dialog message">Applied different matching rule. Number of records matched now
220 [% num_with_matches %]
224 [% IF ( changed_overlay_action ) %]
225 <div class="dialog message">Changed action if matching record found</div>
227 [% IF ( changed_nomatch_action ) %]
228 <div class="dialog message">Changed action if no match found</div>
230 [% IF ( changed_item_action ) %]
231 <div class="dialog message">Changed item processing option</div>
234 <fieldset class="rows" id="staged-record-matching-rules">
236 <li><span class="label">File name:</span> [% file_name %]</li>
237 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
238 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
239 <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
240 <li><span class="label">Status:</span>
241 [% IF ( import_status == 'cleaned' ) %]
243 [% ELSIF ( import_status == 'imported' ) %]
245 [% ELSIF ( import_status == 'importing' ) %]
247 [% ELSIF ( import_status == 'reverted' ) %]
249 [% ELSIF ( import_status == 'reverting' ) %]
251 [% ELSIF ( import_status == 'staged' ) %]
258 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
259 <option value="">Do not look for matching records</option>
260 [% FOREACH available_matcher IN available_matchers %]
261 [% IF ( available_matcher.selected ) %]
262 <option value="[% available_matcher.matcher_id %]" selected="selected">
263 [% available_matcher.code %] ([% available_matcher.description %])
266 <option value="[% available_matcher.matcher_id %]">
267 [% available_matcher.code %] ([% available_matcher.description %])
271 </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 ) %]
272 [% current_matcher_code %] ([% current_matcher_description %])
274 No matching rule in effect
278 [% IF ( can_commit ) %]
279 <label for="overlay_action">Action if matching record found:</label>
280 [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
282 <span class="label">Action if matching record found:</span>
283 [% IF ( overlay_action == 'replace' ) %]
284 Replace existing record with incoming record
285 [% ELSIF ( overlay_action == 'create_new' ) %]
287 [% ELSIF ( overlay_action == 'ignore' ) %]
288 Ignore incoming record (its items may still be processed)
295 [% IF ( can_commit ) %]
296 <label for="nomatch_action">Action if no match found:</label>
297 [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
299 <span class="label">Action if no match found:</span>
300 [% IF ( nomatch_action == 'create_new' ) %]
302 [% ELSIF ( nomatch_action == 'ignore' ) %]
303 Ignore incoming record (its items may still be processed)
310 [% IF ( record_type == 'biblio' ) %]
312 [% IF ( can_commit ) %]
313 <label for="item_action">Item processing:</label>
314 [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
316 <span class="label">Item processing:</span>
317 [% IF ( item_action == 'always_add' ) %]
319 [% ELSIF ( item_action == 'add_only_for_matches' ) %]
320 Add items only if matching bib was found
321 [% ELSIF ( item_action == 'add_only_for_new' ) %]
322 Add items only if no matching bib was found
323 [% ELSIF ( item_action == 'ignore' ) %]
332 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
337 [% IF ( can_commit ) %]
338 <form action="[% script_name %]" method="post">
339 <input type="hidden" name="op" value="commit-batch" />
340 <input type="hidden" name="runinbackground" value="" />
341 <input type="hidden" name="completedJobID" value="" />
342 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
343 <fieldset class="action">
344 <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" onclick="return submitBackgroundJob(this.form);" />
346 [% IF ( record_type != 'auth' ) %]
347 Add new bibliographic records into this framework:
348 <select name="framework" id="frameworks">
349 <option value="">Default</option>
350 [% FOREACH framework IN frameworks %]
351 <option value="[% framework.value %]">[% framework.label %]</option>
357 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
358 <div id="jobfailed"></div></div>
360 [% IF ( can_revert ) %]
361 <form action="[% script_name %]" method="post">
362 <input type="hidden" name="op" value="revert-batch" />
363 <input type="hidden" name="runinbackground" value="" />
364 <input type="hidden" name="completedJobID" value="" />
365 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
366 <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" onclick="return submitBackgroundJob(this.form);" /></fieldset>
368 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
369 <div id="jobfailed"></div></div>
372 [% IF ( did_commit ) %]
373 <div class="dialog message">Completed import of records</div>
375 <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
376 <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
377 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
378 [% IF ( record_type == 'biblio' ) %]
379 <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
380 <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
381 <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
385 [% IF ( did_revert ) %]
386 <div class="dialog message">Success: Import reversed</div>
388 <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
389 [% IF ( record_type == 'biblio' ) %]
390 <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
391 <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
393 <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
394 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
398 <br style="clear:both;" />
400 [% IF ( batch_list ) %]
404 [% FOREACH page IN pages %]
405 [% IF ( page.current_page ) %]
406 <span class="current">[% page.page_number %]</span>
408 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
425 [% FOREACH batch_lis IN batch_list %]
427 <td>[% batch_lis.import_batch_id %]</td>
428 <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
429 <td>[% batch_lis.comments %]</td>
430 <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
432 [% IF ( batch_lis.import_status == 'cleaned' ) %]
434 [% ELSIF ( batch_lis.import_status == 'imported' ) %]
436 [% ELSIF ( batch_lis.import_status == 'importing' ) %]
438 [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
440 [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
442 [% ELSIF ( batch_lis.import_status == 'staged' ) %]
445 [% batch_lis.import_status %]
448 <td>[% batch_lis.upload_timestamp %]</td>
449 <td>[% batch_lis.num_records %]</td>
450 <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>
451 <td>[% IF ( batch_lis.can_clean ) %]
452 <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
453 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
454 <input type="hidden" name="op" value="clean-batch" />
455 <input type="submit" class="button" value="Clean" onclick="return confirm(MSG_CONFIRM_CLEAN);" />
465 [% FOREACH page IN pages %]
466 [% IF ( page.current_page ) %]
467 <span class="current">[% page.page_number %]</span>
469 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
476 [% IF import_batch_id %]
477 <table id="records-table">
484 <th>Match details</th>
485 <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
491 <div id="marcPreview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
492 <div class="modal-header">
493 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
494 <h3 id="marcPreviewLabel">MARC preview</h3>
496 <div class="modal-body">
497 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
499 <div class="modal-footer">
500 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
508 [% INCLUDE 'tools-menu.inc' %]
511 [% INCLUDE 'intranet-bottom.inc' %]