Bug 9896 - Show vendor in subscription search when creating an order for a subscription
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batch_record_modification.tt
1 [% PROCESS 'authorities-search-results.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Tools &rsaquo; Batch record modification</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
8 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
9 <script type="text/javascript">
10 //<![CDATA[
11 $(document).ready(function() {
12   $("#selectall").click(function(e){
13     e.preventDefault();
14     $(".records").checkCheckboxes();
15   });
16   $("#clearall").click(function(e){
17     e.preventDefault();
18     $(".records").unCheckCheckboxes();
19   });
20   $("#selectall").click();
21
22   $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, {
23     "aoColumnDefs": [
24       { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
25       { "aTargets": [ 1 ], "sType": "num-html" }
26     ],
27     "sDom": 't',
28     "aaSorting": [],
29     "bPaginate": false
30   }));
31
32   $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, {
33     "aoColumnDefs": [
34       { "aTargets": [ 0, 3 ], "bSortable": false, "bSearchable": false },
35       { "aTargets": [ 1 ], "sType": "num-html" }
36     ],
37     "sDom": 't',
38     "aaSorting": [],
39     "bPaginate": false
40   }));
41
42   $("#mainformsubmit").click(function(){
43     if ($("input[type=checkbox][name='record_id']:checked").length == 0 ) {
44       alert(_("Please select at least one record to process"));
45       return false;
46     }
47     if ( $("#marc_modification_template_id").val() <= 0 ) {
48       alert(_("Please select a modification template."));
49       return false;
50     }
51     return submitBackgroundJob(document.getElementById("process"));
52   });
53
54   $("#marc_modification_template_id").change(function(){
55     var url = "/cgi-bin/koha/svc/records/preview?"
56     var mmtid = $(this).val();
57     $("a.previewMARC").each(function(){
58       $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
59     });
60   });
61
62     $("body").on("click",".previewMARC", function(e){
63         e.preventDefault();
64         var ltitle = $(this).text();
65         var page = $(this).attr("href");
66         $("#marcPreviewLabel").text(ltitle);
67         $("#marcPreview .modal-body").load(page + " div");
68         $('#marcPreview').modal({show:true});
69     });
70     $("#marcPreview").on("hidden", function(){
71         $("#marcPreviewLabel").html("");
72         $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
73     });
74
75 });
76 //]]>
77 </script>
78 </head>
79 <body id="tools_batch_record_modification" class="tools">
80 [% INCLUDE 'header.inc' %]
81 [% INCLUDE 'cat-search.inc' %]
82
83 <div id="breadcrumbs">
84     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
85     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
86     <a href="/cgi-bin/koha/tools/batch_record_modification.pl">Batch record modification</a>
87 </div>
88
89 <div id="doc3" class="yui-t2">
90 <div id="bd">
91 <div id="yui-main">
92 <div class="yui-b">
93   <h1>Batch record modification</h1>
94
95     [% IF ( messages ) %]
96         <div class="dialog message">
97
98             [% FOREACH message IN messages %]
99                 [% IF message.type == 'success' %]
100                     <div><i class="fa fa-check success"></i>
101                 [% ELSIF message.type == 'warning' %]
102                     <div><i class="fa fa-warning warn"></i>
103                 [% ELSIF message.type == 'error' %]
104                     <div><i class="fa fa-exclamation error"></i>
105                 [% END %]
106                 [% IF message.code == 'no_action_defined_for_the_template' %]
107                     The selected template (id=[% message.mmtid%]) does not exist or no action is defined.
108                 [% ELSIF message.code == 'biblio_not_exists' %]
109                     Bibliographic record [% message.biblionumber %] does not exist in the database.
110                 [% ELSIF message.code == 'authority_not_exists' %]
111                     Authority record [% message.authid %] does not exist in the database.
112                 [% ELSIF message.code == 'biblio_not_modified' %]
113                     Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has not been modified. An error occurred on modifying it.
114                 [% ELSIF message.code == 'authority_not_modified' %]
115                     Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has not been modified. An error occurred on modifying it.
116                 [% ELSIF message.code == 'biblio_modified' %]
117                     Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% message.biblionumber %]">[% message.biblionumber %]</a> has successfully been modified.
118                 [% ELSIF message.code == 'authority_modified' %]
119                     Bibliographic record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% message.authid %]">[% message.authid %]</a> has successfully been modified.
120                 [% END %]
121                 [% IF message.error %]
122                     (The error was: [% message.error%]. See the Koha logfile for more information).
123                 [% END %]
124                 </div>
125             [% END %]
126
127         </div>
128     [% END %]
129
130   [% IF view == 'form' %]
131     <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl">
132       <fieldset class="rows">
133         <legend>Record type</legend>
134         <ol>
135           <li><label for="biblio_type">Biblios: </label><input type="radio" name="recordtype" value="biblio" id="biblio_type" checked="checked" /></li>
136           <li><label for="authority_type">Authorities: </label><input type="radio" name="recordtype" value="authority" id="authority_type" /></li>
137         </ol>
138       </fieldset>
139       <fieldset class="rows">
140         <legend>Use a file</legend>
141         <ol>
142           <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
143         </ol>
144       </fieldset>
145       <fieldset class="rows">
146         <legend>Or enter a list of record numbers</legend>
147         <ol>
148           <li>
149             <label for="recordnumber_list">Record number list (one per line): </label>
150             <textarea rows="10" cols="30" id="recordnumber_list" name="recordnumber_list"></textarea>
151           </li>
152         </ol>
153       </fieldset>
154       <fieldset class="rows">
155         <legend>Use MARC Modification Template:</legend>
156         <ol>
157           <li>
158             <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
159             <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
160               <option value="">Select a template</option>
161                 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
162                   <option value="[% mmt.template_id %]">[% mmt.name %]</option>
163                 [% END %]
164             </select>
165           </li>
166         </ol>
167       </fieldset>
168       <fieldset class="action">
169         <input type="hidden" name="op" value="list" />
170         <input type="submit" value="Continue" class="button" />
171         <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
172       </fieldset>
173     </form>
174   [% ELSIF view == 'list' %]
175     [% IF records %]
176       <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post" id="process">
177         <label for="marc_modification_template_id" class="required">Modify record using the following template: </label>
178         <select name="marc_modification_template_id" id="marc_modification_template_id" required="required">
179           <option value="">Select a template</option>
180           [% FOREACH mmt IN MarcModificationTemplatesLoop %]
181             [% IF mmt.selected %]
182               <option value="[% mmt.template_id %]" selected="selected">[% mmt.name %]</option>
183             [% ELSE %]
184               <option value="[% mmt.template_id %]">[% mmt.name %]</option>
185             [% END %]
186           [% END %]
187         </select>
188         <div id="marcPreview" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
189             <div class="modal-header">
190                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
191                 <h3 id="marcPreviewLabel">MARC preview</h3>
192             </div>
193             <div class="modal-body">
194                 <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
195             </div>
196             <div class="modal-footer">
197                 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
198             </div>
199         </div>
200         [% IF recordtype == 'biblio' %]
201           <div id="toolbar">
202             <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
203             | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
204           </div>
205           <table id="biblios" class="records">
206             <thead>
207               <tr>
208                 <th>&nbsp;</th>
209                 <th>Biblionumber</th>
210                 <th>Title</th>
211                 <th>&nbsp;</th>
212               </tr>
213             </thead>
214             <tbody>
215               [% FOR biblio IN records %]
216                 <tr>
217                   <td><input type="checkbox" name="record_id" value="[% biblio.biblionumber %]" data-items="[% biblio.itemnumbers.size %]" data-issues="[% biblio.issues_count %]" data-reserves="[% biblio.reserves.size %]" /></td>
218                   <td>[% biblio.biblionumber %]</td>
219                   <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
220                   <td class="actions">
221                     <a href="/cgi-bin/koha/svc/records/preview?record_type=biblio&record_id=[% biblio.biblionumber %]&mmtid=[% mmtid %]" class="previewMARC btn btn-mini" data-record_type="biblio" data-record_id="[% biblio.biblionumber %]" data-mmtid="[% mmtid %]" title="Preview MARC"><i class="fa fa-eye"></i> Show MARC</a>
222                   </td>
223                 </tr>
224               [% END %]
225             </tbody>
226           </table>
227           <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected biblios!</div>
228         [% ELSE %]
229           <div id="toolbar">
230             <a id="selectall" href="#"><i class="fa fa-check"></i> Select all</a>
231             | <a id="clearall" href="#"><i class="fa fa-remove"></i> Clear all</a>
232           </div>
233           <table id="authorities" class="records">
234             <thead>
235               <tr>
236                 <th></th>
237                 <th>Authid</th>
238                 <th>Summary</th>
239                 <th>Preview</th>
240               </tr>
241             </thead>
242             <tbody>
243               [% FOR authority IN records %]
244                 <tr>
245                   <td><input type="checkbox" name="record_id" value="[% authority.authid %]" data-usage="[% authority.count_usage %]" /></td>
246                   <td><a href="/cgi-bin/koha/authorities/detail.pl?authid=[% authority.authid %]">[% authority.authid %]</a></td>
247                   <td>[% PROCESS authresult summary=authority.summary %]</td>
248                   <td><a href="/cgi-bin/koha/svc/records/preview?record_type=authority&record_id=[% authority.authid %]&mmtid=[% mmtid %]" data-record_type="authority" data-record_id="[% authority.authid %]" data-mmtid="[% mmtid %]" class="previewMARC">Preview MARC</a>
249                 </tr>
250               [% END %]
251             </tbody>
252           </table>
253           <div class="note"><i class="fa fa-exclamation"></i> Reminder: this action will modify all selected authorities!</div>
254         [% END %]
255         <fieldset class="action">
256           <input type="hidden" name="op" value="modify" />
257           <input type="hidden" name="recordtype" value="[% recordtype %]" />
258           <input type="button" id="mainformsubmit" value="Modify selected records" class="button" />
259           <input type="hidden" name="runinbackground" id="runinbackground" value="" />
260           <input type="hidden" name="completedJobID" id="completedJobID" value="" />
261           <a class="cancel" href="/cgi-bin/koha/tools/batch_record_modification.pl">Cancel</a>
262         </fieldset>
263         <div id="jobpanel">
264           <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
265           <div id="jobfailed"></div>
266         </div>
267       </form>
268     [% ELSE %]
269         <div class="dialog message">
270             No records were modified. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
271         </div>
272     [% END %]
273   [% ELSIF view == 'report' %]
274     [% IF report.total_records == report.total_success %]
275         <div class="dialog message">
276             All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
277         </div>
278     [% ELSE %]
279         <div class="dialog message">
280             [% report.total_success %] / [% report.total_records %] records have successfully been modified. Some errors occurred. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
281         </div>
282     [% END %]
283   [% ELSIF view == 'errors' %]
284     [% FOR error IN errors %]
285       [% IF error == 'no_template_defined' %]
286         <div class="dialog alert">
287             No MARC modification template is defined. You have <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">to create</a> at least one template for using this tool.
288         </div>
289       [% END %]
290     [% END %]
291   [% ELSE %]
292         <div class="dialog alert">
293             No action defined for the template.
294         </div>
295   [% END %]
296 </div>
297 </div>
298 <div class="yui-b">
299   [% INCLUDE 'tools-menu.inc' %]
300 </div>
301 </div>
302 [% INCLUDE 'intranet-bottom.inc' %]