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