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/nursix/eden

  • Loading branch information...
commit 2a41f738f1846e451e06b384ea6f15c430e4ea51 2 parents 5f65b97 + 93e7a5e
@flavour authored
View
8 modules/eden/asset.py
@@ -563,11 +563,11 @@ def asset_onaccept(form):
vars = form.vars
atable = db.asset_asset
- # Update asset realm_entity and components' realm_entity
+ # Update asset realm_entity and components' realm_entity
auth.set_realm_entity(atable, vars, force_update=True)
- auth.set_component_realm_entity(atable, vars,
- update_components = ["log", "presence"]
- )
+ #auth.set_component_realm_entity(atable, vars,
+ #update_components = ["log", "presence"]
+ #)
site_id = vars.get("site_id", None)
if site_id:
View
18 modules/eden/hrm.py
@@ -1151,7 +1151,7 @@ def model(self):
super_link = self.super_link
root_org = auth.root_org()
-
+
group = current.request.get_vars.get("group", None)
# ---------------------------------------------------------------------
@@ -3236,7 +3236,7 @@ def hrm_human_resource_onaccept(form):
s3db = current.s3db
auth = current.auth
setting = current.deployment_settings
-
+
htable = db.hrm_human_resource
record = db(htable.id == id).select(htable.id,
htable.type,
@@ -3253,9 +3253,9 @@ def hrm_human_resource_onaccept(form):
# Affiliation, record ownership and component ownership
s3db.pr_update_affiliations(htable, record)
- auth.s3_set_record_owner(htable, record, force_update=True)
- auth.set_component_realm_entity(htable, vars,
- update_components = ["presence"])
+ #auth.s3_set_record_owner(htable, record, force_update=True)
+ #auth.set_component_realm_entity(htable, vars,
+ #update_components = ["presence"])
# realm_entity for the pr_person record
ptable = s3db.pr_person
@@ -3266,12 +3266,12 @@ def hrm_human_resource_onaccept(form):
organisation_id = record.organisation_id
entity = s3db.pr_get_pe_id("org_organisation", organisation_id)
if entity:
- auth.set_realm_entity(ptable, person,
+ auth.set_realm_entity(ptable, person,
entity = entity,
force_update = True)
- auth.set_component_realm_entity(ptable, person,
- entity = entity,
- update_components = ["presence"])
+ #auth.set_component_realm_entity(ptable, person,
+ #entity = entity,
+ #update_components = ["presence"])
site_id = record.site_id
site_contact = record.site_contact
View
40 modules/eden/inv.py
@@ -330,7 +330,7 @@ def model(self):
# -------------------------------------------------------------------------
@staticmethod
def inv_warehouse_onaccept(form):
- """
+ """
* Update Affiliation and Realms
"""
@@ -341,25 +341,25 @@ def inv_warehouse_onaccept(form):
# Affiliation, record ownership and component ownership
s3db.pr_update_affiliations(wtable, vars)
- auth.s3_set_record_owner(wtable, vars, force_update=True)
- auth.set_component_realm_entity(wtable, vars,
- update_components = ["contact_emergency",
- "physical_description",
- "config",
- "image",
- "req",
- "send",
- "human_resource_site",
- "note",
- "contact",
- "role",
- "asset",
- "commit",
- "inv_item",
- "document",
- "recv",
- "address",
- ])
+ #auth.s3_set_record_owner(wtable, vars, force_update=True)
+ #auth.set_component_realm_entity(wtable, vars,
+ #update_components = ["contact_emergency",
+ #"physical_description",
+ #"config",
+ #"image",
+ #"req",
+ #"send",
+ #"human_resource_site",
+ #"note",
+ #"contact",
+ #"role",
+ #"asset",
+ #"commit",
+ #"inv_item",
+ #"document",
+ #"recv",
+ #"address",
+ #])
# ---------------------------------------------------------------------
@staticmethod
View
10 modules/eden/member.py
@@ -338,9 +338,9 @@ def member_onaccept(form):
# Affiliation, record ownership and component ownership
s3db.pr_update_affiliations(mtable, record)
- auth.s3_set_record_owner(mtable, record, force_update=True)
- auth.set_component_realm_entity(mtable, record)
-
+ #auth.s3_set_record_owner(mtable, record, force_update=True)
+ #auth.set_component_realm_entity(mtable, record)
+
# realm_entity for the pr_person record
person_id = record.person_id
person = Storage(id = person_id)
@@ -349,10 +349,10 @@ def member_onaccept(form):
organisation_id = record.organisation_id
entity = s3db.pr_get_pe_id("org_organisation", organisation_id)
if entity:
- auth.set_realm_entity(ptable, person,
+ auth.set_realm_entity(ptable, person,
entity = entity,
force_update = True)
- #auth.set_component_realm_entity(ptable, person,
+ #auth.set_component_realm_entity(ptable, person,
# entity = entity,
# update_components = [])
View
44 modules/eden/org.py
@@ -1984,9 +1984,9 @@ def org_office_represent(id, row=None):
# ---------------------------------------------------------------------
@staticmethod
def org_office_onaccept(form):
- """
+ """
* Update Affiliation and Realms
- * Process injected fields
+ * Process injected fields
"""
auth = current.auth
@@ -1996,25 +1996,25 @@ def org_office_onaccept(form):
# Affiliation, record ownership and component ownership
s3db.pr_update_affiliations(otable, vars)
- auth.s3_set_record_owner(otable, vars, force_update=True)
- auth.set_component_realm_entity(otable, vars,
- update_components = ["contact_emergency",
- "physical_description",
- "config",
- "image",
- "req",
- "send",
- "human_resource_site",
- "note",
- "contact",
- "role",
- "asset",
- "commit",
- "inv_item",
- "document",
- "recv",
- "address",
- ])
+ #auth.s3_set_record_owner(otable, vars, force_update=True)
+ #auth.set_component_realm_entity(otable, vars,
+ #update_components = ["contact_emergency",
+ #"physical_description",
+ #"config",
+ #"image",
+ #"req",
+ #"send",
+ #"human_resource_site",
+ #"note",
+ #"contact",
+ #"role",
+ #"asset",
+ #"commit",
+ #"inv_item",
+ #"document",
+ #"recv",
+ #"address",
+ #])
if current.deployment_settings.get_org_summary():
@@ -2033,7 +2033,7 @@ def org_office_onaccept(form):
international_staff = vars.international_staff
else:
international_staff = None
-
+
if existing:
db(query).update(national_staff=national_staff,
international_staff=international_staff
View
28 modules/eden/project.py
@@ -751,21 +751,21 @@ def project_project_onaccept(form):
ptable = db.project_project
otable = db.project_organisation
vars = form.vars
- # Update asset realm_entity and components' realm_entity
+ # Update asset realm_entity and components' realm_entity
auth.set_realm_entity(ptable, vars, force_update=True)
- auth.set_component_realm_entity(ptable, vars,
- update_components = ["human_resource",
- "task",
- "organisation",
- "activity",
- "annual_budget",
- "beneficiary",
- "location",
- "milestone",
- "theme_percentage",
- "document",
- "image",
- ])
+ #auth.set_component_realm_entity(ptable, vars,
+ #update_components = ["human_resource",
+ #"task",
+ #"organisation",
+ #"activity",
+ #"annual_budget",
+ #"beneficiary",
+ #"location",
+ #"milestone",
+ #"theme_percentage",
+ #"document",
+ #"image",
+ #])
lead_role = current.deployment_settings.get_project_organisation_lead_role()
View
12 modules/eden/supply.py
@@ -168,7 +168,7 @@ def model(self):
sortby="name",
requires = IS_NULL_OR(
IS_ONE_OF( # Restrict to catalogs the user can update
- db(current.auth.s3_accessible_query("update", table)),
+ db(current.auth.s3_accessible_query("update", table)),
"supply_catalog.id",
"%(name)s",
sort=True,
@@ -192,7 +192,7 @@ def model(self):
# Catalog Items as component of Catalogs
add_component("supply_catalog_item", supply_catalog="catalog_id")
-
+
# =====================================================================
# Item Category
#
@@ -276,7 +276,7 @@ def model(self):
'FieldResource':'item_category',
})
})''')
-
+
# Categories as component of Categories
add_component("supply_item_category",
@@ -1152,13 +1152,13 @@ def supply_item_onaccept(form):
catalog_id = vars.catalog_id
catalog_item_id = None
-
+
citable = db.supply_catalog_item
query = (citable.item_id == item_id) & \
(citable.deleted == False )
rows = db(citable).select(citable.id)
if not len(rows):
- # Create supply_catalog_item
+ # Create supply_catalog_item
catalog_item_id = \
citable.insert(catalog_id = catalog_id,
item_category_id = vars.item_category_id,
@@ -1173,7 +1173,7 @@ def supply_item_onaccept(form):
item_category_id = vars.item_category_id,
item_id = item_id
)
- auth.s3_set_record_owner(citable, catalog_item_id, force_update=True)
+ #auth.s3_set_record_owner(citable, catalog_item_id, force_update=True)
# Update UM
um = vars.um or db.supply_item.um.default
View
76 modules/s3/s3aaa.py
@@ -3412,7 +3412,7 @@ def s3_update_record_owner(self, table, record, **fields):
data[key] = fields[key]
if data:
success = current.db(table._id == record_id).update(**data)
- self.update_super_realm(table, record, **data)
+ self.update_shared_fields(table, record, **data)
else:
return None
@@ -3608,7 +3608,7 @@ def set_realm_entity(self, table, records, entity=0, force_update=False):
if realm_entity != 0 and force_update and query is not None:
data = {REALM:realm_entity}
db(query).update(**data)
- self.update_super_realm(table, query, **data)
+ self.update_shared_fields(table, query, **data)
return
# Find the records
@@ -3649,7 +3649,7 @@ def set_realm_entity(self, table, records, entity=0, force_update=False):
entity=realm_entity)
data = {REALM:realm_entity}
db(q).update(**data)
- self.update_super_realm(table, record_id, **data)
+ self.update_shared_fields(table, record_id, **data)
return
@@ -3716,53 +3716,53 @@ def get_realm_entity(self, table, record, entity=0):
return realm_entity
# -------------------------------------------------------------------------
- def set_component_realm_entity(self, table, record, entity=0,
- force_update=True,
- update_components=[]):
- """
- Update the realm entity for a record and it's components
+ #def set_component_realm_entity(self, table, record, entity=0,
+ #force_update=True,
+ #update_components=[]):
+ #"""
+ #Update the realm entity for a record and it's components
- @param table: the table
- @param record: the record (as Row or dict)
- @param entity: the entity (pe_id)
- """
+ #@param table: the table
+ #@param record: the record (as Row or dict)
+ #@param entity: the entity (pe_id)
+ #"""
- s3db = current.s3db
+ #s3db = current.s3db
- if not entity:
- entity = self.get_realm_entity(table, record)
+ #if not entity:
+ #entity = self.get_realm_entity(table, record)
- # Find Record Components
- components = s3db.get_components(table)
+ ## Find Record Components
+ #components = s3db.get_components(table)
- # Update Components
- for component in update_components:
- c = components[component]
- if not c:
- continue
+ ## Update Components
+ #for component in update_components:
+ #c = components[component]
+ #if not c:
+ #continue
- # @ToDo: Replace with:
- #join = c.get_join()
- #query = join & (table._id == record.id)
- # But this requires a resource
- if c.linktable:
- query = (c.linktable[c.lkey] == record.id) & \
- (c.linktable[c.rkey] == c.table[c.fkey])
- rows = current.db(query).select(c.table.id)
- else:
- rows = (c.table[c.fkey] == record.id)
+ ## @ToDo: Replace with:
+ ##join = c.get_join()
+ ##query = join & (table._id == record.id)
+ ## But this requires a resource
+ #if c.linktable:
+ #query = (c.linktable[c.lkey] == record.id) & \
+ #(c.linktable[c.rkey] == c.table[c.fkey])
+ #rows = current.db(query).select(c.table.id)
+ #else:
+ #rows = (c.table[c.fkey] == record.id)
- self.set_realm_entity(c.table, rows, entity,
- force_update=force_update)
+ #self.set_realm_entity(c.table, rows, entity,
+ #force_update=force_update)
- # @ToDo: Check if we need to update component Super Links
+ ## @ToDo: Check if we need to update component Super Links
- # Update Super Links
- s3db.update_super(table, record)
+ ## Update Super Links
+ #s3db.update_super(table, record)
# -------------------------------------------------------------------------
- def update_super_realm(self, table, record, **data):
+ def update_shared_fields(self, table, record, **data):
"""
Update the shared fields in data in all super-entity rows linked
with this record.
Please sign in to comment.
Something went wrong with that request. Please try again.