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 $(document).ready(function(){
41 $("#staged-record-matching-rules select").change(function(){
42 var str = $(this).attr("id");
43 $("#reset_"+str).parent().show();
45 $("a.reset").click(function(){
46 var str = $(this).attr("id");
47 str = str.replace("reset_","")
48 $("#"+str+" option[selected='selected']").attr("selected","selected");
49 $(this).parent().hide();
52 [% IF import_batch_id %]
53 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
58 "sAjaxSource": 'batch_records_ajax.pl',
59 "sPaginationType": "full_numbers",
60 "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
62 { "mDataProp": "import_record_id" },
63 { "mDataProp": "citation" },
64 { "mDataProp": "status" },
65 { "mDataProp": "overlay_status" },
66 { "mDataProp": "match_citation" },
67 { "mDataProp": "diff_url" },
68 { "mDataProp": "matched" }
70 "fnServerData": function ( sSource, aoData, fnCallback ) {
71 aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
78 'success': function(json){
83 "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
84 [% IF ( record_type == 'auth' ) %]
85 var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
87 var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
90 $('td:eq(1)', nRow).html(
91 '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
94 $('td:eq(2)', nRow).html(
95 aData['status'] == 'imported' ? _("Imported") :
96 aData['status'] == 'ignored' ? _("Ignored") :
97 aData['status'] == 'reverted' ? _("Reverted") :
98 aData['status'] == 'staged' ? _("Staged") :
99 aData['status'] == 'error' ? _("Error") :
103 $('td:eq(3)', nRow).html(
104 aData['overlay_status'] == 'no_match' ? _("No match") :
105 aData['overlay_status'] == 'match_applied' ? _("Match applied") :
106 aData['overlay_status'] == 'auto_match' ? _("Match found") :
107 aData['overlay_status']
110 if ( aData['match_id'] ) {
111 [% IF ( record_type == 'auth' ) -%]
112 var matching_msg = _("Matches authority %s (score=%s):%s");
114 var matching_msg = _("Matches biblio %s (score=%s):%s");
116 $('td:eq(4)', nRow).html(
117 matching_msg.format(aData['match_id'], aData['score'],
118 '<a target="_blank" href="' + record_details_url
119 + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
122 if (aData['diff_url']){
123 $('td:eq(5)', nRow).html(
124 '<a href="'+aData['diff_url']+'">View</a>'
127 $('td:eq(6)', nRow).html(
128 '<a target="_blank" href="' + record_details_url
129 + aData['matched'] + '">' + aData['matched'] + '</a>'
133 $("#import_batch_form").on("submit",function(){
134 return submitBackgroundJob( document.getElementById("import_batch_form") );
136 $("#revert_batch_form").on("submit",function(){
137 return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) && submitBackgroundJob( document.getElementById("revert_batch_form") );
140 $("body").on("click",".previewMARC", function(e){
142 var ltitle = $(this).text();
143 var page = $(this).attr("href");
144 $("#marcPreviewLabel").text(ltitle);
145 $("#marcPreview .modal-body").load(page + " table");
146 $('#marcPreview').modal({show:true});
148 $("#marcPreview").on("hidden", function(){
149 $("#marcPreviewLabel").html("");
150 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
152 $(".batch_form").on("submit",function(){
153 if( $(this).hasClass("batch_delete") ){
154 return confirm( _("Are you sure you want to permanently delete this batch?") );
156 return confirm( _("Clear all reservoir records staged in this batch? This cannot be undone.") );
163 <style type="text/css">
164 #jobpanel,#jobstatus,#jobfailed { display : none; }
167 <body id="tools_manage-marc-import" class="tools">
168 [% INCLUDE 'header.inc' %]
169 [% INCLUDE 'cat-search.inc' %]
171 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
172 [% IF ( import_batch_id ) %]
174 <a href="[% script_name %]">Manage staged MARC records</a>
175 › Batch [% import_batch_id %]
177 › Manage staged MARC records
181 <div id="doc3" class="yui-t2">
187 <h1>Manage staged MARC records
188 [% IF ( import_batch_id ) %]
189 › Batch [% import_batch_id %]
192 [% IF ( label_batch_msg ) %]
196 <div class="dialog message">
198 <b><p>[% label_batch_msg %]</p></b>
202 [% IF ( did_clean ) %]
203 <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
206 [% IF ( did_delete ) %]
207 <div class="dialog message">Import batch deleted successfully</div>
210 [% UNLESS ( batch_list ) %]
211 [% UNLESS ( batch_info ) %]
212 <div class="dialog message">
213 <p>No records have been staged.</p>
214 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
219 [% IF ( batch_info ) %]
221 [% IF ( can_commit ) %]
222 <form action="[% script_name %]" method="post">
223 <input type="hidden" name="op" value="redo-matching" />
224 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
225 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
228 [% IF ( rematch_attempted ) %]
229 [% IF ( rematch_failed ) %]
230 <div class="dialog alert">Failed to apply different matching rule</div>
232 <div class="dialog message">Applied different matching rule. Number of records matched now
233 [% num_with_matches %]
237 [% IF ( changed_overlay_action ) %]
238 <div class="dialog message">Changed action if matching record found</div>
240 [% IF ( changed_nomatch_action ) %]
241 <div class="dialog message">Changed action if no match found</div>
243 [% IF ( changed_item_action ) %]
244 <div class="dialog message">Changed item processing option</div>
247 <fieldset class="rows" id="staged-record-matching-rules">
249 <li><span class="label">File name:</span> [% file_name %]</li>
250 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
251 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
252 <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
253 <li><span class="label">Status:</span>
254 [% IF ( import_status == 'cleaned' ) %]
256 [% ELSIF ( import_status == 'imported' ) %]
258 [% ELSIF ( import_status == 'importing' ) %]
260 [% ELSIF ( import_status == 'reverted' ) %]
262 [% ELSIF ( import_status == 'reverting' ) %]
264 [% ELSIF ( import_status == 'staged' ) %]
271 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
272 <option value="">Do not look for matching records</option>
273 [% FOREACH available_matcher IN available_matchers %]
274 [% IF ( available_matcher.selected ) %]
275 <option value="[% available_matcher.matcher_id %]" selected="selected">
276 [% available_matcher.code %] ([% available_matcher.description %])
279 <option value="[% available_matcher.matcher_id %]">
280 [% available_matcher.code %] ([% available_matcher.description %])
284 </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 ) %]
285 [% current_matcher_code %] ([% current_matcher_description %])
287 No matching rule in effect
291 [% IF ( can_commit ) %]
292 <label for="overlay_action">Action if matching record found:</label>
293 [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
295 <span class="label">Action if matching record found:</span>
296 [% IF ( overlay_action == 'replace' ) %]
297 Replace existing record with incoming record
298 [% ELSIF ( overlay_action == 'create_new' ) %]
300 [% ELSIF ( overlay_action == 'ignore' ) %]
301 Ignore incoming record (its items may still be processed)
308 [% IF ( can_commit ) %]
309 <label for="nomatch_action">Action if no match found:</label>
310 [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
312 <span class="label">Action if no match found:</span>
313 [% IF ( nomatch_action == 'create_new' ) %]
315 [% ELSIF ( nomatch_action == 'ignore' ) %]
316 Ignore incoming record (its items may still be processed)
323 [% IF ( record_type == 'biblio' ) %]
325 [% IF ( can_commit ) %]
326 <label for="item_action">Item processing:</label>
327 [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
329 <span class="label">Item processing:</span>
330 [% IF ( item_action == 'always_add' ) %]
332 [% ELSIF ( item_action == 'add_only_for_matches' ) %]
333 Add items only if matching bib was found
334 [% ELSIF ( item_action == 'add_only_for_new' ) %]
335 Add items only if no matching bib was found
336 [% ELSIF ( item_action == 'ignore' ) %]
345 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
350 [% IF ( can_commit ) %]
351 <form action="[% script_name %]" method="post" id="import_batch_form">
352 <input type="hidden" name="op" value="commit-batch" />
353 <input type="hidden" name="runinbackground" value="" />
354 <input type="hidden" name="completedJobID" value="" />
355 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
356 <fieldset class="action">
357 <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
359 [% IF ( record_type != 'auth' ) %]
360 Add new bibliographic records into this framework:
361 <select name="framework" id="frameworks">
362 <option value="">Default</option>
363 [% FOREACH framework IN frameworks %]
364 <option value="[% framework.frameworkcode %]">[% framework.frameworktext %]</option>
370 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
371 <div id="jobfailed"></div></div>
373 [% IF ( can_revert ) %]
374 <form action="[% script_name %]" method="post" id="revert_batch_form">
375 <input type="hidden" name="op" value="revert-batch" />
376 <input type="hidden" name="runinbackground" value="" />
377 <input type="hidden" name="completedJobID" value="" />
378 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
379 <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
381 <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
382 <div id="jobfailed"></div></div>
385 [% IF ( did_commit ) %]
386 <div class="dialog message">Completed import of records</div>
388 <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
389 <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
390 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
391 [% IF ( record_type == 'biblio' ) %]
392 <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
393 <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
394 <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
398 [% IF ( did_revert ) %]
399 <div class="dialog message">Success: Import reversed</div>
401 <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
402 [% IF ( record_type == 'biblio' ) %]
403 <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
404 <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
406 <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
407 <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
411 <br style="clear:both;" />
413 [% IF ( batch_list ) %]
417 [% FOREACH page IN pages %]
418 [% IF ( page.current_page ) %]
419 <span class="current">[% page.page_number %]</span>
421 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
438 [% FOREACH batch_lis IN batch_list %]
440 <td>[% batch_lis.import_batch_id %]</td>
441 <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
442 <td>[% batch_lis.comments %]</td>
443 <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
445 [% IF ( batch_lis.import_status == 'cleaned' ) %]
447 [% ELSIF ( batch_lis.import_status == 'imported' ) %]
449 [% ELSIF ( batch_lis.import_status == 'importing' ) %]
451 [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
453 [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
455 [% ELSIF ( batch_lis.import_status == 'staged' ) %]
458 [% batch_lis.import_status %]
461 <td>[% batch_lis.upload_timestamp %]</td>
462 <td>[% batch_lis.num_records %]</td>
463 <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>
465 [% IF ( batch_lis.can_clean ) %]
466 <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" >
467 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
468 <input type="hidden" name="op" value="clean-batch" />
469 <button type="submit" class="btn btn-mini"><i class="fa fa-eraser"></i> Clean</button>
471 [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
472 <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">
473 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
474 <input type="hidden" name="op" value="delete-batch" />
475 <button type="submit" class="btn btn-mini"><i class="fa fa-trash"></i> Delete</button>
485 [% FOREACH page IN pages %]
486 [% IF ( page.current_page ) %]
487 <span class="current">[% page.page_number %]</span>
489 <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
496 [% IF import_batch_id %]
497 <table id="records-table">
504 <th>Match details</th>
505 <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
511 <div id="marcPreview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
512 <div class="modal-header">
513 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
514 <h3 id="marcPreviewLabel">MARC preview</h3>
516 <div class="modal-body">
517 <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
519 <div class="modal-footer">
520 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
528 [% INCLUDE 'tools-menu.inc' %]
531 [% INCLUDE 'intranet-bottom.inc' %]