Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/flavour/eden
Browse files Browse the repository at this point in the history
  • Loading branch information
nursix committed Oct 9, 2012
2 parents acc1ec4 + c70d7c6 commit 2ba5ba0
Show file tree
Hide file tree
Showing 27 changed files with 593 additions and 400 deletions.
17 changes: 15 additions & 2 deletions controllers/hrm.py
Expand Up @@ -106,7 +106,7 @@ def staff():
"person_id", "person_id",
"job_title_id", "job_title_id",
"organisation_id", "organisation_id",
"department", "department_id",
"site_id", "site_id",
#"site_contact", #"site_contact",
(T("Email"), "email"), (T("Email"), "email"),
Expand Down Expand Up @@ -143,7 +143,7 @@ def prep(r):


table = r.table table = r.table
table.site_id.comment = DIV(DIV(_class="tooltip", table.site_id.comment = DIV(DIV(_class="tooltip",
_title="%s|%s|%s" % (T("Office/Warehouse/Facility"), _title="%s|%s|%s" % (settings.get_org_site_label(),
T("The facility where this position is based."), T("The facility where this position is based."),
T("Enter some characters to bring up a list of possible matches.")))) T("Enter some characters to bring up a list of possible matches."))))
table.status.writable = False table.status.writable = False
Expand Down Expand Up @@ -693,6 +693,19 @@ def postp(r, output):
# ============================================================================= # =============================================================================
# Jobs # Jobs
# ============================================================================= # =============================================================================
def department():
""" Departments Controller """

mode = session.s3.hrm.mode
def prep(r):
if mode is not None:
r.error(403, message=auth.permission.INSUFFICIENT_PRIVILEGES)
return True
s3.prep = prep

output = s3_rest_controller()
return output

def job_role(): def job_role():
""" Job Roles Controller """ """ Job Roles Controller """


Expand Down
21 changes: 17 additions & 4 deletions controllers/vol.py
Expand Up @@ -202,8 +202,8 @@ def prep(r):
_location.readable = True _location.readable = True
table.code.writable = False table.code.writable = False
table.code.readable = False table.code.readable = False
table.department.writable = False table.department_id.writable = False
table.department.readable = False table.department_id.readable = False
table.essential.writable = False table.essential.writable = False
table.essential.readable = False table.essential.readable = False
table.site_contact.writable = False table.site_contact.writable = False
Expand Down Expand Up @@ -431,8 +431,8 @@ def prep(r):
table = r.component.table table = r.component.table
table.code.writable = False table.code.writable = False
table.code.readable = False table.code.readable = False
table.department.writable = False table.department_id.writable = False
table.department.readable = False table.department_id.readable = False
table.essential.writable = False table.essential.writable = False
table.essential.readable = False table.essential.readable = False
#table.location_id.readable = True #table.location_id.readable = True
Expand Down Expand Up @@ -709,6 +709,19 @@ def postp(r, output):
# ============================================================================= # =============================================================================
# Jobs # Jobs
# ============================================================================= # =============================================================================
def department():
""" Departments Controller """

mode = session.s3.hrm.mode
def prep(r):
if mode is not None:
r.error(403, message=auth.permission.INSUFFICIENT_PRIVILEGES)
return True
s3.prep = prep

output = s3_rest_controller()
return output

def job_role(): def job_role():
""" Job Roles Controller """ """ Job Roles Controller """


Expand Down
1 change: 1 addition & 0 deletions languages/en-gb.py
Expand Up @@ -39,6 +39,7 @@
'Delete Organization': 'Delete Organisation', 'Delete Organization': 'Delete Organisation',
'Delete Organization Domain': 'Delete Organisation Domain', 'Delete Organization Domain': 'Delete Organisation Domain',
'Delete Organization Type': 'Delete Organisation Type', 'Delete Organization Type': 'Delete Organisation Type',
'Department Catalog': 'Department Catalogue',
'Edit Catalog': 'Edit Catalogue', 'Edit Catalog': 'Edit Catalogue',
'Edit Catalog Item': 'Edit Catalogue Item', 'Edit Catalog Item': 'Edit Catalogue Item',
'Edit Organization': 'Edit Organisation', 'Edit Organization': 'Edit Organisation',
Expand Down
23 changes: 10 additions & 13 deletions models/00_settings.py
Expand Up @@ -214,12 +214,12 @@
%(email)s""") %(email)s""")


