diff --git a/bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.xml b/bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.xml index 1935cbc70fa215bde2fc1bc1b4c822103076a014..b1174f60359e570202f844a49a5335a1fe23ad66 100644 --- a/bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.xml +++ b/bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.xml @@ -185,6 +185,7 @@ for candidate in candidate_list:\n candidate_birthplace_address_city)),candidate.getRelativeUrl()))\n \n # Append extra actions\n +result.append((\'-\', \'_no_action\'))\n result.append((\'New Person\', \'_action_create\'))\n return result\n </string> </value> diff --git a/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyOrganisationFromM2.xml b/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyOrganisationFromM2.xml index 8c6bdf9962446683caefc317abcbbbd3ab71783f..02e1f1151f968aecb3fc1effcb4a9a301fc6e7d2 100644 --- a/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyOrganisationFromM2.xml +++ b/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyOrganisationFromM2.xml @@ -133,13 +133,9 @@ for organisation in organisation_list:\n \n # Open all assignemnts that are in open_submitted state\n destination_form_uid = context.portal_categories.destination_form.getUid()\n - #assignment_list = [assignment.getObject() for assignment in context.portal_catalog(portal_type=\'Assignment\',\n - #validation_state = \'open_submitted\',\n - #destination_form_uid = request_eform.getUid())]\n - assignment_list = [assignment for assignment in \\\n - organisation.getDestinationRelatedValueList() if \\\n - assignment.getValidationState()==\'open_submitted\']\n - context.log(assignment_list)\n + assignment_list = [assignment.getObject() for assignment in context.portal_catalog(portal_type=\'Assignment\',\n + validation_state = \'open_submitted\',\n + destination_form_uid = request_eform.getUid())]\n for assignment in assignment_list:\n context.log(assignment)\n assignment.open()\n diff --git a/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyPhysicalPersonFromP2.xml b/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyPhysicalPersonFromP2.xml index 5386ec2180bd4c0c5e31d54a26b1d78ca80683b2..bc1f581a80b980436821bf180ba46de46ae42050 100644 --- a/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyPhysicalPersonFromP2.xml +++ b/bt5/erp5_registry_ohada/WorkflowTemplateItem/portal_workflow/ohada_form_validation_interaction_workflow/scripts/modifyPhysicalPersonFromP2.xml @@ -65,9 +65,12 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>"""\n + <value> <string encoding="cdata"><![CDATA[ + +"""\n This script collects *all* filled properties in the P2\n -request_eform and updates the person and the organisation already created with the P0.\n +request_eform and updates the person and the organisation already\n +created with the P0.\n """\n \n # Initalize some useful variables\n @@ -84,9 +87,9 @@ def attachLocationYearInfo(last_id):\n location_info = request_eform.getSite().split(\'/\')[0]\n if location_info == \'dakar\':\n location_initials = \'DKR\'\n - elif location_info == \'Thies\':\n + elif location_info == \'thies\':\n location_initials = \'TH\'\n - elif location_info == \'Saint-Louis\':\n + elif location_info == \'saint-louis\':\n location_initials = \'SL\'\n year = str(date.year())\n type_of_form = \'M\'\n @@ -103,7 +106,7 @@ def attachLocationYearInfo(last_id):\n # each local registry has a different sequence\n default_address_city = request_eform.getPlace()\n new_registry_number = request_eform.portal_ids.generateNewId(\n - id_group=\'sn-%s\' % request_eform.getGroup(), method=attachLocationYearInfo)\n + id_group=\'sn-%s\' % request_eform.getGroup(), method=attachLocationYearInfo)\n #variable used to store activity of the organisation,activities should be separated with commas, and no space between them\n activity_list=[]\n request_eform.setTitle(request_eform.getOwnerFirstName()+\' \'+request_eform.getOwnerLastName())\n @@ -112,15 +115,31 @@ query=ComplexQuery(Query(title=request_eform.getTitle()),\n Query(birth_date=request_eform.getOwnerBirthday()),\n Query(birthplace_city=request_eform.getOwnerBirthplace()),\n operator="AND")\n -result=[person.getObject() for person in context.portal_catalog(portal_type=\'Person\',query=query)]\n -# Modify person based on properties filled in P2\n -for person in result:\n +person_list=[person.getObject() for person in \\\n + context.portal_catalog(portal_type=\'Person\',query=query)]\n +\n +if len(person_list) >1 :\n + raise ValidationFailed, "Error : There is more than one person with the "\\\n + " title \'%s\', birth date \'%s\' and birthplace \'%s\'" % (\n + request_eform.getTitle(),\n + request_eform.getStartDate(),\n + request_eform.getDefaultBirthplaceAddressCity())\n +elif len(person_list) == 0:\n + raise ValidationFailed, "Error : There is nobody with the "\\\n + " title \'%s\', birth date \'%s\' and birthplace \'%s\'" % (\n + request_eform.getTitle(),\n + request_eform.getStartDate(),\n + request_eform.getDefaultBirthplaceAddressCity())\n +\n +else:\n + # Modify person based on properties filled in P2\n + person = person_list[0]\n person.edit(first_name=request_eform.getOwnerFirstName(),\n - last_name=request_eform.getOwnerLastName(),\n - start_date=request_eform.getOwnerBirthday(),\n - default_birthplace_address_city=request_eform.getOwnerBirthplace(),\n - default_address_street_address=request_eform.getOwnerAddress(),\n - nationality=request_eform.getOwnerCitizenship())\n + last_name=request_eform.getOwnerLastName(),\n + start_date=request_eform.getOwnerBirthday(),\n + default_birthplace_address_city=request_eform.getOwnerBirthplace(),\n + default_address_street_address=request_eform.getOwnerAddress(),\n + nationality=request_eform.getOwnerCitizenship())\n if request_eform.getOwnerMarriedCheck():\n person.edit(marital_status=\'married\')\n elif request_eform.getOwnerDivorcedCheck():\n @@ -135,6 +154,7 @@ for person in result:\n if request_eform.getCompanyModifications():\n organisation_list = [organisation.getObject() for organisation in \\\n organisation_module.searchFolder(corporate_registration_code=request_eform.getCorporateRegistrationCode())]\n + context.log(organisation_list)\n for organisation in organisation_list:\n activity_free_text = organisation.getActivityFreeText()\n activity_list = activity_free_text and activity_free_text.split(\',\') or []\n @@ -187,6 +207,8 @@ for person in result:\n else:\n organisation.edit(activity_free_text = request_eform.getModifiedAddedActivities())\n organisation.getDefaultAddress().modify()\n +\n +\n # Update the request_eform with the allocated number\n request_eform.edit(registration_number = new_registry_number)\n # Update the registration date of the request_eform with the time when the registry officer\n @@ -197,7 +219,9 @@ history_list = context.portal_workflow.getInfoFor(request_eform,\n for history in history_list:\n if history[\'action\'] == \'validate_action\':\n request_eform.edit(registration_date=history[\'time\'])\n -</string> </value> + + +]]></string> </value> </item> <item> <key> <string>_code</string> </key> @@ -268,7 +292,9 @@ for history in history_list:\n <string>_getiter_</string> <string>context</string> <string>person</string> - <string>result</string> + <string>person_list</string> + <string>len</string> + <string>ValidationFailed</string> <string>organisation</string> <string>organisation_list</string> <string>activity_free_text</string>