Skip to content

Commit

Permalink
Fire: Remove/comment dependencies on IRS (index, vehicle_reports)
Browse files Browse the repository at this point in the history
  • Loading branch information
trendspotter committed Sep 28, 2017
1 parent 1fd61be commit 38f50dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 50 deletions.
56 changes: 11 additions & 45 deletions controllers/fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions modules/s3db/fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 38f50dc

Please sign in to comment.