Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/michaelhowden/eden
Browse files Browse the repository at this point in the history
  • Loading branch information
flavour committed Oct 8, 2012
2 parents 9b64fe1 + 8c7c67e commit d0deb01
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 72 deletions.
4 changes: 4 additions & 0 deletions controllers/asset.py
Expand Up @@ -41,6 +41,10 @@ def asset():
return s3db.asset_controller()

# =============================================================================
def supplier():
current.request.get_vars["organisation.organisation_type_id$name"] = "Supplier"
return s3db.org_organisation_controller()
# =============================================================================
def item():
""" RESTful CRUD controller """

Expand Down
4 changes: 2 additions & 2 deletions controllers/project.py
Expand Up @@ -232,7 +232,7 @@ def postp(r, output):
elif r.component_name == "beneficiary":
# Set the minimum end_date to the same as the start_date
s3.jquery_ready.append(
'''S3.start_end_date('project_beneficiary_start_date','project_beneficiary_end_date')''')
'''S3.start_end_date('project_beneficiary_date','project_beneficiary_end_date')''')
return output
s3.postp = postp

Expand Down Expand Up @@ -458,7 +458,7 @@ def location():
def prep(r):
if r.interactive:
if r.record and r.record.project_id:
sector_ids = ptable[r.record.project_id].sector_id
sector_ids = s3db.project_project[r.record.project_id].sector_id
else:
sector_ids = []
set_project_multi_activity_type_id_requires(sector_ids)
Expand Down
96 changes: 49 additions & 47 deletions modules/eden/asset.py
Expand Up @@ -647,6 +647,8 @@ def asset_log_onaccept(form):
atable = s3db.asset_asset
tracker = S3Tracker()
asset_tracker = tracker(atable, asset_id)

thistime = request.now

if status == ASSET_LOG_SET_BASE:
# Set Base Location
Expand Down Expand Up @@ -892,54 +894,54 @@ def asset_rheader(r):
current_log = asset_get_current_log(record.id)
status = current_log.status

