]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/conify/global/acq/invoice_item_type.tt2
LP#1440114 invoice item type prorate/blanket warning
[Evergreen.git] / Open-ILS / src / templates / conify / global / acq / invoice_item_type.tt2
1 [% WRAPPER base.tt2 %]
2 [% ctx.page_title = l('Invoice Item Types') %]
3 <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
4     <div>[% l('Invoice Item Types') %]</div>
5     <div>
6         <button dojoType="dijit.form.Button" onClick="aiitGrid.showCreateDialog();">[% l('New Invoice Item Type') %]</button>
7         <button dojoType="dijit.form.Button" onClick="aiitGrid.deleteSelected();">[% l('Delete Selected') %]</button>
8     </div>
9 </div>
10 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
11     <table  jsId="aiitGrid"
12             dojoType="openils.widget.AutoGrid"
13             fieldOrder="['code', 'name', 'prorate']"
14             defaultCellWidth="'auto'"
15             query="{id: '*'}"
16             fmClass="aiit"
17             editOnEnter="true">
18     </table>
19 </div>
20
21 <script type="text/javascript">
22     dojo.require("openils.widget.AutoGrid");
23     dojo.require("dijit.form.FilteringSelect");
24     dojo.require('openils.PermaCrud');
25     openils.Util.addOnLoad(
26         function() { 
27           aiitGrid.loadAll({"order_by": {"aiit": "name"}}); 
28
29           // If either "prorate" or "blanket" are selected, 
30           // the other must be deselected.  
31           // "For neither can live while the other survives...."
32           aiitGrid.onEditPane = function(pane) {
33
34             pane.onSubmit = function(inv_type, ops) {
35
36               if (inv_type.blanket() == 't') {
37                 if (inv_type.prorate() == 't') {
38                   alert('[% l('Only one of "prorate" and "blanket" may be selected') %]');
39                   return;
40                 }
41               }
42
43               (new openils.PermaCrud())[pane.mode](inv_type, ops);
44             }
45           }
46         }
47     );
48 </script>
49 [% END %]