3 [% PROCESS 'merge-record.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Cataloging › Merging records</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style type="text/css">
9 div.record ul, div.record li { float:none; display:block; }
10 div#result { margin-top: 1em; }
11 /* We use this style "against" the li ui-tabs-nav style automatically applied */
15 <body id="auth_merge" class="cat">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'authorities-search.inc' %]
18 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> › Merging records</div>
20 <div class="main container-fluid">
22 <div class="col-md-8 col-md-offset-2">
24 <h1>Merging records</h1>
28 [% FOREACH error IN errors %]
29 <div class="dialog alert">
30 [% IF error.code == 'WRONG_COUNT' %]
31 Number of records provided for merging: [% error.value | html %]. Currently only 2 records can be merged at a time.
32 [% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
33 You cannot merge a record with itself. Please select two different authorities.
34 [% ELSIF error.code == 'WRONG_FRAMEWORK' %]
35 The Default framework cannot be used, or the framework does not exist. Please select another framework for merging.
36 [% ELSIF error.code == 'EMPTY_MARC' %]
37 Sorry, but we did not find any MARC tags in the reference record.
38 [% ELSIF error.code == 'MISSING_RECORD' %]
39 Sorry, but we did not find a record for number: [% error.value | html %].
46 [% ELSIF ( result ) %]
48 <script type="text/javascript">window.location.href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]"</script>
49 <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]">Click here to see the merged record.</a></p>
51 [% ELSIF ( choosereference ) %]
53 <p>Please choose which record will be the reference for the merge. The record chosen as reference will be kept, and the other will be deleted.</p>
54 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
55 <fieldset class="rows">
56 <legend>Merge reference</legend>
58 <li class="radio"><input type="radio" value="[% recordid1 | html %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 | html %]')" /><label for="mergereference1">[% title1 | html %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1.subfield | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid1 | html %][% IF frameworklabel1 %] — [% frameworklabel1 | html %][% END %]</a>)</label></li>
59 <li class="radio"><input type="radio" value="[% recordid2 | html %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 | html %]')" /><label for="mergereference2">[% title2 | html %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2.subfield | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 | html %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid2 | html %][% IF frameworklabel2 %] — [% frameworklabel2 | html %][% END %]</a>)</label></li>
61 [% IF frameworkselect %]
62 <li><label for="frameworkcode">Using framework:</label>
63 <select name="frameworkcode" id="frameworkcode">
64 [% FOREACH frameworkcodeloo IN frameworkselect %]
65 [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
66 <option value="[% frameworkcodeloo.authtypecode | html %]" selected="selected">
68 <option value="[% frameworkcodeloo.authtypecode | html %]">
70 [% frameworkcodeloo.authtypetext | html %]
77 <input type="hidden" name="authid" value="[% recordid1 | html %]" />
78 <input type="hidden" name="authid" value="[% recordid2 | html %]" />
79 <fieldset class="action"><input type="submit" value="Next" /></fieldset>
85 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
88 <div class="yui-u first">
89 [% PROCESS mergesource sourcerecords=records %]
92 [% PROCESS mergetarget %]
93 </div> <!-- .yui-u -->
95 <input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
96 <input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
97 <input type="hidden" name="mergereference" value="[% mergereference | html %]" />
98 <input type="hidden" name="frameworkcode" value="[% framework | html %]" />
100 <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
108 [% MACRO jsinclude BLOCK %]
109 [% INCLUDE 'merge-record-strings.inc' %]
110 [% INCLUDE 'authorities_js.inc' %]
111 [% Asset.js("js/merge-record.js") | $raw %]
112 [% INCLUDE 'merge-record-strings.inc' %]
113 <script type="text/javascript">
116 // When submiting the form
117 function mergeformsubmit() {
121 $(document).ready(function(){
122 // Getting marc structure via ajax
124 $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) {
126 rebuild_target($("#tabs"), $("#resultul"));
129 $('.preview-merge-reference').click(function (ev) {
131 newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
139 function changeFramework(fw) {
140 $("#Frameworks").val(fw);
147 [% INCLUDE 'intranet-bottom.inc' %]