Bug 5680: Order cancelling improvement : delete attached items & biblio if avalaible
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basket.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname %] ([% basketno %]) for [% name %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% UNLESS ( closedate ) %]
5 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6 <script type="text/JavaScript">
7 //<![CDATA[
8     $(document).ready(function() {
9         $("#orders").tablesorter({
10             headers: {
11                 9: { sorter: false },
12                 10: { sorter: false }
13             }
14         });
15     });
16 //]]>
17 </script>
18 <script type="text/javascript">
19 //<![CDATA[
20             function confirm_close() {
21                 var is_confirmed = confirm(_('Are you sure you want to close this basket?'));
22                 if (is_confirmed) {
23                     window.location = "[% script_name %]?op=close&basketno=[% basketno %]";
24                 }
25             }
26 //]]>
27         </script>
28 <script type="text/javascript">
29 //<![CDATA[
30             function confirm_deletion() {
31                 var is_confirmed = confirm(_('Are you sure you want to delete this basket?'));
32                 if (is_confirmed) {
33                     window.location = "[% script_name %]?op=delete_confirm&basketno=[% basketno %]&booksellerid=[% booksellerid %]";
34                 }
35             }
36             function confirm_delete_item(ordernumber, biblionumber) {
37                 var is_confirmed = confirm(_('Are you sure you want to delete this order ?'));
38                 if (is_confirmed) {
39                     window.location = "addorder.pl?ordernumber="+ordernumber+"&basketno=[% basketno %]&quantity=0&biblionumber="+biblionumber;
40                 }
41             }
42             
43             function confirm_delete_biblio(ordernumber, biblionumber) {
44                 var is_confirmed = confirm(_('Are you sure you want to delete this catalog record and order ?'));
45                 if (is_confirmed) {
46                     window.location = "addorder.pl?ordernumber="+ordernumber+"&basketno=[% basketno %]&quantity=0&biblionumber="+biblionumber+"&delbiblio=1";
47                     }
48             }
49
50 //]]>
51 </script>
52 [% ELSE %]
53 [% UNLESS ( grouped ) %]
54 <script type="text/javascript">
55 //<![CDATA[
56             function confirm_reopen(skip) {
57                 var is_confirmed = skip || confirm(_('Are you sure you want to reopen this basket?'));
58                 if (is_confirmed) {
59                     window.location = "[% script_name %]?op=reopen&basketno=[% basketno %]";
60                 }
61             }
62 //]]>
63 </script>
64 [% END %]
65 [% END %]
66 <style type="text/css">
67 .sortmsg {font-size: 80%;}
68 </style>
69 </head>
70 <body>
71 [% INCLUDE 'header.inc' %]
72 [% INCLUDE 'acquisitions-search.inc' %]
73
74
75 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% booksellerid %]">[% name %]</a> &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname %] ([% basketno %]) for [% name %]</div>
76
77 <div id="doc3" class="yui-t2">
78
79 <div id="bd">
80     <div id="yui-main">
81     <div class="yui-b">
82         [% UNLESS ( confirm_close ) %]
83         [% UNLESS ( selectbasketg ) %]
84             [% UNLESS ( closedate ) %]
85                 <div id="toolbar">
86                     <script type="text/javascript">
87                         //<![CDATA[
88                         // prepare DOM for YUI Toolbar
89                         $(document).ready(function() {
90                             yuiToolbar();
91                         });
92                         // YUI Toolbar Functions
93                         function yuiToolbar() {
94                             [% IF ( unclosable ) %]
95                                 new YAHOO.widget.Button("closebutton", {disabled:true});
96                             [% ELSIF ( uncertainprices ) %]
97                                 new YAHOO.widget.Button("uncertpricesbutton");
98                             [% ELSE %]
99                                 new YAHOO.widget.Button("closebutton");
100                             [% END %]
101                             new YAHOO.widget.Button("basketheadbutton");
102                             new YAHOO.widget.Button("exportbutton");
103                             new YAHOO.widget.Button("delbasketbutton");
104                         }
105                         //]]>
106                     </script>
107
108                     <ul id="toolbar-list" class="toolbar">
109                     <li><a href="basketheader.pl?basketno=[% basketno %]&amp;op=add_form" class="button" id="basketheadbutton">Edit basket header information</a></li>
110                     <li><a href="javascript:confirm_deletion();" class="button" id="delbasketbutton">Delete this basket</a></li>
111                     [% IF ( unclosable ) %]
112                     [% ELSIF ( uncertainprices ) %]
113                         <li><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="button" id="uncertpricesbutton">Uncertain prices</a></li>
114                     [% ELSE %]
115                         <li><a href="[% script_name %]?op=close&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="button" id="closebutton">Close this basket</a></li>
116                     [% END %]
117                         <li><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="button" id="exportbutton">Export this basket as CSV</a></li>
118                     </ul>
119
120                 </div>
121             [% ELSE %]
122                 [% UNLESS ( grouped ) %]
123                 <div id="toolbar">
124                     <script type="text/javascript">
125                         //<![CDATA[
126                         // prepare DOM for YUI Toolbar
127                         $(document).ready(function() {
128                             yuiToolbar();
129                         });
130                         // YUI Toolbar Functions
131                         function yuiToolbar() {
132                             new YAHOO.widget.Button("reopenbutton");
133                         }
134                         //]]>
135                     </script>
136                         <ul id="toolbar-list" class="toolbar">
137                             <li><a href="javascript:confirm_reopen([% skip_confirm_reopen %]);" class="button" id="reopenbutton">Reopen this basket</a></li>
138                         </ul>
139                 </div>
140                 [% END %]
141             [% END %]
142             [% END %]
143
144     [% IF ( NO_BOOKSELLER ) %]
145     <h2>Vendor not found</h2>
146     [% ELSE %]
147         [% IF ( delete_confirmed ) %]
148             <h3>Basket deleted</h3>
149             <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
150         [% ELSE %]
151         <h1>[% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname %] ([% basketno %]) for <a href="supplier.pl?supplierid=[% booksellerid %]">[% name %]</a></h1>
152         [% IF ( delete_confirm ) %]
153             <h2>
154             <span class="yui-button yui-link-button">
155             <em class="first-child">
156                 <a href="[% script_name %]?op=delete_confirm&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="yui-link-button">Yes, delete this basket!</a>
157             </em>
158             </span>
159             <span class="yui-button yui-link-button">
160             <em class="first-child">
161                 <a href="[% script_name %]?basketno=[% basketno %]" class="yui-link-button">Cancel</a>
162             </em>
163             </span>
164             </h2>
165         [% END %]
166         [% IF ( basketno ) %]
167             <div id="acqui_basket_summary"  class="yui-g">
168                 <h2>Basket details</h2>
169                 [% IF ( basketnote ) %]<p>Internal note: [% basketnote %]</p>[% END %]
170                 [% IF ( basketbooksellernote ) %]<p>Vendor note: [% basketbooksellernote %]</p>[% END %]
171                 [% IF ( basketcontractno ) %]
172                     <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></p>
173                 [% END %]
174                 [% IF ( authorisedbyname ) %]<p>Managed by:  [% authorisedbyname %]</p>[% END %]
175                 [% IF ( creationdate ) %]<p>Opened on:  [% creationdate %]</p>[% END %]
176                 [% IF ( closedate ) %]
177                 <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
178                 <p>Closed on:  [% closedate %]</p>
179                 [% IF ( basketgroups ) %]
180                     <p> Basket group: <select id="basketgroupid" name="basketgroupid">
181                         [% FOREACH basketgroup IN basketgroups %]
182                             [% IF ( basketgroup.default ) %]
183                             <option value="[% basketgroup.id %]" selected="selected">[% basketgroup.name %]</option>
184                             [% ELSE %]
185                             <option value="[% basketgroup.id %]">[% basketgroup.name %]</option>
186                             [% END %]
187                         [% END %]
188                         </select>
189                         <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
190                         <input type="hidden" value="mod_basket" name="op" />
191                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
192                         <input type="submit" value="Change basket group" />
193                     </p>
194                 </form>
195                 [% ELSE %]
196                     <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% basketgroups %]&amp;basketgroupid=[% id %]">[% name %]</a>
197                 [% END %]
198                 [% END %]
199             </div>
200         [% END %]
201
202         [% UNLESS ( delete_confirm ) %]
203         <div id="acqui_basket_content">
204         <h2>Order Details</h2>
205         [% IF ( books_loop ) %]
206             <table id="orders">
207                 <thead>
208                     <tr>
209                         <th>Order</th>
210                         <th>RRP</th>
211                         <th>Est.</th>
212                         <th>Qty.</th>
213                         <th>Total</th>
214                         <th>Fund</th>
215                         [% IF ( active ) %]
216                             [% UNLESS ( closedate ) %]
217                                 <th>Modify</th>
218                                 <th>Delete</th>
219                             [% END %]
220                         [% END %]
221                     </tr>
222                 </thead>
223                 <tfoot>
224                 [% IF ( GST ) %]
225                 <tr>
226                     <th>Total Tax Exc.</th>
227                     <th>[% total_rrp_gste %]</th>
228                     <th>&nbsp;</th>
229                     <th>[% qty_total %]</th>
230                     <th>[% total_est_gste %]</th>
231                         [% IF ( active ) %]
232                             [% IF ( closedate ) %]
233                             <td colspan="1" rowspan="3">&nbsp;</td>
234                             [% ELSE %]
235                             <td colspan="3" rowspan="3">&nbsp;</td>
236                             [% END %]
237                         [% END %]
238                 </tr>
239                 <tr>
240                     <th>Tax ([% gist_rate %])</th>
241                     <th>[% gist_rrp %]</th>
242                     <th>&nbsp;</th>
243                     <th>&nbsp;</th>
244                     <th>[% gist_est %]</th>
245                 </tr>
246                 <tr>
247                     <th>Total Tax Inc. ([% currency %])</th>
248                     <th>[% total_rrp_gsti %]</th>
249                     <th>&nbsp;</th>
250                     <th>[% qty_total %]</th>
251                     <th>[% total_est_gsti %]</th>
252                 </tr>
253                 [% ELSE %]
254                 <tr>
255                     <th>Total ([% currency %])</th>
256                     <th>[% total_rrp_gsti %]</th>
257                     <th>&nbsp;</th>
258                     <th>[% qty_total %]</th>
259                     <th>[% total_est_gsti %]</th>
260                 </tr>
261                 [% END %]
262                 </tfoot>
263                 <tbody>
264                 [% FOREACH books_loo IN books_loop %]
265                     [% IF ( books_loo.order_received ) %]<tr class="disabled">[% ELSE %][% IF ( books_loo.toggle ) %]<tr class="highlight">[% ELSE %]<tr>[% END %][% END %]
266                         <td>
267                             <p>[% IF ( books_loo.order_received ) %] (rcvd)[% END %]
268                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber %]">[% books_loo.title |html %]</a> by [% books_loo.author %]
269                                     [% IF ( books_loo.notes ) %] [% books_loo.notes %][% END %]
270                                     [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %]
271                                     [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %]
272                                     [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %]
273                                     [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear %][% END %]
274                             </p>
275                             </td>
276                         <td class="number">[% books_loo.rrp %]</td>
277                         <td class="number">[% books_loo.ecost %]</td>
278                         <td class="number">[% books_loo.quantity %]</td>
279                         <td class="number">[% books_loo.line_total %]</td>
280                         <td>[% books_loo.budget_name %]</td>
281                         [% IF ( active ) %]
282                             [% UNLESS ( closedate ) %]
283                             <td>
284                                 <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber %]&amp;booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Modify</a>
285                             </td>
286                             <td>
287                             [% IF ( books_loo.left_holds_on_order ) %]
288                             <span class="button" title="Can't delete order, ([% books_loo.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br>
289                             [% ELSE %]
290                             <a href="javascript:confirm_delete_item([% books_loo.ordernumber %],[% books_loo.biblionumber %])" class="button">Delete order</a><br>
291                             [% END %]
292                             [% IF ( books_loo.can_del_bib ) %]
293                             <a href="javascript:confirm_delete_biblio([% books_loo.ordernumber %],[% books_loo.biblionumber %])" class="button">Delete order and catalog record</a><br>
294                             [% ELSE %]
295                             <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br>
296                             [% END %]
297                             [% IF ( books_loo.left_item ) %]
298                             <b title="Can't delete catalog record, because of [% books_loo.items %] existing hold(s)" >[% books_loo.items %] item(s) left</b><br>
299                             [% END %]
300                             [% IF ( books_loo.left_biblio ) %]
301                             <b title="Can't delete catalog record, delete other orders linked to it first">[% books_loo.biblios %] order(s) left</b><br>
302                             [% END %]
303                             [% IF ( books_loo.left_subscription ) %]
304                             <b title="Can't delete catalog record, delete subscriptions first">[% books_loo.subscriptions %] subscription(s) left</b><br>
305                             [% END %]
306                             [% IF ( books_loo.left_holds ) %]
307                             <b title="Can't delete catalog record or order, cancel holds first">[% books_loo.holds %] hold(s) left</b>
308                             [% END %]
309                             </td>
310                             [% END %]
311                         [% END %]
312                     </tr>
313                 [% END %]
314                 </tbody>
315             </table>
316         [% ELSE %]
317             <table>
318                 <tr><td>Basket empty</td></tr>
319             </table>
320         [% END %]
321         [% IF ( listincgst ) %]<small class="highlight">** Vendor's listings already include tax.</small>
322         [% END %]
323         </div>
324         <br />
325         [% UNLESS ( closedate ) %]
326         [% INCLUDE 'acquisitions-add-to-basket.inc' %]
327         [% END %]
328         [% END %]
329 [% END %]
330 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
331     [% END %]
332 [% IF ( confirm_close ) %]
333         <div id="closebasket_needsconfirmation" class="dialog alert">
334
335         <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm">
336             <h1>Are you sure you want to close basket [% basketname %]?</h1>
337             <p>
338             <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
339             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
340             </p>
341             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
342             <input type="hidden" value="close" name="op" />
343             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
344             <input type="hidden" name="confirm" value="1" />
345             <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" />
346             <input type="submit" class="approve" value="Yes, Close (Y)" accesskey="y" />
347             <input type="submit" class="deny" value="No, Don't Close (N)" accesskey="n" onclick="javascript:window.location='/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]';return false;" />
348         </form>
349         </div>
350     [% END %]
351 </div>
352 </div>
353 <div class="yui-b">
354 [% INCLUDE 'acquisitions-menu.inc' %]
355 </div>
356 </div>
357 [% INCLUDE 'intranet-bottom.inc' %]