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