Bug 17380: [QA Follow-up] Report error to user instead of throwing exception
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / merge.tt
1 [% PROCESS 'merge-record.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Cataloging &rsaquo; Merging records</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript" src="[% interface %]/[% theme %]/js/merge-record.js"></script>
6 [% INCLUDE 'merge-record-strings.inc' %]
7 <style type="text/css">
8 div.record ul, div.record li { float:none; display:block; }
9 div#result { margin-top: 1em; }
10 /* We use this style "against" the li ui-tabs-nav style automatically applied */
11 </style>
12 <script type="text/javascript">
13 //<![CDATA[
14
15     // When submiting the form
16     function mergeformsubmit() {
17         $('#tabs').remove();
18     }
19
20 $(document).ready(function(){
21     // Getting marc structure via ajax
22     tagslib = [];
23     $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) {
24         tagslib = json;
25         rebuild_target($("#tabs"), $("#resultul"));
26     });
27
28     $('.preview-merge-reference').click(function (ev) {
29         ev.preventDefault();
30         newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
31     });
32
33     // Creating tabs
34     $("#tabs").tabs();
35 });
36
37
38 function changeFramework(fw) {
39     $("#Frameworks").val(fw);
40 }
41
42 //]]>
43 </script>
44 </head>
45 <body id="auth_merge" class="cat">
46 [% INCLUDE 'header.inc' %]
47 [% INCLUDE 'authorities-search.inc' %]
48 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>  &rsaquo; Merging records</div>
49
50 <div id="doc" class="yui-t7">
51
52 <div id="bd">
53         <div id="yui-main">
54
55
56 <h1>Merging records</h1>
57
58 [% IF ( errors ) %]
59
60     [% FOREACH error IN errors %]
61         <div class="dialog alert">
62             [% IF error.code == 'WRONG_COUNT' %]
63                 Number of records provided for merging: [% error.value %]. Currently only 2 records can be merged at a time.
64             [% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
65                 You cannot merge a record with itself. Please select two different authorities.
66             [% ELSIF error.code == 'WRONG_FRAMEWORK' %]
67                 The Default framework cannot be used, or the framework does not exist. Please select another framework for merging.
68             [% ELSIF error.code == 'EMPTY_MARC' %]
69                 Sorry, but we did not find any MARC tags in the reference record.
70             [% ELSIF error.code == 'MISSING_RECORD' %]
71                 Sorry, but we did not find a record for number: [% error.value %].
72             [% ELSE %]
73                 [% error %]
74             [% END %]
75         </div>
76     [% END %]
77
78 [% ELSIF ( result ) %]
79
80         <script type="text/javascript">window.location.href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 %]"</script>
81         <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 %]">Click here to see the merged record.</a></p>
82
83 [% ELSIF ( choosereference ) %]
84
85 <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>
86 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
87     <fieldset class="rows">
88     <legend>Merge reference</legend>
89     <ol>
90     <li class="radio"><input type="radio" value="[% recordid1 %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 %]')" /><label for="mergereference1">[% title1 %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1.subfield %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid1 %][% IF frameworklabel1 %] &mdash; [% frameworklabel1 %][% END %]</a>)</label></li>
91     <li class="radio"><input type="radio" value="[% recordid2 %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 %]')" /><label for="mergereference2">[% title2 %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2.subfield %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid2 %][% IF frameworklabel2 %] &mdash; [% frameworklabel2 %][% END %]</a>)</label></li>
92
93     [% IF frameworkselect %]
94           <li><label for="frameworkcode">Using framework:</label>
95                       <select name="frameworkcode" id="frameworkcode">
96                                       [% FOREACH frameworkcodeloo IN frameworkselect %]
97                                           [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
98                                               <option value="[% frameworkcodeloo.authtypecode %]" selected="selected">
99                                           [% ELSE %]
100                                               <option value="[% frameworkcodeloo.authtypecode %]">
101                                           [% END %]
102                                            [% frameworkcodeloo.authtypetext %]
103                                            </option>
104                                       [% END %]
105                       </select></li>
106     [% END %]
107 </ol>
108
109     <input type="hidden" name="authid" value="[% recordid1 %]" />
110     <input type="hidden" name="authid" value="[% recordid2 %]" />
111     <fieldset class="action"><input type="submit" value="Next" /></fieldset>
112     </fieldset>
113 </form>
114
115 [% ELSE %]
116
117 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
118
119 <div class="yui-g">
120 <div class="yui-u first">
121 [% PROCESS mergesource sourcerecords=records %]
122 </div>
123 <div class="yui-u">
124 [% PROCESS mergetarget %]
125 </div> <!-- .yui-u -->
126
127 <input type="hidden" name="recordid1" value="[% recordid1 %]" />
128 <input type="hidden" name="recordid2" value="[% recordid2 %]" />
129 <input type="hidden" name="mergereference" value="[% mergereference %]" />
130 <input type="hidden" name="frameworkcode" value="[% framework %]" />
131
132 <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
133 </div>
134 </form>
135
136 [% END %]
137
138 </div>
139 </div>
140 </div>
141
142 [% INCLUDE 'intranet-bottom.inc' %]