From 38f50dcd4e34c9433dd861c511a384ff8f60e403 Mon Sep 17 00:00:00 2001 From: trendspotter Date: Thu, 28 Sep 2017 10:02:08 +0200 Subject: [PATCH] Fire: Remove/comment dependencies on IRS (index, vehicle_reports) --- controllers/fire.py | 56 +++++++++----------------------------------- modules/s3db/fire.py | 10 ++++---- 2 files changed, 16 insertions(+), 50 deletions(-) diff --git a/controllers/fire.py b/controllers/fire.py index e28e726eb2..085a9787a3 100644 --- a/controllers/fire.py +++ b/controllers/fire.py @@ -10,50 +10,16 @@ def index(): """ Module Homepage """ - module_name = settings.modules[module].name_nice - response.title = module_name - - htable = s3db.fire_shift_staff - stable = s3db.fire_station - station_id = None - station_name = None - - human_resource_id = auth.s3_logged_in_human_resource() - query = htable.human_resource_id == human_resource_id - - left = htable.on(htable.station_id == stable.id) - - row = db(query).select(htable.station_id, - stable.name, - left = left, - limitby = (0, 1), - ).first() - if row: - station_id = row.fire_shift_staff.station_id - station_name = row.fire_station.name - - # Note that this requires setting the Porto Incident Types in modules/s3db/irs.py - incidents = DIV(A(DIV(T("Fire"), - _style="background-color:red;", - _class="question-container fleft"), - _href=URL(c="irs", f="ireport", args=["create"], - vars={"type":"fire"})), - A(DIV(T("Rescue"), - _style="background-color:green;", - _class="question-container fleft"), - _href=URL(c="irs", f="ireport", args=["create"], - vars={"type":"rescue"})), - A(DIV(T("Hazmat"), - _style="background-color:yellow;", - _class="question-container fleft"), - _href=URL(c="irs", f="ireport", args=["create"], - vars={"type":"hazmat"}))) - - return dict(incidents = incidents, - station_id = station_id, - station_name = station_name, - module_name = module_name, - ) + return s3db.cms_index(module, alt_function="index_alt") + +# ----------------------------------------------------------------------------- +def index_alt(): + """ + Module homepage for non-Admin users when no CMS content found + """ + + # Just redirect to the list of Fire stations + s3_redirect_default(URL(f="station")) # ----------------------------------------------------------------------------- def zone(): @@ -155,7 +121,7 @@ def fire_rheader(r, tabs=[]): (T("Staff"), "human_resource"), #(T("Shifts"), "shift"), (T("Roster"), "shift_staff"), - (T("Vehicle Deployments"), "vehicle_report"), + #(T("Vehicle Deployments"), "vehicle_report"), ] rheader_tabs = s3_rheader_tabs(r, tabs) diff --git a/modules/s3db/fire.py b/modules/s3db/fire.py index a54fc877c0..d6ff6c99d4 100644 --- a/modules/s3db/fire.py +++ b/modules/s3db/fire.py @@ -360,10 +360,10 @@ def model(self): msg_no_match = T("No Vehicles could be found"), msg_list_empty = T("No Vehicles currently registered")) - self.set_method("fire", "station", - method = "vehicle_report", - action = self.vehicle_report, - ) + #self.set_method("fire", "station", + # method = "vehicle_report", + # action = self.vehicle_report, + # ) # ===================================================================== # Water Sources @@ -568,7 +568,7 @@ def fire_staff_on_duty(station_id=None): def vehicle_report(r, **attr): """ Custom method to provide a report on Vehicle Deployment Times - - this is one of the main tools currently used to manage an Incident + @ToDo: Currently unused, requires deprecated irs module """ rheader = attr.get("rheader", None)