Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/flavour/eden

  • Loading branch information...
commit 2ba5ba05f5448906d174a9ee54a61fff57fa6349 2 parents acc1ec4 + c70d7c6
Dominic König nursix authored
17 controllers/hrm.py
View
@@ -106,7 +106,7 @@ def staff():
"person_id",
"job_title_id",
"organisation_id",
- "department",
+ "department_id",
"site_id",
#"site_contact",
(T("Email"), "email"),
@@ -143,7 +143,7 @@ def prep(r):
table = r.table
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("Enter some characters to bring up a list of possible matches."))))
table.status.writable = False
@@ -693,6 +693,19 @@ def postp(r, output):
# =============================================================================
# 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():
""" Job Roles Controller """
21 controllers/vol.py
View
@@ -202,8 +202,8 @@ def prep(r):
_location.readable = True
table.code.writable = False
table.code.readable = False
- table.department.writable = False
- table.department.readable = False
+ table.department_id.writable = False
+ table.department_id.readable = False
table.essential.writable = False
table.essential.readable = False
table.site_contact.writable = False
@@ -431,8 +431,8 @@ def prep(r):
table = r.component.table
table.code.writable = False
table.code.readable = False
- table.department.writable = False
- table.department.readable = False
+ table.department_id.writable = False
+ table.department_id.readable = False
table.essential.writable = False
table.essential.readable = False
#table.location_id.readable = True
@@ -709,6 +709,19 @@ def postp(r, output):
# =============================================================================
# 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():
""" Job Roles Controller """
1  languages/en-gb.py
View
@@ -39,6 +39,7 @@
'Delete Organization': 'Delete Organisation',
'Delete Organization Domain': 'Delete Organisation Domain',
'Delete Organization Type': 'Delete Organisation Type',
+'Department Catalog': 'Department Catalogue',
'Edit Catalog': 'Edit Catalogue',
'Edit Catalog Item': 'Edit Catalogue Item',
'Edit Organization': 'Edit Organisation',
23 models/00_settings.py
View
@@ -214,12 +214,12 @@
%(email)s""")
_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"),
- settings.get_system_name(),
- T("Portal at"),
- s3.base_url,
- T("Thanks for your assistance"))
+ settings.get_system_name(),
+ T("Portal at"),
+ s3.base_url,
+ T("Thanks for your assistance"))
# We don't wish to clutter the groups list with 1 per user.
_settings.create_user_groups = False
@@ -229,19 +229,16 @@
_settings.logout_onlogout = s3_auth_on_logout
_settings.login_onaccept = s3_auth_on_login
_settings.login_next = settings.get_auth_login_next()
-if settings.get_auth_registration_volunteer() and \
- settings.has_module("vol"):
+if settings.has_module("vol") and \
+ settings.get_auth_registration_volunteer():
_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
-field = _settings.table_user.language
if len(s3.l10n_languages) > 1:
- field.requires = IS_IN_SET(s3.l10n_languages,
- zero=None)
+ _settings.table_user.language.requires = IS_IN_SET(s3.l10n_languages,
+ zero=None)
else:
+ field = _settings.table_user.language
field.default = s3.l10n_languages.keys()[0]
field.readable = False
field.writable = False
25 modules/eden/asset.py
View
@@ -49,8 +49,8 @@
# To pass to global scope
asset_types = {
"VEHICLE" : ASSET_TYPE_VEHICLE,
- "RADIO" : ASSET_TYPE_RADIO,
- "TELEPHONE" : ASSET_TYPE_TELEPHONE,
+ "RADIO" : ASSET_TYPE_RADIO,
+ "TELEPHONE" : ASSET_TYPE_TELEPHONE,
"OTHER" : ASSET_TYPE_OTHER,
}
@@ -104,7 +104,9 @@ def model(self):
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
add_component = self.add_component
@@ -123,8 +125,8 @@ def model(self):
ASSET_TYPE_OTHER : T("Other")
}
- asset_item_represent = lambda id: self.supply_item_represent(id,
- show_um = False)
+ asset_item_represent = lambda id: \
+ self.supply_item_represent(id, show_um = False)
ctable = self.supply_item_category
itable = self.supply_item
@@ -169,7 +171,7 @@ def model(self):
# This is a component, so needs to be a super_link
# - can't override field name, ondelete or requires
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,
readable = True,
writable = True,
@@ -198,7 +200,8 @@ def model(self):
),
Field("purchase_price", "double",
#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"),
# Base Location, which should always be a Site & set via Log
location_id(readable=False,
@@ -240,7 +243,7 @@ def model(self):
represent = self.asset_represent,
label = T("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")
table.virtualfields.append(AssetVirtualFields())
@@ -288,7 +291,7 @@ def model(self):
"number",
(T("Category"), "item_id$item_category_id"),
(T("Item"), "item_id"),
- (T("Office/Warehouse/Facility"), "site"),
+ (org_site_label, "site"),
"L1",
"L2",
]
@@ -366,7 +369,7 @@ def model(self):
# 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_RETURN : T("Returned"),
ASSET_LOG_CHECK : T("Checked"),
@@ -431,7 +434,7 @@ def model(self):
# This is a component, so needs to be a super_link
# - can't override field name, ondelete or requires
super_link("site_id", "org_site",
- label = T("Warehouse/Facility/Office"),
+ label = org_site_label,
#filterby = "site_id",
#filter_opts = auth.permitted_facilities(redirect_on_error=False),
instance_types = auth.org_site_types,
15 modules/eden/dvi.py
View
@@ -434,14 +434,17 @@ def model(self):
def body_onaccept(form):
""" Update body presence log """
- try:
- body = current.db.dvi_body[form.vars.id]
- except:
- return
+ db = current.db
+ table = db.dvi_body
+ body = db(table.id == form.vars.id).select(table.uuid,
+ table.location_id,
+ table.track_id,
+ table.date_of_recovery,
+ limitby=(0, 1)).first()
if body and body.location_id:
tracker = S3Tracker()
- tracker(body).set_location(body.location_id,
- timestmp=body.date_of_recovery)
+ tracker(record=body).set_location(body.location_id,
+ timestmp=body.date_of_recovery)
# -------------------------------------------------------------------------
@staticmethod
163 modules/eden/hrm.py
View
@@ -83,6 +83,7 @@ def model(self):
UNKNOWN_OPT = messages.UNKNOWN_OPT
crud_strings = current.response.s3.crud_strings
+ super_link = self.super_link
# =========================================================================
# Human Resource
@@ -119,15 +120,15 @@ def model(self):
tablename = "hrm_human_resource"
table = self.define_table(tablename,
- self.super_link("track_id", "sit_trackable"),
+ super_link("track_id", "sit_trackable"),
self.org_organisation_id(
label = organisation_label,
requires = self.org_organisation_requires(updateable=True),
widget = None,
#widget=S3OrganisationAutocompleteWidget(
# default_from_profile=True),
- empty=False,
- required = True,
+ empty = False,
+ # Limit Sites to those belonging to the Organisation
script = SCRIPT('''
$(document).ready(function(){
S3FilterFieldChange({
@@ -139,18 +140,18 @@ def model(self):
})
})'''),
),
- self.super_link("site_id", "org_site",
- label=T("Office/Warehouse/Facility"),
- instance_types = auth.org_site_types,
- updateable = True,
- not_filterby = "obsolete",
- not_filter_opts = [True],
- default = auth.user.site_id if auth.is_logged_in() else None,
- readable = True,
- writable = True,
- empty = False,
- represent = self.org_site_represent,
- ),
+ super_link("site_id", "org_site",
+ label=settings.get_org_site_label(),
+ instance_types = auth.org_site_types,
+ updateable = True,
+ not_filterby = "obsolete",
+ not_filter_opts = [True],
+ default = auth.user.site_id if auth.is_logged_in() else None,
+ readable = True,
+ writable = True,
+ empty = False,
+ represent = self.org_site_represent,
+ ),
self.pr_person_id(
widget=S3AddPersonWidget(controller="hrm"),
requires=IS_ADD_PERSON_WIDGET(),
@@ -160,7 +161,7 @@ def model(self):
requires = IS_IN_SET(hrm_type_opts,
zero=None),
default = 1,
- label = T("Type"),
+ #label = T("Type"),
# Always set via the Controller we create from
readable=False,
writable=False,
@@ -179,12 +180,7 @@ def model(self):
readable = job_roles,
writable = job_roles,
),
- Field("department",
- #readable = False,
- #writable = False,
- represent = lambda opt: \
- opt or messages.NONE,
- label = T("Department / Unit")),
+ self.hrm_department_id(),
# Essential Staff
Field("essential", "boolean",
#readable = False,
@@ -431,6 +427,7 @@ def model(self):
self.configure(tablename,
super_entity = "sit_trackable",
+ mark_required = ["organisation_id"],
deletable = current.deployment_settings.get_hrm_deletable(),
search_method = human_resource_search,
onaccept = hrm_human_resource_onaccept,
@@ -736,7 +733,9 @@ def hrm_human_resource_site_duplicate(item):
# =============================================================================
class S3HRJobModel(S3Model):
- names = ["hrm_job_role",
+ names = ["hrm_department",
+ "hrm_department_id",
+ "hrm_job_role",
"hrm_job_role_id",
"hrm_multi_job_role_id",
"hrm_job_title",
@@ -766,12 +765,62 @@ def model(self):
if not group and request.controller == "vol":
group = "volunteer"
- job_roles = current.deployment_settings.get_hrm_job_roles()
+ # =========================================================================
+ # Departments
+ #
+ tablename = "hrm_department"
+ table = define_table(tablename,
+ Field("name", notnull=True,
+ length=64,
+ label=T("Name")),
+ # Only included in order to be able to set
+ # realm_entity to filter appropriately
+ organisation_id(
+ default = root_org,
+ readable = False,
+ writable = False,
+ ),
+ s3_comments(label=T("Description"),
+ comment=None),
+ *s3_meta_fields())
+
+ label_create = T("Add New Department")
+ crud_strings[tablename] = Storage(
+ title_create = T("Add Department"),
+ title_display = T("Department Details"),
+ title_list = T("Department Catalog"),
+ title_update = T("Edit Department"),
+ title_search = T("Search Departments"),
+ title_upload = T("Import Departments"),
+ subtitle_create = T("Add Department"),
+ label_list_button = T("List Departments"),
+ label_create_button = label_create,
+ label_delete_button = T("Delete Department"),
+ msg_record_created = T("Department added"),
+ msg_record_modified = T("Department updated"),
+ msg_record_deleted = T("Department deleted"),
+ msg_list_empty = T("Currently no entries in the catalog"))
+
+ department_id = S3ReusableField("department_id", table,
+ sortby = "name",
+ label = T("Department / Unit"),
+ requires = IS_NULL_OR(
+ IS_ONE_OF(db, "hrm_department.id",
+ hrm_department_represent,
+ filterby="organisation_id",
+ filter_opts=filter_opts)),
+ represent = hrm_department_represent,
+ comment=S3AddResourceLink(c="vol" if group == "volunteer" else "hrm",
+ f="department",
+ label=label_create),
+ ondelete = "SET NULL")
+
+ configure("hrm_department",
+ deduplicate=self.hrm_department_duplicate)
# =========================================================================
# Job Roles (Mayon: StaffResourceType)
#
-
tablename = "hrm_job_role"
table = define_table(tablename,
Field("name", notnull=True,
@@ -784,7 +833,8 @@ def model(self):
readable = False,
writable = False,
),
- s3_comments(label="Description", comment=None),
+ s3_comments(label=T("Description"),
+ comment=None),
*s3_meta_fields())
vars = current.request.get_vars
@@ -854,7 +904,6 @@ def model(self):
# =========================================================================
# Job Titles
#
-
tablename = "hrm_job_title"
table = define_table(tablename,
Field("name", notnull=True,
@@ -867,7 +916,8 @@ def model(self):
readable = False,
writable = False,
),
- s3_comments(label="Description", comment=None),
+ s3_comments(label=T("Description"),
+ comment=None),
*s3_meta_fields())
if group == "volunteer":
@@ -1065,6 +1115,7 @@ def model(self):
# Pass model-global names to s3db.*
#
return Storage(
+ hrm_department_id = department_id,
hrm_job_role_id = job_role_id,
hrm_multi_job_role_id = multi_job_role_id,
hrm_job_title_id = job_title_id,
@@ -1074,6 +1125,27 @@ def model(self):
# -------------------------------------------------------------------------
@staticmethod
+ def hrm_department_duplicate(item):
+ """
+ """
+
+ if item.tablename == "hrm_department":
+ data = item.data
+ name = "name" in data and data.name
+ org = "organisation_id" in data and data.organisation_id
+
+ table = item.table
+ query = (table.name.lower() == name.lower())
+ if org:
+ query = query & (table.organisation_id == org)
+ duplicate = current.db(query).select(table.id,
+ limitby=(0, 1)).first()
+ if duplicate:
+ item.id = duplicate.id
+ item.method = item.METHOD.UPDATE
+
+ # -------------------------------------------------------------------------
+ @staticmethod
def hrm_job_role_duplicate(item):
"""
"""
@@ -1616,7 +1688,7 @@ def model(self):
table = define_table(tablename,
course_id(empty=False),
self.super_link("site_id", "org_site",
- label=T("Office/Warehouse/Facility"),
+ label=settings.get_org_site_label(),
instance_types = auth.org_site_types,
updateable = True,
not_filterby = "obsolete",
@@ -2801,7 +2873,8 @@ def model(self):
readable = False,
writable = False,
),
- s3_comments(label=T("Description"), comment=None),
+ s3_comments(label=T("Description"),
+ comment=None),
*s3_meta_fields())
crud_strings[tablename] = Storage(
@@ -3055,6 +3128,24 @@ def hrm_job_title_represent(id, row=None):
return current.messages.UNKNOWN_OPT
# =============================================================================
+def hrm_department_represent(id, row=None):
+ """ FK representation """
+
+ if row:
+ return row.name
+ elif not id:
+ return current.messages.NONE
+
+ db = current.db
+ table = db.hrm_department
+ r = db(table.id == id).select(table.name,
+ limitby=(0, 1)).first()
+ try:
+ return r.name
+ except:
+ return current.messages.UNKNOWN_OPT
+
+# =============================================================================
def hrm_job_role_represent(id, row=None):
""" FK representation """
@@ -3066,7 +3157,7 @@ def hrm_job_role_represent(id, row=None):
db = current.db
table = db.hrm_job_role
r = db(table.id == id).select(table.name,
- limitby = (0, 1)).first()
+ limitby=(0, 1)).first()
try:
return r.name
except:
@@ -3116,7 +3207,7 @@ def hrm_job_title_represent(id, row=None):
db = current.db
table = db.hrm_job_title
r = db(table.id == id).select(table.name,
- limitby = (0, 1)).first()
+ limitby=(0, 1)).first()
try:
return r.name
except:
@@ -3213,7 +3304,7 @@ def hrm_training_event_represent(id, row=None):
# (table.organisation_id == otable.id)
# position = db(query).select(jtable.name,
# otable.name,
-# limitby = (0, 1)).first()
+# limitby=(0, 1)).first()
# try:
# represent = position.hrm_job_title.name
# if position.org_organisation:
@@ -3240,7 +3331,6 @@ def hrm_human_resource_onaccept(form):
# e.g. Coming from s3_register callback
vars = form
- # Get the full record
id = vars.id
if not id:
return
@@ -3249,6 +3339,7 @@ def hrm_human_resource_onaccept(form):
s3db = current.s3db
auth = current.auth
+ # Get the full record
htable = db.hrm_human_resource
record = db(htable.id == id).select(htable.id,
htable.type,
@@ -3263,6 +3354,8 @@ def hrm_human_resource_onaccept(form):
limitby=(0, 1)).first()
data = Storage()
+ site_id = record.site_id
+
# Affiliation, record ownership and component ownership
s3db.pr_update_affiliations(htable, record)
@@ -3272,14 +3365,12 @@ def hrm_human_resource_onaccept(form):
person = Storage(id = person_id)
if current.deployment_settings.get_auth_person_realm_human_resource_site():
# Set pr_person.realm_entity to the human_resource's site pe_id
- site_id = record.site_id
entity = s3db.pr_get_pe_id("org_site", site_id)
if entity:
auth.set_realm_entity(ptable, person,
entity = entity,
force_update = True)
- site_id = record.site_id
site_contact = record.site_contact
if record.type == 1:
# Staff
10 modules/eden/menus.py
View
@@ -856,6 +856,11 @@ def hrm(self):
M("New", m="create"),
M("List All"),
),
+ M("Department Catalog", f="department",
+ check=manager_mode)(
+ M("New", m="create"),
+ M("List All"),
+ ),
M("Job Role Catalog", f="job_role",
check=[manager_mode, job_roles])(
M("New", m="create"),
@@ -950,6 +955,11 @@ def vol(self):
M("New", m="create"),
M("List All"),
),
+ M("Department Catalog", f="department",
+ check=manager_mode)(
+ M("New", m="create"),
+ M("List All"),
+ ),
M("Job Role Catalog", f="job_role",
check=[manager_mode, job_roles])(
M("New", m="create"),
5 modules/eden/org.py
View
@@ -1235,10 +1235,11 @@ def model(self):
*s3_ownerstamp())
# ---------------------------------------------------------------------
+ org_site_label = current.deployment_settings.get_org_site_label()
site_id = self.super_link("site_id", "org_site",
#writable = True,
#readable = True,
- label=T("Office/Warehouse/Facility"),
+ label=org_site_label,
default=auth.user.site_id if auth.is_logged_in() else None,
represent=org_site_represent,
orderby="org_site.name",
@@ -1246,7 +1247,7 @@ def model(self):
# Comment these to use a Dropdown & not an Autocomplete
widget=S3SiteAutocompleteWidget(),
comment=DIV(_class="tooltip",
- _title="%s|%s" % (T("Office/Warehouse/Facility"),
+ _title="%s|%s" % (org_site_label,
T("Enter some characters to bring up a list of possible matches")))
)
4 modules/eden/pr.py
View
@@ -3060,8 +3060,8 @@ def note_onaccept(form):
(ttable.timestmp == note.timestmp)
if note.location_id:
tracker = S3Tracker()
- tracker(query).set_location(note.location_id,
- timestmp=note.timestmp)
+ tracker(query=query).set_location(note.location_id,
+ timestmp=note.timestmp)
return
# =============================================================================
199 modules/s3/s3aaa.py
View
@@ -189,7 +189,6 @@ def __init__(self):
self.messages.registration_disabled = "Registration Disabled!"
self.messages.registration_verifying = "You haven't yet Verified your account - please check your email"
self.messages.label_organisation_id = "Organization"
- self.messages.label_site_id = "Office/Warehouse/Facility"
self.messages.label_utc_offset = "UTC Offset"
self.messages.label_image = "Profile Image"
self.messages.help_utc_offset = "The time difference between UTC and your timezone, specify as +HHMM for eastern or -HHMM for western timezones."
@@ -248,175 +247,181 @@ def define_tables(self, migrate=True, fake_migrate=False):
db = current.db
settings = self.settings
messages = self.messages
+ deployment_settings = current.deployment_settings
+ define_table = db.define_table
# User table
- if not settings.table_user:
+ utable = settings.table_user
+ uname = settings.table_user_name
+ label_user_id = messages.label_user_id
+ if not utable:
passfield = settings.password_field
# @ToDo - remove duplicate of table definitions
if settings.username_field:
# with username (not used by default in Sahana)
- settings.table_user = db.define_table(
- settings.table_user_name,
- Field("first_name", length=128, default="",
- notnull = True,),
- Field("last_name", length=128, default="",
+ utable = define_table(uname,
+ Field("first_name", length=128, notnull=True,
+ default=""),
+ Field("last_name", length=128,
+ default="",
label=messages.label_last_name),
- Field("username", length=128, default="",
+ Field("username", length=128,
+ default="",
unique=True),
Field(passfield, "password", length=512,
requires = [ CRYPT( key = settings.hmac_key,
min_length = settings.password_min_length,
digest_alg = "sha512") ],
readable=False, label=messages.label_password),
- Field("email", length=512, default="",
+ Field("email", length=512,
+ default="",
label=messages.label_email),
- Field("language", length=16),
+ Field("language", length=16,
+ default = deployment_settings.get_L10n_default_language()),
Field("utc_offset", length=16,
readable=False, writable=False),
Field("organisation_id", "integer",
- writable=False, readable=False,
+ readable=False, writable=False,
label=messages.label_organisation_id),
Field("site_id", "integer",
- writable=False, readable=False,
- label=messages.label_site_id),
+ readable=False, writable=False,
+ label=deployment_settings.get_org_site_label()),
Field("registration_key", length=512,
- writable=False, readable=False, default="",
+ default="",
+ readable=False, writable=False,
label=messages.label_registration_key),
Field("reset_password_key", length=512,
- writable=False, readable=False, default="",
+ default="",
+ readable=False, writable=False,
label=messages.label_registration_key),
- Field("deleted", "boolean", writable=False,
- readable=False, default=False),
- Field("timestmp", "datetime", writable=False,
- readable=False, default=""),
+ Field("deleted", "boolean",
+ default="",
+ readable=False, writable=False),
+ Field("timestmp", "datetime",
+ default="",
+ readable=False, writable=False),
s3_comments(readable=False, writable=False),
migrate = migrate,
fake_migrate=fake_migrate,
*(s3_uid()+s3_timestamp()))
else:
# with email-address (Sahana default)
- settings.table_user = db.define_table(
- settings.table_user_name,
- Field("first_name", length=128, default="",
+ utable = define_table(uname,
+ Field("first_name", length=128, notnull=True,
+ default="",
label=messages.label_first_name,
requires = \
IS_NOT_EMPTY(error_message=messages.is_empty),
- notnull = True,),
- Field("last_name", length=128, default="",
+ ),
+ Field("last_name", length=128,
+ default="",
label=messages.label_last_name),
- Field("email", length=512, default="",
+ Field("email", length=512,
+ default="",
label=messages.label_email,
unique=True),
Field(passfield, "password", length=512,
requires = [ CRYPT( key = settings.hmac_key,
min_length = settings.password_min_length,
digest_alg = "sha512") ],
- readable=False, label=messages.label_password),
- Field("language", length=16),
- Field("utc_offset", length=16,
readable=False,
- writable=False,
+ label=messages.label_password),
+ Field("language", length=16,
+ default = deployment_settings.get_L10n_default_language()),
+ Field("utc_offset", length=16,
+ readable=False, writable=False,
label=messages.label_utc_offset),
Field("organisation_id", "integer",
- writable=False, readable=False,
+ readable=False, writable=False,
label=messages.label_organisation_id),
Field("site_id", "integer",
- writable=False, readable=False,
- label=messages.label_site_id),
+ readable=False, writable=False,
+ label=deployment_settings.get_org_site_label()),
Field("registration_key", length=512,
- writable=False, readable=False, default="",
+ default="",
+ readable=False, writable=False,
label=messages.label_registration_key),
Field("reset_password_key", length=512,
- writable=False, readable=False, default="",
+ default="",
+ readable=False, writable=False,
label=messages.label_registration_key),
- Field("deleted", "boolean", writable=False,
- readable=False, default=False),
- Field("timestmp", "datetime", writable=False,
- readable=False, default=""),
+ Field("deleted", "boolean",
+ default="",
+ readable=False, writable=False),
+ Field("timestmp", "datetime",
+ default="",
+ readable=False, writable=False),
s3_comments(readable=False, writable=False),
migrate = migrate,
fake_migrate=fake_migrate,
*(s3_uid()+s3_timestamp()))
+ settings.table_user = utable
# Fields configured in configure_user_fields
# Temporary User Table
# for storing User Data that will be used to create records for
# the user once they are approved
- db.define_table(
- "auth_user_temp",
- Field("user_id", settings.table_user,
- label=messages.label_user_id),
- Field("mobile"),
- Field("image", "upload"),
- *(s3_uid()+s3_timestamp()) )
+ define_table("auth_user_temp",
+ Field("user_id", utable),
+ Field("mobile"),
+ Field("image", "upload"),
+ *(s3_uid()+s3_timestamp()))
# Group table (roles)
- if not settings.table_group:
- settings.table_group = db.define_table(
- settings.table_group_name,
+ gtable = settings.table_group
+ gname = settings.table_group_name
+ label_group_id = messages.label_group_id
+ if not gtable:
+ gtable = define_table(gname,
# Group unique ID, must be notnull+unique:
- Field("uuid",
- length=64,
- notnull=True,
- unique=True,
- readable=False,
- writable=False),
+ Field("uuid", length=64, notnull=True, unique=True,
+ readable=False, writable=False),
# Group does not appear in the Role Manager:
# (can neither assign, nor modify, nor delete)
Field("hidden", "boolean",
- readable=False,
- writable=False,
+ readable=False, writable=False,
default=False),
# Group cannot be modified in the Role Manager:
# (can assign, but neither modify nor delete)
Field("system", "boolean",
- readable=False,
- writable=False,
+ readable=False, writable=False,
default=False),
# Group cannot be deleted in the Role Manager:
# (can assign and modify, but not delete)
Field("protected", "boolean",
- readable=False,
- writable=False,
+ readable=False, writable=False,
default=False),
# Role name:
- Field("role",
- length=512,
+ Field("role", length=512, unique=True,
default="",
- unique=True,
+ requires = IS_NOT_IN_DB(db, "%s.role" % gname),
label=messages.label_role),
Field("description", "text",
label=messages.label_description),
migrate = migrate,
fake_migrate=fake_migrate,
*(s3_timestamp()+s3_deletion_status()))
- table = settings.table_group
- table.role.requires = IS_NOT_IN_DB(db, "%s.role"
- % settings.table_group._tablename)
+ settings.table_group = gtable
# Group membership table (user<->role)
if not settings.table_membership:
- settings.table_membership = db.define_table(
+ settings.table_membership = define_table(
settings.table_membership_name,
- Field("user_id", settings.table_user,
- label=messages.label_user_id),
- Field("group_id", settings.table_group,
- label=messages.label_group_id),
+ Field("user_id", utable,
+ requires = IS_IN_DB(db, "%s.id" % uname,
+ "%(id)s: %(first_name)s %(last_name)s"),
+ label=label_user_id),
+ Field("group_id", gtable,
+ requires = IS_IN_DB(db, "%s.id" % gname,
+ "%(id)s: %(role)s"),
+ label=label_group_id),
Field("pe_id", "integer"),
migrate = migrate,
fake_migrate=fake_migrate,
*(s3_uid()+s3_timestamp()+s3_deletion_status()))
- table = settings.table_membership
- table.user_id.requires = IS_IN_DB(db, "%s.id" %
- settings.table_user._tablename,
- "%(id)s: %(first_name)s %(last_name)s")
- table.group_id.requires = IS_IN_DB(db, "%s.id" %
- settings.table_group._tablename,
- "%(id)s: %(role)s")
-
- security_policy = current.deployment_settings.get_security_policy()
+ security_policy = deployment_settings.get_security_policy()
# Define Eden permission table
self.permission.define_table(migrate=migrate,
fake_migrate=fake_migrate)
@@ -425,44 +430,42 @@ def define_tables(self, migrate=True, fake_migrate=False):
not settings.table_permission:
# Permissions table (group<->permission)
# NB This Web2Py table is deprecated / replaced in Eden by S3Permission
- settings.table_permission = db.define_table(
+ settings.table_permission = define_table(
settings.table_permission_name,
- Field("group_id", settings.table_group,
- label=messages.label_group_id),
+ Field("group_id", gtable,
+ requires = IS_IN_DB(db, "%s.id" % gname,
+ "%(id)s: %(role)s"),
+ label=label_group_id),
Field("name", default="default", length=512,
+ requires = IS_NOT_EMPTY(),
label=messages.label_name),
Field("table_name", length=512,
+ # Needs to be defined after all tables created
+ #requires = IS_IN_SET(db.tables),
label=messages.label_table_name),
Field("record_id", "integer",
+ requires = IS_INT_IN_RANGE(0, 10 ** 9),
label=messages.label_record_id),
migrate = migrate,
fake_migrate=fake_migrate)
- table = settings.table_permission
- table.group_id.requires = IS_IN_DB(db, "%s.id" %
- settings.table_group._tablename,
- "%(id)s: %(role)s")
- table.name.requires = IS_NOT_EMPTY()
- table.table_name.requires = IS_IN_SET(db.tables)
- table.record_id.requires = IS_INT_IN_RANGE(0, 10 ** 9)
# Event table (auth_event)
# Records Logins & ?
# @ToDo: Deprecate? At least make it configurable?
if not settings.table_event:
request = current.request
- settings.table_event = db.define_table(
+ settings.table_event = define_table(
settings.table_event_name,
Field("time_stamp", "datetime",
- default=request.now,
+ default=request.utcnow,
label=messages.label_time_stamp),
Field("client_ip",
default=request.client,
label=messages.label_client_ip),
- Field("user_id", settings.table_user, default=None,
- requires = IS_IN_DB(db, "%s.id" %
- settings.table_user._tablename,
+ Field("user_id", utable, default=None,
+ requires = IS_IN_DB(db, "%s.id" % uname,
"%(id)s: %(first_name)s %(last_name)s"),
- label=messages.label_user_id),
+ label=label_user_id),
Field("origin", default="auth", length=512,
label=messages.label_origin,
requires = IS_NOT_EMPTY()),
@@ -1263,8 +1266,8 @@ def configure_user_fields(self):
#site_id.widget = S3SiteAutocompleteWidget()
# no permissions for autocomplete on registration page
site_id.comment = DIV(_class="tooltip",
- _title="%s|%s" % (T("Office/Warehouse/Facility"),
- T("Enter some characters to bring up a list of possible matches")))
+ _title="%s|%s" % (deployment_settings.get_org_site_label(),
+ T("Enter some characters to bring up a list of possible matches")))
if not deployment_settings.get_auth_registration_site_required():
site_id.requires = IS_NULL_OR(site_id.requires)
2  modules/s3/s3gis.py
View
@@ -2028,7 +2028,7 @@ def get_locations_and_popups(resource,
# Use S3Track
ids = resource._ids
try:
- tracker = S3Trackable(table, record_id=ids)
+ tracker = S3Trackable(table, record_ids=ids)
except SyntaxError:
# This table isn't trackable
pass
2  modules/s3/s3resource.py
View
@@ -1929,7 +1929,7 @@ def export_tree(self,
duration = end - _start
duration = '{:.2f}'.format(duration.total_seconds())
_debug("export_resource of referenced resources and their components completed in %s seconds" % \
- duration)
+ duration)
# Complete the tree
tree = xml.tree(None,
3  modules/s3/s3rest.py
View
@@ -1188,7 +1188,8 @@ def get_tree(r, **attr):
else:
as_json = False
default = "text/xml"
- headers["Content-Type"] = manager.content_type.get(representation, default)
+ headers["Content-Type"] = manager.content_type.get(representation,
+ default)
# Export the resource
output = r.resource.export_xml(start=start,
176 modules/s3/s3track.py
View
@@ -29,7 +29,8 @@
"""
from gluon import current
-from gluon.dal import Table, Query, Set, Expression, Rows, Row
+#from gluon.dal import Table, Query, Set, Expression, Rows, Row
+from gluon.dal import Table, Rows, Row
from datetime import datetime, timedelta
__all__ = ["S3Tracker"]
@@ -48,13 +49,17 @@ class S3Trackable(object):
Trackable types instance(s)
"""
- def __init__(self, trackable, record_id=None, uid=None, rtable=None):
+ def __init__(self, table=None, tablename=None, record=None, query=None,
+ record_id=None, record_ids=None, rtable=None):
"""
Constructor:
- @param trackable: the trackable object
- @param record_id: the record ID(s) (if object is a table or tablename)
- @param uid: the record UID(s) (if object is a table or tablename)
+ @param table: a Table object
+ @param tablename: a Str tablename
+ @param record: a Row object
+ @param query: a Query object
+ @param record_id: a record ID (if object is a Table)
+ @param record_ids: a list of record IDs (if object is a Table)
@param rtable: the resource table (for the recursive calls)
"""
@@ -66,66 +71,95 @@ def __init__(self, trackable, record_id=None, uid=None, rtable=None):
self.table = s3db.sit_trackable
self.rtable = rtable
- if isinstance(trackable, (Table, str)):
- if hasattr(trackable, "_tablename"):
- table = trackable
+ # if isinstance(trackable, (Table, str)):
+ # if hasattr(trackable, "_tablename"):
+ # table = trackable
+ # tablename = table._tablename
+ # else:
+ # table = s3db[trackable]
+ # tablename = trackable
+ # fields = self.__get_fields(table)
+ # if not fields:
+ # raise SyntaxError("Not a trackable type: %s" % tablename)
+ # query = (table._id > 0)
+ # if uid is None:
+ # if record_id is not None:
+ # if isinstance(record_id, (list, tuple)):
+ # query = (table._id.belongs(record_id))
+ # else:
+ # query = (table._id == record_id)
+ # elif UID in table.fields:
+ # if not isinstance(uid, (list, tuple)):
+ # query = (table[UID].belongs(uid))
+ # else:
+ # query = (table[UID] == uid)
+ # fields = [table[f] for f in fields]
+ # rows = db(query).select(*fields)
+ if table or tablename:
+ if table:
tablename = table._tablename
else:
- table = s3db[trackable]
- tablename = trackable
+ table = s3db[tablename]
fields = self.__get_fields(table)
if not fields:
raise SyntaxError("Not a trackable type: %s" % tablename)
- query = (table._id > 0)
- if uid is None:
- if record_id is not None:
- if isinstance(record_id, (list, tuple)):
- query = (table._id.belongs(record_id))
- else:
- query = (table._id == record_id)
- elif UID in table.fields:
- if not isinstance(uid, (list, tuple)):
- query = (table[UID].belongs(uid))
- else:
- query = (table[UID] == uid)
+ if record_ids:
+ query = (table._id.belongs(record_ids))
+ elif record_id:
+ query = (table._id == record_id)
+ else:
+ query = (table._id > 0)
fields = [table[f] for f in fields]
rows = db(query).select(*fields)
- elif isinstance(trackable, Row):
- fields = self.__get_fields(trackable)
+ # elif isinstance(trackable, Row):
+ # fields = self.__get_fields(trackable)
+ # if not fields:
+ # raise SyntaxError("Required fields not present in the row")
+ # rows = Rows(records=[trackable], compact=False)
+ elif record:
+ fields = self.__get_fields(record)
if not fields:
raise SyntaxError("Required fields not present in the row")
- rows = Rows(records=[trackable], compact=False)
-
- elif isinstance(trackable, Rows):
- rows = [r for r in trackable if self.__get_fields(r)]
- fail = len(trackable) - len(rows)
- if fail:
- raise SyntaxError("Required fields not present in %d of the rows" % fail)
- rows = Rows(records=rows, compact=False)
-
- elif isinstance(trackable, (Query, Expression)):
- tablename = db._adapter.get_table(trackable)
+ rows = Rows(records=[record], compact=False)
+
+ # elif isinstance(trackable, Rows):
+ # rows = [r for r in trackable if self.__get_fields(r)]
+ # fail = len(trackable) - len(rows)
+ # if fail:
+ # raise SyntaxError("Required fields not present in %d of the rows" % fail)
+ # rows = Rows(records=rows, compact=False)
+
+ # elif isinstance(trackable, (Query, Expression)):
+ # tablename = db._adapter.get_table(trackable)
+ # self.rtable = s3db[tablename]
+ # fields = self.__get_fields(self.rtable)
+ # if not fields:
+ # raise SyntaxError("Not a trackable type: %s" % tablename)
+ # query = trackable
+ # fields = [self.rtable[f] for f in fields]
+ # rows = db(query).select(*fields)
+ elif query:
+ tablename = db._adapter.get_table(query)
self.rtable = s3db[tablename]
fields = self.__get_fields(self.rtable)
if not fields:
raise SyntaxError("Not a trackable type: %s" % tablename)
- query = trackable
fields = [self.rtable[f] for f in fields]
rows = db(query).select(*fields)
- elif isinstance(trackable, Set):
- query = trackable.query
- tablename = db._adapter.get_table(query)
- table = s3db[tablename]
- fields = self.__get_fields(table)
- if not fields:
- raise SyntaxError("Not a trackable type: %s" % tablename)
- fields = [table[f] for f in fields]
- rows = trackable.select(*fields)
+ # elif isinstance(trackable, Set):
+ # query = trackable.query
+ # tablename = db._adapter.get_table(query)
+ # table = s3db[tablename]
+ # fields = self.__get_fields(table)
+ # if not fields:
+ # raise SyntaxError("Not a trackable type: %s" % tablename)
+ # fields = [table[f] for f in fields]
+ # rows = trackable.select(*fields)
- else:
- raise SyntaxError("Invalid parameter type %s" % type(trackable))
+ # else:
+ # raise SyntaxError("Invalid parameter type %s" % type(trackable))
records = []
for r in rows:
@@ -144,7 +178,6 @@ def __init__(self, trackable, record_id=None, uid=None, rtable=None):
self.records = Rows(records=records, compact=False)
-
# -------------------------------------------------------------------------
@staticmethod
def __super_entity(trackable):
@@ -235,8 +268,8 @@ def get_location(self,
if presence:
if presence.interlock:
exclude = [r[TRACK_ID]] + exclude
- tablename, record = presence.interlock.split(",", 1)
- trackable = S3Trackable(tablename, record)
+ tablename, record_id = presence.interlock.split(",", 1)
+ trackable = S3Trackable(tablename=tablename, record_id=record_id)
record = trackable.records.first()
if TRACK_ID not in record or \
record[TRACK_ID] not in exclude:
@@ -256,7 +289,7 @@ def get_location(self,
if not location:
if len(self.records) > 1:
- trackable = S3Trackable(r, rtable=self.rtable)
+ trackable = S3Trackable(record=r, rtable=self.rtable)
else:
trackable = self
location = trackable.get_base_location(_fields=_fields)
@@ -311,7 +344,7 @@ def set_location(self, location, timestmp=None):
if TRACK_ID not in r:
# No track ID => set base location
if len(self.records) > 1:
- trackable = S3Trackable(r)
+ trackable = S3Trackable(record=r)
else:
trackable = self
trackable.set_base_location(location)
@@ -440,8 +473,8 @@ def check_out(self, table=None, record=None, timestmp=None):
elif not interlock and table and \
not presence.interlock.startswith("%s" % table):
continue
- tablename, record = presence.interlock.split(",", 1)
- trackable = S3Trackable(tablename, record)
+ tablename, record_id = presence.interlock.split(",", 1)
+ trackable = S3Trackable(tablename=tablename, record_id=record_id)
location = trackable.get_location(timestmp=timestmp).first()
if timestmp - presence.timestmp < timedelta(seconds=1):
timestmp = timestmp + timedelta(seconds=1)
@@ -514,7 +547,7 @@ def get_base_location(self,
locations.append(location)
else:
# Ensure we return an entry so that indexes match
- locations.append(Row({"id": None, "lat": None, "lon": None}))
+ locations.append(Row({"lat": None, "lon": None}))
if as_rows:
return Rows(records=locations, compact=False)
@@ -607,12 +640,10 @@ def __update_timestamp(self, track_id, timestamp):
if trackable:
trackable.update_record(track_timestmp=timestamp)
-
# =============================================================================
class S3Tracker(object):
"""
- S3 Tracking system, to be instantiated once as global "s3tracker" object
-
+ S3 Tracking system, to be instantiated once as global "s3tracker" object
"""
def __init__(self):
@@ -621,24 +652,28 @@ def __init__(self):
"""
# -------------------------------------------------------------------------
- def __call__(self, trackable, record_id=None, uid=None):
+ def __call__(self, table=None, record_id=None, record_ids=None,
+ tablename=None, record=None, query=None):
"""
Get a tracking interface for a record or set of records
- @param trackable: a Row, Rows, Query, Expression, Set object or
- a Table or a tablename
- @param record_id: a record ID or a list/tuple of record IDs
- (together with Table or tablename)
- @param uid: a record UID or a list/tuple of record UIDs
- (together with Table or tablename)
+ @param table: a Table object
+ @param record_id: a record ID (together with Table or tablename)
+ @param record_ids: a list/tuple of record IDs (together with Table or tablename)
+ @param tablename: a Str object
+ @param record: a Row object
+ @param query: a Query object
@returns: a S3Trackable instance for the specified record(s)
"""
- return S3Trackable(trackable,
+ return S3Trackable(table=table,
+ tablename=tablename,
record_id=record_id,
- uid=uid)
-
+ record_ids=record_ids,
+ record=record,
+ query=query,
+ )
# -------------------------------------------------------------------------
def get_all(self, entity,
@@ -650,7 +685,6 @@ def get_all(self, entity,
"""
raise NotImplementedError
-
# -------------------------------------------------------------------------
def get_checked_in(self, table, record,
instance_type=None,
@@ -661,6 +695,4 @@ def get_checked_in(self, table, record,
"""
raise NotImplementedError
-
-# =============================================================================
-
+# END =========================================================================
52 modules/s3cfg.py
View
@@ -547,6 +547,7 @@ def get_terms_of_service(self):
# UI Settings
def get_ui_navigate_away_confirm(self):
return self.ui.get("navigate_away_confirm", True)
+
def get_ui_confirm(self):
"""
For Delete actions
@@ -558,43 +559,40 @@ def get_ui_confirm(self):
def get_ui_autocomplete(self):
""" Currently Unused """
return self.ui.get("autocomplete", False)
+
def get_ui_read_label(self):
"""
Label for buttons in list views which lead to a Read-opnly 'Display' view
"""
return self.ui.get("read_label", "Open")
+
def get_ui_update_label(self):
"""
Label for buttons in list views which lead to a Read-opnly 'Display' view
"""
return self.ui.get("update_label", "Open")
+
def get_ui_cluster(self):
""" UN-style deployment? """
return self.ui.get("cluster", False)
+
def get_ui_camp(self):
""" 'Camp' instead of 'Shelter'? """
return self.ui.get("camp", False)
+
def get_ui_label_mobile_phone(self):
"""
Label for the Mobile Phone field
e.g. 'Cell Phone'
"""
- T = current.T
- label = self.ui.get("label_mobile_phone", T("Mobile Phone"))
- # May need this form for Web Setup
- #return T(label)
- return label
+ return current.T(self.ui.get("label_mobile_phone", "Mobile Phone"))
def get_ui_label_postcode(self):
"""
Label for the Postcode field
e.g. 'ZIP Code'
"""
- T = current.T
- label = self.ui.get("label_postcode", T("Postcode"))
- # May need this form for Web Setup
- #return T(label)
- return label
+ return current.T(self.ui.get("label_postcode", "Postcode"))
def get_ui_social_buttons(self):
""" Display social media Buttons in the footer? """
@@ -653,75 +651,71 @@ def get_save_search_widget(self):
# Alert
def get_cap_identifier_prefix(self):
"""
- prefix to be prepended to identifiers of cap alerts.
+ Prefix to be prepended to identifiers of CAP alerts
"""
return self.cap.get("identifier_prefix", "")
def get_cap_identifier_suffix(self):
"""
- suffix to be appended to identifiers of cap alerts.
+ Suffix to be appended to identifiers of CAP alerts
"""
return self.cap.get("identifier_suffix", "")
def get_cap_codes(self):
"""
- default codes for cap alert.
+ Default codes for CAP alerts
should return a list of dicts:
[ {"key": "<ValueName>, "value": "<Value>",
"comment": "<Help string>", "mutable": True|False},
...]
-
"""
return self.cap.get("codes", [])
def get_cap_event_codes(self):
"""
- default alert codes for cap info.
+ Default alert codes for CAP info segments
should return a list of dicts:
[ {"key": "<ValueName>, "value": "<Value>",
"comment": "<Help string>", "mutable": True|False},
...]
-
"""
return self.cap.get("event_codes", [])
def get_cap_parameters(self):
"""
- default parameters for cap info.
+ Default parameters for CAP info segments
should return a list of dicts:
[ {"key": "<ValueName>, "value": "<Value>",
"comment": "<Help string>", "mutable": True|False},
...]
-
"""
return self.cap.get("parameters", [])
def get_cap_geocodes(self):
"""
- default geocodes.
+ Default geocodes.
should return a list of dicts:
[ {"key": "<ValueName>, "value": "<Value>",
"comment": "<Help string>", "mutable": True|False},
...]
-
"""
return self.cap.get("geocodes", [])
def get_cap_base64(self):
"""
- Should cap resources be base64 encoded and embedded in the alert message?
-
+ Should CAP resources be base64 encoded and embedded in the alert message?
"""
return self.cap.get("base64", False)
def get_cap_languages(self):
"""
- Languages for cap info. This gets filled in the drop-down for
- selecting languages. These values should conform to RFC 3066.
+ Languages for CAP info segments.
+ This gets filled in the drop-down for selecting languages.
+ These values should conform to RFC 3066.
For a full list of languages and their codes, see:
http://www.i18nguy.com/unicode/language-identifiers.html
@@ -739,7 +733,7 @@ def get_cap_languages(self):
def get_cap_priorities(self):
"""
- settings for priorities.
+ Settings for CAP priorities
Should be an ordered dict of the format
OrderedDict([
@@ -861,7 +855,7 @@ def get_hrm_organisation_label(self):
"""
Label for Organisations in Human Resources
"""
- return self.hrm.get("organisation_label", current.T("Organization"))
+ return current.T(self.hrm.get("organisation_label", "Organization"))
# -------------------------------------------------------------------------
# Inventory Management Settings
@@ -947,6 +941,12 @@ def get_org_site_code_len(self):
"""
return self.org.get("site_code_len", 10)
+ def get_org_site_label(self):
+ """
+ Label for site_id fields
+ """
+ return current.T(self.org.get("site_label", "Facility"))
+
def get_org_summary(self):
"""
Whether to use Summary fields for Organisation/Office:
4 private/templates/Georgia/config.py
View
@@ -32,6 +32,10 @@
settings.L10n.thousands_separator = ","
# Default Country Code for telephone numbers
settings.L10n.default_country_code = 1
+# Enable this to change the label for 'Mobile Phone'
+settings.ui.label_mobile_phone = "Cell Phone"
+# Enable this to change the label for 'Postcode'
+settings.ui.label_postcode = "ZIP Code"
# Comment/uncomment modules here to disable/enable them
settings.modules = OrderedDict([
4 private/templates/IFRC/auth_roles.csv
View
@@ -200,6 +200,7 @@ staff_data_entry,Staff Data Entry,,hrm,compose,,,NONE,,,,,
staff_data_entry,Staff Data Entry,,vol,volunteer,,,NONE,,,,,
staff_data_entry,Staff Data Entry,,hrm,certificate,,,READ,,,,,
staff_data_entry,Staff Data Entry,,hrm,course,,,READ,,,,,
+staff_data_entry,Staff Data Entry,,hrm,department,,,READ,,,,,
staff_data_entry,Staff Data Entry,,hrm,job_title,,,READ,,,,,
staff_data_entry,Staff Data Entry,,pr,,,,READ|CREATE,READ|CREATE|UPDATE,,,,
staff_data_entry,Staff Data Entry,,org,,,,READ,,,,,Used to filter organisation fields
@@ -211,6 +212,7 @@ staff_editor,Staff Editor,,hrm,compose,,,NONE,,,,,
staff_editor,Staff Editor,,vol,,,,NONE,,,,,
staff_editor,Staff Editor,,hrm,certificate,,,READ,,,,,
staff_editor,Staff Editor,,hrm,course,,,READ,,,,,
+staff_editor,Staff Editor,,hrm,department,,,READ,,,,,
staff_editor,Staff Editor,,hrm,job_title,,,READ,,,,,
staff_editor,Staff Editor,,pr,,,,READ|CREATE|UPDATE,,,,,
staff_editor,Staff Editor,,org,,,,READ|CREATE|UPDATE,,,,,
@@ -233,6 +235,7 @@ vol_data_entry,Volunteer Data Entry,,hrm,human_resource,,,NONE,,,,,
vol_data_entry,Volunteer Data Entry,,vol,compose,,,NONE,,,,,
vol_data_entry,Volunteer Data Entry,,vol,certificate,,,READ,,,,,
vol_data_entry,Volunteer Data Entry,,vol,course,,,READ,,,,,
+vol_data_entry,Volunteer Data Entry,,vol,department,,,READ,,,,,
vol_data_entry,Volunteer Data Entry,,vol,job_title,,,READ,,,,,
vol_data_entry,Volunteer Data Entry,,vol,programme,,,READ,,,,,
vol_data_entry,Volunteer Data Entry,,pr,,,,READ|CREATE,READ|CREATE|UPDATE,,,,
@@ -244,6 +247,7 @@ vol_editor,Volunteer Editor,,hrm,human_resource,,,NONE,,,,,
vol_editor,Volunteer Editor,,vol,compose,,,NONE,,,,,
vol_editor,Volunteer Editor,,vol,certificate,,,READ,,,,,
vol_editor,Volunteer Editor,,vol,course,,,READ,,,,,
+vol_editor,Volunteer Editor,,vol,department,,,READ,,,,,
vol_editor,Volunteer Editor,,vol,job_title,,,READ,,,,,
vol_editor,Volunteer Editor,,vol,programme,,,READ,,,,,
vol_editor,Volunteer Editor,,pr,,,,READ|CREATE|UPDATE,,,,,
4 private/templates/IFRC/config.py
View
@@ -229,6 +229,8 @@ def ifrc_realm_entity(table, row):
# Organisation Management
# Set the length of the auto-generated org/site code the default is 10
settings.org.site_code_len = 3
+# Set the label for Sites
+settings.org.site_label = "Office/Warehouse/Facility"
# -----------------------------------------------------------------------------
# Human Resource Management
@@ -247,7 +249,7 @@ def ifrc_realm_entity(table, row):
# Uncomment to disable the use of HR Teams
#settings.hrm.use_teams = False
# Custom label for Organisations in HR module
-settings.hrm.organisation_label = T("National Society / Branch")
+settings.hrm.organisation_label = "National Society / Branch"
# -----------------------------------------------------------------------------
# Projects
10 private/templates/IFRC/menus.py
View
@@ -290,6 +290,11 @@ def hrm(self):
M("Search", m="search"),
M("Import", m="import", p="create"),
),
+ M("Department Catalog", c="hrm", f="department",
+ check=manager_mode)(
+ M("New", m="create"),
+ M("List All"),
+ ),
M("Job Role Catalog", c="hrm", f="job_title",
check=manager_mode)(
M("New Job Role", m="create"),
@@ -382,6 +387,11 @@ def vol(self):
M("New", m="create"),
M("List All"),
),
+ M("Department Catalog", f="department",
+ check=manager_mode)(
+ M("New", m="create"),
+ M("List All"),
+ ),
M("Job Role Catalog", f="job_title",
check=[manager_mode, job_roles])(
M("New", m="create"),
11 private/templates/IFRC_Train/tasks.cfg
View
@@ -67,6 +67,12 @@ gis,layer_config,IFRC/gis_layer_kml.csv,layer_kml.xsl
gis,layer_symbology,IFRC/gis_layer_kml.csv,layer_kml.xsl
gis,layer_config,default/gis_layer_coordinate.csv,layer_coordinate.xsl
# -----------------------------------------------------------------------------
+# Offices
+org,office,IFRC/office.csv,office.xsl
+org,office,office.csv,office.xsl
+# Warehouses
+inv,warehouse,warehouse.csv,warehouse.xsl
+# -----------------------------------------------------------------------------
# HRM
#hrm,skill,IFRC/SkillList.csv,skill.xsl
#hrm,competency_rating,IFRC/SkillCompetency.csv,competency_rating.xsl
@@ -88,16 +94,11 @@ project,hazard,IFRC/project_hazard.csv,hazard.xsl
project,theme,IFRC/project_theme.csv,theme.xsl
project,beneficiary_type,IFRC/project_beneficiary_type.csv,beneficiary_type.xsl
# -----------------------------------------------------------------------------
-# Offices
-org,office,IFRC/office.csv,office.xsl
-org,office,office.csv,office.xsl
# Assets
asset,asset,asset.csv,asset.xsl
# Members
member,membership_type,IFRC/membership_type.csv,membership_type.xsl
member,person,members.csv,person.xsl
-# Warehouses
-inv,warehouse,warehouse.csv,warehouse.xsl
# Inventory
inv,inv_item,inv_item.csv,inv_item.xsl
# Requests
4 private/templates/NYC/config.py
View
@@ -32,6 +32,10 @@
settings.L10n.thousands_separator = ","
# Default Country Code for telephone numbers
settings.L10n.default_country_code = 1
+# Enable this to change the label for 'Mobile Phone'
+settings.ui.label_mobile_phone = "Cell Phone"
+# Enable this to change the label for 'Postcode'
+settings.ui.label_postcode = "ZIP Code"
# Comment/uncomment modules here to disable/enable them
settings.modules = OrderedDict([
124 private/templates/default/config.py
View
@@ -212,13 +212,73 @@
# Enable this to use the label 'Camp' instead of 'Shelter'
#settings.ui.camp = True
# Enable this to change the label for 'Mobile Phone'
-#settings.ui.label_mobile_phone = T("Cell Phone")
+#settings.ui.label_mobile_phone = "Cell Phone"
# Enable this to change the label for 'Postcode'
-#settings.ui.label_postcode = T("ZIP Code")
+#settings.ui.label_postcode = "ZIP Code"
# Enable Social Media share buttons
#settings.ui.social_buttons = True
-# Request
+# Organisation Management
+# Set the length of the auto-generated org/site code the default is 10
+#settings.org.site_code_len = 3
+# Set the label for Sites
+#settings.org.site_label = "Facility"
+# Uncomment to add summary fields for Organisations/Offices for # National/International staff
+#settings.org.summary = True
+
+# Human Resource Management
+# Uncomment to allow Staff & Volunteers to be registered without an email address
+#settings.hrm.email_required = False
+# Uncomment to allow HR records to be deletable rather than just marking them as obsolete
+#settings.hrm.deletable = True
+# Uncomment to allow HRs to have multiple Job Roles in addition to their Job Title
+#settings.hrm.job_roles = True
+# Uncomment to hide the Staff resource
+#settings.hrm.show_staff = False
+# Uncomment to allow hierarchical categories of Skills, which each need their own set of competency levels.
+#settings.hrm.skill_types = True
+# Uncomment to disable Staff experience
+#settings.hrm.staff_experience = False
+# Uncomment to disable Volunteer experience
+#settings.hrm.vol_experience = False
+# Uncomment to show the Organisation name in HR represents
+#settings.hrm.show_organisation = True
+# Uncomment to disable the use of HR Certificates
+#settings.hrm.use_certificates = False
+# Uncomment to disable the use of HR Credentials
+#settings.hrm.use_credentials = False
+# Uncomment to disable the use of HR Description
+#settings.hrm.use_description = False
+# Uncomment to enable the use of HR Education
+#settings.hrm.use_education = True
+# Uncomment to disable the use of HR ID
+#settings.hrm.use_id = False
+# Uncomment to disable the use of HR Skills
+#settings.hrm.use_skills = False
+# Uncomment to disable the use of HR Teams
+#settings.hrm.use_teams = False
+# Uncomment to disable the use of HR Trainings
+#settings.hrm.use_trainings = False
+
+# Inventory Management
+#settings.inv.collapse_tabs = False
+# Use the term 'Order' instead of 'Shipment'
+#settings.inv.shipment_name = "order"
+#settings.inv.send_form_name = "Tally Out Sheet"
+#settings.inv.send_short_name = "TO"
+#settings.inv.send_ref_field_name = "Tally Out Number"
+#settings.inv.recv_form_name = "Acknowledgement Receipt for Donations Received Form"
+#settings.inv.recv_shortname = "ARDR"
+#settings.inv.shipment_types = {
+# 0: T("-"),
+# 1: T("Other Warehouse"),
+# 2: T("Donation"),
+# 3: T("Foreign Donation"),
+# 4: T("Local Purchases"),
+# 5: T("Confiscated Goods from Bureau Of Customs")
+# }
+
+# Requests Management
#settings.req.type_inv_label = T("Donations")
#settings.req.type_hrm_label = T("Volunteers")
# Allow the status for requests to be set manually,
@@ -272,69 +332,11 @@
# msg_record_deleted = T("Request for Volunteers Canceled"),
# msg_list_empty = T("No Requests for Volunteers"))
-# Inventory Management
-#settings.inv.collapse_tabs = False
-# Use the term 'Order' instead of 'Shipment'
-#settings.inv.shipment_name = "order"
-#settings.inv.send_form_name = "Tally Out Sheet"
-#settings.inv.send_short_name = "TO"
-#settings.inv.send_ref_field_name = "Tally Out Number"
-#settings.inv.recv_form_name = "Acknowledgement Receipt for Donations Received Form"
-#settings.inv.recv_shortname = "ARDR"
-#settings.inv.shipment_types = {
-# 0: T("-"),
-# 1: T("Other Warehouse"),
-# 2: T("Donation"),
-# 3: T("Foreign Donation"),
-# 4: T("Local Purchases"),
-# 5: T("Confiscated Goods from Bureau Of Customs")
-# }
-
# Supply
#settings.supply.use_alt_name = False
# Do not edit after deployment
#settings.supply.catalog_default = T("Default")
-# Organisation Management
-# Set the length of the auto-generated org/site code the default is 10
-#settings.org.site_code_len = 3
-# Uncomment to add summary fields for Organisations/Offices for # National/International staff
-#settings.org.summary = True
-
-# Human Resource Management
-# Uncomment to allow Staff & Volunteers to be registered without an email address
-#settings.hrm.email_required = False
-# Uncomment to allow HR records to be deletable rather than just marking them as obsolete
-#settings.hrm.deletable = True
-# Uncomment to allow HRs to have multiple Job Roles in addition to their Job Title
-#settings.hrm.job_roles = True
-# Uncomment to hide the Staff resource
-#settings.hrm.show_staff = False
-# Uncomment to allow hierarchical categories of Skills, which each need their own set of competency levels.
-#settings.hrm.skill_types = True
-# Uncomment to disable Staff experience
-#settings.hrm.staff_experience = False
-# Uncomment to disable Volunteer experience
-#settings.hrm.vol_experience = False
-# Uncomment to show the Organisation name in HR represents
-#settings.hrm.show_organisation = True
-# Uncomment to disable the use of HR Certificates
-#settings.hrm.use_certificates = False
-# Uncomment to disable the use of HR Credentials
-#settings.hrm.use_credentials = False
-# Uncomment to disable the use of HR Description
-#settings.hrm.use_description = False
-# Uncomment to enable the use of HR Education
-#settings.hrm.use_education = True
-# Uncomment to disable the use of HR ID
-#settings.hrm.use_id = False
-# Uncomment to disable the use of HR Skills
-#settings.hrm.use_skills = False
-# Uncomment to disable the use of HR Teams
-#settings.hrm.use_teams = False
-# Uncomment to disable the use of HR Trainings
-#settings.hrm.use_trainings = False
-
# Projects
# Uncomment this to use settings suitable for a global/regional organisation (e.g. DRR)
#settings.project.mode_3w = True
8 static/formats/s3csv/hrm/person.xsl
View
@@ -466,7 +466,7 @@
<xsl:call-template name="ContactInformation"/>
<!-- Address -->
- <xsl:if test="col[@field='Home Address']!=''">
+ <xsl:if test="col[@field='Home Address'] or col[@field='Home Postcode'] or col[@field='Home L4'] or col[@field='Home L3'] or col[@field='Home L2'] or col[@field='Home L1']">
<xsl:call-template name="Address">
<xsl:with-param name="address" select="col[@field='Home Address']/text()"/>
<xsl:with-param name="postcode" select="col[@field='Home Postcode']/text()"/>
@@ -479,7 +479,7 @@
</xsl:call-template>
</xsl:if>
- <xsl:if test="col[@field='Permanent Address']!=''">
+ <xsl:if test="col[@field='Permanent Address'] or col[@field='Permanent Postcode'] or col[@field='Permanent L4'] or col[@field='Permanent L3'] or col[@field='Permanent L2'] or col[@field='Permanent L1']">
<xsl:call-template name="Address">
<xsl:with-param name="address" select="col[@field='Permanent Address']/text()"/>
<xsl:with-param name="postcode" select="col[@field='Permanent Postcode']/text()"/>
@@ -538,7 +538,7 @@
</resource>
<!-- Locations -->
- <xsl:if test="col[@field='Home Address']!=''">
+ <xsl:if test="col[@field='Home Address'] or col[@field='Home Postcode'] or col[@field='Home L4'] or col[@field='Home L3'] or col[@field='Home L2'] or col[@field='Home L1']">
<xsl:call-template name="Locations">
<xsl:with-param name="address" select="col[@field='Home Address']/text()"/>
<xsl:with-param name="postcode" select="col[@field='Home Postcode']/text()"/>
@@ -552,7 +552,7 @@
<xsl:with-param name="lon" select="col[@field='Home Lon']/text()"/>
</xsl:call-template>
</xsl:if>
- <xsl:if test="col[@field='Permanent Address']!=''">
+ <xsl:if test="col[@field='Permanent Address'] or col[@field='Permanent Postcode'] or col[@field='Permanent L4'] or col[@field='Permanent L3'] or col[@field='Permanent L2'] or col[@field='Permanent L1']">
<xsl:call-template name="Locations">
<xsl:with-param name="address" select="col[@field='Permanent Address']/text()"/>
<xsl:with-param name="postcode" select="col[@field='Permanent Postcode']/text()"/>
4 static/formats/s3csv/inv/warehouse.xsl
View
@@ -321,8 +321,8 @@
</reference>
</xsl:otherwise>
</xsl:choose>
- <data field="name"><xsl:value-of select="$l3"/></data>
- <data field="level"><xsl:text>L3</xsl:text></data>
+ <data field="name"><xsl:value-of select="$l4"/></data>
+ <data field="level"><xsl:text>L4</xsl:text></data>
</resource>
</xsl:if>
98 static/formats/s3csv/member/person.xsl
View
@@ -280,7 +280,7 @@
<!-- ****************************************************************** -->
<xsl:template name="HomeAddress">
- <xsl:if test="col[@field='Home Address']!=''">
+ <xsl:if test="col[@field='Home Address'] or col[@field='Home Postcode'] or col[@field='Home L4'] or col[@field='Home L3'] or col[@field='Home L2'] or col[@field='Home L1']">
<resource name="pr_address">
<!-- Link to Location -->
<xsl:call-template name="LocationReference"/>
@@ -549,55 +549,53 @@
</xsl:if>
<!-- Address Location -->
- <xsl:if test="$Address!=''">
- <resource name="gis_location">
- <xsl:attribute name="tuid">
- <xsl:value-of select="$l5id"/>
- </xsl:attribute>
- <xsl:choose>
- <xsl:when test="$l4!=''">
- <reference field="parent" resource="gis_location">
- <xsl:attribute name="tuid">
- <xsl:value-of select="$l4id"/>
- </xsl:attribute>
- </reference>
- </xsl:when>
- <xsl:when test="$l3!=''">
- <reference field="parent" resource="gis_location">
- <xsl:attribute name="tuid">
- <xsl:value-of select="$l3id"/>
- </xsl:attribute>
- </reference>
- </xsl:when>
- <xsl:when test="$l2!=''">
- <reference field="parent" resource="gis_location">
- <xsl:attribute name="tuid">
- <xsl:value-of select="$l2id"/>
- </xsl:attribute>
- </reference>
- </xsl:when>
- <xsl:when test="$l1!=''">
- <reference field="parent" resource="gis_location">
- <xsl:attribute name="tuid">
- <xsl:value-of select="$l1id"/>
- </xsl:attribute>
- </reference>
- </xsl:when>
- <xsl:otherwise>
- <reference field="parent" resource="gis_location">
- <xsl:attribute name="uuid">
- <xsl:value-of select="$country"/>
- </xsl:attribute>
- </reference>
- </xsl:otherwise>
- </xsl:choose>
- <data field="name"><xsl:value-of select="$Address"/></data>
- <data field="addr_street"><xsl:value-of select="$Address"/></data>
- <data field="addr_postcode"><xsl:value-of select="col[@field='Home Postcode']"/></data>
- <data field="lat"><xsl:value-of select="col[@field='Home Lat']"/></data>
- <data field="lon"><xsl:value-of select="col[@field='Home Lon']"/></data>
- </resource>
- </xsl:if>
+ <resource name="gis_location">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$l5id"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$l4!=''">
+ <reference field="parent" resource="gis_location">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$l4id"/>
+ </xsl:attribute>
+ </reference>
+ </xsl:when>
+ <xsl:when test="$l3!=''">
+ <reference field="parent" resource="gis_location">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$l3id"/>
+ </xsl:attribute>
+ </reference>
+ </xsl:when>
+ <xsl:when test="$l2!=''">
+ <reference field="parent" resource="gis_location">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$l2id"/>
+ </xsl:attribute>
+ </reference>
+ </xsl:when>
+ <xsl:when test="$l1!=''">
+ <reference field="parent" resource="gis_location">
+ <xsl:attribute name="tuid">
+ <xsl:value-of select="$l1id"/>
+ </xsl:attribute>
+ </reference>
+ </xsl:when>
+ <xsl:otherwise>
+ <reference field="parent" resource="gis_location">
+ <xsl:attribute name="uuid">
+ <xsl:value-of select="$country"/>
+ </xsl:attribute>
+ </reference>
+ </xsl:otherwise>
+ </xsl:choose>
+ <data field="name"><xsl:value-of select="$Address"/></data>
+ <data field="addr_street"><xsl:value-of select="$Address"/></data>
+ <data field="addr_postcode"><xsl:value-of select="col[@field='Home Postcode']"/></data>
+ <data field="lat"><xsl:value-of select="col[@field='Home Lat']"/></data>
+ <data field="lon"><xsl:value-of select="col[@field='Home Lon']"/></data>
+ </resource>
</xsl:template>
4 static/formats/s3csv/org/office.xsl
View
@@ -321,8 +321,8 @@
</reference>
</xsl:otherwise>
</xsl:choose>
- <data field="name"><xsl:value-of select="$l3"/></data>
- <data field="level"><xsl:text>L3</xsl:text></data>
+ <data field="name"><xsl:value-of select="$l4"/></data>
+ <data field="level"><xsl:text>L4</xsl:text></data>
</resource>
</xsl:if>
Please sign in to comment.
Something went wrong with that request. Please try again.