Bug 29602: Surround strings with span tag
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Batch item modification &rsaquo; Tools &rsaquo; Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <style>input[type=checkbox]{ margin : 0 .5em; }</style>
11 [% Asset.css("css/addbiblio.css") | $raw %]
12 [% Asset.css("css/humanmsg.css") | $raw %]
13 </head>
14
15 <body id="tools_batchMod-edit" class="tools">
16     [% INCLUDE 'header.inc' %]
17     [% INCLUDE 'cat-search.inc' %]
18
19
20 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
21     <ol>
22         <li>
23             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24         </li>
25         <li>
26             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
27         </li>
28         <li>
29             <a href="#" aria-current="page">Batch item modification</a>
30         </li>
31     </ol>
32 </nav>
33
34     <div class="main container-fluid">
35
36         <h1>Batch item modification</h1>
37         [% IF op == 'enqueued' %]
38             <div class="dialog message">
39               <p>The job has been enqueued! It will be processed as soon as possible.</p>
40               <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a>
41               | <a href="/cgi-bin/koha/tools/batchMod.pl" title="New batch item modification">New batch item modification</a></p>
42             </div>
43
44             <fieldset class="action">
45                 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
46                     [% IF searchid %]
47                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]">Return to the record</a>
48                     [% ELSE %]
49                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">Return to the record</a>
50                     [% END %]
51                 [% ELSIF src %]
52                     <a href="[% src | url %]">Return to where you were</a>
53                 [% ELSE %]
54                     <a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a>
55                 [% END %]
56             </fieldset>
57         [% END %]
58
59         [% FOREACH message IN messages %]
60           [% IF message.type == 'success' %]
61             <div class="dialog message">
62           [% ELSIF message.type == 'warning' %]
63             <div class="dialog alert">
64           [% ELSIF message.type == 'error' %]
65             <div class="dialog alert" style="margin:auto;">
66           [% END %]
67           [% IF message.code == 'cannot_enqueue_job' %]
68               <span>Cannot enqueue this job.</span>
69           [% END %]
70           [% IF message.error %]
71             <span>(The error was: [% message.error | html %], see the Koha log file for more information).</span>
72           [% END %]
73           </div>
74         [% END %]
75
76
77         [% IF ( barcode_not_unique ) %]
78             <div class="dialog alert">
79                 <strong>Error saving item</strong>: Barcode must be unique.
80             </div>
81         [% END %]
82         [% IF ( no_next_barcode ) %]
83             <div class="dialog alert">
84                 <strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.
85             </div>
86         [% END %]
87
88         [% IF ( notfoundbarcodes.size ) %]
89             <div class="dialog alert">
90                 <p>Warning, the following barcodes were not found:</p>
91             </div>
92
93             <table style="margin:auto;">
94                 <thead>
95                     <tr><th>Barcodes not found</th></tr>
96                 </thead>
97                 <tbody>
98                     [% FOREACH notfoundbarcode IN notfoundbarcodes %]
99                         <tr><td>[% notfoundbarcode |html %]</td></td>
100                     [% END %]
101                 </tbody>
102             </table>
103
104             [% IF ( item_loop ) %]
105                 [% UNLESS ( too_many_items_display ) %]
106                     <h4>The following barcodes were found: </h4>
107                 [% END %]
108             [% END %]
109         [% END # /IF notfoundbarcodes.size %]
110
111         [% IF ( notfounditemnumbers.size ) %]
112             <div class="dialog alert">
113                 <p>Warning, the following itemnumbers were not found:</p>
114             </div>
115
116             <table style="margin:auto;">
117                 <thead>
118                     <tr><th>Itemnumbers not found</th></tr>
119                 </thead>
120                 <tbody>
121                     [% FOREACH notfounditemnumber IN notfounditemnumbers %]
122                         <tr><td>[% notfounditemnumber |html %]</td></td>
123                     [% END %]
124                 </tbody>
125             </table>
126             [% IF ( item_loop ) %]
127                 [% UNLESS ( too_many_items_display ) %]
128                     <h4>The following itemnumbers were found: </h4>
129                 [% END %]
130             [% END %]
131         [% END # /IF notfounditemnumbers.size %]
132
133
134         <form name="f" action="batchMod.pl" method="post">
135             <input type="hidden" name="op" value="[% op | html %]" />
136             <input type="hidden" name="searchid" value="[% searchid | html %]" />
137             <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
138             <input type="hidden" name="src" id="src" value="[% src | html %]" />
139             [% IF biblionumber %]
140                 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
141             [% END %]
142
143             [% IF items.size %]
144                     [% PROCESS items_table_batchmod headers => item_header_loop, items => items, checkboxes_edit => 1, display_columns_selection => 1 %]
145             [% END %]
146
147             [% IF ( simple_items_display || job_completed ) %]
148                 [% IF ( too_many_items_display ) %]
149                     <p>Too many items ([% too_many_items_display | html %]): You have edited more than [% Koha.Preference('MaxItemsToDisplayForBatchMod') | html %] items in a batch, items will not be shown.</p>
150                 [% ELSE %]
151                     <p>The following items were modified:</p>
152                     <ul>
153                         [% FOREACH simple_items_displa IN simple_items_display %]
154                             <li>
155                                 [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% simple_items_displa.biblionumber | uri %]&amp;itemnumber=[% simple_items_displa.itemnumber | uri %]">[% simple_items_displa.barcode | html %]</a>[% ELSE %][% simple_items_displa.barcode | html %][% END %]
156                             </li>
157                         [% END %]
158                     </ul>
159                 [% END # /IF too_many_items_display %]
160             [% END # /IF simple_items_display %]
161
162             [% IF ( show ) %]
163
164                 [% IF ( too_many_items_process ) %]
165                     <p>Too many items ([% too_many_items_process | html %]): You are not allowed to edit more than [% Koha.Preference('MaxItemsToProcessForBatchMod') | html %] items in a batch.</p>
166                 [% ELSIF ( too_many_items_display ) %]
167                     <p>Too many items ([% too_many_items_display | html %]): You are editing more than [% Koha.Preference('MaxItemsToDisplayForBatchMod') | html %] items in a batch, items will not be shown.</p>
168                     [% FOREACH itemnumber IN itemnumbers_array %]
169                         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
170                     [% END %]
171                 [% END # /IF too_many_items_process %]
172
173                 [% UNLESS (too_many_items_process) %]
174                     <div id="cataloguing_additem_newitem">
175                         <h2>Edit items</h2>
176                         <div class="hint">Checking the box right next to the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div>
177                         <fieldset class="rows">
178                             [%# no_plugin from batchMod-edit, jQuery is included at the end of the template and cataloguing plugins are not working in this situation %]
179                             [% PROCESS subfields_for_item subfields => subfields, add_regex => 1, add_delete_checkbox => 1, no_plugin => 1 %]
180                         </fieldset>
181
182                         <fieldset class="rows">
183                             <legend>Other attributes</legend>
184                             <ol>
185                                 <li>
186                                     <div class="subfield_line">
187                                         <label for="exclude_from_local_holds_priority">Exclude from local holds priority:</label>
188                                         <select id="exclude_from_local_holds_priority" name="exclude_from_local_holds_priority" class="input_marceditor select2" style="width: 50px">
189                                             <option selected></option>
190                                             <option value="1">Yes</option>
191                                             <option value="0">No</option>
192                                         </select>
193                                     </div>
194                                 </li>
195                             </ol>
196                         </fieldset>
197
198                         <fieldset class="action">
199                             <input type="submit" id="mainformsubmit" value="Save" />
200                             <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a>
201                         </fieldset>
202                     </div> <!-- /#cataloguing_additem_newitem -->
203                 [% ELSE %]
204                     <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
205                 [% END # /UNLESS too_many_items_process %]
206             [% ELSE # IF show %]
207                 <fieldset class="action">
208                     [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
209                         [% IF searchid %]
210                             <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&searchid=[% searchid | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
211                         [% ELSE %]
212                             <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
213                         [% END %]
214                     [% ELSIF src %]
215                         <a class="btn btn-default" href="[% src | url %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
216                     [% ELSE %]
217                         <a class="btn btn-default" href="/cgi-bin/koha/tools/batchMod.pl"><i class="fa fa-check-square-o"></i> Return to batch item modification</a>
218                     [% END %]
219                 </fieldset> <!-- /.action -->
220             [% END %]
221         </form>
222
223     [% MACRO jsinclude BLOCK %]
224         [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
225         [% Asset.js("js/cataloging.js") | $raw %]
226         [% INCLUDE 'datatables.inc' %]
227         [% Asset.js("js/pages/batchMod.js") | $raw %]
228         [% INCLUDE 'select2.inc' %]
229         [% INCLUDE 'calendar.inc' %]
230         <script>
231             // Prepare array of all column headers, incrementing each index by
232             // two to accommodate control and title columns
233             var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
234             for( x=0; x<allColumns.length; x++ ){
235                 allColumns[x] = Number(allColumns[x]) + 2;
236             }
237
238             $(document).ready(function(){
239                 $("input[name='disable_input']").click(function() {
240                     var row = $(this).attr("id");
241                     row = row.replace("row","hint");
242                     var todisable = $(this).parent().find(".input_marceditor,.tag,.subfield,.mandatory");
243                     var regex_link = $(this).parent().find(".field_regex");
244                     if ($(this).is(":checked")) {
245                         $(todisable).prop('disabled', true);
246                         $("#"+row).html(_("This subfield will be deleted"));
247                         $(regex_link).hide();
248                     } else {
249                         $(todisable).prop('disabled', false);
250                         $("#"+row).html("");
251                         $(regex_link).show();
252                     }
253                 });
254                 $('a.field_regex').click(function() {
255                     var editor = $(this).parent().find(".input_marceditor");
256                     var tag_editor = $(this).parent().find(".buttonDot");
257                     var regex = $(this).parent().find("[name='regex_fields']");
258                     var disable_input = $(this).parent().find(".disable_input");
259                     if ($(this).html() == 'RegEx') {
260                         $(editor).hide();
261                         $(regex).show();
262                         $(tag_editor).hide();
263                         $(this).html('Text');
264                         $(disable_input).prop('disabled', true);
265                         let input_name = $(editor).attr('name');
266                         let cloned = $("input[name='"+input_name+"']");
267                         if ( cloned.length > 1 ) {
268                             for( i = 1 ; i < cloned.length ; i++){
269                                 $(cloned[i]).parent().remove();
270                             }
271                         }
272                     } else {
273                         $(editor).show();
274                         $(tag_editor).show();
275                         $(regex).hide();
276                         $(this).html('RegEx');
277                         $(disable_input).prop('disabled', false);
278                     }
279                     return false;
280                 });
281             });
282         </script>
283         [% IF ( show ) %]
284             [%- # Loop over fields which may have plugin JavaScript -%]
285             [%- UNLESS (too_many_items_process) -%]
286                 [%- FOREACH subfield IN subfields -%]
287                     [% SET mv = subfield.marc_value %]
288                     [%- IF ( mv.type == 'text_plugin' ) -%]
289                         <!-- subfield[% subfield.tag | html %][% subfield.subfield | html %][% subfield.random | html %] -->
290                         [% mv.javascript | $raw %]
291                     [%- END -%]
292                 [%- END -%]
293             [%- END -%]
294         [%- END -%]
295     [% END %]
296
297 [% INCLUDE 'intranet-bottom.inc' %]