Bug 5521 - item edit form appears if no items found
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Batch item modification</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
5 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
6 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/pages/batchMod.css" />
7 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 <script type="text/javascript">
10 //<![CDATA[
11
12 // Prepare array of all column headers, incrementing each index by
13 // two to accomodate control and title columns
14 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
15 for( x=0; x<allColumns.length; x++ ){
16   allColumns[x] = Number(allColumns[x]) + 2;
17 }
18 $(document).ready(function(){
19   $("#itemst").tablesorter({ widgets : ['zebra'], headers: {0:{sorter: false}} });
20   $("#selectallbutton").click(function() {
21       $("#itemst").find("input:checkbox").each(function() {
22    $(this).attr("checked", "checked");
23       });
24   });
25   $("#clearallbutton").click(function() {
26       $("#itemst").find("input:checkbox").each(function() {
27    $(this).removeAttr("checked");
28       });
29   });
30   $("input[name='disable_input']").click(function() {
31       var row = $(this).attr("id");
32       row = row.replace("row","hint");
33       var subfield = $(this).next();
34       if ($(this).is(":checked")){
35           $(this).val($(this).siblings("[name='subfield']").val());
36           $(subfield).attr('disabled',true);
37           $("#"+row).html(_("This subfield will be deleted"));
38       } else {
39           $(subfield).removeAttr('disabled');
40           $("#"+row).html("");
41       }
42   });
43 });
44 //]]>
45 </script>
46 <script type="text/javascript" src="[% themelang %]/js/pages/batchMod.js"></script>
47 <!--[if IE]>
48 <style type="text/css">#selections { display: none; }</style>
49 <![endif]-->
50 <style type="text/css">input[type=checkbox]{ margin : 0 .5em; }</style>
51 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
52 </head>
53 <body id="tools_batchMod-edit" class="tools">
54 [% INCLUDE 'header.inc' %]
55 [% INCLUDE 'cat-search.inc' %]
56
57 <div id="breadcrumbs">
58   <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
59   <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
60   <a href="/cgi-bin/koha/tools/batchMod.pl">Batch item modification</a>
61 </div>
62
63 <div id="doc3" class="yui-t7">
64     <div id="bd">
65         <div id="yui-main">
66             [% IF ( show ) %]<h1>Batch item modification</h1>[% ELSE %]<h1>Batch item modification results</h1>[% END %]
67 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
68 [% 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 %]
69 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
70 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
71
72     [% IF ( notfoundbarcodes ) %]
73       <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div>
74       <table style="margin:auto;">
75     <thead>
76         <tr><th>Barcodes not found</th></tr>
77     </thead>
78     <tbody>
79         [% FOREACH notfoundbarcode IN notfoundbarcodes %]
80       <tr><td>[% notfoundbarcode.barcode %]</td></td>
81         [% END %]
82     </tbody>
83       </table>
84       [% IF ( item_loop ) %]
85           [% UNLESS ( too_many_items ) %]
86           <h4>The following barcodes were found: </h4>
87           [% END %]
88       [% END %]
89   [% END %] <!-- /notfoundbarcodes -->
90
91 <form name="f" action="batchMod.pl" method="post">
92      <input type="hidden" name="op" value="[% op %]" />
93      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
94      <input type="hidden" name="runinbackground" id="runinbackground" value="" />
95      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
96      <input type="hidden" name="src" id="src" value="[% src %]" />
97
98 [% IF ( item_loop ) %]
99   [% IF ( show ) %]<div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>[% ELSE %][% END %]
100 <div id="cataloguing_additem_itemlist">
101
102 <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> 
103         [% FOREACH item_header_loo IN item_header_loop %]
104         <span class="selected"><input id="checkheader[% loop.count %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
105         [% END %]
106 </p>
107         <table id="itemst">
108       <thead>
109     <tr>
110         <th>&nbsp;</th>
111         <th>Title</th>
112         [% FOREACH item_header_loo IN item_header_loop %]
113         <th> [% item_header_loo.header_value %] </th>
114         [% END %] 
115     </tr>
116       </thead>
117       <tbody>
118             [% FOREACH item_loo IN item_loop %] <tr> [% IF ( show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% ELSE %]<td>&nbsp;</td>[% END %]
119                 <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
120                 [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
121         [% END %] </tr>
122             [% END %]
123       </tbody>
124         </table>
125 </div>
126 [% END %]<!-- /item_loop -->
127
128 [% IF ( simple_items_display ) %]
129     <p>The following items were modified:</p>
130     <ul>
131     [% FOREACH simple_items_displa IN simple_items_display %]
132   <li>
133       [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&amp;biblionumber=[% simple_items_displa.biblionumber %]&amp;itemnumber=[% simple_items_displa.itemnumber %]">[% simple_items_displa.barcode %]</a>[% ELSE %][% simple_items_displa.barcode %][% END %]
134   </li>
135     [% END %]
136     </ul>
137 [% END %]<!-- /simple_items_display -->
138
139 [% IF ( show ) %]
140
141 [% IF ( too_many_items ) %]
142     <p>Too many items ([% too_many_items %]): not displaying each one individually.</p>
143     [% FOREACH itemnumbers_hashre IN itemnumbers_hashref %]
144   <input type="hidden" name="itemnumber" value="[% itemnumbers_hashre.itemnumber %]" />
145     [% END %]
146 [% END %]<!-- /too_many_items -->
147
148 [% IF ( item_loop ) %]
149 <div id="cataloguing_additem_newitem">
150         <h2>Edit Items</h2>
151         <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>
152   <fieldset class="rows">
153   <ol>
154         [% FOREACH ite IN item %]
155                <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
156               [% IF ( ite.mandatory ) %]
157               <label class="required" for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
158               [% ELSE %]
159               <label for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
160               [% END %]
161               [% ite.subfield %] -
162           [% ite.marc_lib %]
163          </label>
164                 [% UNLESS ( ite.mandatory ) %]<input type="checkbox" id="row[% ite.tag %][% ite.subfield %][% ite.random %]" title="Check to delete subfield [% ite.subfield %]" name="disable_input" value="[% ite.subfield %]" />[% ELSE %]<span class="required">Required</span>[% END %]
165                 [% ite.marc_value %]
166                 <input type="hidden" name="tag"       value="[% ite.tag %]" />
167                 <input type="hidden" name="subfield"       value="[% ite.subfield %]" />
168                 <input type="hidden" name="mandatory"       value="[% ite.mandatory %]" />
169                 [% IF ( ite.repeatable ) %]
170                     <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
171                         <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
172                     </a>
173                 [% END %]
174                 <span class="hint" id="hint[% ite.tag %][% ite.subfield %][% ite.random %]"></span>
175             </div></li>
176         [% END %]
177     </ol>
178     </fieldset>
179     <fieldset class="action">    
180    <div id="jobpanel">
181        <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
182        <div id="jobfailed"></div>
183    </div>
184    <input type="submit" name="mainformsubmit" value="Save" onclick="return submitBackgroundJob(this.form);" />
185          <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel" onclick="history.back();return false;">Cancel</a>
186     </fieldset>
187 </div>
188 [% ELSE %]
189     <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
190 [% END %]
191 [% ELSE %] <!-- // show -->
192 <fieldset class="action">
193 [% IF ( src == 'CATALOGUING') %]
194    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">Done</a>
195 [% ELSE %]
196    <a href="/cgi-bin/koha/tools/batchMod.pl">Done</a>
197 [% END %]
198 </fieldset>
199          
200 [% END %]
201 </div>
202     </div>
203 [% INCLUDE 'intranet-bottom.inc' %]