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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 30 13:42:08 EST 2008


Author: erickson
Date: 2008-01-30 13:14:37 -0500 (Wed, 30 Jan 2008)
New Revision: 8541

Added:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html
Removed:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
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/templates/oils/default/acq/financial/navigate.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html
Log:

updated to suit terminonolgy change on fund objects



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-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-01-30 18:14:37 UTC (rev 8541)
@@ -32,10 +32,11 @@
 
         self.currency_types = ContextItem()
         self.fund = ContextItem()
-        self.fund_list = ContextItem()
-        self.fund_name = ContextItem(cgi_name='acq.fn')
-        self.fund_currency_type = ContextItem(cgi_name='acq.fc')
-        self.fund_owner = ContextItem(cgi_name='acq.fo')
+        self.fund_source = ContextItem()
+        self.fund_source_list = ContextItem()
+        self.fund_source_name = ContextItem(cgi_name='acq.fn')
+        self.fund_source_currency_type = ContextItem(cgi_name='acq.fc')
+        self.fund_source_owner = ContextItem(cgi_name='acq.fo')
 
         # -------------------------------------------------------------
         # utility functions

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-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-01-30 18:14:37 UTC (rev 8541)
@@ -5,6 +5,8 @@
 import osrf.net_obj
 import oils.org
 
+# XXX update to match new fund layout
+
 class FundController(BaseController):
 
     def view(self, **kwargs):
@@ -40,4 +42,3 @@
         r.ctx.acq.currency_types = fund_mgr.fetch_currency_types()
         r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
         return r.render('acq/financial/create_fund.html')
-

Added: 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	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py	2008-01-30 18:14:37 UTC (rev 8541)
@@ -0,0 +1,44 @@
+from oilsweb.lib.base import *
+import pylons
+from oilsweb.lib.request import RequestMgr
+import oilsweb.lib.acq.fund
+import osrf.net_obj
+import oils.org
+
+
+class FundSourceController(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)
+        source = fund_mgr.retrieve_fund_source(kwargs.get('id'))
+        source.owner(oils.org.OrgUtil.get_org_unit(source.owner())) # flesh the owner
+        r.ctx.acq.fund_source = source
+        return r.render('acq/financial/view_fund_source.html')
+
+    def list(self):
+        r = RequestMgr()
+        fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
+        r.ctx.acq.fund_source_list = fund_mgr.retrieve_org_fund_sources()
+        for f in r.ctx.acq.fund_source_list:
+            f.owner(oils.org.OrgUtil.get_org_unit(f.owner()))
+        return r.render('acq/financial/list_fund_sources.html')
+            
+
+    def create(self):
+        r = RequestMgr()
+        fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
+
+        if r.ctx.acq.fund_source_name:
+            source = osrf.net_obj.NetworkObject.acqfs()
+            source.name(r.ctx.acq.fund_source_name)
+            source.owner(r.ctx.acq.fund_source_owner)
+            source.currency_type(r.ctx.acq.fund_source_currency_type)
+            source_id = fund_mgr.create_fund_source(source)
+            return redirect_to(controller='acq/fund_source', action='view', id=source_id)
+
+        r.ctx.acq.currency_types = fund_mgr.fetch_currency_types()
+        r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
+        return r.render('acq/financial/create_fund_source.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-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py	2008-01-30 18:14:37 UTC (rev 8541)
@@ -14,6 +14,7 @@
         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', 
@@ -37,5 +38,31 @@
             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):
+        source = self.ses.request(
+            'open-ils.acq.funding_source.retrieve', 
+            self.request_mgr.ctx.core.authtoken, source_id).recv().content()
+        oils.event.Event.parse_and_raise(source)
+        return source
+
+    def retrieve_org_fund_sources(self):
+        sources = self.ses.request(
+            'open-ils.acq.funding_source.org.retrieve', 
+            self.request_mgr.ctx.core.authtoken, 
+            self.request_mgr.ctx.core.workstation.owning_lib(),
+            {"full_path":1}).recv().content()
+        oils.event.Event.parse_and_raise(sources)
+        return sources
+
+
+    def create_fund_source(self, source):
+        source_id = self.ses.request(
+            'open-ils.acq.funding_source.create', 
+            self.request_mgr.ctx.core.authtoken, source).recv().content()
+        oils.event.Event.parse_and_raise(source_id)
+        return source_id
+
+

Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html	2008-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-<%inherit file='../base.html'/>
-<%namespace file='../../common/widgets.html' name='widget'/>
-<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
-<%def name="block_content()">
-
-<form action='${c.oils.acq.prefix}/fund/create' method='POST'>
-    <table class='oils-admin-table'>
-        <tbody>
-            <tr>
-                <td class='oils-admin-label'>${_('Fund Name')}</td>
-                <td> 
-                    <input type='text' size='42' name='${c.oils.acq.fund_name_.cgi_name}'/>
-                </td>
-            </tr>
-            <tr>
-                <td class='oils-admin-label'>${_('Fund Onwer')}</td>
-                <td> 
-                    ${widget.org_select(c.oils.acq.fund_owner_.cgi_name)}
-                    <b>* ADD PERM FILTER HERE *</b>
-                </td>
-            </tr>
-            <tr>
-                <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
-                <td> 
-                    <select name='${c.oils.acq.fund_currency_type_.cgi_name}'>
-                        % for type in c.oils.acq.currency_types:
-                            <option value='${type.code()}'>${type.label()}</option>
-                        % endfor
-                    </select>
-                </td>
-            </tr>
-            <tr>
-                <td colspan='2'>
-                    <input type='submit' value='${_("Create Fund")}'/>
-                </td>
-            </tr>
-        </tbody>
-    </table>
-</form>
-</%def>

