From: erickson Date: Fri, 14 Nov 2008 21:15:40 +0000 (+0000) Subject: plugged in context org picker and plumbing for create dialog X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cd3a8b72fe5f94726976da3fbb1c6a70fe4f9cd5;p=Evergreen.git plugged in context org picker and plumbing for create dialog git-svn-id: svn://svn.open-ils.org/ILS/trunk@11200 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js b/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js index 46367b2fc6..0761c01dc4 100644 --- a/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js +++ b/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js @@ -7,6 +7,26 @@ dojo.require('openils.widget.OrgUnitFilteringSelect'); var btContextOrg; var btList; +/** really need to put this in a shared location... */ +function getOrgInfo(rowIndex, item) { + if(!item) return ''; + var orgId = this.grid.store.getValue(item, this.field); + return fieldmapper.aou.findOrgUnit(orgId).shortname(); +} + +function btInit() { + buildBTGrid(); + var connect = function() { + dojo.connect(btContextOrgSelect, 'onChange', + function() { + btContextOrg = this.getValue(); + buildBTGrid(); + } + ); + }; + new openils.User().buildPermOrgSelector('VIEW_BILLING_TYPE', btContextOrgSelect, null, connect); +} + function buildBTGrid() { if(btContextOrg == null) btContextOrg = openils.User.user.ws_ou(); @@ -25,6 +45,29 @@ function buildBTGrid() { ); } -openils.Util.addOnLoad(buildBTGrid); +function btCreate(args) { + if(!args.name || args.owner == null) + return; + if(args.default_price == '' || isNaN(args.default_price)) + args.default_price = null; + + var btype = new cbt(); + btype.name(args.name); + btype.owner(args.owner); + btype.default_price(args.default_price); + + fieldmapper.standardRequest( + ['open-ils.permacrud', 'open-ils.permacrud.create.cbt'], + { async: true, + params: [openils.User.authtoken, btype], + oncomplete: function(r) { + if(new String(openils.Util.readResponse(r)) != '0') + buildBTGrid(); + } + } + ); +} + +openils.Util.addOnLoad(btInit); diff --git a/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2 b/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2 index fd437e35c3..b206d23ac7 100644 --- a/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2 +++ b/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2 @@ -2,45 +2,57 @@

Billing Types


+
New Billing Type
+ - + - + - +
+ +
- +
+Context Org Unit + +
- - + +
IDNameOwning LocationNameOwning Location Default Price
+ [% END %]