[open-ils-commits] r8675 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb: controllers/acq lib/acq public/oils/media/css/skin

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 6 16:59:09 EST 2008


Author: erickson
Date: 2008-02-06 16:30:39 -0500 (Wed, 06 Feb 2008)
New Revision: 8675

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css
Log:
added fund_allocation creation, added fund summary display

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-02-06 20:23:22 UTC (rev 8674)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-02-06 21:30:39 UTC (rev 8675)
@@ -33,10 +33,12 @@
         self.currency_types = ContextItem()
 
         self.fund = ContextItem()
+        self.fund_id = ContextItem(cgi_name='acq.fi')
         self.fund_list = ContextItem()
         self.fund_name = ContextItem(cgi_name='acq.fn')
         self.fund_year = ContextItem(cgi_name='acq.fc')
         self.fund_org = ContextItem(cgi_name='acq.fo')
+        self.fund_summary = ContextItem()
 
         self.fund_source = ContextItem()
         self.fund_source_list = ContextItem()
@@ -44,6 +46,16 @@
         self.fund_source_currency_type = ContextItem(cgi_name='acq.fc')
         self.fund_source_owner = ContextItem(cgi_name='acq.fo')
 
+
+        self.fund_allocation = ContextItem()
+        self.fund_allocation_list = ContextItem()
+        self.fund_allocation_source= ContextItem(cgi_name='acq.fas')
+        self.fund_allocation_fund = ContextItem(cgi_name='acq.faf')
+        self.fund_allocation_amount = ContextItem(cgi_name='acq.faa')
+        self.fund_allocation_percent = ContextItem(cgi_name='acq.fap')
+        self.fund_allocation_note = ContextItem(cgi_name='acq.fan')
+
+
         # -------------------------------------------------------------
         # utility functions
         self.find_entry_attr = ContextItem(

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-02-06 20:23:22 UTC (rev 8674)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-02-06 21:30:39 UTC (rev 8675)
@@ -2,18 +2,31 @@
 import pylons
 from oilsweb.lib.request import RequestMgr
 import oilsweb.lib.acq.fund, oilsweb.lib.user
-import osrf.net_obj
-import oils.org
+import osrf.net_obj, osrf.ses
+import oils.org, oils.const, oils.event
 
 class FundController(BaseController):
 
     def view(self, **kwargs):
         r = RequestMgr()
         r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
-        fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
-        fund = fund_mgr.retrieve(kwargs.get('id'))
+        fund_id = kwargs['id']
+
+        ses = osrf.ses.ClientSession(oils.const.OILS_APP_ACQ)
+        fund_req = ses.request('open-ils.acq.fund.retrieve', r.ctx.core.authtoken, fund_id)
+        fund_summary_req = ses.request('open-ils.acq.fund.summary.retrieve', r.ctx.core.authtoken, fund_id)
+
+        # grab the fund object
+        fund = fund_req.recv().content()
+        oils.event.Event.parse_and_raise(fund)
         fund.org(oils.org.OrgUtil.get_org_unit(fund.org())) # flesh the org
         r.ctx.acq.fund = fund
+
+        # grab the fund summary
+        fund_summary = fund_summary_req.recv().content()
+        oils.event.Event.parse_and_raise(fund_summary)
+        r.ctx.acq.fund_summary = fund_summary
+
         return r.render('acq/financial/view_fund.html')
 
     def list(self):
@@ -45,4 +58,27 @@
 
         return r.render('acq/financial/create_fund.html')
 
+    def allocate(self):
+        r = RequestMgr()
+        fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
 
+        if r.ctx.acq.fund_allocation_source:
+            alloc = osrf.net_obj.NetworkObject.acqfa()
+            alloc.funding_source(r.ctx.acq.fund_allocation_source)
+            alloc.fund(r.ctx.acq.fund_allocation_fund)
+            if r.ctx.acq.fund_allocation_amount:
+                alloc.amount(r.ctx.acq.fund_allocation_amount)
+            else:
+                alloc.percent(r.ctx.acq.fund_allocation_percent)
+            alloc.note(r.ctx.acq.fund_allocation_note)
+            fund_mgr.create_allocation(alloc)
+            return redirect_to(controller='acq/fund', action='view', id=r.ctx.acq.fund_allocation_fund)
+
+        fund = fund_mgr.retrieve(r.ctx.acq.fund_id)
+        fund.org(oils.org.OrgUtil.get_org_unit(fund.org())) # flesh the org
+        r.ctx.acq.fund = fund
+        r.ctx.acq.fund_source_list = fund_mgr.retrieve_org_fund_sources('MANAGE_FUNDING_SOURCE')
+        return r.render('acq/financial/create_fund_allocation.html')
+
+
+

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py	2008-02-06 20:23:22 UTC (rev 8674)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py	2008-02-06 21:30:39 UTC (rev 8675)
@@ -21,10 +21,10 @@
         oils.event.Event.parse_and_raise(fund)
         return fund
 
-    def retrieve_org_funds(self):
+    def retrieve_org_funds(self, limit_perm=None):
         funds = self.ses.request(
             'open-ils.acq.fund.org.retrieve', 
-            self.request_mgr.ctx.core.authtoken).recv().content()
+            self.request_mgr.ctx.core.authtoken, None, limit_perm).recv().content()
         oils.event.Event.parse_and_raise(funds)
         return funds
 
@@ -43,10 +43,10 @@
         oils.event.Event.parse_and_raise(source)
         return source
 
-    def retrieve_org_fund_sources(self):
+    def retrieve_org_fund_sources(self, limit_perm=None):
         sources = self.ses.request(
             'open-ils.acq.funding_source.org.retrieve', 
-            self.request_mgr.ctx.core.authtoken).recv().content()
+            self.request_mgr.ctx.core.authtoken, None, limit_perm).recv().content()
         oils.event.Event.parse_and_raise(sources)
         return sources
 
@@ -58,4 +58,10 @@
         oils.event.Event.parse_and_raise(source_id)
         return source_id
 
+    def create_allocation(self, alloc):
+        alloc_id = self.ses.request(
+            'open-ils.acq.fund_allocation.create',
+            self.request_mgr.ctx.core.authtoken, alloc).recv().content()
+        oils.event.Event.parse_and_raise(alloc_id)
+        return alloc_id
 

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css	2008-02-06 20:23:22 UTC (rev 8674)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css	2008-02-06 21:30:39 UTC (rev 8675)
@@ -28,7 +28,8 @@
 /* general purpose form table */
 .oils-admin-table { width: 100%; }
 .oils-admin-table td { padding: 4px; }
-.oils-admin-label { width: 20%; }
+.oils-admin-table textarea { width: 400px; height: 40px; overflow:auto;}
+.oils-admin-label { width: auto; }
 
 .label { margin: 1px; }
 



More information about the open-ils-commits mailing list