Bug 29234: Further clean Z3950 Tests
[koha-ffzg.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 class="page-section">
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                                 [% UNLESS item.nomod %]
119                                     <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>
120                                 [% END %]
121                                 <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>
122                                 <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>
123                                 [% UNLESS item.nomod %]
124                                     <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>
125                                 [% END %]
126                             [% END %]
127                                 [% IF ( OPACBaseURL ) %]
128                                     <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>
129                                 [% END %]
130                             </ul>
131                             </div>
132                         </td>
133                         [% END %]
134                     [% FOREACH header IN item_header_loop %]
135                         [% SET attribute = header.attribute %]
136                         [% SET can_mod = item.nomod ? "nomod" : "canmod" %]
137                         [% IF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %]
138                             <td class="[% can_mod | html %]" data-order="[% item.$attribute | html %]">[% item.$attribute | $KohaDates %]</td>
139                         [% ELSIF ( item.$attribute && ( attribute == 'price' || attribute == 'replacementprice' ) ) %]
140                             <td class="[% can_mod | html %]" data-order="[% item.$attribute | html %]">[% item.$attribute | $Price %]</td>
141                         [% ELSE %]
142                             <td class="[% can_mod | html %]">[% item.$attribute | html %]</td>
143                         [% END %]
144                     [% END %]
145                     </tr>
146                     [% END %]
147             </tbody>
148             </table>
149         </div> <!-- /.page-section -->
150     [% END %]
151
152 <div class="row">
153     <div class="col-sm-2">
154         [% INCLUDE 'biblio-view-menu.inc' %]
155     </div>
156     <div class="col-sm-10">
157
158 <div id="cataloguing_additem_newitem" class="item_edit_form page-section">
159     <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblio.biblionumber | html %]" name="f">
160     <input type="hidden" name="op" value="[% op | html %]" />
161     [% IF (popup) %]
162         <input type="hidden" name="popup" value="1" />
163     [% END %]
164     <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" />
165     [% IF op != 'saveitem' %]
166         <h2 id="additema">Add item [% IF (circborrowernumber) %]<em>(fast cataloging)</em>[% END %]</h2>
167     [% ELSE %]
168         <h2 id="edititem">Edit item #[% itemnumber | html %][% IF ( barcode ) %] / Barcode [% barcode | html %][% END %]</h2>
169     [% END %]
170
171     [% IF item_templates.owned.count || item_templates.shared.count %]
172         <div id="item-template-toolbar" class="btn-toolbar">
173             <div class="btn-group">
174                 <select name="template_id" id="template_id" class="select2" style="width: 20em">
175                     <option value="0" selected="selected">Do not use template</option>
176                     <optgroup label="My templates">
177                         [% FOREACH t IN item_templates.owned %]
178                             [% IF t.id == template_id %]
179                                 <option data-editor="1" value="[% t.id | html %]" selected="selected">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
180                             [% ELSE %]
181                                 <option data-editor="1" value="[% t.id | html %]">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
182                             [% END %]
183                         [% END %]
184                     </optgroup>
185                     <optgroup label="Shared templates">
186                         [% FOREACH t IN item_templates.shared %]
187                             [% IF t.id == template_id %]
188                                 [% IF CAN_user_editcatalogue_manage_item_editor_templates %]
189                                     <option data-editor="1" value="[% t.id | html %]" selected="selected">[% t.name | html %]</option>
190                                 [% ELSE %]
191                                     <option data-editor="0" value="[% t.id | html %]" selected="selected">[% t.name | html %]</option>
192                                 [% END %]
193                             [% ELSE %]
194                                 [% IF CAN_user_editcatalogue_manage_item_editor_templates %]
195                                     <option data-editor="1" value="[% t.id | html %]">[% t.name | html %]</option>
196                                 [% ELSE %]
197                                     <option data-editor="0" value="[% t.id | html %]">[% t.name | html %]</option>
198                                 [% END %]
199                             [% END %]
200                         [% END %]
201                     </optgroup>
202                 </select>
203             </div>
204             <div class="btn-group">
205                 <button type="submit" id="load_template_submit" name="load_template_submit" value="1"><i class="fa fa-wpforms"></i> Apply template</button>
206             </div>
207             <div class="btn-group">
208                 <label for="use_template_for_session">
209                     [% IF use_template_for_session %]
210                         <input type="checkbox" id="use_template_for_session" name="use_template_for_session" checked="checked">
211                     [% ELSE %]
212                         <input type="checkbox" id="use_template_for_session" name="use_template_for_session">
213                     [% END %]
214                 For session</label>
215             </div>
216
217             <div class="btn-group">
218                 <button type="submit" id="unload_template_submit" name="unload_template_submit" value="1"><i class="fa fa-eraser"></i> Clear template</button>
219             </div>
220
221             <div class="btn-group">
222                 <button type="submit" id="delete_template_submit" name="delete_template_submit" value="1" disabled><i class="fa fa-trash"></i> Delete template</button>
223             </div>
224         </div>
225     [% END %]
226
227         <fieldset class="rows">
228         [% PROCESS subfields_for_item subfields => subfields %]
229     </fieldset>
230     [% IF op != 'add_item' %]
231         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
232     [% END %]
233
234 [% IF item_groups.size && op != 'saveitem' && CAN_user_editcatalogue_manage_item_groups %]
235     <fieldset class="rows">
236         <legend><i class="fa fa-plus"></i> Add to item group</legend>
237         [% FOREACH ig IN item_groups %]
238             <input type="hidden" id="item-group-[% ig.id | html %]" value="[% ig.description | html %]" />
239         [% END %]
240         <p>
241             <label for="select_item_group">Options: </label>
242             <select name="item_group" id="item-group-add-or-create-form-select">
243                 <optgroup label="Use existing item group">
244                     [% FOREACH ig IN item_groups %]
245                         <option value="[% ig.id | html %]">Use: [% ig.description | html %]</option>
246                     [% END %]
247                 </optgroup>
248                 <optgroup label="Other options">
249                     <option id="item-group-add-or-create-form-no-add" value="">Do not add to item group</option>
250                     <option value="create">Create new item group</option>
251                 </optgroup>
252             </select>
253         </p>
254
255         <p id="item-group-add-or-create-form-description-block">
256             <label for="item_group_description" class="required">Name: </label>
257             <input name="item_group_description" id="item-group-add-or-create-form-description" type="text" size="30" class="required" />
258             <span class="required">Required</span>
259         </p>
260     </fieldset>
261 [% END %]
262
263 <fieldset class="action">    [% IF op != 'saveitem' %]
264     <input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
265     <!-- 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
266                 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.
267                 It is a bit tricky, but necessary in the sake of UI correctness.
268     -->
269     <span id="addsingle">
270         <input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
271         <input type="submit" name="add_duplicate_submit" value="Add &amp; duplicate" onclick="return Check(this.form)" />
272     </span>
273     <span id="addmultiple">
274         <input type="button" name="add_multiple_copies" id="add_multiple_copies" value="Add multiple copies of this item" />
275     </span>
276     <fieldset id="add_multiple_copies_span">
277         <label for="number_of_copies">Number of copies of this item to add: </label>
278         <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
279         <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>
280         <div class="hint"><p>The barcode you enter will be incremented for each additional item.</p></div>
281     </fieldset>
282
283     <span id="savetemplate">
284         <input type="button" name="save_as_template" id="save_as_template" value="Save as template" />
285     </span>
286     <fieldset id="save_as_template_span">
287         <legend>Save template</legend>
288         <div class="btn-group">
289             <select name="replace_template_id" id="replace_template_id" class="select2" style="width: 20em">
290                 <option value="0" selected="selected">Save as new template</option>
291                 <optgroup label="Update existing template">
292                     [% FOREACH t IN item_templates.owned %]
293                         <option data-editor="1" data-shared="[% t.is_shared | html %]" value="[% t.id | html %]">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
294                     [% END %]
295                     [% IF CAN_user_editcatalogue_manage_item_editor_templates && item_templates.shared.count %]
296                         <optgroup label="Update shared template">
297                             [% FOREACH t IN item_templates.shared %]
298                                 <option data-editor="1" data-shared="1" value="[% t.id | html %]">[% t.name | html %][% IF t.is_shared %] (shared)[% END %]</option>
299                             [% END %]
300                         </optgroup>
301                     [% END %]
302                 </optgroup>
303             </select>
304         </div>
305
306         <div class="btn-group">
307             <span id="template_name_block">
308                 <label for="template_name" class="required">Template name: </label>
309                 <input type="text" id="template_name" name="template_name" class="required"/>
310                 <span class="required">Required</span>
311             </span>
312         </div>
313
314         <div class="btn-group">
315             <label for="template_is_shared">
316                 <input type="checkbox" id="template_is_shared" name="template_is_shared"/>
317                 Share template
318             </label>
319         </div>
320
321         <div class="btn-group">
322             <input type="submit" id="save_as_template_submit" name="save_as_template_submit" value="Save" onclick="javascript:return CheckTemplateForm(this.form);" />
323             <a href="#" id="cancel_save_as_template" class="cancel">Cancel</a>
324         </div>
325     </fieldset>
326
327     [% ELSE %]
328     [% IF op != 'add_item' %]
329         <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
330     [% END %]
331     <input type="submit" value="Save changes" onclick="return Check(this.form)">
332     <input type="button" id="addnewitem" value="Add a new item">
333     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Cancel</a>
334     [% END %]</fieldset>
335
336     [%# Fields for fast cataloging %]
337     <input type="hidden" name="circborrowernumber" value="[% circborrowernumber | html %]" />
338     <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
339     <input type="hidden" name="barcode" value="[% barcode | html %]" />
340     <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
341     [%# End fields for fast cataloging %]
342
343
344     </form>
345
346     [% INCLUDE 'modals/cataloguing_create_av.inc' %]
347
348                             </div> <!-- /#cataloguing_additem_newitem -->
349                         </div> <!-- /.col-sm-10 -->
350                     </div> <!-- /.row -->
351                 </div> <!-- /#cataloguing_additem_itemlist -->
352             </main>
353         </div> <!-- /.col-sm-12 -->
354     </div> <!-- /.row -->
355
356 [% MACRO jsinclude BLOCK %]
357 [% END %]
358
359 [% INCLUDE 'intranet-bottom.inc' %]