[open-ils-commits] r8724 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib/acq templates/oils/default/acq/financial
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Feb 11 16:22:12 EST 2008
Author: erickson
Date: 2008-02-11 15:53:00 -0500 (Mon, 11 Feb 2008)
New Revision: 8724
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/templates/oils/default/acq/financial/create_fund.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.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.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html
Log:
added fund currency type info to displays, more funding-source summary usage
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-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-02-11 20:53:00 UTC (rev 8724)
@@ -39,13 +39,14 @@
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_currency_type = ContextItem(cgi_name='acq.fc')
self.fund_summary = ContextItem()
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')
+ self.fund_source_name = ContextItem(cgi_name='acq.fsn')
+ self.fund_source_currency_type = ContextItem(cgi_name='acq.fsc')
+ self.fund_source_owner = ContextItem(cgi_name='acq.fso')
self.fund_allocation = 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-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py 2008-02-11 20:53:00 UTC (rev 8724)
@@ -50,6 +50,7 @@
fund.name(r.ctx.acq.fund_name)
fund.org(r.ctx.acq.fund_org)
fund.year(r.ctx.acq.fund_year)
+ fund.currency_type(r.ctx.acq.fund_currency_type)
fund_id = ses.request('open-ils.acq.fund.create',
r.ctx.core.authtoken, fund).recv().content()
@@ -60,6 +61,12 @@
usermgr = oilsweb.lib.user.User(r.ctx.core)
tree = usermgr.highest_work_perm_tree('CREATE_FUND')
+ types = ses.request(
+ 'open-ils.acq.currency_type.all.retrieve',
+ r.ctx.core.authtoken).recv().content()
+ r.ctx.acq.currency_types = oils.event.Event.parse_and_raise(types)
+
+
if tree is None:
return _("Insufficient Permissions") # XXX Return a perm failure template
@@ -76,7 +83,7 @@
source_list = ses.request(
'open-ils.acq.funding_source.org.retrieve',
- r.ctx.core.authtoken, None, 'MANAGE_FUNDING_SOURCE').recv().content()
+ r.ctx.core.authtoken, None, {'limit_perm':'MANAGE_FUNDING_SOURCE', 'flesh_summary':1}).recv().content()
oils.event.Event.parse_and_raise(source_list)
r.ctx.acq.fund = fund
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-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py 2008-02-11 20:53:00 UTC (rev 8724)
@@ -3,26 +3,38 @@
from oilsweb.lib.request import RequestMgr
import oilsweb.lib.acq.fund
import osrf.net_obj
-import oils.org
+import oils.org, oils.event, oils.const
class FundSourceController(BaseController):
def view(self, **kwargs):
r = RequestMgr()
+ ses = osrf.ses.ClientSession(oils.const.OILS_APP_ACQ)
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 = ses.request(
+ 'open-ils.acq.funding_source.retrieve',
+ r.ctx.core.authtoken, kwargs.get('id'), {"flesh_summary":1}).recv().content()
+ oils.event.Event.parse_and_raise(source)
+
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()))
+ ses = osrf.ses.ClientSession(oils.const.OILS_APP_ACQ)
+
+ sources = ses.request(
+ 'open-ils.acq.funding_source.org.retrieve',
+ r.ctx.core.authtoken, None, {"flesh_summary":1}).recv().content()
+
+ oils.event.Event.parse_and_raise(sources)
+ r.ctx.acq.fund_source_list = sources
+
+ for source in sources:
+ source.owner(oils.org.OrgUtil.get_org_unit(source.owner()))
return r.render('acq/financial/list_fund_sources.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-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py 2008-02-11 20:53:00 UTC (rev 8724)
@@ -43,10 +43,10 @@
oils.event.Event.parse_and_raise(source)
return source
- def retrieve_org_fund_sources(self, limit_perm=None):
+ def retrieve_org_fund_sources(self, options=None):
sources = self.ses.request(
'open-ils.acq.funding_source.org.retrieve',
- self.request_mgr.ctx.core.authtoken, None, limit_perm).recv().content()
+ self.request_mgr.ctx.core.authtoken, None, options).recv().content()
oils.event.Event.parse_and_raise(sources)
return sources
Modified: 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-02-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html 2008-02-11 20:53:00 UTC (rev 8724)
@@ -24,11 +24,22 @@
</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 class='oils-admin-label'>${_('Fund Year')}</td>
<td>
<input type='text' size='42' year='${c.oils.acq.fund_year_.cgi_name}'/>
</td>
</tr>
+
<tr>
<td colspan='2'>
<input type='submit' value='${_("Create Fund")}'/>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html 2008-02-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html 2008-02-11 20:53:00 UTC (rev 8724)
@@ -21,7 +21,8 @@
<td>
<select name='${c.oils.acq.fund_allocation_source_.cgi_name}'>
% for source in c.oils.acq.fund_source_list:
- <option value='${source.id()}'>${source.name()}</option>
+ <% source_label = _('%(name)s (balance = %(b)s)') % {'name':source.name(), 'b': source.summary()['balance']} %>
+ <option value='${source.id()}'>${source_label}</option>
% endfor
</select>
</td>
Modified: 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/list_fund_sources.html 2008-02-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html 2008-02-11 20:53:00 UTC (rev 8724)
@@ -18,6 +18,7 @@
<td>${_('Funding Source Name')}</td>
<td>${_('Funding Source Owner')}</td>
<td>${_('Funding Source Currency Type')}</td>
+ <td>${_('Funding Source Balance')}</td>
</tr>
</thead>
<tbody>
@@ -26,6 +27,7 @@
<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>
+ <td>${source.summary()['balance']}</td>
</tr>
%endfor
</tbody>
Modified: 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-02-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html 2008-02-11 20:53:00 UTC (rev 8724)
@@ -6,15 +6,19 @@
<table class='oils-admin-table'>
<tbody>
<tr>
- <td class='oils-admin-label'>${_('Fund Name')}</td>
+ <td class='oils-admin-label'>${_('Name')}</td>
<td>${c.oils.acq.fund.name()}</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Owner')}</td>
+ <td class='oils-admin-label'>${_('Owner')}</td>
<td>${c.oils.acq.fund.org().name()}</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Year')}</td>
+ <td class='oils-admin-label'>${_('Currency')}</td>
+ <td>${c.oils.acq.fund.currency_type()}</td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Year')}</td>
<td>${c.oils.acq.fund.year()}</td>
</tr>
<tr>
@@ -22,11 +26,11 @@
<td>${c.oils.acq.fund.summary()['allocation_total']}</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Balance (Total - (Spent + Encumberances))')}</td>
+ <td class='oils-admin-label'>${_('Balance (Total - (Spent + Encumberances))')}</td>
<td>${c.oils.acq.fund.summary()['combined_balance']}</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Spent Balance (Total - Spent)')}</td>
+ <td class='oils-admin-label'>${_('Spent Balance (Total - Spent)')}</td>
<td>${c.oils.acq.fund.summary()['spent_balance']}</td>
</tr>
<tr>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html 2008-02-11 20:47:11 UTC (rev 8723)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html 2008-02-11 20:53:00 UTC (rev 8724)
@@ -17,6 +17,18 @@
<td class='oils-admin-label'>${_('Funding Source Currency Type')}</td>
<td>${c.oils.acq.fund_source.currency_type()}</td>
</tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Funding Source Credit Total')}</td>
+ <td>${c.oils.acq.fund_source.summary()['credit_total']}</td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Funding Source Allocation Total')}</td>
+ <td>${c.oils.acq.fund_source.summary()['allocation_total']}</td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Funding Source Balance')}</td>
+ <td>${c.oils.acq.fund_source.summary()['balance']}</td>
+ </tr>
</tbody>
</table>
</%def>
More information about the open-ils-commits
mailing list