Bug 24606: (QA follow-up) Set existing sharing setting when updating existing template
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / additem.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% USE Price %]
7 [% USE TablesSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Items &rsaquo; [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %]) &rsaquo; Cataloging &rsaquo; Koha</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% Asset.css("css/addbiblio.css") | $raw %]
12 [% INCLUDE 'datatables.inc' %]
13 <script>
14     [% IF Koha.Preference('CreateAVFromCataloguing') && CAN_user_parameters_manage_auth_values %]
15         var auth_values_creation = 1;
16     [% ELSE %]
17         var auth_values_creation = 0;
18     [% END %]
19 </script>
20 [% INCLUDE 'select2.inc' %]
21 [% Asset.js("js/cataloging.js") | $raw %]
22 [% INCLUDE 'columns_settings.inc' %]
23 [% Asset.js("js/browser.js") | $raw %]
24 [% INCLUDE 'calendar.inc' %]
25 [% INCLUDE 'str/cataloging_additem.inc' %]
26 [% Asset.js("js/cataloging_additem.js") | $raw %]
27     <script>
28       var has_item_groups = "[% item_groups.size | html %]";
29     </script>
30 </head>
31
32 <body id="cat_additem" class="cat">
33 [% WRAPPER 'header.inc' %]
34     [% INCLUDE 'cataloging-search.inc' %]
35 [% END %]
36
37 [% WRAPPER 'sub-header.inc' %]
38 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
39     <ol>
40         <li>
41           <a href="/cgi-bin/koha/mainpage.pl">Home</a>
42         </li>
43         <li>
44             <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
45         </li>
46         <li>
47             <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblio.biblionumber | uri %]">Edit <em>[% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</em></a>
48         </li>
49         <li>
50             <a href="#" aria-current="page">
51                 Items
52             </a>
53         </li>
54     </ol>
55 </nav>
56 [% END %]
57
58 <div class="main container-fluid">
59     <div class="row">
60         <div class="col-sm-12">
61             <main>
62                 [% INCLUDE 'blocking_errors.inc' %]
63 <h1>Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])</h1>
64
65 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
66 [% 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 %]
67 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
68 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot delete</strong>: item has a waiting hold.</div>[% END %]
69 [% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot delete</strong>: The items do not belong to your library.</div>[% END %]
70 [% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;analyze=1">analytics.</a>.</div>[% END %]
71 [% IF last_item_for_hold %]<div class="dialog alert"><strong>Cannot delete</strong>: Last item for bibliographic record with biblio-level hold on it.</div>[% END %]
72 [% IF item_not_found %]<div class="dialog alert"><strong>Cannot delete</strong>: Item not found.</div>[% END %]
73
74 <div id="cataloguing_additem_itemlist">
75     [% IF items %]
76         [% SET date_fields = [ 'dateaccessioned', 'onloan', 'datelastseen', 'datelastborrowed', 'replacementpricedate' ] %]
77         <div>
78         <table id="itemst">
79           <thead>
80             <tr>
81                 <th class="NoSort">&nbsp;</th>
82                 [% FOREACH item_header IN item_header_loop %]
83                     <th data-colname="[% item_header.attribute | html %]">
84                         [% item_header.header_value | html %]
85                     </th>
86                 [% END %]
87             </tr>
88           </thead>
89           <tbody>
90                 [% FOREACH item IN items %]
91                     [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %]
92                     [% IF item.itemnumber == itemnumber%]
93                         [% UNLESS can_be_edited %]
94                            <tr id="row[% item.itemnumber | html %]" class="active">
95                         [% ELSE %]
96                             <tr id="row[% item.itemnumber | html %]" class="active editable">
97                         [% END %]
98                     [% ELSE %]
99                         [% UNLESS can_be_edited %]
100                            <tr id="row[% item.itemnumber | html %]">
101                         [% ELSE %]
102                             <tr id="row[% item.itemnumber | html %]" class="editable">
103                         [% END %]
104                     [% END %]
105                     [% UNLESS can_be_edited %]
106                       <td>&nbsp;</td>
107                     [% ELSE %]
108                       <td>
109                           <div class="btn-group dropup">
110                           <a class="btn btn-default btn-xs dropdown-toggle" id="itemactions[% item.itemnumber | html %]" role="button" data-toggle="dropdown" href="#">
111                               Actions <b class="caret"></b>
112                           </a>
113                           <ul class="dropdown-menu" role="menu" aria-labelledby="itemactions[% item.itemnumber | html %]">
114
115                         [% IF item.biblionumber != biblio.biblionumber %] [%# Host item %]
116                               <li><a href="additem.pl?op=edititem&amp;biblionumber=[% item.biblionumber | uri %]&amp;itemnumber=[% item.itemnumber | uri %]#edititem">Edit in host</a> &nbsp; <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblio.biblionumber | html %]&amp;hostitemnumber=[% item.itemnumber | html %]&amp;searchid=[% searchid | html %]">Delink</a></li>
117                         [% ELSE %]
118                               <li><a href="additem.pl?op=edititem&amp;biblionumber=[% biblio.biblionumber | uri %]&amp;itemnumber=[% item.itemnumber | uri %]&amp;searchid=[% searchid | uri %]#edititem">Edit</a></li>
119                               <li><a href="additem.pl?op=dupeitem&amp;biblionumber=[% biblio.biblionumber | uri %]&amp;itemnumber=[% item.itemnumber | uri %]&amp;searchid=[% searchid | uri %]#additema">Duplicate</a></li>
120                               <li class="print_label"><a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=add&amp;number_type=itemnumber&amp;number_list=[% item.itemnumber | uri %]" target="_blank" >Print label</a></li>
121                               <li><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&amp;biblionumber=[% item.biblionumber | html %]&amp;itemnumber=[% item.itemnumber | html %]&amp;searchid=[% searchid | html %]" onclick="return confirm_deletion();">Delete</a></li>
122                         [% END %]
123                             [% IF ( OPACBaseURL ) %]
124                                 <li class="view-in-opac"><a target="_blank" href="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% item.biblionumber | uri %]">OPAC view</a></li>
125                             [% END %]
126                           </ul>
127                           </div>
128                       </td>
129                     [% END %]
130                 [% FOREACH header IN item_header_loop %]
131                     [% SET attribute = header.attribute %]
132                     [% IF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %]
133                         <td data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates %]</td>
134                     [% ELSIF ( item.$attribute && ( attribute == 'price' || attribute == 'replacementprice' ) ) %]
135                         <td data-order="[% item.$attribute | html %]">[% item.$attribute | $Price %]</td>
136                     [% ELSE %]
137                         <td>[% item.$attribute | html %]</td>
138                     [% END %]
139                 [% END %]
140                 </tr>
141                 [% END %]
142           </tbody>
143         </table>
144         </div>
145     [% END %]
146
147 <div class="row">
148     <div class="col-sm-2">
149         [% INCLUDE 'biblio-view-menu.inc' %]
150     </div>
151     <div class="col-sm-10">
152
153 <div id="cataloguing_additem_newitem">
154     <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblio.biblionumber | html %]" name="f">
155     <input type="hidden" name="op" value="[% op | html %]" />
156     [% IF (popup) %]
157         <input type="hidden" name="popup" value="1" />
158     [% END %]
159     <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" />
160     [% IF op != 'saveitem' %]
161         <h2 id="additema">Add item [% IF (circborrowernumber) %]<em>(fast cataloging)</em>[% END %]</h2>
162     [% ELSE %]
163         <h2 id="edititem">Edit item #[% itemnumber | html %][% IF ( barcode ) %] / Barcode [% barcode | html %][% END %]</h2>
164     [% END %]
165
166     <div id="item-template-toolbar" class="btn-toolbar">
167         <select name="template_id" id="template_id" class="select2" style="width: 20em">
168             <option value="0" selected="selected">Do not use template</option>
169             <optgroup label="My templates">
170                 [% FOREACH t IN item_templates.owned %]
171                     [% IF t.id == template_id %]
172                         <option data-editor="1" value="[% t.id | html %]" selected="selected">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
173                     [% ELSE %]
174                         <option data-editor="1" value="[% t.id | html %]">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
175                     [% END %]
176                 [% END %]
177             </optgroup>
178             <optgroup label="Shared templates">
179                 [% FOREACH t IN item_templates.shared %]
180                     [% IF t.id == template_id %]
181                         [% IF CAN_user_editcatalogue_manage_item_editor_templates %]
182                             <option data-editor="1" value="[% t.id | html %]" selected="selected">[% t.name | html %]</option>
183                         [% ELSE %]
184                             <option data-editor="0" value="[% t.id | html %]" selected="selected">[% t.name | html %]</option>
185                         [% END %]
186                     [% ELSE %]
187                         [% IF CAN_user_editcatalogue_manage_item_editor_templates %]
188                             <option data-editor="1" value="[% t.id | html %]">[% t.name | html %]</option>
189                         [% ELSE %]
190                             <option data-editor="0" value="[% t.id | html %]">[% t.name | html %]</option>
191                         [% END %]
192                     [% END %]
193                 [% END %]
194             </optgroup>
195         </select>
196         <button type="submit" id="load_template_submit" name="load_template_submit" value="1"><i class="fa fa-wpforms"></i> Apply template</button>
197         <label for="use_template_for_session">
198             [% IF use_template_for_session %]
199                 <input type="checkbox" id="use_template_for_session" name="use_template_for_session" checked="checked">
200             [% ELSE %]
201                 <input type="checkbox" id="use_template_for_session" name="use_template_for_session">
202             [% END %]
203         For session</label>
204
205         <button type="submit" id="unload_template_submit" name="unload_template_submit" value="1"><i class="fa fa-eraser"></i> Clear template</button>
206
207         <button type="submit" id="delete_template_submit" name="delete_template_submit" value="1" disabled><i class="fa fa-trash"></i> Delete template</button>
208
209     </div>
210
211         <fieldset class="rows">
212         [% PROCESS subfields_for_item subfields => subfields %]
213     </fieldset>
214     [% IF op != 'add_item' %]
215         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
216     [% END %]
217
218 [% IF item_groups.size && op != 'saveitem' && CAN_user_editcatalogue_manage_item_groups %]
219     <fieldset class="rows">
220         <legend><i class="fa fa-plus"></i> Add to item group</legend>
221         [% FOREACH ig IN item_groups %]
222             <input type="hidden" id="item-group-[% ig.id | html %]" value="[% ig.description | html %]" />
223         [% END %]
224         <p>
225             <label for="select_item_group">Options: </label>
226             <select name="item_group" id="item-group-add-or-create-form-select">
227                 <optgroup label="Use existing item group">
228                     [% FOREACH ig IN item_groups %]
229                         <option value="[% ig.id | html %]">Use: [% ig.description | html %]</option>
230                     [% END %]
231                 </optgroup>
232                 <optgroup label="Other options">
233                     <option id="item-group-add-or-create-form-no-add" value="">Do not add to item group</option>
234                     <option value="create">Create new item group</option>
235                 </optgroup>
236             </select>
237         </p>
238
239         <p id="item-group-add-or-create-form-description-block">
240             <label for="item_group_description" class="required">Name: </label>
241             <input name="item_group_description" id="item-group-add-or-create-form-description" type="text" size="30" class="required" />
242             <span class="required">Required</span>
243         </p>
244     </fieldset>
245 [% END %]
246
247 <fieldset class="action">    [% IF op != 'saveitem' %]
248     <input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
249     <!-- Note : We use here a false submit button because we have several submit buttons and we don't want the user to believe they validated the adding of multiple items
250                 when pressing the enter key, while in fact it is the first submit button that is validated, in our case the "add (single) item" button.
251                 It is a bit tricky, but necessary in the sake of UI correctness.
252     -->
253     <span id="addsingle">
254         <input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
255         <input type="submit" name="add_duplicate_submit" value="Add &amp; duplicate" onclick="return Check(this.form)" />
256     </span>
257     <span id="addmultiple">
258         <input type="button" name="add_multiple_copies" id="add_multiple_copies" value="Add multiple copies of this item" />
259     </span>
260     <fieldset id="add_multiple_copies_span">
261         <label for="number_of_copies">Number of copies of this item to add: </label>
262         <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
263         <input type="submit" id="add_multiple_copies_submit" name="add_multiple_copies_submit" value="Add" onclick="javascript:return Check(this.form) && CheckMultipleAdd(this.form.number_of_copies.value);" /> <a href="#" id="cancel_add_multiple" class="cancel">Cancel</a>
264         <div class="hint"><p>The barcode you enter will be incremented for each additional item.</p></div>
265     </fieldset>
266
267     <span id="savetemplate">
268         <input type="button" name="save_as_template" id="save_as_template" value="Save as template" />
269     </span>
270     <fieldset id="save_as_template_span">
271         <legend>Save template</legend>
272         <select name="replace_template_id" id="replace_template_id" class="select2" style="width: 20em">
273             <option value="0" selected="selected">Save as new template</option>
274             <optgroup label="Update existing template">
275                 [% FOREACH t IN item_templates.owned %]
276                     <option data-editor="1" data-shared="[% t.is_shared %]" value="[% t.id | html %]">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
277                 [% END %]
278                 [% IF CAN_user_editcatalogue_manage_item_editor_templates && item_templates.shared.count %]
279                     <optgroup label="Update shared template">
280                         [% FOREACH t IN item_templates.shared %]
281                             <option data-editor="1" data-shared="1" value="[% t.id | html %]">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
282                         [% END %]
283                     </optgroup>
284                 [% END %]
285             </optgroup>
286         </select>
287
288         <span id="template_name_block">
289             <label for="template_name" class="required">Template name: </label>
290             <input type="text" id="template_name" name="template_name" class="required"/>
291             <span class="required">Required</span>
292         </span>
293
294         <label for="template_is_shared">
295             <input type="checkbox" id="template_is_shared" name="template_is_shared"/>
296             Share template
297         </label>
298
299         <input type="submit" id="save_as_template_submit" name="save_as_template_submit" value="Save" onclick="javascript:return CheckTemplateForm(this.form);" />
300         <a href="#" id="cancel_save_as_template" class="cancel">Cancel</a>
301     </fieldset>
302
303     [% ELSE %]
304     [% IF op != 'add_item' %]
305         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
306     [% END %]
307     <input type="submit" value="Save changes" onclick="return Check(this.form)">
308     <input type="button" id="addnewitem" value="Add a new item">
309     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Cancel</a>
310     [% END %]</fieldset>
311
312     [%# Fields for fast cataloging %]
313     <input type="hidden" name="circborrowernumber" value="[% circborrowernumber | html %]" />
314     <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
315     <input type="hidden" name="barcode" value="[% barcode | html %]" />
316     <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
317     [%# End fields for fast cataloging %]
318
319
320     </form>
321
322     [% INCLUDE 'modals/cataloguing_create_av.inc' %]
323
324                             </div> <!-- /#cataloguing_additem_newitem -->
325                         </div> <!-- /.col-sm-10 -->
326                     </div> <!-- /.row -->
327                 </div> <!-- /#cataloguing_additem_itemlist -->
328             </main>
329         </div> <!-- /.col-sm-12 -->
330     </div> <!-- /.row -->
331
332 [% MACRO jsinclude BLOCK %]
333 [% END %]
334
335 [% INCLUDE 'intranet-bottom.inc' %]