Copied: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html (from rev 8528, branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html)
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
+<%def name="block_content()">
+
+<form action='${c.oils.acq.prefix}/fund_source/create' method='POST'>
+    <table class='oils-admin-table'>
+        <tbody>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Name')}</td>
+                <td> 
+                    <input type='text' size='42' name='${c.oils.acq.fund_source_name_.cgi_name}'/>
+                </td>
+            </tr>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Onwer')}</td>
+                <td> 
+                    ${widget.org_select(c.oils.acq.fund_source_owner_.cgi_name)}
+                    <b>* ADD PERM FILTER HERE *</b>
+                </td>
+            </tr>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
+                <td> 
+                    <select name='${c.oils.acq.fund_source_currency_type_.cgi_name}'>
+                        % for type in c.oils.acq.currency_types:
+                            <option value='${type.code()}'>${type.label()}</option>
+                        % endfor
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <td colspan='2'>
+                    <input type='submit' value='${_("Create Fund")}'/>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+</form>
+</%def>

Copied: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html (from rev 8528, branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html)
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
+<%def name="block_content()">
+
+<table class='oils-admin-table'>
+    <thead>
+        <tr>
+            <td>${_('Fund Name')}</td>
+            <td>${_('Fund Owner')}</td>
+            <td>${_('Fund Currency Type')}</td>
+        </tr>
+    </thead>
+    <tbody>
+        % for source in c.oils.acq.fund_source_list:
+        <tr>
+            <td><a href='${c.oils.acq.prefix}/fund_source/view/${source.id()}'>${source.name()}</a></td>
+            <td>${source.owner().name()}</td> 
+            <td>${source.currency_type()}</td> 
+        </tr>
+        %endfor
+    </tbody>
+</table>
+</%def>

Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html	2008-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-<%inherit file='../base.html'/>
-<%namespace file='../../common/widgets.html' name='widget'/>
-<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
-<%def name="block_content()">
-
-<table class='oils-admin-table'>
-    <thead>
-        <tr>
-            <td>${_('Fund Name')}</td>
-            <td>${_('Fund Owner')}</td>
-            <td>${_('Fund Currency Type')}</td>
-        </tr>
-    </thead>
-    <tbody>
-        % for fund in c.oils.acq.fund_list:
-        <tr>
-            <td><a href='${c.oils.acq.prefix}/fund/view/${fund.id()}'>${fund.name()}</a></td>
-            <td>${fund.owner().name()}</td> 
-            <td>${fund.currency_type()}</td> 
-        </tr>
-        %endfor
-    </tbody>
-</table>
-</%def>

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-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 <div class='oils-base-navigate-item'>
-    <a href='${c.oils.core.prefix}/acq/fund/list'>${_('My Funds')}</a>
+    <a href='${c.oils.core.prefix}/acq/fund_source/list'>${_('My Fund Sources')}</a>
 </div>
 <div class='oils-base-navigate-item'>
-    <a href='${c.oils.core.prefix}/acq/fund/create'>${_('Create Fund')}</a>
+    <a href='${c.oils.core.prefix}/acq/fund_source/create'>${_('Create Fund Source')}</a>
 </div>
    

Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html	2008-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-<%inherit file='../base.html'/>
-<%namespace file='../../common/widgets.html' name='widget'/>
-<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
-<%def name="block_content()">
-
-<form action='${c.oils.acq.prefix}/fund/create' method='POST'>
-    <table class='oils-admin-table'>
-        <tbody>
-            <tr>
-                <td class='oils-admin-label'>${_('Fund Name')}</td>
-                <td>${c.oils.acq.fund.name()}</td>
-            </tr>
-            <tr>
-                <td class='oils-admin-label'>${_('Fund Onwer')}</td>
-                <td>${c.oils.acq.fund.owner().name()}</td> 
-            </tr>
-            <tr>
-                <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
-                <td>${c.oils.acq.fund.currency_type()}</td> 
-            </tr>
-        </tbody>
-    </table>
-</form>
-</%def>

Copied: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html (from rev 8528, branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html)
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
+<%def name="block_content()">
+
+<form action='${c.oils.acq.prefix}/fund_source/create' method='POST'>
+    <table class='oils-admin-table'>
+        <tbody>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Name')}</td>
+                <td>${c.oils.acq.fund_source.name()}</td>
+            </tr>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Onwer')}</td>
+                <td>${c.oils.acq.fund_source.owner().name()}</td> 
+            </tr>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
+                <td>${c.oils.acq.fund_source.currency_type()}</td> 
+            </tr>
+        </tbody>
+    </table>
+</form>
+</%def>

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html	2008-01-30 18:05:57 UTC (rev 8540)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html	2008-01-30 18:14:37 UTC (rev 8541)
@@ -11,7 +11,10 @@
     </div>
 % endif
 <div class='oils-base-navigate-item'>
+    <a href='${c.oils.core.prefix}/acq/fundsource/list'>${_('Funds')}</a>
+    <!--
     <a href='${c.oils.core.prefix}/acq/fund/list'>${_('Funds')}</a>
+    -->
 </div>
 % if c.oils.core.page.startswith('acq/financial'):
     <div class='oils-base-navigate-sub-list'>



More information about the open-ils-commits mailing list