[open-ils-commits] r9332 - branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Apr 13 23:29:53 EDT 2008


Author: erickson
Date: 2008-04-13 22:51:59 -0400 (Sun, 13 Apr 2008)
New Revision: 9332

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html
Log:
using real perm orgs to populate new-funding-source dropdown button

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html	2008-04-14 02:01:52 UTC (rev 9331)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html	2008-04-14 02:51:59 UTC (rev 9332)
@@ -40,12 +40,9 @@
                 <tr>
                     <td><label for="loc">${_('Owning Location:')} </label></td>
                     <td>
-                        <select jsId='fsOwnerSelect' name="owner" dojoType="dijit.form.FilteringSelect" searchAttr='shortname'>
-                            <!-- XXX get orgs from DB... -->
-                            <option value='2'>SYS1</option>
-                            <option value='3'>SYS2</option>
-                            <option value='7'>BR4</option>
-                        </select>
+                        <input jsId='fsOwnerSelect' name="owner" 
+                            dojoType="dijit.form.FilteringSelect" searchAttr='shortname'>
+                        </input>
                     </td>
                 </tr>
                 <tr>
@@ -78,20 +75,39 @@
 <script>
 
     function loadFSGrid() {
-        openils.acq.CurrencyType.fetchAll(drawFSGrid);
+        openils.acq.CurrencyType.fetchAll(
+            function(ctypes) {
+                fsCurrencySelector.store = 
+                    new dojo.data.ItemFileReadStore(
+                        {data:acqct.toStoreData(ctypes, 'code', {identifier:'code'})}
+                    );
+                fsCurrencySelector.labelAttr = 'code';
+                /* XXX get default currency from setting */
+                fsCurrencySelector.setValue(ctypes[0].code());
+
+                loadPermOrgs();
+            }
+        );
     }
+    
+    function loadPermOrgs() {
+        openils.User.getPermOrgList('ADMIN_FUNDING_SOURCE', drawFSGrid);
+    }
 
-    function drawFSGrid(ctypes) {
+    function drawFSGrid(orgIdList) {
 
-        fsCurrencySelector.store = 
+        /* XXX put child orgs in the list as well... */
+        var orgList = [];
+        for(var i in orgIdList)
+            orgList.push(fieldmapper.aou.findOrgUnit(orgIdList[i]));
+
+        fsOwnerSelect.store = 
             new dojo.data.ItemFileReadStore(
-                {data:acqct.toStoreData(ctypes, 'code', {identifier:'code'})}
+                {data:aou.toStoreData(orgList)}
             );
-        fsCurrencySelector.labelAttr = 'code';
+        fsOwnerSelect.labelAttr = 'shortname';
+        fsOwnerSelect.setValue(orgIdList[0]);
 
-        /* XXX get default currency from setting */
-        fsCurrencySelector.setValue(ctypes[0].code());
-
         function getOrgInfo(rowIndex) {
             data = fundingSourceListGrid.model.getRow(rowIndex);
             if(!data) return;



More information about the open-ils-commits mailing list