Bug 7996: (QA follow-up) Remove unnecessary permission check view logs template
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Tools &rsaquo; Batch item modification</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% Asset.js("js/background-job-progressbar.js") | $raw %]
8 [% Asset.js("js/cataloging.js") | $raw %]
9 [% Asset.css("css/datatables.css") | $raw %]
10 [% INCLUDE 'datatables.inc' %]
11 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
12 [% Asset.js("js/pages/batchMod.js") | $raw %]
13 <script type="text/javascript">
14 //<![CDATA[
15
16 // Prepare array of all column headers, incrementing each index by
17 // two to accommodate control and title columns
18 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count | html %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
19 for( x=0; x<allColumns.length; x++ ){
20   allColumns[x] = Number(allColumns[x]) + 2;
21 }
22 $(document).ready(function(){
23
24   $("input[name='disable_input']").click(function() {
25       var row = $(this).attr("id");
26       row = row.replace("row","hint");
27       var editor = $(this).parent().find("[name='field_value']");
28       if ($(this).is(":checked")) {
29           $(editor).prop('disabled', true);
30           $("#"+row).html(_("This subfield will be deleted"));
31       } else {
32           $(editor).prop('disabled', false);
33           $("#"+row).html("");
34       }
35   });
36     $("#mainformsubmit").on("click",function(){
37         return submitBackgroundJob(this.form);
38     });
39 });
40 //]]>
41 </script>
42 <!--[if IE]>
43 <style type="text/css">#selections { display: none; }</style>
44 <![endif]-->
45 <style type="text/css">input[type=checkbox]{ margin : 0 .5em; }</style>
46 [% Asset.css("css/addbiblio.css") | $raw %]
47
48 [% INCLUDE 'select2.inc' %]
49 <script type="text/javascript">
50   $(document).ready(function() {
51     $('.subfield_line select').select2();
52   });
53 </script>
54
55 </head>
56 <body id="tools_batchMod-edit" class="tools">
57 [% INCLUDE 'header.inc' %]
58 [% INCLUDE 'cat-search.inc' %]
59
60 <div id="breadcrumbs">
61   <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
62   <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
63   <a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a>
64 </div>
65
66 <div class="main container-fluid">
67
68             [% IF ( show ) %]
69               <h1>Batch item modification</h1>
70             [% ELSE %]
71               <h1>Batch item modification results</h1>
72               <div class="dialog message">
73                 [% IF (modified_items) %]
74                   [% modified_items | html %] item(s) modified (with [% modified_fields | html %] field(s) modified).
75                 [% ELSE %]
76                   No items modified.
77                 [% END %]
78               <fieldset class="action">
79                   [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
80                       <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | html %]">Return to the record</a>
81                   [% ELSIF src %]
82                       <a href="[% src | html %]">Return to where you were</a>
83                   [% ELSE %]
84                       <a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a>
85                   [% END %]
86               </fieldset>
87               </div>
88             [% END %]
89 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
90 [% IF ( no_next_barcode ) %]<div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div>[% END %]
91 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
92 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
93
94     [% IF ( notfoundbarcodes.size ) %]
95         <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div>
96         <table style="margin:auto;">
97             <thead>
98                 <tr><th>Barcodes not found</th></tr>
99             </thead>
100             <tbody>
101                 [% FOREACH notfoundbarcode IN notfoundbarcodes %]
102                     <tr><td>[% notfoundbarcode |html %]</td></td>
103                 [% END %]
104             </tbody>
105         </table>
106         [% IF ( item_loop ) %]
107             [% UNLESS ( too_many_items ) %]
108                 <h4>The following barcodes were found: </h4>
109             [% END %]
110         [% END %]
111     [% END %] <!-- /notfoundbarcodes -->
112     [% IF ( notfounditemnumbers.size ) %]
113         <div class="dialog alert"><p>Warning, the following itemnumbers were not found:</p></div>
114         <table style="margin:auto;">
115             <thead>
116                 <tr><th>Itemnumbers not found</th></tr>
117             </thead>
118             <tbody>
119                 [% FOREACH notfounditemnumber IN notfounditemnumbers %]
120                     <tr><td>[% notfounditemnumber |html %]</td></td>
121                 [% END %]
122             </tbody>
123         </table>
124         [% IF ( item_loop ) %]
125             [% UNLESS ( too_many_items ) %]
126                 <h4>The following itemnumbers were found: </h4>
127             [% END %]
128         [% END %]
129     [% END %] <!-- /notfounditemnumbers -->
130
131
132
133 <form name="f" action="batchMod.pl" method="post">
134      <input type="hidden" name="op" value="[% op | html %]" />
135      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
136      <input type="hidden" name="runinbackground" id="runinbackground" value="" />
137      <input type="hidden" name="completedJobID" id="completedJobID" 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 ( item_loop ) %]
144   [% IF show %]
145     <div id="toolbar">
146       <a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-remove"></i> Clear all</a> | <a id="clearonloanbutton" href="#">Clear on loan</a>
147     </div>
148   [% END %]
149 <div id="cataloguing_additem_itemlist">
150
151 <p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
152         [% FOREACH item_header_loo IN item_header_loop %]
153         <span class="selected"><input id="checkheader[% loop.count | html %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count | html %]">[% item_header_loo.header_value | html %]</label> </span>
154         [% END %]
155 </p>
156         <table id="itemst">
157       <thead>
158     <tr>
159         <th>&nbsp;</th>
160         <th class="anti-the">Title</th>
161         [% FOREACH item_header_loo IN item_header_loop %]
162         <th> [% item_header_loo.header_value | html %] </th>
163         [% END %] 
164     </tr>
165       </thead>
166       <tbody>
167             [% FOREACH item_loo IN item_loop %]
168               <tr>
169                 [% IF show %]
170                   [% IF item_loo.nomod %]
171                     <td class="error">Cannot edit</td>
172                   [% ELSE %]
173                     <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" data-is-onloan="[% item_loo.onloan | html %]" /></td>
174                   [% END %]
175                 [% ELSE %]
176                   <td>&nbsp;</td>
177                 [% END %]
178                 <td><label for="row[% item_loo.itemnumber | html %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber | html %]">[% item_loo.title | html %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author | html %][% END %]</label></td>
179                 [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field | html %]</td>
180         [% END %] </tr>
181             [% END %]
182       </tbody>
183         </table>
184 </div>
185 [% END %]<!-- /item_loop -->
186
187 [% IF ( simple_items_display ) %]
188     <p>The following items were modified:</p>
189     <ul>
190     [% FOREACH simple_items_displa IN simple_items_display %]
191   <li>
192       [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% simple_items_displa.biblionumber | html %]&amp;itemnumber=[% simple_items_displa.itemnumber | html %]">[% simple_items_displa.barcode | html %]</a>[% ELSE %][% simple_items_displa.barcode | html %][% END %]
193   </li>
194     [% END %]
195     </ul>
196 [% END %]<!-- /simple_items_display -->
197
198 [% IF ( show ) %]
199
200 [% IF ( too_many_items ) %]
201     <p>Too many items ([% too_many_items | html %]): You are not allowed to edit more than [% Koha.Preference('MaxItemsToProcessForBatchMod') | html %] items in a batch.</p>
202     [% FOREACH itemnumber IN itemnumbers_array %]
203   <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
204     [% END %]
205 [% END %]<!-- /too_many_items -->
206
207 [% IF ( item_loop ) %]
208 <div id="cataloguing_additem_newitem">
209         <h2>Edit Items</h2>
210         <div class="hint">Checking the box right next the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div>
211   <fieldset class="rows">
212   <ol>
213         [% FOREACH ite IN item %]
214           <li>
215             <div class="subfield_line" style="[% ite.visibility | html %]" id="subfield[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]">
216               [% SET mv = ite.marc_value %]
217               [% IF ( ite.mandatory ) %]
218                 <label class="required" for="[%- mv.id | html -%]">
219               [% ELSE %]
220                 <label for="[%- mv.id | html -%]">
221               [% END %]
222                 [% ite.subfield | html %] - [% ite.marc_lib | $raw %]
223               </label>
224
225               [% IF ( mv.type == 'select' ) -%]
226                 <select name="[%- mv.name | html -%]" id="[%- mv.id | html -%]" size="1" tabindex="1" class="input_marceditor">
227                   [%- FOREACH aval IN mv.values %]
228               [% ite.subfield | html %] -
229                     [% IF aval == mv.default %]
230                       <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
231                     [% ELSE %]
232                       <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
233                     [% END %]
234                   [%- END -%]
235                 </select>
236               [% ELSIF ( mv.type == 'text1' ) %]
237                 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
238                 <a href="#" class="buttonDot" onclick="Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=[%- mv.authtypecode | html -%]&index=[%- mv.id | html -%]','[%- mv.id | html -%]'); return false;" title="Tag editor">...</a>
239               [% ELSIF ( mv.type == 'text2' ) %]
240                 <input type="text" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
241                 [% IF mv.noclick %]
242                   <a href="#" class="buttonDot disabled" title="No popup">...</a>
243                 [% ELSE %]
244                   <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot" title="Tag editor">...</a>
245                 [% END %]
246                 [% mv.javascript | $raw %]
247               [% ELSIF ( mv.type == 'text' ) %]
248                 <input type="text" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
249               [% ELSIF ( mv.type == 'hidden' ) %]
250                 <input type="hidden" tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value | html -%]" />
251               [% ELSIF ( mv.type == 'textarea' ) %]
252                 <textarea tabindex="1" id="[%- mv.id | html -%]" name="field_value" class="input_marceditor" size="50" maxlength="255">[%- mv.value | html -%]"</textarea>
253               [%- END -%]
254
255               [% UNLESS ( ite.mandatory ) %]
256                 <input type="checkbox" id="row[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]" title="Check to delete subfield [% ite.subfield | html %]" name="disable_input" value="[% ite.subfield | html %]" />
257               [% ELSE %]
258                 <span class="required">Required</span>
259               [% END %]
260
261               <input type="hidden" name="tag"       value="[% ite.tag | html %]" />
262               <input type="hidden" name="subfield"       value="[% ite.subfield | html %]" />
263               <input type="hidden" name="mandatory"       value="[% ite.mandatory | html %]" />
264               [% IF ( ite.repeatable ) %]
265                 <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
266                   <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
267                 </a>
268               [% END %]
269               <span class="hint" id="hint[% ite.tag | html %][% ite.subfield | html %][% ite.random | html %]"></span>
270             </div>
271           </li>
272         [% END %]
273     </ol>
274     </fieldset>
275     <fieldset class="action">    
276    <div id="jobpanel">
277        <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
278        <div id="jobfailed"></div>
279    </div>
280    <input type="submit" id="mainformsubmit" value="Save" />
281          <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a>
282     </fieldset>
283 </div>
284 [% ELSE %]
285     <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
286 [% END %]
287 [% ELSE %] <!-- // show -->
288 <fieldset class="action">
289 [% IF src == 'CATALOGUING' # from catalogue/detail.pl > Edit items in a batch%]
290    <a class="btn btn-default" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | html %]"><i class="fa fa-check-square-o"></i> Return to the record</a>
291 [% ELSIF src %]
292    <a class="btn btn-default" href="[% src | html %]"><i class="fa fa-check-square-o"></i> Return to where you were</a>
293 [% ELSE %]
294    <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>
295 [% END %]
296 </fieldset>
297
298 [% END %]
299
300 [% INCLUDE 'intranet-bottom.inc' %]