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; }
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 [% IF ( did_delete ) %]
198 <div class="dialog message">Import batch deleted successfully</div>
201 [% UNLESS ( batch_list ) %]
202 [% UNLESS ( batch_info ) %]
203 <div class="dialog message">
204 <p>No records have been staged.</p>
205 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
210 [% IF ( batch_info ) %]
212 [% IF ( can_commit ) %]
213 <form action="[% script_name %]" method="post">
214 <input type="hidden" name="op" value="redo-matching" />
215 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
216 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
219 [% IF ( rematch_attempted ) %]
220 [% IF ( rematch_failed ) %]
221 <div class="dialog alert">Failed to apply different matching rule</div>
223 <div class="dialog message">Applied different matching rule. Number of records matched now
224 [% num_with_matches %]
228 [% IF ( changed_overlay_action ) %]
229 <div class="dialog message">Changed action if matching record found</div>
231 [% IF ( changed_nomatch_action ) %]
232 <div class="dialog message">Changed action if no match found</div>
234 [% IF ( changed_item_action ) %]
235 <div class="dialog message">Changed item processing option</div>
238 <fieldset class="rows" id="staged-record-matching-rules">
240 <li><span class="label">File name:</span> [% file_name %]</li>
241 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
242 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
243 <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
244 <li><span class="label">Status:</span>
245 [% IF ( import_status == 'cleaned' ) %]
247 [% ELSIF ( import_status == 'imported' ) %]
249 [% ELSIF ( import_status == 'importing' ) %]
251 [% ELSIF ( import_status == 'reverted' ) %]
253 [% ELSIF ( import_status == 'reverting' ) %]
255 [% ELSIF ( import_status == 'staged' ) %]
262 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
263 <option value="">Do not look for matching records</option>
264 [% FOREACH available_matcher IN available_matchers %]
265 [% IF ( available_matcher.selected ) %]
266 <option value="[% available_matcher.matcher_id %]" selected="selected">
267 [% available_matcher.code %] ([% available_matcher.description %])
270 <option value="[% available_matcher.matcher_id %]">
271 [% available_matcher.code %] ([% available_matcher.description %])
275 </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 ) %]
276 [% current_matcher_code %] ([% current_matcher_description %])
278 No matching rule in effect
282 [% IF ( can_commit ) %]
283 <label for="overlay_action">Action if matching record found:</label>
284 [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
286 <span class="label">Action if matching record found:</span>
287 [% IF ( overlay_action == 'replace' ) %]
288 Replace existing record with incoming record
289 [% ELSIF ( overlay_action == 'create_new' ) %]
291 [% ELSIF ( overlay_action == 'ignore' ) %]
292 Ignore incoming record (its items may still be processed)
299 [% IF ( can_commit ) %]
300 <label for="nomatch_action">Action if no match found:</label>
301 [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
303 <span class="label">Action if no match found:</span>
304 [% IF ( nomatch_action == 'create_new' ) %]
306 [% ELSIF ( nomatch_action == 'ignore' ) %]
307 Ignore incoming record (its items may still be processed)
314 [% IF ( record_type == 'biblio' ) %]
316 [% IF ( can_commit ) %]
317 <label for="item_action">Item processing:</label>
318 [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
320 <span class="label">Item processing:</span>
321 [% IF ( item_action == 'always_add' ) %]
323 [% ELSIF ( item_action == 'add_only_for_matches' ) %]
324 Add items only if matching bib was found
325 [% ELSIF ( item_action == 'add_only_for_new' ) %]
326 Add items only if no matching bib was found
327 [% ELSIF ( item_action == 'ignore' ) %]
336 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
341 [% IF ( can_commit ) %]
342 <form action="[% script_name %]" method="post">
343 <input type="hidden" name="op" value="commit-batch" />
344 <input type="hidden" name="runinbackground" value="" />
345 <input type="hidden" name="completedJobID" value="" />
346 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
347 <fieldset class="action">
348 <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" onclick="return submitBackgroundJob(this.form);" />
350 [% IF ( record_type != 'auth' ) %]
351 Add new bibliographic records into this framework:
352 <select name="framework" id="frameworks">
353 <option value="">Default</option>
354 [% FOREACH framework IN frameworks %]
355 <option value="[% framework.value %]">[% framework.label %]</option>
361 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
362 <div id="jobfailed"></div></div>
364 [% IF ( can_revert ) %]
365 <form action="[% script_name %]" method="post">
366 <input type="hidden" name="op" value="revert-batch" />
367 <input type="hidden" name="runinbackground" value="" />
368 <input type="hidden" name="completedJobID" value="" />
369 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
370 <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>
372 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
373 <div id="jobfailed"></div></div>
376 [% IF ( did_commit ) %]
377 <div class="dialog message">Completed import of records</div>
379 <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
380 <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
381 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
382 [% IF ( record_type == 'biblio' ) %]
383 <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
384 <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
385 <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
389 [% IF ( did_revert ) %]
390 <div class="dialog message">Success: Import reversed</div>
392 <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
393 [% IF ( record_type == 'biblio' ) %]
394 <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
395 <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
397 <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
398 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
402 <br style="clear:both;" />
404 [% IF ( batch_list ) %]
408 [% FOREACH page IN pages %]
409 [% IF ( page.current_page ) %]
410 <span class="current">[% page.page_number %]</span>
412 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
429 [% FOREACH batch_lis IN batch_list %]
431 <td>[% batch_lis.import_batch_id %]</td>
432 <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
433 <td>[% batch_lis.comments %]</td>
434 <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
436 [% IF ( batch_lis.import_status == 'cleaned' ) %]
438 [% ELSIF ( batch_lis.import_status == 'imported' ) %]
440 [% ELSIF ( batch_lis.import_status == 'importing' ) %]
442 [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
444 [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
446 [% ELSIF ( batch_lis.import_status == 'staged' ) %]
449 [% batch_lis.import_status %]
452 <td>[% batch_lis.upload_timestamp %]</td>
453 <td>[% batch_lis.num_records %]</td>
454 <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>
456 [% IF ( batch_lis.can_clean ) %]
457 <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
458 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
459 <input type="hidden" name="op" value="clean-batch" />
460 <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_CLEAN);"><i class="fa fa-eraser"></i> Clean</button>
462 [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
463 <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 %]">
464 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
465 <input type="hidden" name="op" value="delete-batch" />
466 <button class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);"><i class="fa fa-trash"></i> Delete</button>
476 [% FOREACH page IN pages %]
477 [% IF ( page.current_page ) %]
478 <span class="current">[% page.page_number %]</span>
480 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
487 [% IF import_batch_id %]
488 <table id="records-table">
495 <th>Match details</th>
496 <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
502 <div id="marcPreview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
503 <div class="modal-header">
504 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
505 <h3 id="marcPreviewLabel">MARC preview</h3>
507 <div class="modal-body">
508 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
510 <div class="modal-footer">
511 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
519 [% INCLUDE 'tools-menu.inc' %]
522 [% INCLUDE 'intranet-bottom.inc' %]