Bug 7673: New patron permissions
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / additem.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Cataloging &rsaquo; [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) &rsaquo; Items</title>
3 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'datatables.inc' %]
6 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
7 [% INCLUDE 'browser-strings.inc' %]
8 <!--[if lt IE 9]>
9 <script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script>
10 <![endif]-->
11 <script type="text/javascript" src="[% interface %]/js/browser.js"></script>
12 <script type="text/javascript">
13 //<![CDATA[
14     var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10));
15     browser.show();
16
17 $(document).ready(function(){
18     [% IF (popup) %]
19         [% IF (opisadd) %]
20             window.close();
21         [% END %]
22     [% END %]
23             $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
24                 /* Inline edit/delete links */
25                 var biblionumber = $("input[name='biblionumber']").attr("value");
26         $("tr.editable td").click(function(event){
27                         var $tgt = $(event.target);
28                         if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
29                         var rowid = $(this).parent().attr("id");
30                         num_rowid = rowid.replace("row","");
31                         $(".linktools").remove();
32                         $(this).append("<span class=\"linktools\"><a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"#edititem\">" + _("Edit item") + "</a> <a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"\" onclick=\"confirm_deletion([% biblionumber %],"+num_rowid+"); return false;\">" + _("Delete item") + "</a></span>");
33                 }
34                 });
35
36     var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
37         "aoColumnDefs": [
38           { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
39         ],
40         'bPaginate': false,
41         'bInfo': false,
42         "bAutoWidth": false
43     } ) );
44
45 });
46 function active(numlayer)
47 {
48     for (i=10; i < 11 ; i++ ) {
49         ong = i+"XX";
50             link = "link"+i;
51         if (numlayer==i) {
52             document.getElementById(ong).style.visibility="visible";
53             document.getElementById(link).style.backgroundColor="#11AA11";
54             document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)";
55         } else {
56             document.getElementById(ong).style.visibility="hidden";
57             document.getElementById(link).style.backgroundColor="#FFFFFF";
58             document.getElementById(link).style.backgroundImage="";
59         }
60     }
61 }
62 function Check(f) {
63     var total_errors = CheckMandatorySubfields(f);
64     if (total_errors==0) {
65         // Explanation about this line:
66         // In case of limited edition permission, we have to prevent user from modifying some fields.
67         // But there is no such thing as readonly attribute for select elements.
68         // So we use disabled instead. But disabled prevent values from being passed through the form at submit.
69         // So we "un-disable" the elements just before submitting.
70         // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
71         $("select[name=field_value]").removeAttr("disabled");
72         return true;
73     } else {
74         var alertString2 = _("Form not submitted because of the following problem(s)");
75         alertString2 += "\n------------------------------------------------------------------------------------\n";
76         alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
77         alert(alertString2);
78         return false;
79     }
80     return true;
81 }
82 function CheckMultipleAdd(f) {
83
84     if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) {
85         alert(_("Please enter a number of items to create."));
86         return false;
87     }
88 }
89 function Dopop(link,i) {
90     defaultvalue=document.forms[0].field_value[i].value;
91     newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
92 }
93
94 function confirm_deletion(biblionumber,itemnumber) {
95         var original = $("#row"+itemnumber).attr("class");
96         $("#row"+itemnumber).attr("class","confirm");
97     var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
98     if (is_confirmed) {
99     window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
100         } else {
101         $("#row"+itemnumber).attr("class","");
102     }
103 }
104
105 $(document).ready(function() {
106     $("#cataloguing_additem_itemlist  tr").hover(
107         function () {$(this).addClass("highlight");},
108         function () {$(this).removeClass("highlight");}
109     );
110 });
111 //]]>
112 </script>
113 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
114 [% IF ( bidi ) %]
115    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
116 [% END %]
117 </head>
118 <body id="cat_additem" class="cat">
119 [% INCLUDE 'header.inc' %]
120 [% INCLUDE 'cataloging-search.inc' %]
121
122 <div id="breadcrumbs">
123           <a href="/cgi-bin/koha/mainpage.pl">Home</a>
124  &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
125  &rsaquo; Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]">[% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</a>
126  &rsaquo; <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Items</a>
127 </div>
128
129 <div id="doc3" class="yui-t7">
130
131    <div id="bd">
132         <div id="yui-main">
133
134 <h1>Items for [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</h1>
135
136 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
137 [% 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 %]
138 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item is checked out.</div>[% END %]
139 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot delete</strong>: item has a waiting hold.</div>[% END %]
140 [% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot delete</strong>: The items do not belong to your library.</div>[% END %]
141 [% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]&amp;analyze=1">analytics.</a>.</div>[% END %]
142
143 <div id="cataloguing_additem_itemlist">
144     [% IF ( item_loop ) %]
145         <div>
146         <table id="itemst">
147           <thead>
148             <tr>
149                 <th>&nbsp;</th>
150                 [% FOREACH item_header_loo IN item_header_loop %]
151                     <th>
152                         [% item_header_loo.header_value %]
153                     </th>
154                 [% END %]
155             </tr>
156           </thead>
157           <tbody>
158                 [% FOREACH item_loo IN item_loop %]
159                     [% IF ( item_loo.itemnumber == itemnumber) %]
160                         [% IF item_loo.nomod %]
161                            <tr id="row[% item_loo.itemnumber %]" class="active">
162                         [% ELSE %]
163                             <tr id="row[% item_loo.itemnumber %]" class="active editable">
164                         [% END %]
165                     [% ELSE %]
166                         [% IF item_loo.nomod %]
167                            <tr id="row[% item_loo.itemnumber %]">
168                         [% ELSE %]
169                             <tr id="row[% item_loo.itemnumber %]" class="editable">
170                         [% END %]
171                     [% END %]
172                     [% IF ( item_loo.nomod ) %]
173                       <td>&nbsp;</td>
174                     [% ELSE %]
175                       <td>
176                         [% IF ( item_loo.hostitemflag ) %]
177                           <a href="additem.pl?op=edititem&amp;biblionumber=[% item_loo.hostbiblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> &nbsp; <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblionumber %]&amp;hostitemnumber=[% item_loo.itemnumber %]">Delink</a>
178                         [% ELSE %]
179                           <a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a>
180                           [% IF ( item_loo.countanalytics ) %]
181                             <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
182                           [% ELSE %]
183                             <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a>
184                           [% END %]
185                         [% END %]
186                       </td>
187                     [% END %]
188                 [% FOREACH item_valu IN item_loo.item_value %]
189                     <td>[% item_valu.field |html %]</td>
190                 [% END %]
191                 </tr>
192                 [% END %]
193           </tbody>
194         </table>
195         </div>
196     [% END %]
197 </div>
198 <div class="yui-gf">
199 <div class="yui-u first">
200 [% INCLUDE 'biblio-view-menu.inc' %]
201 </div>
202 <div class="yui-u">
203 <div id="cataloguing_additem_newitem">
204     <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
205     <input type="hidden" name="op" value="[% op %]" />
206     [% IF (popup) %]
207         <input type="hidden" name="popup" value="1" />
208     [% END %]
209     <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
210     [% IF ( opisadd ) %]
211         <h2 id="additema">Add item [% IF (circborrowernumber) %]<em>(fast cataloging)</em>[% END %]</h2>
212     [% ELSE %]
213         <h2 id="edititem">Edit Item #[% itemnumber %][% IF ( barcode ) %] / Barcode [% barcode %][% END %]</h2>
214     [% END %]
215         <fieldset class="rows">
216         <ol>
217         [% FOREACH ite IN item %]
218                <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
219                 [% IF ( ite.mandatory ) %]
220                <label class="required">[% ite.subfield %] - [% ite.marc_lib %]</label>
221                [% ELSE %]
222                <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
223                [% END %]
224                 [% ite.marc_value %]
225                 <input type="hidden" name="tag"       value="[% ite.tag %]" />
226                 <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
227                 <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
228                 [% IF ( ite.repeatable ) %]
229                     <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
230                         <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
231                     </a>
232                 [% END %]
233                 [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
234             </div></li>
235         [% END %]
236     </ol>
237     </fieldset>
238     <input type="hidden" name="indicator" value=" " />
239     <input type="hidden" name="indicator" value=" " />
240     <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
241
242 <fieldset class="action">    [% IF ( opisadd ) %]
243     <input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
244     <!-- Note : We use here a false submit button because we have several submit buttons and we don't want the user to believe he validated the adding of multiple items
245                 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.
246                 It is a bit tricky, but necessary in the sake of UI correctness.
247     -->
248
249     <input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
250     <input type="submit" name="add_duplicate_submit" value="Add &amp; duplicate" onclick="return Check(this.form)" />
251     <input type="submit" name="add_multiple_copies" value="Add multiple items" onclick="javascript:this.nextSibling.style.visibility='visible';document.f.number_of_copies.focus(); return false;" /><span id="add_multiple_copies_span" style="visibility:hidden">
252     <label for="number_of_copies">Number of items to add : </label>
253         <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
254         <input type="submit" id="add_multiple_copies_submit" name="add_multiple_copies_submit" value="Add" onclick="javascript:return Check(this.form) &amp;&amp; CheckMultipleAdd(this.form.number_of_copies.value);" />
255     </span>
256
257     [% ELSE %]
258     <input type="hidden" name="tag" value="[% itemtagfield %]" />
259     <input type="hidden" name="subfield" value="[% itemtagsubfield %]" />
260     <input type="hidden" name="field_value" value="[% itemnumber %]" />
261     <input type="submit" value="Save changes" onclick="return Check(this.form)" />
262     [% END %]</fieldset>
263     
264     [%# Fields for fast cataloging %]
265     <input type="hidden" name="circborrowernumber" value="[% circborrowernumber %]" />
266     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
267     <input type="hidden" name="barcode" value="[% barcode %]" />
268     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
269     [%# End fields for fast cataloging %]
270
271
272     </form>
273 </div>
274 </div><!-- /yui-u -->
275 </div><!-- /yui-gf -->
276
277 </div>
278 </div>
279 [% INCLUDE 'intranet-bottom.inc' %]