From e94dba4299e17bbb8b391be28f19fb39c8f90a52 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 23 Jan 2008 19:24:35 +0000 Subject: [PATCH] implemented baseline my-funds interface git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8485 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/oilsweb/oilsweb/controllers/acq/__init__.py | 1 + Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py | 8 +++++++- Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py | 18 ++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py index cca275515a..03c23a171e 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py @@ -32,6 +32,7 @@ class AcqContext(SubContext): 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') diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py index 411425880d..63a031e6b3 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py @@ -17,7 +17,13 @@ class FundController(BaseController): return r.render('acq/financial/view_fund.html') def list(self): - pass + r = RequestMgr() + fund_mgr = oilsweb.lib.acq.fund.FundMgr(r) + r.ctx.acq.fund_list = fund_mgr.retrieve_org_funds() + for f in r.ctx.acq.fund_list: + f.owner(oils.org.OrgUtil.get_org_unit(f.owner())) + return r.render('acq/financial/list_funds.html') + def create(self): r = RequestMgr() diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py index dcbe6fcdc0..21063654a1 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py @@ -1,5 +1,5 @@ import osrf.ses, osrf.net_obj -import oils.const, oils.utils.utils, oils.event +import oils.const, oils.utils.utils, oils.event, oils.org class FundMgr(object): ''' Fund utility class ''' @@ -15,11 +15,21 @@ class FundMgr(object): return types def retrieve(self, fund_id): - status = self.ses.request( + fund = self.ses.request( 'open-ils.acq.fund.retrieve', self.request_mgr.ctx.core.authtoken, fund_id).recv().content() - oils.event.Event.parse_and_raise(status) - return status + oils.event.Event.parse_and_raise(fund) + return fund + + def retrieve_org_funds(self): + funds = self.ses.request( + 'open-ils.acq.fund.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(funds) + return funds + def create_fund(self, fund): fund_id = self.ses.request( -- 2.11.0