Bug 16739: Show note instead of 500 error for 'Generate EDIFACT' when no EDI account...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / basketgroup.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Basket grouping for [% booksellername | html %]</title>
7 [% Asset.css("css/datatables.css") | $raw %]
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% INCLUDE 'datatables.inc' %]
10 [% Asset.js("lib/yui/utilities/utilities.js") | $raw %]
11 [% Asset.js("lib/yui/button/button-min.js") | $raw %]
12 [% Asset.js("lib/yui/container/container_core-min.js") | $raw %]
13 [% Asset.js("lib/yui/menu/menu-min.js") | $raw %]
14 [% Asset.js("js/basketgroup.js") | $raw %]
15 [% IF ( grouping ) %]
16 [% Asset.js("lib/yui/yahoo-dom-event/yahoo-dom-event.js") | $raw %]
17 [% Asset.js("lib/yui/animation/animation-min.js") | $raw %]
18 [% Asset.js("lib/yui/dragdrop/dragdrop-min.js") | $raw %]
19 [% Asset.js("lib/yui/element/element-min.js") | $raw %]
20 <style type="text/css">
21 /*margin and padding on body element
22   can introduce errors in determining
23   element position and are not recommended;
24   we turn them off as a foundation for YUI
25   CSS treatments. */
26
27 #ungrouped {
28         overflow: auto;
29         height: 400px;
30 }
31
32 .draglist{
33         width: 200px;
34         height: 300px;
35         overflow: auto;
36 }
37
38 div.workarea_alt { padding: 5px; float:left; width: 95%;}
39 div.closed { background-color: pink; padding:10px; float:left; width: 45%;}
40
41 ul.draglist {
42     position: relative;
43     background: #EEE;
44     padding-bottom:10;
45     border: 1px inset gray;
46     list-style: none;
47     margin:0;
48     padding: 5px;
49 }
50
51 ul.draglist li {
52     margin: 1px;
53     cursor: move;
54     list-style: none;
55 }
56
57 ul.draglist_alt {
58     position: relative;
59     border: 1px solid gray;
60     list-style: none;
61     margin: 0;
62     background: #f7f7f7;
63     padding: 5px;
64     cursor: move;
65 }
66
67 ul.draglist_alt li {
68     margin: 1px;
69     list-style: none;
70 }
71
72 li.grouped {
73     background-color: #D1E6EC;
74     border:1px solid #7EA6B2;
75     list-style: none;
76 }
77
78 li.ungrouped {
79     background-color: #D8D4E2;
80     border:1px solid #6B4C86;
81 }
82
83 fieldset.various li {
84     list-style: none;
85     clear: none;
86 }
87
88 </style>
89  [% END %]
90 <script type="text/javascript">
91 //<![CDATA[
92         YAHOO.util.Event.onDOMReady(DDApp.init, DDApp, true);
93
94 var MSG_CONFIRM_CLOSE_BASKETGROUP = _("Are you sure you want to close this basketgroup?");
95 var MSG_CLOSE_EMPTY_BASKET = _("Why close an empty basket?");
96 var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing");
97 var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
98 var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
99
100 function submitForm(form) {
101     if (form.close.checked == true) {
102         var input = document.createElement("input");
103         input.setAttribute("type", "hidden");
104         input.setAttribute("name", "closed");
105         input.setAttribute("value", "1");
106         form.appendChild(input);
107     }
108 }
109
110  $(document).ready(function() {
111     $("#basket_groups").tabs();
112
113     $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
114         "aoColumnDefs": [
115             { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
116         ],
117         "bAutoWidth": false,
118         "sPaginationType": "four_button"
119     } ));
120
121  });
122
123
124 //]]>
125 </script>
126 </head>
127 <body id="acq_basketgroup" class="acq">
128 [% INCLUDE 'header.inc' %]
129 [% INCLUDE 'acquisitions-search.inc' %]
130
131 <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;
132 [% IF ( grouping ) %]
133     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]">Basket grouping</a> &rsaquo; Add basket group for [% booksellername | html %]</div>
134 [% ELSE %]
135     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; Basket grouping</div>
136 [% END %]
137
138
139 <div class="main container-fluid">
140     <div class="row">
141         <div class="col-sm-10 col-sm-push-2">
142             <main>
143
144                 [% IF ( grouping ) %]
145                     [% IF (closedbg) %]
146                         <div id="toolbar" class="btn-toolbar">
147                             <div class="btn-group"><a href="[% script_name | uri %]?op=reopen&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;mode=singlebg" class="btn btn-default btn-sm" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div>
148                             <div class="btn-group"><a href="[% script_name | uri %]?op=export&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div>
149                             <div class="btn-group"><a href="[% script_name | uri %]?op=print&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div>
150                         [% IF (ediaccount) %]
151                             <div class="btn-group"><a href="[% script_name | uri %]?op=ediprint&amp;basketgroupid=[% basketgroupid | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-sm" id="printbutton"><i class="fa fa-download"></i> Generate EDIFACT order</a></div>
152                         [% END %]
153                         </div>
154                     [% END %]
155                     [% IF (name && closedbg) %]
156                         <h1>Basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
157                     [% ELSIF (name) %]
158                         <h1>Edit basket group [% name | html %] ([% basketgroupid | html %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
159                     [% ELSE %]
160                         <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a></h1>
161                     [% END %]
162                     <div id="basketgroupcolumns" class="row">
163                         [% UNLESS (closedbg) %]
164                             <div class="col-xs-6 col-xs-push-6">
165                                 <form action="[% scriptname | html %]" method="post" name="basketgroups" id="basketgroups">
166                                     <div id="groups">
167                                         <fieldset class="brief">
168                                             <div class="workarea_alt" >
169                                                 <h3>Ungrouped baskets</h3>
170                                                 <ul id="ungrouped" class="draglist_alt">
171                                                     [% IF ( baskets ) %]
172                                                         [% FOREACH basket IN baskets %]
173                                                             <li class="ungrouped" id="b-[% basket.basketno | html %]" >
174                                                                 <a href="basket.pl?basketno=[% basket.basketno | html %]">
175                                                                     [% IF ( basket.basketname ) %]
176                                                                         [% basket.basketname | html %]
177                                                                     [% ELSE %]
178                                                                         No name, basketnumber: [% basket.basketno | html %]
179                                                                     [% END %]
180                                                                 </a>, <br />
181                                                                 Total: [% basket.total | $Price | html %]
182                                                                 <input type="hidden" class="basket" name="basket" value="[% basket.basketno | html %]" />
183                                                             </li>
184                                                         [% END %]
185                                                     [% END %]
186                                                 </ul>
187                                             </div>
188                                         </fieldset>
189                                     </div>
190                                 </form>
191                             </div>
192                         [% END %]
193                         [% IF ( closedbg ) %]
194                             <div class="col-xs-12">
195                         [% ELSE %]
196                             <div class="col-xs-6 col-xs-pull-6">
197                         [% END %]
198                             <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
199                                 <fieldset id="various" class="brief">
200                                     <ol>
201                                         [% UNLESS (closedbg) %]
202                                             <li>
203                                                 <label for="basketgroupname">Basket group name:</label>
204                                                 <input type="text" name="basketgroupname" id="basketgroupname" value="[% name | html %]" class="focus" />
205                                             </li>
206                                         [% ELSE %]
207                                             <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name | html %]" />
208                                         [% END %]
209                                         <li>
210                                             [% UNLESS (closedbg) %]
211                                                 <label for="billingplace">Billing place:</label>
212                                                 <select name="billingplace" id="billingplace">
213                                                     <option value="">--</option>
214                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
215                                                 </select>
216                                             [% ELSE %]
217                                                 <span class="label">Billing place:</span>
218                                                 <input name="billingplace" id="billingplace" type ="hidden" value="[% billingplace | html %]" />[% Branches.GetName( billingplace ) | html %]
219                                             [% END %]
220                                         </li>
221                                         [% UNLESS (closedbg) %]
222                                             <li>
223                                                 <label for="deliveryplace">Delivery place:</label>
224                                                 <select name="deliveryplace" id="deliveryplace">
225                                                     <option value="">--</option>
226                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
227                                                 </select>
228                                             </li>
229                                             <li><p>or</p></li>
230                                             <li>
231                                                 <label for="freedeliveryplace">Delivery place:</label>
232                                                 <textarea cols="26" rows="3" name="freedeliveryplace" id="freedeliveryplace">[% freedeliveryplace | html %]</textarea>
233                                             </li>
234                                             [% ELSE %]
235                                                 <li>
236                                                     <span class="label">Delivery place:</span>
237                                                     [% IF (freedeliveryplace) %]
238                                                         <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="[% freedeliveryplace | html %]" />[% freedeliveryplace | html %]
239                                                         <input name="deliveryplace" id="deliveryplace" type ="hidden" value="" />
240                                                     [% ELSE %]
241                                                         <input name="deliveryplace" id="deliveryplace" type ="hidden" value="[% deliveryplace | html %]" />[% Branches.GetName( deliveryplace ) | html %]
242                                                         <input name="freedeliveryplace" id="freedeliveryplace" type ="hidden" value="" />
243                                                     [% END %]
244                                                 </li>
245                                             [% END %]
246                                             <li>
247                                                 [% UNLESS (closedbg) %]
248                                                     <label for="deliverycomment">Delivery comment:</label>
249                                                     <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment | html %]</textarea>
250                                                 [% ELSE %]
251                                                     <span class="label">Delivery comment:</span>[% deliverycomment | html %]
252                                                     <input name="deliverycomment" id="deliverycomment" type="hidden" value = "[% deliverycomment | html %]" />
253                                                 [% END %]
254                                             </li>
255                                             <li>
256                                                 <span class="label">Baskets in this group:</span>
257                                                 [% UNLESS (closedbg) %]
258                                                     <ul class="draglist" id="bg">
259                                                 [% ELSE %]
260                                                     <ul>
261                                                 [% END %]
262                                                 [% FOREACH selectedbasket IN selectedbaskets %]
263                                                     <li class="grouped" id="b-[% selectedbasket.basketno | html %]" >
264                                                         <a href="basket.pl?basketno=[% selectedbasket.basketno | html %]">
265                                                             [% IF ( selectedbasket.basketname ) %]
266                                                                 [% selectedbasket.basketname | html %]
267                                                             [% ELSE %]
268                                                                 No name, basketnumber: [% selectedbasket.basketno | html %]
269                                                             [% END %]
270                                                         </a>, <br />
271                                                         Total: [% selectedbasket.total | $Price | html %]
272                                                         <input type="hidden" class="basket" name="basket" value="[% selectedbasket.basketno | html %]" />
273                                                     </li>
274                                                 [% END %]
275                                             </ul>
276                                         </li>
277                                             [% UNLESS (closedbg) %]
278                                                 <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
279                                             [% ELSE %]
280                                                 <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
281                                             [% END %]
282                                     </ol>
283                                 </fieldset>
284                                 [% UNLESS (closedbg) %]
285                                     <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
286                                         [% IF ( basketgroupid ) %]
287                                             <input type="hidden" name="basketgroupid" value="[% basketgroupid | html %]" />
288                                         [% END %]
289                                         <input type="hidden" name="op" value="attachbasket" />
290                                         <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid | html %]" class="cancel">Cancel</a>
291                                     </fieldset>
292                                 [% END %]
293                             </form>
294                         </div>
295                     </div>
296                 [% ELSE %]
297                     <div id="toolbar" class="btn-toolbar">
298                         <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid=[% booksellerid | html %]" class="btn btn-default btn-sm" id="newbasketgroup"><i class="fa fa-plus"></i> New basket group</a></div>
299                     </div>
300                     <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
301                     [% IF (NoEDIMessage) %]<div><strong>No EDIFACT configuration for [% booksellername | html %]</strong></div>[% END %]
302                     <div id="basket_groups" class="toptabs">
303                         <ul class="ui-tabs-nav">
304                             [% UNLESS ( listclosed) %]<li class="ui-tabs-active"><a href="#opened">Open</a></li>
305                             [% ELSE%]<li><a href="#opened">Open</a></li>[% END %]
306                             [% IF ( listclosed) %]<li class="ui-tabs-active"><a href="#closed">Closed</a></li>
307                             [% ELSE %]<li><a href="#closed">Closed</a></li>[% END %]
308                         </ul>
309                         <div id="opened">
310                             <table id="basket_group_opened">
311                                 <thead>
312                                     <tr>
313                                         <th>Name</th>
314                                         <th>Number</th>
315                                         <th>Billing place</th>
316                                         <th>Delivery place</th>
317                                         <th>Number of baskets</th>
318                                         <th>Action</th>
319                                     </tr>
320                                 </thead>
321                                 <tbody>
322                                     [% FOREACH basketgroup IN basketgroups %]
323                                         [% UNLESS ( basketgroup.closed ) %]
324                                             <tr>
325                                                 <td>[% IF ( basketgroup.name ) %]
326                                                     [% basketgroup.name | html %]
327                                                     [% ELSE %]
328                                                         Basket group no. [% basketgroup.id | html %]
329                                                     [% END %]
330                                                 </td>
331                                                 <td>[% basketgroup.id | html %]</td>
332                                                 <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
333                                                 <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
334                                                 <td>[% basketgroup.basketsqty | html %]</td>
335                                                 <td>
336                                                     <input type="button" onclick="closeandprint('[% basketgroup.id | html %]');" value="Close and export as PDF" />
337                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Edit" /></form>
338                                                     [% UNLESS basketgroup.basketsqty %]
339                                                         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="delete" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Delete" /></form>
340                                                     [% END %]
341                                                 </td>
342                                             </tr>
343                                         [% END %]
344                                     [% END %]
345                                 </tbody>
346                             </table>
347                         </div>
348                         <div id="closed">
349                             <table id="basket_group_closed">
350                                 <thead>
351                                     <tr>
352                                         <th>Name</th>
353                                         <th>Number</th>
354                                         <th>Billing place</th>
355                                         <th>Delivery place</th>
356                                         <th>Number of baskets</th>
357                                         <th>Action</th>
358                                     </tr>
359                                 </thead>
360                                 <tbody>
361                                     [% FOREACH basketgroup IN basketgroups %]
362                                         [% IF ( basketgroup.closed ) %]
363                                             <tr>
364                                                 <td>
365                                                     [% IF ( basketgroup.name ) %]
366                                                         [% basketgroup.name | html %]
367                                                         [% ELSE %]
368                                                             Basket group no. [% basketgroup.id | html %]
369                                                         [% END %]
370                                                 </td>
371                                                 <td>[% basketgroup.id | html %]</td>
372                                                 <td>[% Branches.GetName( basketgroup.billingplace ) | html %]</td>
373                                                 <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) | html %][% END %]</td>
374                                                 <td>[% basketgroup.basketsqty | html %]</td>
375                                                 <td>
376                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="View" /></form>
377                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid | html %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Reopen" /></form>
378                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as PDF" /></form>
379                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="export" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Export as CSV" /></form>
380                                             [% IF (ediaccount) %]
381                                                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="ediprint" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id | html %]" /><input type="submit" value="Generate EDIFACT order" /></form>
382                                             [% ELSE %]
383                                                     <div>No EDIFACT configuration for [% booksellername | html %]</div>
384                                             [% END %]
385                                                 </td>
386                                             </tr>
387                                         [% END %]
388                                     [% END %]
389                                 </tbody>
390                             </table>
391                         </div>
392                     </div>
393                 [% END %]
394             </main>
395         </div> <!-- /.col-sm-10.col-sm-push-2 -->
396
397         <div class="col-sm-2 col-sm-pull-10">
398             <aside>
399                 [% IF ( booksellerid ) %]
400                     [% INCLUDE 'vendor-menu.inc' %]
401                 [% END %]
402                 [% INCLUDE 'acquisitions-menu.inc' %]
403             </aside>
404         </div>
405     </div> <!-- /.row -->
406     [% INCLUDE 'intranet-bottom.inc' %]