_messages["confirmation_email_subject"] = "%s %s" % (settings.get_system_name(), _messages["confirmation_email_subject"] = "%s %s" % (settings.get_system_name(),
T("access granted")) T("access granted"))
_messages["confirmation_email"] = "%s %s %s %s. %s." % (T("Welcome to the"), _messages["confirmation_email"] = "%s %s %s %s. %s." % (T("Welcome to the"),
settings.get_system_name(), settings.get_system_name(),
T("Portal at"), T("Portal at"),
s3.base_url, s3.base_url,
T("Thanks for your assistance")) T("Thanks for your assistance"))


# We don't wish to clutter the groups list with 1 per user. # We don't wish to clutter the groups list with 1 per user.
_settings.create_user_groups = False _settings.create_user_groups = False
Expand All @@ -229,19 +229,16 @@
_settings.logout_onlogout = s3_auth_on_logout _settings.logout_onlogout = s3_auth_on_logout
_settings.login_onaccept = s3_auth_on_login _settings.login_onaccept = s3_auth_on_login
_settings.login_next = settings.get_auth_login_next() _settings.login_next = settings.get_auth_login_next()
if settings.get_auth_registration_volunteer() and \ if settings.has_module("vol") and \
settings.has_module("vol"): settings.get_auth_registration_volunteer():
_settings.register_next = URL(c="vol", f="person") _settings.register_next = URL(c="vol", f="person")


# Default Language for authenticated users
_settings.table_user.language.default = settings.get_L10n_default_language()

# Languages available in User Profiles # Languages available in User Profiles
field = _settings.table_user.language
if len(s3.l10n_languages) > 1: if len(s3.l10n_languages) > 1:
field.requires = IS_IN_SET(s3.l10n_languages, _settings.table_user.language.requires = IS_IN_SET(s3.l10n_languages,
zero=None) zero=None)
else: else:
field = _settings.table_user.language
field.default = s3.l10n_languages.keys()[0] field.default = s3.l10n_languages.keys()[0]
field.readable = False field.readable = False
field.writable = False field.writable = False
Expand Down
25 changes: 14 additions & 11 deletions modules/eden/asset.py
Expand Up @@ -49,8 +49,8 @@
# To pass to global scope # To pass to global scope
asset_types = { asset_types = {
"VEHICLE" : ASSET_TYPE_VEHICLE, "VEHICLE" : ASSET_TYPE_VEHICLE,
"RADIO" : ASSET_TYPE_RADIO, "RADIO" : ASSET_TYPE_RADIO,
"TELEPHONE" : ASSET_TYPE_TELEPHONE, "TELEPHONE" : ASSET_TYPE_TELEPHONE,
"OTHER" : ASSET_TYPE_OTHER, "OTHER" : ASSET_TYPE_OTHER,
} }


Expand Down Expand Up @@ -104,7 +104,9 @@ def model(self):


UNKNOWN_OPT = current.messages.UNKNOWN_OPT UNKNOWN_OPT = current.messages.UNKNOWN_OPT


vehicle = current.deployment_settings.has_module("vehicle") settings = current.deployment_settings
org_site_label = settings.get_org_site_label()
vehicle = settings.has_module("vehicle")


# Shortcuts # Shortcuts
add_component = self.add_component add_component = self.add_component
Expand All @@ -123,8 +125,8 @@ def model(self):
ASSET_TYPE_OTHER : T("Other") ASSET_TYPE_OTHER : T("Other")
} }


asset_item_represent = lambda id: self.supply_item_represent(id, asset_item_represent = lambda id: \
show_um = False) self.supply_item_represent(id, show_um = False)


