Merge branch 'bug_8945' into 3.12-master
[koha.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 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
5 <script type="text/javascript">
6 //<![CDATA[
7 $(document).ready(function(){
8     [% IF (popup) %]
9         [% IF (opisadd) %]
10             window.close();
11         [% END %]
12     [% END %]
13                 $("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
14                 /* Inline edit/delete links */
15                 var biblionumber = $("input[name='biblionumber']").attr("value");
16                 $("td").click(function(event){
17                         var $tgt = $(event.target);
18                         if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
19                         var rowid = $(this).parent().attr("id");
20                         num_rowid = rowid.replace("row","");
21                         $(".linktools").remove();
22                         $(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>");
23                 }
24                 });
25 });
26 function active(numlayer)
27 {
28     for (i=10; i < 11 ; i++ ) {
29         ong = i+"XX";
30             link = "link"+i;
31         if (numlayer==i) {
32             document.getElementById(ong).style.visibility="visible";
33             document.getElementById(link).style.backgroundColor="#11AA11";
34             document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)";
35         } else {
36             document.getElementById(ong).style.visibility="hidden";
37             document.getElementById(link).style.backgroundColor="#FFFFFF";
38             document.getElementById(link).style.backgroundImage="";
39         }
40     }
41 }
42 function Check(f) {
43     var total_errors=0;
44     $("input[name='mandatory'],select[name='mandatory']").each(function(i){
45         if($(this).val() == 1){
46             var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i);
47             if(mandatory_field.val() == ''){
48                 mandatory_field.addClass("missing");
49                 total_errors++;
50             }
51         }
52     });
53
54     var alertString2;
55     if (total_errors==0) {
56         return true;
57     } else {
58         alertString2  = _("Form not submitted because of the following problem(s)");
59         alertString2 += "\n------------------------------------------------------------------------------------\n";
60         alertString2 += "\n- "+ total_errors+_(" mandatory fields empty (highlighted)");
61         alert(alertString2);
62         return false;
63     }
64 }
65 function CheckMultipleAdd(f) {
66
67     if (!f || isNaN(f) || !parseInt(f) == f || f <= 0) {
68         alert(_("Please enter a number of items to create."));
69         return false;
70     }
71 }
72 function Dopop(link,i) {
73     defaultvalue=document.forms[0].field_value[i].value;
74     newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
75 }
76
77 function confirm_deletion(biblionumber,itemnumber) {
78         var original = $("#row"+itemnumber).attr("class");
79         $("#row"+itemnumber).attr("class","confirm");
80     var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
81     if (is_confirmed) {
82     window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
83         } else {
84         $("#row"+itemnumber).attr("class","");
85     }
86 }
87
88 $(document).ready(function() {
89     $("#cataloguing_additem_itemlist  tr").hover(
90         function () {$(this).attr("class","highlight");},
91         function () {$(this).attr("class",""         );}
92     );
93 });
94 //]]>
95 </script>
96 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
97 </head>
98 <body id="cat_additem" class="cat">
99 [% INCLUDE 'header.inc' %]
100 <div id="breadcrumbs">
101           <a href="/cgi-bin/koha/mainpage.pl">Home</a>
102  &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
103  &rsaquo; Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]">[% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</a>
104  &rsaquo; <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Items</a>
105 </div>
106
107 <div id="doc3" class="yui-t7">
108
109    <div id="bd">
110         <div id="yui-main">
111
112 <h1>Items for [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %])</h1>
113
114 [% IF ( barcode_not_unique ) %]<div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div>[% END %]
115 [% 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 %]
116 [% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
117 [% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
118 [% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: The items do not belong to your library.</div>[% END %]
119 [% 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 %]
120
121 <div id="cataloguing_additem_itemlist">
122     [% IF ( item_loop ) %]
123         <div>
124         <table>
125             <tr>
126                 <th colspan="2">&nbsp;</th>
127                 [% FOREACH item_header_loo IN item_header_loop %]
128                     <th>
129                         [% item_header_loo.header_value %]
130                     </th>
131                 [% END %]
132             </tr>
133                 [% FOREACH item_loo IN item_loop %]
134                 <tr id="row[% item_loo.itemnumber %]">
135                     [% IF ( item_loo.nomod ) %] <td colspan="2">&nbsp;</td>[% ELSE %][% IF ( item_loo.hostitemflag ) %]<td><a href="additem.pl?op=edititem&amp;biblionumber=[% item_loo.hostbiblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a></td>
136 <td><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblionumber %]&amp;hostitemnumber=[% item_loo.itemnumber %]">Delink</a></td>
137 [% ELSE %]<td><a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a></td>
138                     <td>[% IF ( item_loo.countanalytics ) %]<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>[% ELSE %]<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>[% END %]</td>[% END %][% END %]
139                 [% FOREACH item_valu IN item_loo.item_value %]
140                     <td>[% item_valu.field |html %]</td>
141                 [% END %]
142                 </tr>
143                 [% END %]
144         </table>
145         </div>
146     [% END %]
147 </div>
148 <div class="yui-gf">
149 <div class="yui-u first">
150 [% INCLUDE 'biblio-view-menu.inc' %]
151 </div>
152 <div class="yui-u">
153 <div id="cataloguing_additem_newitem">
154     <form method="post" action="/cgi-bin/koha/cataloguing/additem.pl" name="f">
155     <input type="hidden" name="op" value="[% op %]" />
156     [% IF (popup) %]
157         <input type="hidden" name="popup" value="1" />
158     [% END %]
159     <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
160     [% IF ( opisadd ) %]
161         <h2 id="additema">Add item</h2>
162     [% ELSE %]
163         <h2 id="edititem">Edit Item #[% itemnumber %][% IF ( barcode ) %] / Barcode [% barcode %][% END %]</h2>
164     [% END %]
165         <fieldset class="rows">
166         <ol>
167         [% FOREACH ite IN item %]
168                <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
169                 [% IF ( ite.mandatory ) %]
170                <label class="required">[% ite.subfield %] - [% ite.marc_lib %]</label>
171                [% ELSE %]
172                <label>[% ite.subfield %] - [% ite.marc_lib %]</label>
173                [% END %]
174                 [% ite.marc_value %]
175                 <input type="hidden" name="tag"       value="[% ite.tag %]" />
176                 <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
177                 <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
178                 [% IF ( ite.repeatable ) %]
179                     <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
180                         <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
181                     </a>
182                 [% END %]
183                 [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
184             </div></li>
185         [% END %]
186     </ol>
187     </fieldset>
188     <input type="hidden" name="indicator" value=" " />
189     <input type="hidden" name="indicator" value=" " />
190     <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
191
192 <fieldset class="action">    [% IF ( opisadd ) %]
193     <input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
194     <!-- 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 copies
195                 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.
196                 It is a bit tricky, but necessary in the sake of UI correctness.
197     -->
198
199     <input type="submit" name="add_submit" value="Add item" onclick="return Check(this.form)" />
200     <input type="submit" name="add_duplicate_submit" value="Add &amp; Duplicate" onclick="return Check(this.form)" />
201     <input type="submit" name="add_multiple_copies" value="Add Multiple Copies" onclick="javascript:this.nextSibling.style.visibility='visible';document.f.number_of_copies.focus(); return false;" /><span id="add_multiple_copies_span" style="visibility:hidden">
202         <label for="number_of_copies">Number of copies to add : </label>
203         <input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
204         <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);" />
205     </span>
206
207     [% ELSE %]
208     <input type="hidden" name="tag" value="[% itemtagfield %]" />
209     <input type="hidden" name="subfield" value="[% itemtagsubfield %]" />
210     <input type="hidden" name="field_value" value="[% itemnumber %]" />
211     <input type="submit" value="Save Changes" onclick="return Check(this.form)" />
212     [% END %]</fieldset>
213     
214     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
215     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
216     <input type="hidden" name="barcode" value="[% barcode %]" />
217     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
218
219
220     </form>
221 </div>
222 </div><!-- /yui-u -->
223 </div><!-- /yui-gf -->
224
225 </div>
226 </div>
227 [% INCLUDE 'intranet-bottom.inc' %]