[open-ils-commits] r8639 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb: controllers/acq lib lib/acq templates/oils/default/acq/financial

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 5 11:44:05 EST 2008


Author: erickson
Date: 2008-02-05 11:15:45 -0500 (Tue, 05 Feb 2008)
New Revision: 8639

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/controllers/acq/fund_source.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/user.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html
Log:
moved some work org logic into the new user class.  started basic fund management

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-05 15:59:24 UTC (rev 8638)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-02-05 16:15:45 UTC (rev 8639)
@@ -31,7 +31,13 @@
         self.picklist_entry = ContextItem() # picklist_entry object
 
         self.currency_types = ContextItem()
+
         self.fund = ContextItem()
+        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_source = ContextItem()
         self.fund_source_list = ContextItem()
         self.fund_source_name = ContextItem(cgi_name='acq.fn')

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-05 15:59:24 UTC (rev 8638)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-02-05 16:15:45 UTC (rev 8639)
@@ -1,12 +1,10 @@
 from oilsweb.lib.base import *
 import pylons
 from oilsweb.lib.request import RequestMgr
-import oilsweb.lib.acq.fund
+import oilsweb.lib.acq.fund, oilsweb.lib.user
 import osrf.net_obj
 import oils.org
 
-# XXX update to match new fund layout
-
 class FundController(BaseController):
 
     def view(self, **kwargs):
@@ -32,13 +30,19 @@
         fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
 
         if r.ctx.acq.fund_name:
-            fund = osrf.net_obj.NetworkObject.acqfund()
+            fund = osrf.net_obj.NetworkObject.acqf()
             fund.name(r.ctx.acq.fund_name)
-            fund.owner(r.ctx.acq.fund_owner)
-            fund.currency_type(r.ctx.acq.fund_currency_type)
+            fund.org(r.ctx.acq.fund_org)
+            fund.year(r.ctx.acq.fund_year)
             fund_id = fund_mgr.create_fund(fund)
             return redirect_to(controller='acq/fund', action='view', id=fund_id)
 
-        r.ctx.acq.currency_types = fund_mgr.fetch_currency_types()
-        r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
+        usermgr = oilsweb.lib.user.User(r.ctx.core)
+        tree = usermgr.highest_work_perm_tree('CREATE_FUND')
+
+        if tree is None:
+            return _("Insufficient Permissions") # XXX Return a perm failure template
+
         return r.render('acq/financial/create_fund.html')
+
+

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py	2008-02-05 15:59:24 UTC (rev 8638)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py	2008-02-05 16:15:45 UTC (rev 8639)
@@ -46,7 +46,6 @@
         if len(perm_orgs) == 0:
             return _("Insufficient Permissions") # XXX Return a perm failure template
 
-        r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
         r.ctx.core.perm_tree['CREATE_FUNDING_SOURCE'] = oils.org.OrgUtil.get_union_tree(perm_orgs)
         r.ctx.core.high_perm_orgs['CREATE_FUNDING_SOURCE'] = perm_orgs
         r.ctx.acq.currency_types = fund_mgr.fetch_currency_types()

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-05 15:59:24 UTC (rev 8638)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py	2008-02-05 16:15:45 UTC (rev 8639)
@@ -14,7 +14,6 @@
         oils.event.Event.parse_and_raise(types)
         return types
 
-    ''' XXX update to look like a fund 
     def retrieve(self, fund_id):
         fund = self.ses.request(
             'open-ils.acq.fund.retrieve', 
@@ -22,6 +21,7 @@
         oils.event.Event.parse_and_raise(fund)
         return fund
 
+    ''' XXX update to look like a fund 
     def retrieve_org_funds(self):
         funds = self.ses.request(
             'open-ils.acq.fund.org.retrieve', 
@@ -32,13 +32,13 @@
         return funds
 
 
+    '''
     def create_fund(self, fund):
         fund_id = self.ses.request(
             'open-ils.acq.fund.create', 
             self.request_mgr.ctx.core.authtoken, fund).recv().content()
         oils.event.Event.parse_and_raise(fund_id)
         return fund_id
-    '''
 
     
     def retrieve_fund_source(self, source_id):

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/user.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/user.py	2008-02-05 15:59:24 UTC (rev 8638)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/user.py	2008-02-05 16:15:45 UTC (rev 8639)
@@ -59,5 +59,18 @@
         oils.event.Event.parse_and_raise(work_orgs)
         return work_orgs
 
+    def highest_work_perm_set(self, perm):
+        perm_orgs = osrf.ses.ClientSession.atomic_request(
+            'open-ils.actor',
+            'open-ils.actor.user.work_perm.highest_org_set', self.ctx.authtoken, perm);
+        self.ctx.high_perm_orgs[perm] = perm_orgs
+        return perm_orgs
 
+    def highest_work_perm_tree(self, perm):
+        perm_orgs = self.highest_work_perm_set(perm)
+        if len(perm_orgs) == 0:
+            return None
+        self.ctx.perm_tree[perm] = oils.org.OrgUtil.get_union_tree(perm_orgs)
+        return self.ctx.perm_tree[perm]
 
+

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html	2008-02-05 15:59:24 UTC (rev 8638)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html	2008-02-05 16:15:45 UTC (rev 8639)
@@ -1,5 +1,8 @@
 # -*- coding: utf-8 -*-
 <div class='oils-base-navigate-item'>
+    <a href='${c.oils.core.prefix}/acq/fund/create'>${_('New Fund')}</a>
+</div>
+<div class='oils-base-navigate-item'>
     <a href='${c.oils.core.prefix}/acq/fund_source/list'>${_('Fund Sources')}</a>
 </div>
 <div class='oils-base-navigate-item'>



More information about the open-ils-commits mailing list