ctable = self.supply_item_category ctable = self.supply_item_category
itable = self.supply_item itable = self.supply_item
Expand Down Expand Up @@ -169,7 +171,7 @@ def model(self):
# This is a component, so needs to be a super_link # This is a component, so needs to be a super_link
# - can't override field name, ondelete or requires # - can't override field name, ondelete or requires
super_link("site_id", "org_site", super_link("site_id", "org_site",
label = T("Office/Warehouse/Facility"), label = org_site_label,
default = auth.user.site_id if auth.is_logged_in() else None, default = auth.user.site_id if auth.is_logged_in() else None,
readable = True, readable = True,
writable = True, writable = True,
Expand Down Expand Up @@ -198,7 +200,8 @@ def model(self):
), ),
Field("purchase_price", "double", Field("purchase_price", "double",
#default=0.00, #default=0.00,
represent=lambda v, row=None: IS_FLOAT_AMOUNT.represent(v, precision=2)), represent=lambda v, row=None: \
IS_FLOAT_AMOUNT.represent(v, precision=2)),
s3_currency("purchase_currency"), s3_currency("purchase_currency"),
# Base Location, which should always be a Site & set via Log # Base Location, which should always be a Site & set via Log
location_id(readable=False, location_id(readable=False,
Expand Down Expand Up @@ -240,7 +243,7 @@ def model(self):
represent = self.asset_represent, represent = self.asset_represent,
label = T("Asset"), label = T("Asset"),
comment = S3AddResourceLink(c="asset", f="asset", comment = S3AddResourceLink(c="asset", f="asset",
tooltip=T("If you don't see the asset in the list, you can add a new one by clicking link 'Add Asset'.")), tooltip=T("If you don't see the asset in the list, you can add a new one by clicking link 'Add Asset'.")),
ondelete = "CASCADE") ondelete = "CASCADE")


table.virtualfields.append(AssetVirtualFields()) table.virtualfields.append(AssetVirtualFields())
Expand Down Expand Up @@ -288,7 +291,7 @@ def model(self):
"number", "number",
(T("Category"), "item_id$item_category_id"), (T("Category"), "item_id$item_category_id"),
(T("Item"), "item_id"), (T("Item"), "item_id"),
(T("Office/Warehouse/Facility"), "site"), (org_site_label, "site"),
"L1", "L1",
"L2", "L2",
] ]
Expand Down Expand Up @@ -366,7 +369,7 @@ def model(self):
# Asset Log # Asset Log
# #


asset_log_status_opts = {ASSET_LOG_SET_BASE : T("Base Office/Warehouse/Facility Set"), asset_log_status_opts = {ASSET_LOG_SET_BASE : T("Base %(facility)s Set") % org_site_label,
ASSET_LOG_ASSIGN : T("Assigned"), ASSET_LOG_ASSIGN : T("Assigned"),
ASSET_LOG_RETURN : T("Returned"), ASSET_LOG_RETURN : T("Returned"),
ASSET_LOG_CHECK : T("Checked"), ASSET_LOG_CHECK : T("Checked"),
Expand Down Expand Up @@ -431,7 +434,7 @@ def model(self):
# This is a component, so needs to be a super_link # This is a component, so needs to be a super_link
# - can't override field name, ondelete or requires # - can't override field name, ondelete or requires
super_link("site_id", "org_site", super_link("site_id", "org_site",
label = T("Warehouse/Facility/Office"), label = org_site_label,
#filterby = "site_id", #filterby = "site_id",
#filter_opts = auth.permitted_facilities(redirect_on_error=False), #filter_opts = auth.permitted_facilities(redirect_on_error=False),
instance_types = auth.org_site_types, instance_types = auth.org_site_types,
Expand Down
15 changes: 9 additions & 6 deletions modules/eden/dvi.py
Expand Up @@ -434,14 +434,17 @@ def model(self):
def body_onaccept(form): def body_onaccept(form):
""" Update body presence log """ """ Update body presence log """


try: db = current.db
body = current.db.dvi_body[form.vars.id] table = db.dvi_body
except: body = db(table.id == form.vars.id).select(table.uuid,
return table.location_id,
table.track_id,
table.date_of_recovery,
limitby=(0, 1)).first()
if body and body.location_id: if body and body.location_id:
tracker = S3Tracker() tracker = S3Tracker()
tracker(body).set_location(body.location_id, tracker(record=body).set_location(body.location_id,
timestmp=body.date_of_recovery) timestmp=body.date_of_recovery)


# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
@staticmethod @staticmethod
Expand Down

0 comments on commit 2ba5ba0

Please sign in to comment.