diff --git a/VERSION b/VERSION index 17faba41f9..2988a1def9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -nursix-1.1.0-devel-2853-ga6fbbfe (2015-10-02 13:10:53) +5826631 (2015-10-02 18:04:14) \ No newline at end of file diff --git a/controllers/project.py b/controllers/project.py index b62b8918e2..3ef1d645d6 100644 --- a/controllers/project.py +++ b/controllers/project.py @@ -104,6 +104,28 @@ def prep(r): field.default = organisation_id field.readable = field.writable = False + elif r.method == "details": + # Until we can automate this inside s3profile + # - remove the fkey from the list_fields + configure = s3db.configure + get_config = s3db.get_config + define_resource = s3db.resource + for tablename in ("project_organisation", + "project_location", + "project_beneficiary", + "project_human_resource_project", + ): + s3db.table(tablename) + list_fields = get_config(tablename, "list_fields") + if not list_fields: + list_fields = define_resource(tablename).list_fields() + try: + list_fields.remove("project_id") + except: + # Already removed + pass + configure(tablename, list_fields=list_fields) + if r.id: r.table.human_resource_id.represent = \ s3db.hrm_HumanResourceRepresent(show_link=True) @@ -292,7 +314,7 @@ def prep(r): ) ) - elif component_name == "human_resource": + elif component_name in ("human_resource", "human_resource_project"): htable = s3db.hrm_human_resource htable.person_id.represent = \ @@ -325,6 +347,37 @@ def prep(r): sort=True ) + # @ToDo: + #if settings.has_module("budget"): + # from s3 import S3SQLCustomForm, S3SQLInlineComponent + # field = s3db.budget_allocation.budget_entity_id + # field.readable = field.writable = True + # field.requires = S3Represent(lookup="budget_budget", key="budget_entity_id") + # field.requires = IS_ONE_OF() + # + # crud_form = S3SQLCustomForm("project_id", + # "human_resource_id", + # "status", + # S3SQLInlineComponent("allocation", + # label = T("Budget"), + # fields = ["budget_entity_id", + # "start_date", + # "end_date", + # "daily_cost", + # ], + # ), + # ) + # s3db.configure("project_human_resoruce_project", + # crud_form = crud_form, + # list_fields = [#"project_id", # Not being dropped in component view + # "human_resource_id", + # "status", + # "allocation.budget_entity_id", + # "allocation.start_date", + # "allocation.end_date", + # "allocation.daily_cost", + # ], + elif component_name == "document": # Hide unnecessary fields dtable = component.table diff --git a/languages/es.py b/languages/es.py index 77ffc9d240..b3a297441d 100644 --- a/languages/es.py +++ b/languages/es.py @@ -342,7 +342,8 @@ 'Add Level 1 Assessment': 'Añadir evaluación de nivel 1', 'Add Level 2 Assessment': 'Añadir evaluación de nivel 2', 'Add Line': 'Añadir Línea', -'Add Locations': 'Añadir ubicaciones', +'Add Location': 'Añadir Ubicacion', +'Add Locations': 'Añadir Ubicaciones', 'Add Log Entry': 'Añadir Entrada de Registro', 'Add Member': 'Añadir Miembro', 'Add Membership': 'Añadir Membresía', @@ -1316,6 +1317,7 @@ 'Communication': 'Comunicación', 'Communications': 'comunicaciones', 'Communities': 'Comunidades', +'Community': 'Comunidad', 'Community Action Planning': 'Planificación de Acción Comunitaria', 'Community Based Health and First Aid (CBHFA)': 'Basado en la Comunidad de la Salud y Primeros Auxilios (SPAC)', 'Community Centre': 'Centro de la comunidad', @@ -3431,6 +3433,7 @@ 'Layout': 'Diseño', 'Leader': 'Líder', 'Lebanon': 'Líbano', +'Left': 'Salido', 'Left-to-Right': 'De izquierda a derecha', 'Legend Format': 'Formato de la leyenda', 'Length (m)': 'Largo (m)', @@ -4142,6 +4145,7 @@ 'No Level 2 Assessments currently registered': 'No hay evaluaciones nivel 2 actualmente registradas', 'No Locations currently available': 'No hay ubicaciones disponibles en la actualidad', 'No Locations currently registered': 'No existen lugares actualmente registrados', +'No Locations Found': 'Ninguna ubicaciones encontrada', 'No Map Profiles currently defined': 'Sin configuraciones de correlación actualmente definidas', 'No Map Profiles currently registered in this event': 'Sin configuraciones de correlación actualmente definidas en este evento', 'No Map Profiles currently registered in this scenario': 'Sin configuraciones de correlación actualmente registradas en este escenario', diff --git a/modules/s3/s3profile.py b/modules/s3/s3profile.py index 397af5aedc..347288a25e 100644 --- a/modules/s3/s3profile.py +++ b/modules/s3/s3profile.py @@ -551,15 +551,12 @@ def _datatable(self, r, widget, **attr): tablename = widget.get("tablename") resource, context = self._resolve_context(r, tablename, context) - # Define target resource - table = resource.table - get_config = resource.get_config - # List fields - list_fields = widget.get("list_fields", - get_config("list_fields", None)) + list_fields = widget.get("list_fields") if not list_fields: - list_fields = [f for f in table.fields if table[f].readable] + # @ToDo: Set the parent so that the fkey gets removed from the list_fields + #resource.parent = s3db.resource("") + list_fields = resource.list_fields() # Widget filter option widget_filter = widget.get("filter") @@ -621,7 +618,7 @@ def default_orderby(): # ORDERBY fallbacks: widget->resource->default orderby = widget.get("orderby") if not orderby: - orderby = get_config("orderby") + orderby = resource.get_config("orderby") if not orderby: orderby = default_orderby() @@ -716,7 +713,7 @@ def default_orderby(): if not orderby: orderby = widget.get("orderby") if not orderby: - orderby = get_config("orderby") + orderby = resource.get_config("orderby") if not orderby: orderby = default_orderby() diff --git a/modules/s3/s3rest.py b/modules/s3/s3rest.py index 0c29634146..811b27eb80 100644 --- a/modules/s3/s3rest.py +++ b/modules/s3/s3rest.py @@ -215,7 +215,10 @@ def __init__(self, tablename = "%s_%s" % (self.prefix, self.name) - if self.method == "review": + if not current.deployment_settings.get_auth_record_approval(): + # Record Approval is off + approved, unapproved = True, True + elif self.method == "review": approved, unapproved = False, True elif auth.s3_has_permission("review", tablename, self.id): # Approvers should be able to edit records during review diff --git a/modules/s3/s3xml.py b/modules/s3/s3xml.py index 86c3232cdc..221378d50c 100644 --- a/modules/s3/s3xml.py +++ b/modules/s3/s3xml.py @@ -1009,6 +1009,7 @@ def gis_encode(self, LatLon = latlons[tablename].get(record_id, None) if LatLon: # @ToDo: Support records with multiple locations + # via making these also use the map element lat = LatLon[0] lon = LatLon[1] if lat is not None and lon is not None: diff --git a/modules/s3db/project.py b/modules/s3db/project.py index e11436df34..5873baee34 100644 --- a/modules/s3db/project.py +++ b/modules/s3db/project.py @@ -2750,6 +2750,7 @@ def model(self): ), Field("status", "integer", default = 1, + label = T("Status"), represent = lambda opt: \ status_opts.get(opt, current.messages.UNKNOWN_OPT), requires = IS_IN_SET(status_opts), @@ -2769,32 +2770,7 @@ def model(self): msg_record_deleted = T("Human Resource unassigned"), msg_list_empty = T("No Human Resources currently assigned to this project")) - if settings.has_module("budget"): - crud_form = S3SQLCustomForm("project_id", - "human_resource_id", - "status", - S3SQLInlineComponent("allocation", - label = T("Budget"), - fields = ["budget_id", - "start_date", - "end_date", - "daily_cost", - ], - ), - ) - else: - crud_form = None - self.configure(tablename, - crud_form = crud_form, - list_fields = [#"project_id", # Not being dropped in component view - "human_resource_id", - "status", - "allocation.budget_id", - "allocation.start_date", - "allocation.end_date", - "allocation.daily_cost", - ], onvalidation = self.project_human_resource_onvalidation, super_entity = "budget_cost_item", ) @@ -2806,16 +2782,17 @@ def model(self): @staticmethod def project_human_resource_onvalidation(form): """ - Prevent the same hrm_human_resource record being added more than - once. + Prevent the same human_resource record being added more than once """ - # The project human resource table hr = current.s3db.project_human_resource_project # Fetch the first row that has the same project and human resource ids - query = (hr.human_resource_id == form.vars.human_resource_id) & \ - (hr.project_id == form.request_vars.project_id) + # (which isn't this record!) + form_vars = form.request_vars + query = (hr.human_resource_id == form_vars.human_resource_id) & \ + (hr.project_id == form_vars.project_id) & \ + (hr.id != form_vars.id) row = current.db(query).select(hr.id, limitby=(0, 1)).first() @@ -9093,12 +9070,12 @@ def dt_row_actions(component): # NB T() here to prevent requiring an extra translation of 'Add ' label_create = T("Add %(staff)s") % dict(staff=STAFF), type = "datatable", - actions = dt_row_actions("human_resource"), - tablename = "hrm_human_resource", + actions = dt_row_actions("human_resource_project"), + tablename = "project_human_resource_project", context = "project", create_controller = "project", create_function = "project", - create_component = "human_resource", + create_component = "human_resource_project", pagesize = None, # all records ) profile_widgets.append(hr_widget) diff --git a/modules/templates/RMSAmericas/auth_roles.csv b/modules/templates/RMSAmericas/auth_roles.csv index d4eecacd2b..eca357dce9 100644 --- a/modules/templates/RMSAmericas/auth_roles.csv +++ b/modules/templates/RMSAmericas/auth_roles.csv @@ -84,6 +84,7 @@ ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all recor ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_status,,READ,,,,, ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_theme,,READ,,,,, ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_goal,,READ|CREATE|UPDATE|DELETE,,,,, +ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_human_resource_project,,READ|CREATE|UPDATE|DELETE,,,,, ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_location,,READ|CREATE|UPDATE|DELETE,,,,, ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_outcome,,READ|CREATE|UPDATE|DELETE,,,,, ORG_ADMIN,Organisation Admin,Can manage Organisation Users and control all record permissions,,,project_output,,READ|CREATE|UPDATE|DELETE,,,,, @@ -118,6 +119,7 @@ monitoring_evaluation,M&E,,,,project_hazard,,READ,,,,, monitoring_evaluation,M&E,,,,project_status,,READ,,,,, monitoring_evaluation,M&E,,,,project_theme,,READ,,,,, monitoring_evaluation,M&E,,,,project_goal,,READ|CREATE|UPDATE|DELETE,,,,, +monitoring_evaluation,M&E,,,,project_human_resource_project,,READ|CREATE|UPDATE|DELETE,,,,, monitoring_evaluation,M&E,,,,project_location,,READ|CREATE|UPDATE,,,,, monitoring_evaluation,M&E,,,,project_outcome,,READ|CREATE|UPDATE|DELETE,,,,, monitoring_evaluation,M&E,,,,project_output,,READ|CREATE|UPDATE|DELETE,,,,, @@ -165,6 +167,7 @@ project_manager,Project Manager,,,,project_hazard,,READ,,,,, project_manager,Project Manager,,,,project_status,,READ,,,,, project_manager,Project Manager,,,,project_theme,,READ,,,,, project_manager,Project Manager,,,,project_goal,,READ|CREATE,,,,, +project_manager,Project Manager,,,,project_human_resource_project,,READ|CREATE,READ|CREATE|UPDATE|DELETE,,,, project_manager,Project Manager,,,,project_location,,READ|CREATE,,,,, project_manager,Project Manager,,,,project_outcome,,READ|CREATE,,,,, project_manager,Project Manager,,,,project_output,,READ|CREATE,,,,, @@ -212,6 +215,7 @@ project_reader,Project Reader,,,,project_hazard,,READ,,,,, project_reader,Project Reader,,,,project_status,,READ,,,,, project_reader,Project Reader,,,,project_theme,,READ,,,,, project_reader,Project Reader,,,,project_goal,,READ,,,,, +project_reader,Project Reader,,,,project_human_resource_project,,READ,,,,, project_reader,Project Reader,,,,project_location,,READ,,,,, project_reader,Project Reader,,,,project_outcome,,READ,,,,, project_reader,Project Reader,,,,project_output,,READ,,,,, diff --git a/modules/templates/RMSAmericas/config.py b/modules/templates/RMSAmericas/config.py index 52fa387e08..146b863917 100644 --- a/modules/templates/RMSAmericas/config.py +++ b/modules/templates/RMSAmericas/config.py @@ -70,7 +70,7 @@ def config(settings): #"member": T("Member") } - settings.auth.record_approval = True + #settings.auth.record_approval = True # @ToDo: Should we fallback to organisation_id if site_id is None? settings.auth.registration_roles = {"site_id": ["reader", @@ -1749,42 +1749,6 @@ def customise_survey_series_controller(**attr): settings.customise_survey_series_controller = customise_survey_series_controller - # ----------------------------------------------------------------------------- - # Projects - # Uncomment this to use settings suitable for a global/regional organisation (e.g. DRR) - settings.project.mode_3w = True - # Uncomment this to use DRR (Disaster Risk Reduction) extensions - settings.project.mode_drr = True - # Uncomment this to use Activity Types for Activities & Projects - settings.project.activity_types = True - # Uncomment this to use Codes for projects - settings.project.codes = True - # Uncomment this to call project locations 'Communities' - settings.project.community = True - # Uncomment this to enable Hazards in 3W projects - settings.project.hazards = True - # Uncomment this to enable Indicators in projects - # Just HNRC - #settings.project.indicators = True - # Uncomment this to use multiple Budgets per project - settings.project.multiple_budgets = True - # Uncomment this to use multiple Organisations per project - settings.project.multiple_organisations = True - # Uncomment this to enable Programmes in projects - settings.project.programmes = True - # Uncomment this to enable Themes in 3W projects - settings.project.themes = True - # Uncomment this to customise - # Links to Filtered Components for Donors & Partners - settings.project.organisation_roles = { - 1: T("Host National Society"), - 2: T("Partner"), - 3: T("Donor"), - #4: T("Customer"), # T("Beneficiary")? - #5: T("Supplier"), - 9: T("Partner National Society"), - } - # ------------------------------------------------------------------------- def household_inject_form_script(r, record): """ @@ -2015,7 +1979,7 @@ def customise_project_project_controller(**attr): # @ToDo: Use Inter-American Framework instead (when extending to Zone office) # @ToDo: Add 'Business Line' (when extending to Zone office) settings.project.details_tab = True - settings.project.community_volunteers = True + #settings.project.community_volunteers = True # Done in a more structured way instead objectives = None outputs = None @@ -2366,9 +2330,15 @@ def customise_project_indicator_data_resource(r, tablename): # ----------------------------------------------------------------------------- def customise_project_location_resource(r, tablename): - table = current.s3db.project_location + s3db = current.s3db + table = s3db.project_location table.name.readable = False table.percentage.readable = table.percentage.writable = False + list_fields = s3db.get_config(tablename, "list_fields") + try: + list_fields.remove((T("Activity Types"), "activity_type.name")) + except: + pass settings.customise_project_location_resource = customise_project_location_resource diff --git a/static/formats/geojson/export.xsl b/static/formats/geojson/export.xsl index 739550716d..03107ac2cc 100755 --- a/static/formats/geojson/export.xsl +++ b/static/formats/geojson/export.xsl @@ -414,7 +414,9 @@ --> - + Feature