3 [% PROCESS 'merge-record.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Merging records › Cataloging › Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
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 [% WRAPPER 'header.inc' %]
17 [% INCLUDE 'authorities-search.inc' %]
20 [% WRAPPER 'sub-header.inc' %]
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
24 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27 <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
30 <a href="#" aria-current="page">
38 <div class="main container-fluid">
40 <div class="col-md-8 col-md-offset-2">
43 <h1>Merging records</h1>
47 [% FOREACH error IN errors %]
48 <div class="dialog alert">
49 [% IF error.code == 'WRONG_COUNT' %]
50 <span>Number of records provided for merging: [% error.value | html %]. Currently only 2 records can be merged at a time.</span>
51 [% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
52 <span>You cannot merge a record with itself. Please select two different authorities.</span>
53 [% ELSIF error.code == 'WRONG_FRAMEWORK' %]
54 <span>The default framework cannot be used, or the framework does not exist. Please select another framework for merging.</span>
55 [% ELSIF error.code == 'EMPTY_MARC' %]
56 <span>Sorry, but we did not find any MARC tags in the reference record.</span>
57 [% ELSIF error.code == 'MISSING_RECORD' %]
58 <span>Sorry, but we did not find a record for number: [% error.value | html %].</span>
65 [% ELSIF ( result ) %]
67 <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]">View the merged record.</a></p>
69 [% ELSIF ( choosereference ) %]
71 <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>
72 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
73 <fieldset class="rows">
74 <legend>Merge reference</legend>
76 <li class="radio"><input type="radio" value="[% recordid1 | uri %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 | html %]')" /><label for="mergereference1">[% title1 | html %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1 | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid1 | html %][% IF frameworklabel1 %] — [% frameworklabel1 | html %][% END %]</a>)</label></li>
77 <li class="radio"><input type="radio" value="[% recordid2 | uri %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 | html %]')" /><label for="mergereference2">[% title2 | html %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2 | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 | uri %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid2 | html %][% IF frameworklabel2 %] — [% frameworklabel2 | html %][% END %]</a>)</label></li>
79 [% IF frameworkselect %]
80 <li><label for="frameworkcode">Using framework:</label>
81 <select name="frameworkcode" id="frameworkcode">
82 [% FOREACH frameworkcodeloo IN frameworkselect %]
83 [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
84 <option value="[% frameworkcodeloo.authtypecode | html %]" selected="selected">
86 <option value="[% frameworkcodeloo.authtypecode | html %]">
88 [% frameworkcodeloo.authtypetext | html %]
95 <input type="hidden" name="authid" value="[% recordid1 | html %]" />
96 <input type="hidden" name="authid" value="[% recordid2 | html %]" />
97 <fieldset class="action"><input type="submit" class="btn btn-primary" value="Next" /></fieldset>
103 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
106 <div class="col-sm-6">
107 [% PROCESS mergesource sourcerecords=records %]
109 <div class="col-sm-6">
110 [% PROCESS mergetarget %]
114 <input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
115 <input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
116 <input type="hidden" name="mergereference" value="[% mergereference | html %]" />
117 <input type="hidden" name="frameworkcode" value="[% framework | html %]" />
119 <fieldset class="action"><input type="submit" name="merge" class="btn btn-primary" value="Merge" /></fieldset>
125 </div> <!-- /.col-md-8 col-md-offset-2 -->
126 </div> <!-- /.row -->
128 [% MACRO jsinclude BLOCK %]
129 [% INCLUDE 'authorities_js.inc' %]
130 [% Asset.js("js/merge-record.js") | $raw %]
133 // When submiting the form
134 function mergeformsubmit() {
138 $(document).ready(function(){
139 // Getting marc structure via ajax
141 $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) {
143 rebuild_target($("#tabs"), $("#resultul"));
146 $('.preview-merge-reference').click(function (ev) {
148 newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
150 if( $(".tab-pane.active").length < 1 ){
151 $("#tabs a:first").tab("show");
156 function changeFramework(fw) {
157 $("#Frameworks").val(fw);
163 [% INCLUDE 'intranet-bottom.inc' %]