From: erickson Date: Wed, 30 Jan 2008 18:14:37 +0000 (+0000) Subject: updated to suit terminonolgy change on fund objects X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b24049948e5f29cf3bdafcc5d42fc1d1edfc799c;p=Evergreen.git updated to suit terminonolgy change on fund objects git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8541 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py index 03c23a171e..9636974abb 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py @@ -32,10 +32,11 @@ 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') + 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 diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py index 63a031e6b3..eb5a5facb6 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py @@ -5,6 +5,8 @@ import oilsweb.lib.acq.fund 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 @@ class FundController(BaseController): 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') - diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py new file mode 100644 index 0000000000..9400986faf --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py @@ -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') + diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py index 21063654a1..a52e25eefd 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py @@ -14,6 +14,7 @@ class FundMgr(object): 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 @@ class FundMgr(object): 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 + + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html deleted file mode 100644 index d45f504720..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html +++ /dev/null @@ -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 name="block_content()"> - -
- - - - - - - - - - - - - - - - - - -
${_('Fund Name')} - -
${_('Fund Onwer')} - ${widget.org_select(c.oils.acq.fund_owner_.cgi_name)} - * ADD PERM FILTER HERE * -
${_('Fund Currency Type')} - -
- -
-
- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html new file mode 100644 index 0000000000..36f20dae56 --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html @@ -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 name="block_content()"> + +
+ + + + + + + + + + + + + + + + + + +
${_('Fund Name')} + +
${_('Fund Onwer')} + ${widget.org_select(c.oils.acq.fund_source_owner_.cgi_name)} + * ADD PERM FILTER HERE * +
${_('Fund Currency Type')} + +
+ +
+
+ diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html new file mode 100644 index 0000000000..cc1df2f0ff --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html @@ -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 name="block_content()"> + + + + + + + + + + + % for source in c.oils.acq.fund_source_list: + + + + + + %endfor + +
${_('Fund Name')}${_('Fund Owner')}${_('Fund Currency Type')}
${source.name()}${source.owner().name()}${source.currency_type()}
+ diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html deleted file mode 100644 index b29e75c71b..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html +++ /dev/null @@ -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 name="block_content()"> - - - - - - - - - - - % for fund in c.oils.acq.fund_list: - - - - - - %endfor - -
${_('Fund Name')}${_('Fund Owner')}${_('Fund Currency Type')}
${fund.name()}${fund.owner().name()}${fund.currency_type()}
- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html index cf932a86b4..a66b86b59c 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*-
- ${_('My Funds')} + ${_('My Fund Sources')}
- ${_('Create Fund')} + ${_('Create Fund Source')}
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html deleted file mode 100644 index 4ee52c8056..0000000000 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html +++ /dev/null @@ -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 name="block_content()"> - -
- - - - - - - - - - - - - - - -
${_('Fund Name')}${c.oils.acq.fund.name()}
${_('Fund Onwer')}${c.oils.acq.fund.owner().name()}
${_('Fund Currency Type')}${c.oils.acq.fund.currency_type()}
-
- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html new file mode 100644 index 0000000000..1266e63956 --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html @@ -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 name="block_content()"> + +
+ + + + + + + + + + + + + + + +
${_('Fund Name')}${c.oils.acq.fund_source.name()}
${_('Fund Onwer')}${c.oils.acq.fund_source.owner().name()}
${_('Fund Currency Type')}${c.oils.acq.fund_source.currency_type()}
+
+ diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html index 76068dad23..518dc7b0b4 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html @@ -11,7 +11,10 @@ % endif
+ ${_('Funds')} +
% if c.oils.core.page.startswith('acq/financial'):