Permalink
Browse files

Fix Hospitals index when not logged-in (EUROSHA). Fix membership paid VF

(IFRC)
  • Loading branch information...
1 parent d8a502d commit 43e934b346740ebefa1e55c947e171dbe283b00c @flavour flavour committed Mar 27, 2013
View
2 VERSION
@@ -1 +1 @@
-392090b (2013-03-26 14:54:22)
+d8a502d (2013-03-27 12:24:05)
View
6 controllers/admin.py
@@ -12,7 +12,7 @@
def index():
""" Module's Home Page """
- module_name = deployment_settings.modules[module].name_nice
+ module_name = settings.modules[module].name_nice
response.title = module_name
return dict(module_name=module_name)
@@ -42,7 +42,7 @@ def prep(r):
if r.representation != "html":
return False
handler = s3base.S3RoleManager()
- modules = deployment_settings.modules
+ modules = settings.modules
handler.controllers = Storage([(m, modules[m])
for m in modules
if modules[m].restricted])
@@ -395,7 +395,7 @@ def acl():
table.group_id.requires = IS_ONE_OF(db, "auth_group.id", "%(role)s")
table.group_id.represent = lambda opt: opt and db.auth_group[opt].role or opt
- table.controller.requires = IS_EMPTY_OR(IS_IN_SET(current.deployment_settings.modules.keys(),
+ table.controller.requires = IS_EMPTY_OR(IS_IN_SET(settings.modules.keys(),
zero="ANY"))
table.controller.represent = lambda opt: opt and \
"%s (%s)" % (opt,
View
8 controllers/assess2.py
@@ -268,9 +268,9 @@ def rat_tables():
module = "assess"
# Load the models we depend on
- if deployment_settings.has_module("cr"):
+ if settings.has_module("cr"):
shelter_id = s3db.shelter_id
- if deployment_settings.has_module("hrm"):
+ if settings.has_module("hrm"):
human_resource_id = s3db.hrm_human_resource_id
else:
human_resource_id = s3db.pr_person_id
@@ -1941,7 +1941,7 @@ def impact_type_comment():
def index():
""" Module's Home Page """
- module_name = deployment_settings.modules[module].name_nice
+ module_name = settings.modules[module].name_nice
response.title = module_name
return dict(module_name=module_name)
@@ -2334,7 +2334,7 @@ def mobile_basic_assess():
form, form_accepted, assess_id = custom_assess(custom_assess_fields)
if form_accepted:
- form = FORM(H1(deployment_settings.get_system_name_short()),
+ form = FORM(H1(settings.get_system_name_short()),
H2(T("Short Assessment")),
P(T("Assessment Reported")),
A(T("Report Another Assessment..."),
View
2 controllers/budget.py
@@ -527,7 +527,7 @@ def bundle_total(form):
def index():
""" Module's Home Page """
- module_name = deployment_settings.modules[module].name_nice
+ module_name = settings.modules[module].name_nice
response.title = module_name
return dict(module_name=module_name)
View
2 controllers/building.py
@@ -565,7 +565,7 @@ def index():
""" Module's Home Page """
- module_name = deployment_settings.modules[module].name_nice
+ module_name = settings.modules[module].name_nice
response.title = module_name
return dict(module_name=module_name)
View
6 controllers/event.py
@@ -165,11 +165,11 @@ def event_rheader(r):
if r.name == "incident":
# Incident Controller
tabs = [(T("Incident Details"), None)]
- if deployment_settings.has_module("project"):
+ if settings.has_module("project"):
tabs.append((T("Tasks"), "task"))
- if deployment_settings.has_module("hrm"):
+ if settings.has_module("hrm"):
tabs.append((T("Human Resources"), "human_resource"))
- if deployment_settings.has_module("asset"):
+ if settings.has_module("asset"):
tabs.append((T("Assets"), "asset"))
tabs.append((T("Facilities"), "site"))
tabs.append((T("Map Configuration"), "config"))
View
2 controllers/hms.py
@@ -7,7 +7,7 @@
module = request.controller
resourcename = request.function
-if not deployment_settings.has_module(module):
+if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
View
6 controllers/scenario.py
@@ -59,13 +59,13 @@ def scenario_rheader(r, tabs=[]):
if r.name == "scenario":
# Scenario Controller
tabs = [(T("Scenario Details"), None)]
- if deployment_settings.has_module("hrm"):
+ if settings.has_module("hrm"):
tabs.append((T("Human Resources"), "human_resource"))
- if deployment_settings.has_module("asset"):
+ if settings.has_module("asset"):
tabs.append((T("Assets"), "asset"))
tabs.append((T("Organizations"), "organisation"))
tabs.append((T("Facilities"), "site"))
- if deployment_settings.has_module("project"):
+ if settings.has_module("project"):
tabs.append((T("Tasks"), "task"))
tabs.append((T("Map Configuration"), "config"))
View
22 modules/eden/member.py
@@ -571,8 +571,20 @@ def paid(self):
OVERDUE = T("overdue")
LAPSED = T("expired")
lapsed = datetime.timedelta(days=183) # 6 months
-
+ year = datetime.timedelta(days=365)
now = current.request.utcnow.date()
+
+ if not paid_date:
+ # Never renewed since Membership started
+ # => due within 1 year
+ due = start_date + year
+ if now < due:
+ return PAID
+ elif now > (due + lapsed):
+ return LAPSED
+ else:
+ return OVERDUE
+
now_month = now.month
start_month = start_date.month
if now_month > start_month:
@@ -585,15 +597,9 @@ def paid(self):
else:
due = datetime.date((now.year - 1), start_month, start_day)
else:
+ # now_month < start_month
due = datetime.date((now.year - 1), start_month, start_date.day)
- if not paid_date:
- # Never paid
- if (now - due) > lapsed:
- return LAPSED
- else:
- return OVERDUE
-
if paid_date >= due:
return PAID
elif (due - paid_date) > lapsed:
View
125 static/formats/drrp.xsl
@@ -3,7 +3,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- **********************************************************************
- Projects - Stylesheet to migrate from DRRPP v1 to v2
+ Stylesheet to migrate from DRRPP v1 to v2
*********************************************************************** -->
<xsl:output method="xml"/>
@@ -268,6 +268,15 @@
</resource>
+ <resource name="org_organisation">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$LeadOrganisation"/>
+ </xsl:attribute>
+ <data field="name">
+ <xsl:value-of select="$LeadOrganisation"/>
+ </data>
+ </resource>
+
<xsl:call-template name="splitList">
<xsl:with-param name="list">
<xsl:value-of select="$Hazards"/>
@@ -539,20 +548,31 @@
<!-- ****************************************************************** -->
<xsl:template match="resource[@name='drrpp_funding']">
- <resource name="project_organisation">
- <data field="role">3</data>
- <data field="amount"><xsl:value-of select="data[@field='amount']/@value"/></data>
- <reference field="organisation_id" resource="org_organisation">
- <xsl:attribute name="tuid">
- <xsl:value-of select="reference[@field='organisation_id']"/>
- </xsl:attribute>
- </reference>
- <reference field="project_id" resource="project_project">
+ <xsl:variable name="Org" select="reference[@field='organisation_id']"/>
+ <xsl:variable name="Project" select="reference[@field='project_id']/@uuid"/>
+
+ <xsl:if test="$Org!='' and $Project!=''">
+ <resource name="project_organisation">
+ <data field="role">3</data>
+ <data field="amount"><xsl:value-of select="data[@field='amount']/@value"/></data>
+ <reference field="organisation_id" resource="org_organisation">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$Org"/>
+ </xsl:attribute>
+ </reference>
+ <reference field="project_id" resource="project_project">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$Project"/>
+ </xsl:attribute>
+ </reference>
+ </resource>
+ <resource name="org_organisation">
<xsl:attribute name="tuid">
- <xsl:value-of select="reference[@field='project_id']/@uuid"/>
+ <xsl:value-of select="$Org"/>
</xsl:attribute>
- </reference>
- </resource>
+ <data field="name"><xsl:value-of select="$Org"/></data>
+ </resource>
+ </xsl:if>
</xsl:template>
@@ -609,20 +629,31 @@
<!-- ****************************************************************** -->
<xsl:template match="resource[@name='drrpp_impl_org']">
- <resource name="project_organisation">
- <data field="role">2</data>
- <data field="comments"><xsl:value-of select="data[@field='role']"/></data>
- <reference field="organisation_id" resource="org_organisation">
- <xsl:attribute name="tuid">
- <xsl:value-of select="reference[@field='organisation_id']"/>
- </xsl:attribute>
- </reference>
- <reference field="project_id" resource="project_project">
+ <xsl:variable name="Org" select="reference[@field='organisation_id']"/>
+ <xsl:variable name="Project" select="reference[@field='project_id']/@uuid"/>
+
+ <xsl:if test="$Org!='' and $Project!=''">
+ <resource name="project_organisation">
+ <data field="role">2</data>
+ <data field="comments"><xsl:value-of select="data[@field='role']"/></data>
+ <reference field="organisation_id" resource="org_organisation">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$Org"/>
+ </xsl:attribute>
+ </reference>
+ <reference field="project_id" resource="project_project">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$Project"/>
+ </xsl:attribute>
+ </reference>
+ </resource>
+ <resource name="org_organisation">
<xsl:attribute name="tuid">
- <xsl:value-of select="reference[@field='project_id']/@uuid"/>
+ <xsl:value-of select="$Org"/>
</xsl:attribute>
- </reference>
- </resource>
+ <data field="name"><xsl:value-of select="$Org"/></data>
+ </resource>
+ </xsl:if>
</xsl:template>
@@ -711,27 +742,29 @@
<xsl:variable name="Project" select="reference[@field='project_id']/@uuid"/>
- <resource name="project_output">
- <xsl:attribute name="tuid">
- <xsl:value-of select="concat('OUTPUT',data[@field='output'])"/>
- </xsl:attribute>
- <data field="name"><xsl:value-of select="data[@field='output']"/></data>
- <xsl:choose>
- <xsl:when test="data[@field='status']='Proposed'">
- <data field="status">1</data>
- </xsl:when>
- <xsl:when test="data[@field='status']='Achieved'">
- <data field="status">2</data>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="$Project!=''">
- <reference field="project_id" resource="project_project">
- <xsl:attribute name="tuid">
- <xsl:value-of select="$Project"/>
- </xsl:attribute>
- </reference>
- </xsl:if>
- </resource>
+ <xsl:if test="$Project!=''">
+ <resource name="project_output">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="concat('OUTPUT',data[@field='output'])"/>
+ </xsl:attribute>
+ <data field="name"><xsl:value-of select="data[@field='output']"/></data>
+ <xsl:choose>
+ <xsl:when test="data[@field='status']='Proposed'">
+ <data field="status">1</data>
+ </xsl:when>
+ <xsl:when test="data[@field='status']='Achieved'">
+ <data field="status">2</data>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="$Project!=''">
+ <reference field="project_id" resource="project_project">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$Project"/>
+ </xsl:attribute>
+ </reference>
+ </xsl:if>
+ </resource>
+ </xsl:if>
</xsl:template>
View
4 static/themes/default/survey.css
@@ -20,6 +20,6 @@ div.survey_map-legend td {
}
div.survey_scrollable {
- width:900px;
- overflow:scroll;
+ width: 900px;
+ overflow: scroll;
}

0 comments on commit 43e934b

Please sign in to comment.