if record.location_id:
# A Base Site has been set
# Return functionality removed - as it doesn't set site_id & organisation_id in the logs
#if status == ASSET_LOG_ASSIGN:
# asset_action_btns += [ A( T("Return"),
# _href = URL(f=func,
# args = [record.id, "log", "create"],
# vars = dict(status = ASSET_LOG_RETURN)
# ),
# _class = "action-btn"
# )
# ]
if status < ASSET_LOG_DONATED:
# @ToDo: deployment setting to prevent assigning assets before returning them
# The Asset is available for assignment (not disposed)
asset_action_btns += [ A( T("Assign to Person"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = dict(status = ASSET_LOG_ASSIGN,
type = "person")
),
_class = "action-btn"
),
A( T("Assign to Facility/Site"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = dict(status = ASSET_LOG_ASSIGN,
type = "site")
),
_class = "action-btn"
),
A( T("Assign to Organization"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = dict(status = ASSET_LOG_ASSIGN,
type = "organisation")
),
_class = "action-btn"
),
]
asset_action_btns += [ A( T("Update Status"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = None
#if record.location_id:
# A Base Site has been set
# Return functionality removed - as it doesn't set site_id & organisation_id in the logs
#if status == ASSET_LOG_ASSIGN:
# asset_action_btns += [ A( T("Return"),
# _href = URL(f=func,
# args = [record.id, "log", "create"],
# vars = dict(status = ASSET_LOG_RETURN)
# ),
# _class = "action-btn"
# )
# ]
if status < ASSET_LOG_DONATED:
# @ToDo: deployment setting to prevent assigning assets before returning them
# The Asset is available for assignment (not disposed)
asset_action_btns += [ A( T("Assign to Person"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = dict(status = ASSET_LOG_ASSIGN,
type = "person")
),
_class = "action-btn"
),
]
_class = "action-btn"
),
A( T("Assign to Facility/Site"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = dict(status = ASSET_LOG_ASSIGN,
type = "site")
),
_class = "action-btn"
),
A( T("Assign to Organization"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = dict(status = ASSET_LOG_ASSIGN,
type = "organisation")
),
_class = "action-btn"
),
]
asset_action_btns += [ A( T("Update Status"),
_href = URL(f=func,
args = [record.id, "log", "create"],
vars = None
),
_class = "action-btn"
),
]

table = r.table
ltable = s3db.asset_log
Expand Down
9 changes: 5 additions & 4 deletions modules/eden/hrm.py
Expand Up @@ -127,6 +127,7 @@ def model(self):
#widget=S3OrganisationAutocompleteWidget(
# default_from_profile=True),
empty=False,
required = True,
script = SCRIPT('''
$(document).ready(function(){
S3FilterFieldChange({
Expand Down Expand Up @@ -3270,10 +3271,10 @@ def hrm_human_resource_onaccept(form):
ptable = s3db.pr_person
person_id = record.person_id
person = Storage(id = person_id)
if setting.get_auth_person_realm_human_resource_org():
# Set pr_person.realm_entity to the human_resource's organisation pe_id
organisation_id = record.organisation_id
entity = s3db.pr_get_pe_id("org_organisation", organisation_id)
if setting.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,
Expand Down
16 changes: 3 additions & 13 deletions modules/eden/menus.py
Expand Up @@ -441,33 +441,23 @@ def asset(self):
M("Report", m="report"),
M("Import", m="import", p="create"),
),
M("Items", c="supply", f="item")(
M("Items", f="item")(
M("New", m="create"),
M("List All"),
M("Search", m="search"),
M("Report", m="report"),
M("Import", m="import", p="create"),
),
M("Catalogs", c="supply", f="catalog")(
M("New", m="create"),
M("List All"),
#M("Search", m="search"),
),
M("Item Categories", c="supply", f="item_category")(
M("Item Categories", f="item_category")(
M("New", m="create"),
M("List All"),
),
M("Suppliers", c="inv", f="supplier")(
M("Suppliers", f="supplier")(
M("New", m="create"),
M("List All"),
M("Search", m="search"),
M("Import", m="import", p="create"),
),
M("Facilities", c="inv", f="facility")(
M("New", m="create"),
M("List All"),
#M("Search", m="search"),
),
)

# -------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions modules/s3/s3widgets.py
Expand Up @@ -3480,6 +3480,7 @@ def s3_checkboxes_widget(field,
values = not isinstance(value, (list, tuple)) and [value] or value
values = [str(v) for v in values]

attributes["_name"] = "%s_widget" % field.name
if "_class" not in attributes:
attributes["_class"] = "s3-checkboxes-widget"

Expand Down
4 changes: 2 additions & 2 deletions modules/s3cfg.py
Expand Up @@ -228,12 +228,12 @@ def get_auth_record_approval_required_for(self):
def get_auth_realm_entity(self):
""" Hook to determine the owner entity of a record """
return self.auth.get("realm_entity", None)
def get_auth_person_realm_human_resource_org(self):
def get_auth_person_realm_human_resource_site(self):
"""
Sets pr_person.realm_entity to
organisation.pe_id of hrm_human_resource
"""
return self.auth.get("person_realm_human_resource_org", False)
return self.auth.get("person_realm_human_resource_site", False)
def get_auth_person_realm_member_org(self):
"""
Sets pr_person.realm_entity to
Expand Down
8 changes: 8 additions & 0 deletions private/templates/IFRC/auth_roles.csv
Expand Up @@ -162,11 +162,19 @@ project_reader,Project Reader,,pr,,,,READ,,,,,
project_reader,Project Reader,,hrm,person_search,,,READ,,,,,
project_data_entry,Project Data Entry,,project,,,,READ|CREATE,READ|CREATE|UPDATE,,,,
project_data_entry,Project Data Entry,,project,partner,,,READ,,,,,
project_data_entry,Project Data Entry,,,,project_theme,,READ,,,,,
project_data_entry,Project Data Entry,,,,project_hazard,,READ,,,,,
project_data_entry,Project Data Entry,,,,project_activity_type,,READ,,,,,
project_data_entry,Project Data Entry,,,,project_beneficiary_type,,READ,,,,,
project_data_entry,Project Data Entry,,org,,,,READ,,,,,Used to filter organisation fields
project_data_entry,Project Data Entry,,,,org_organisation,,READ|UPDATE,,,,,Used to filter organisation fields
project_data_entry,Project Data Entry,,pr,,,,READ,,,,,
project_data_entry,Project Data Entry,,hrm,person_search,,,READ,,,,,
project_editor,Project Editor,,project,,,,READ|CREATE|UPDATE,,,,,
project_editor,Project Editor,,,,project_theme,,READ,,,,,
project_editor,Project Editor,,,,project_hazard,,READ,,,,,
project_editor,Project Editor,,,,project_activity_type,,READ,,,,,
project_editor,Project Editor,,,,project_beneficiary_type,,READ,,,,,
project_editor,Project Editor,,org,,,,READ|CREATE|UPDATE,,,,,
project_editor,Project Editor,,pr,,,,READ,,,,,
project_editor,Project Editor,,hrm,person_search,,,READ,,,,,
Expand Down
3 changes: 2 additions & 1 deletion private/templates/IFRC/config.py
Expand Up @@ -48,7 +48,7 @@
settings.security.map = True

# Owner Entity
settings.auth.person_realm_human_resource_org = True
settings.auth.person_realm_human_resource_site = True
settings.auth.person_realm_member_org = True

def ifrc_realm_entity(table, row):
Expand Down Expand Up @@ -82,6 +82,7 @@ def ifrc_realm_entity(table, row):
pr_identity = "person_id",
pr_education = "person_id",
pr_note = "person_id",
hrm_human_resource = "site_id",
inv_recv = "site_id",
inv_recv_item = "req_id",
inv_track_item = "track_org_id",
Expand Down
2 changes: 1 addition & 1 deletion private/templates/IFRC/project_theme.csv
Expand Up @@ -43,7 +43,7 @@ Partnerships ,,,,,,,,
PASSA,,,,,,,Yes,
PMER development,,,,Yes,,,,
Private-Public Partnerships,"corporate social responsibility, private sector engagement in DRR",,,,,,,
Programme planning and management ,,,,Yes,,,,
Programme Planning and Management ,,,,Yes,,,,
Protecting Livelihoods,,,,,,Yes,,
Psychosocial Support,,Yes,,,,,,
Recovery,"building back better, long-term recovery and reconstruction, rehabilitation, shelter",,,,,,,
Expand Down
5 changes: 3 additions & 2 deletions static/themes/default/widgets.css
Expand Up @@ -863,9 +863,10 @@ ul.x-tree-root-ct {
margin-left: 2em;
}

.search_select_letter_widget label,
.s3-checkboxes-widget label {
div.form-container form fieldset .search_select_letter_widget label,
div.form-container form fieldset .s3-checkboxes-widget label {
white-space: nowrap;
text-align: left;
}
/* Checkboxes with title attributes */
/*
Expand Down

0 comments on commit d0deb01

Please sign in to comment.