diff --git a/.gitignore b/.gitignore index bd9db83469ecf1751dacf06f8a70f5caffc39ff0..de3ab422c43067d6538bd1da7eaa9663d5dc2709 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /others/db_changes/liqui_update.bat /others/db_changes/liqui_reset.ps1 /others/jsdocOut -/userhelp \ No newline at end of file +/userhelp +/system/dev_local \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_districtContact_1066036.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_districtContact_1066036.xml new file mode 100644 index 0000000000000000000000000000000000000000..b389c64e723131b3531d7d5a503f2bd102662e10 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_districtContact_1066036.xml @@ -0,0 +1,13 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Pierre Suchacek" id="9aace074-1b61-4577-ad27-bee6a498134c"> + <addColumn tableName="DISTRICTCONTACT"> + <column name="USER_NEW" type="NVARCHAR(50)" /> + <column name="USER_EDIT" type="NVARCHAR(50)" /> + <column name="DATE_NEW" type="DATETIME" /> + <column name="DATE_EDIT" type="DATETIME" /> + </addColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_districtResponsibleDatatypes.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_districtResponsibleDatatypes.xml new file mode 100644 index 0000000000000000000000000000000000000000..7865093566d927f59c40e287bb707ec886a9458d --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_districtResponsibleDatatypes.xml @@ -0,0 +1,13 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Pierre Suchacek" id="6feb15fd-c517-4bf9-be88-59993908b9ed"> + <addColumn tableName="DISTRICTRESPONSIBLE"> + <column name="ADVISERSTATUS" type="VARCHAR(36)" /> + <column name="ADVISERROLE" type="VARCHAR(36)" /> + <column name="VALIDFROM" type="DATETIME" /> + <column name="VALIDTO" type="DATETIME" /> + </addColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_district_1066187.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_district_1066187.xml new file mode 100644 index 0000000000000000000000000000000000000000..d0b0bdd3c9f37e715838f7f30970b079298e70cf --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/alter_district_1066187.xml @@ -0,0 +1,10 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Gerhard Bachmaier" id="3a1bb059-c040-435b-8978-bfddb1a6e2d4"> + <addColumn tableName="DISTRICT"> + <column name="DISTRICT_AUTOADD" type="SMALLINT(5)" /> + </addColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/changelog.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/changelog.xml index 9fc9e12d38ffb3a457f219ee37898dd5092e5f08..76bc7b7962c4e58f58146a1976b1000850a8767a 100644 --- a/.liquibase/Data_alias/basic/2020.2.0/Districts/changelog.xml +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/changelog.xml @@ -5,4 +5,11 @@ <include relativeToChangelogFile="true" file="create_districtresponsible.xml"/> <include relativeToChangelogFile="true" file="create_districtResponsibleKeyword.xml"/> <include relativeToChangelogFile="true" file="create_indizes.xml"/> + <include relativeToChangelogFile="true" file="create_districtContact.xml"/> + <include relativeToChangelogFile="true" file="insert_KeywordsDistrictOrigin.xml"/> + <include relativeToChangelogFile="true" file="alter_districtResponsibleDatatypes.xml"/> + <include relativeToChangelogFile="true" file="insert_KeywordsAdviserRoles.xml"/> + <include relativeToChangelogFile="true" file="update_ContactResponsible_consistent.xml"/> + <include relativeToChangelogFile="true" file="alter_district_1066187.xml"/> + <include relativeToChangelogFile="true" file="alter_districtContact_1066036.xml"/> </databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/create_districtContact.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/create_districtContact.xml new file mode 100644 index 0000000000000000000000000000000000000000..77d941f78dad6508618470834e71656e13d6f74f --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/create_districtContact.xml @@ -0,0 +1,20 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Pierre Suchacek" id="c17cc078-3d3d-4988-9dda-789a59aad814"> + <createTable tableName="DISTRICTCONTACT"> + <column name="DISTRICTCONTACTID" type="CHAR(36)"> + <constraints primaryKey="true" primaryKeyName="PK_DISTRICTCONTACT_DISTRICTCONTACTID"/> + </column> + <column name="CONTACT_ID" type="VARCHAR(36)"/> + <column name="DISTRICT_ID" type="VARCHAR(36)"/> + <column name="ADVISER_CONTACT_ID" type="VARCHAR(36)"/> + <column name="ADVISER_ROLE" type="VARCHAR(36)"/> + <column name="STATUS" type="CHAR(36)"/> + <column name="VALID_FROM" type="DATETIME"/> + <column name="VALID_UNTIL" type="DATETIME"/> + <column name="ORIGIN" type="NVARCHAR(36)"/> + </createTable> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/insert_KeywordsAdviserRoles.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/insert_KeywordsAdviserRoles.xml new file mode 100644 index 0000000000000000000000000000000000000000..84cc08d4f148a5841fbc5f2aaac882690f1043c3 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/insert_KeywordsAdviserRoles.xml @@ -0,0 +1,61 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Pierre Suchacek" id="d5737f12-5e86-4d6c-bcc7-7d7bed2d993f"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="97c73c26-c90e-410b-8732-47cbeaf986df"/> + <column name="KEYID" value="ADVISERROLE_SalesManager"/> + <column name="TITLE" value="Sales Manager"/> + <column name="CONTAINER" value="ADVISER_ROLE"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="8d853c34-0896-45db-989d-131a15bd0c6a"/> + <column name="KEYID" value="ADVISERROLE_OfficeDuty"/> + <column name="TITLE" value="Office Duty"/> + <column name="CONTAINER" value="ADVISER_ROLE"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="40212bc7-df71-4131-965b-344e6baf7c57"/> + <column name="KEYID" value="ADVISERROLE_RegionManager"/> + <column name="TITLE" value="Region Manager"/> + <column name="CONTAINER" value="ADVISER_ROLE"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="df052065-a32d-4c17-a229-60abcaf2736f"/> + <column name="KEYID" value="ADVISERROLE_AccountManager"/> + <column name="TITLE" value="Account Manager"/> + <column name="CONTAINER" value="ADVISER_ROLE"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="3b080d0e-9301-47f2-9ead-10f2b5aaf701"/> + <column name="KEYID" value="ADVISERROLE_AreaManager"/> + <column name="TITLE" value="Area Manager"/> + <column name="CONTAINER" value="ADVISER_ROLE"/> + <column name="SORTING" valueNumeric="4"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="a343cbe0-af9c-464c-861e-65f00eab392f"/> + <column name="KEYID" value="ADVISERROLE_FieldService"/> + <column name="TITLE" value="Field Service"/> + <column name="CONTAINER" value="ADVISER_ROLE"/> + <column name="SORTING" valueNumeric="5"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/insert_KeywordsDistrictOrigin.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/insert_KeywordsDistrictOrigin.xml new file mode 100644 index 0000000000000000000000000000000000000000..59cc5b0cfa80d4593b27a5f43d22a143b63aeff5 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/insert_KeywordsDistrictOrigin.xml @@ -0,0 +1,25 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Pierre Suchacek" id="a2067d42-75a1-4799-8c03-e5ec13f29b7a"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="9531f6ba-dbbc-43c2-ba7a-761c6e44ca3b"/> + <column name="KEYID" value="DistrictOrigin_auto"/> + <column name="TITLE" value="auto"/> + <column name="CONTAINER" value="DISTRICT_ORIGIN"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="b063bd18-0f60-4e5f-b153-62acb984a4b2"/> + <column name="KEYID" value="DistrictOrigin_manual"/> + <column name="TITLE" value="manual"/> + <column name="CONTAINER" value="DISTRICT_ORIGIN"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/Districts/update_ContactResponsible_consistent.xml b/.liquibase/Data_alias/basic/2020.2.0/Districts/update_ContactResponsible_consistent.xml new file mode 100644 index 0000000000000000000000000000000000000000..9aaa38da63024a5b8d0d662bbef91b9459e09440 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/Districts/update_ContactResponsible_consistent.xml @@ -0,0 +1,30 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="Pierre Suchacek" id="610e5b84-2428-4294-b513-b4a0c7493e0a"> + <renameColumn + columnDataType="VARCHAR(36)" + newColumnName="ADVISER_STATUS" + oldColumnName="ADVISERSTATUS" + tableName="DISTRICTRESPONSIBLE"/> + + <renameColumn + columnDataType="VARCHAR(36)" + newColumnName="ADVISER_ROLE" + oldColumnName="ADVISERROLE" + tableName="DISTRICTRESPONSIBLE"/> + + <renameColumn + columnDataType="VARCHAR(36)" + newColumnName="VALID_FROM" + oldColumnName="VALIDFROM" + tableName="DISTRICTRESPONSIBLE"/> + + <renameColumn + columnDataType="VARCHAR(36)" + newColumnName="VALID_UNTIL" + oldColumnName="VALIDTO" + tableName="DISTRICTRESPONSIBLE"/> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.0/changelog.xml b/.liquibase/Data_alias/basic/2020.2.0/changelog.xml index 620de869917cdd857fbdaee72b06b6b9ae84c26c..af1c4df61ea5a8c61ac6722772f405b8752fc886 100644 --- a/.liquibase/Data_alias/basic/2020.2.0/changelog.xml +++ b/.liquibase/Data_alias/basic/2020.2.0/changelog.xml @@ -6,7 +6,7 @@ <include relativeToChangelogFile="true" file="ImportFields/changelog.xml"/> <include relativeToChangelogFile="true" file="LeadimportMappingAssistant/changelog.xml"/> <include relativeToChangelogFile="true" file="Lead/changelog.xml"/> - <include relativeToChangelogFile="true" file="optimizeIndizes.xml"/> + <!--<include relativeToChangelogFile="true" file="optimizeIndizes.xml"/>--> <include relativeToChangelogFile="true" file="addNotificationStateKeywords/addNotificationStateKeyword.xml"/> <include relativeToChangelogFile="true" file="alter_ComunicationMedium_IdDatatype.xml"/> <include relativeToChangelogFile="true" file="ReportDispatchImpl/add_DocumentTemplatePlaceOfUse.xml"/> diff --git a/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSION.xml b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSION.xml new file mode 100644 index 0000000000000000000000000000000000000000..635ef285ba0a85e4e84df8dd4ed05434c6b9b8d6 --- /dev/null +++ b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSION.xml @@ -0,0 +1,23 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="j.luginger" id="1110a814-62e1-4c54-9e8d-03e2feb27760"> + <insert tableName="ASYS_PERMISSION"> + <column name="ASYS_PERMISSIONID" value="f53f7071-c0ad-4af4-b3c0-4a02bb8f27b5"/> + <column name="ASYS_PERMISSIONSET_ID" value="8cc1bee8-0092-4e52-a439-f647eed55441"/> + <column name="COND" value="{"entity":"DistrictContact_entity","filter":{"type":"group","operator":"AND","childs":[]}}"/> + <column name="CONDTYPE" valueNumeric="1"/> + </insert> + <insert tableName="ASYS_PERMISSION"> + <column name="ASYS_PERMISSIONID" value="3cbc4523-6d24-44aa-bc05-ef044b13d3fb"/> + <column name="ASYS_PERMISSIONSET_ID" value="295cd7b4-7ffd-4249-919f-daa908dab7ec"/> + <column name="COND" value="{"entity":"DistrictContact_entity","filter":{"type":"group","operator":"AND","childs":[]}}"/> + <column name="CONDTYPE" valueNumeric="1"/> + </insert> + <insert tableName="ASYS_PERMISSION"> + <column name="ASYS_PERMISSIONID" value="ddfb3a26-8be1-4773-9cd6-73675603201e"/> + <column name="ASYS_PERMISSIONSET_ID" value="295cd7b4-7ffd-4249-919f-daa908dab7ec"/> + <column name="COND" value="{"entity":"DistrictContact_entity","filter":{"type":"group","operator":"AND","childs":[{"type":"row","name":"ORIGIN","operator":"EQUAL","value":"manual","key":"DistrictOrigin_manual","contenttype":"TEXT"}]}}"/> + <column name="CONDTYPE" valueNumeric="1"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSIONACTION.xml b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSIONACTION.xml new file mode 100644 index 0000000000000000000000000000000000000000..74dd82d7f1d5f281069376f66c13db45ac5186fa --- /dev/null +++ b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSIONACTION.xml @@ -0,0 +1,30 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="j.luginger" id="a6e86404-38ec-419f-9fe8-25327a6b3ac6"> + <insert tableName="ASYS_PERMISSIONACTION"> + <column name="ACTION" value="view"/> + <column name="ASYS_PERMISSION_ID" value="f53f7071-c0ad-4af4-b3c0-4a02bb8f27b5"/> + <column name="ASYS_PERMISSIONACTIONID" value="8cae79d8-e8bf-4d9a-9353-e0dd7df1f667"/> + </insert> + <insert tableName="ASYS_PERMISSIONACTION"> + <column name="ACTION" value="create"/> + <column name="ASYS_PERMISSION_ID" value="f53f7071-c0ad-4af4-b3c0-4a02bb8f27b5"/> + <column name="ASYS_PERMISSIONACTIONID" value="3a7a7322-ac8b-49dc-b185-a5acab4fb6dc"/> + </insert> + <insert tableName="ASYS_PERMISSIONACTION"> + <column name="ACTION" value="read"/> + <column name="ASYS_PERMISSION_ID" value="3cbc4523-6d24-44aa-bc05-ef044b13d3fb"/> + <column name="ASYS_PERMISSIONACTIONID" value="1686674d-7343-4d00-8a92-290c0263991b"/> + </insert> + <insert tableName="ASYS_PERMISSIONACTION"> + <column name="ACTION" value="delete"/> + <column name="ASYS_PERMISSION_ID" value="ddfb3a26-8be1-4773-9cd6-73675603201e"/> + <column name="ASYS_PERMISSIONACTIONID" value="a60eb350-12a5-444c-8d1a-3f5a7d57d8f3"/> + </insert> + <insert tableName="ASYS_PERMISSIONACTION"> + <column name="ACTION" value="update"/> + <column name="ASYS_PERMISSION_ID" value="ddfb3a26-8be1-4773-9cd6-73675603201e"/> + <column name="ASYS_PERMISSIONACTIONID" value="63668e61-664b-48d3-8ba8-fea974271438"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSIONSET.xml b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSIONSET.xml new file mode 100644 index 0000000000000000000000000000000000000000..4611c456f2d4ebde1cf1c773190a5c8b3fbbd5da --- /dev/null +++ b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/ASYS_PERMISSIONSET.xml @@ -0,0 +1,18 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="j.luginger" id="c83eadc7-c360-411a-8a83-da85eff5e945"> + <insert tableName="ASYS_PERMISSIONSET"> + <column name="ACCESSTYPE" value="E"/> + <column name="ASYS_PERMISSIONSETID" value="8cc1bee8-0092-4e52-a439-f647eed55441"/> + <column name="ENTITY_ID" value="DistrictContact_entity"/> + <column name="ROLE_ID" value="INTERNAL_EVERYONE"/> + </insert> + <insert tableName="ASYS_PERMISSIONSET"> + <column name="ACCESSTYPE" value="R"/> + <column name="ASYS_PERMISSIONSET_ID" value="8cc1bee8-0092-4e52-a439-f647eed55441"/> + <column name="ASYS_PERMISSIONSETID" value="295cd7b4-7ffd-4249-919f-daa908dab7ec"/> + <column name="ENTITY_ID" value="DistrictContact_entity"/> + <column name="ROLE_ID" value="INTERNAL_EVERYONE"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/changelog.xml b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/changelog.xml index b64f62ea0f7bca50bca82cb051c542a489bb7409..5c155f478645750f5b76a9a1e4f2364eca59b34d 100644 --- a/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/changelog.xml +++ b/.liquibase/_____SYSTEMALIAS/basic/_demoData/generatedData/changelog.xml @@ -1,6 +1,9 @@ <?xml version="1.1" encoding="UTF-8" standalone="no"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> <include relativeToChangelogFile="true" file="ASYS_BINARIES.xml"/> - <include relativeToChangelogFile="true" file="ASYS_RECORD.xml"/> - <include relativeToChangelogFile="true" file="ASYS_RECORDGROUP.xml"/> + <include relativeToChangelogFile="true" file="ASYS_RECORD.xml"/> + <include relativeToChangelogFile="true" file="ASYS_RECORDGROUP.xml"/> + <include relativeToChangelogFile="true" file="ASYS_PERMISSION.xml"/> + <include relativeToChangelogFile="true" file="ASYS_PERMISSIONACTION.xml"/> + <include relativeToChangelogFile="true" file="ASYS_PERMISSIONSET.xml"/> </databaseChangeLog> \ No newline at end of file diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 0095a7d0c2cd6242458d1fd4123fc835cd87d91b..5dbb631687f716bf31e3412700768f6f86d1927c 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -15820,6 +15820,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>DISTRICT_AUTOADD</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="5" /> + <size v="5" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -15859,8 +15873,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="29" /> - <scale v="9" /> + <size v="19" /> + <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -15915,8 +15929,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="29" /> - <scale v="9" /> + <size v="19" /> + <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -15952,6 +15966,300 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>ADVISER_STATUS</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ADVISER_ROLE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>VALID_FROM</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>VALID_UNTIL</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> + <entityDb> + <name>DISTRICTCONTACT</name> + <dbName></dbName> + <idColumn>DISTRICTCONTACTID</idColumn> + <idGeneratorType v="0" /> + <idGeneratorInterval v="1" /> + <documentation></documentation> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="1" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>ORIGIN</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>STATUS</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title>District assignment status</title> + <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + <customJDitoProperty> + <name>translate4Log</name> + <global v="false" /> + <property>%aditoprj%/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/status/customproperties/translate4log/property.js</property> + </customJDitoProperty> + </customProperties> + </entityFieldDb> + <entityFieldDb> + <name>ADVISER_ROLE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>ADVISER_CONTACT_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DISTRICTCONTACTID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="true" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DISTRICT_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title>District</title> + <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + <customJDitoProperty> + <name>translate4Log</name> + <global v="false" /> + <property>%aditoprj%/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/district_id/customproperties/translate4log/property.js</property> + </customJDitoProperty> + </customProperties> + </entityFieldDb> + <entityFieldDb> + <name>CONTACT_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="false" /> + </customBooleanProperty> + <customStringProperty> + <name>tableRef</name> + <global v="false" /> + <property>CONTACT</property> + </customStringProperty> + </customProperties> + </entityFieldDb> + <entityFieldDb> + <name>VALID_FROM</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="19" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>VALID_UNTIL</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="19" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="19" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="19" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/district_id/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/district_id/customproperties/translate4log/property.js new file mode 100644 index 0000000000000000000000000000000000000000..1107fb8c489e4ff36f2cfe85ee1607b6e5ec5098 --- /dev/null +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/district_id/customproperties/translate4log/property.js @@ -0,0 +1,22 @@ +import("system.translate"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("District_lib"); +import("system.result"); +import("Loghistory_lib"); +import("Contact_lib"); + +var params = Translate4LogParams.load(); + +if (params.action == 'I') +{ + //Gebiet und Betreur umschlüsseln + var arrDistrictContact = DistrictUtils.getDataFromDistrictContact(params.rowId); + var districtName = DistrictUtils.getDistrictName(arrDistrictContact[0]); + var adviserName = ContactUtils.getTitleByContactId(arrDistrictContact[1]); + result.string(districtName + " (" + params.value + "); " + translate.text("Adviser") + ": " + adviserName); +} +else if (params.action == 'D') +{ + result.string(params.value); +} \ No newline at end of file diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/status/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/status/customproperties/translate4log/property.js new file mode 100644 index 0000000000000000000000000000000000000000..2c298584241dbb8701c02a1b7f5974471326113d --- /dev/null +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/districtcontact/entityfields/status/customproperties/translate4log/property.js @@ -0,0 +1,24 @@ +import("system.translate"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("District_lib"); +import("system.result"); +import("Loghistory_lib"); +import("Contact_lib"); + +var params = Translate4LogParams.load(); + +//Statusänderung protokollieren +if (params.action == 'U') +{ + //Keyword umschlüsseln + var keyname = KeywordUtils.getViewValue($KeywordRegistry.contactStatus(), params.value); + + //Gebiet und Betreur umschlüsseln + var arrDistrictContact = DistrictUtils.getDataFromDistrictContact(params.rowId); + var districtName = DistrictUtils.getDistrictName(arrDistrictContact[0]); + //var adviserName = ContactUtils.getFullTitleByContactId(arrDistrictContact[1]); + var adviserName = ContactUtils.getTitleByContactId(arrDistrictContact[1]); + + result.string(keyname + " (" + translate.text("District") + ": " + districtName + "; " + translate.text("Adviser") + ": " + adviserName + ")"); +} \ No newline at end of file diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index 0efb778259b5ae9f631757bf9d1221198e34ba4b..4891628b32b0bb8d32d5783fafe33604322fec5e 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -157,12 +157,6 @@ <fieldName>Departments</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>71cfeddd-a315-4692-8299-08813ca1dc19</name> - <entityName>DistrictResponsible_entity</entityName> - <fieldName>Departments</fieldName> - <isConsumer v="false" /> - </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/DistrictContact_entity/DistrictContact_entity.aod b/entity/DistrictContact_entity/DistrictContact_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..c039e6254d45883a3394f0aafd67a5307218d5a2 --- /dev/null +++ b/entity/DistrictContact_entity/DistrictContact_entity.aod @@ -0,0 +1,309 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.17" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.17"> + <name>DistrictContact_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:GLOBE</icon> + <title>District Contact</title> + <iconIdProcess>%aditoprj%/entity/DistrictContact_entity/iconIdProcess.js</iconIdProcess> + <image>VAADIN:GLOBE</image> + <titlePlural>Supervisors</titlePlural> + <recordContainer>db</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityProvider> + <name>#PROVIDER_AGGREGATES</name> + <useAggregates v="true" /> + </entityProvider> + <entityField> + <name>CONTACT_ID</name> + <title>Company</title> + <consumer>Organisations</consumer> + <groupable v="true" /> + <linkedContext>Organisation</linkedContext> + <state>EDITABLE</state> + <stateProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/contact_id/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/contact_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>DISTRICT_ID</name> + <title>{$DISTRICT}</title> + <consumer>Districts</consumer> + <groupable v="true" /> + <linkedContext>District</linkedContext> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/district_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/district_id/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>ADVISER_CONTACT_ID</name> + <title>Adviser contact</title> + <consumer>Advisers</consumer> + <groupable v="true" /> + <linkedContext>Person</linkedContext> + <mandatory v="true" /> + <displayValueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/adviser_contact_id/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>ADVISER_ROLE</name> + <title>Adviser role</title> + <consumer>KeywordAdviserRoles</consumer> + <groupable v="true" /> + <displayValueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/adviser_role/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>STATUS</name> + <title>Status</title> + <consumer>KeywordContactStates</consumer> + <groupable v="true" /> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/status/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/status/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>VALID_FROM</name> + <title>Valid from</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + <groupable v="true" /> + </entityField> + <entityField> + <name>VALID_UNTIL</name> + <title>Valid until</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + <groupable v="true" /> + </entityField> + <entityField> + <name>ORIGIN</name> + <title>Origin</title> + <consumer>KeywordDistrictOrigin</consumer> + <groupable v="true" /> + <state>READONLY</state> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/origin/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/origin/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>DISTRICTCONTACTID</name> + </entityField> + <entityConsumer> + <name>KeywordContactStates</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ExcludedKeyIdsSubquery_param</name> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>KeywordAdviserRoles</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keywordadviserroles/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>KeywordDistrictOrigin</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keyworddistrictorigin/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>Organisations</name> + <dependency> + <name>dependency</name> + <entityName>Organisation_entity</entityName> + <fieldName>Organisations</fieldName> + </dependency> + </entityConsumer> + <entityConsumer> + <name>Advisers</name> + <dependency> + <name>dependency</name> + <entityName>DistrictResponsible_entity</entityName> + <fieldName>DistrictResponsibleAdvisers</fieldName> + </dependency> + <children> + <entityParameter> + <name>DistrictId_param</name> + <valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/advisers/children/districtid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>Districts</name> + <dependency> + <name>dependency</name> + <entityName>District_entity</entityName> + <fieldName>DistrictContacts</fieldName> + </dependency> + </entityConsumer> + <entityProvider> + <name>DistrictContacts</name> + <dependencies> + <entityDependency> + <name>6a15b92f-e0b6-459d-a106-615dcfac3dbd</name> + <entityName>District_entity</entityName> + <fieldName>DistrictContactUIDs</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>e33ae6f8-0a21-406c-950a-ab60f27026b3</name> + <entityName>Organisation_entity</entityName> + <fieldName>DistrictContacts</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityParameter> + <name>DistrictId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>currentOrganisationId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>RowId_param</name> + <expose v="true" /> + </entityParameter> + <entityActionGroup> + <name>setStatus</name> + <children> + <entityActionField> + <name>setActive</name> + <title>Set active</title> + <onActionProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/setstatus/children/setactive/onActionProcess.js</onActionProcess> + <isSelectionAction v="true" /> + <iconId>VAADIN:THUMBS_UP</iconId> + <tooltip>Set status to active</tooltip> + </entityActionField> + <entityActionField> + <name>setInactive</name> + <title>Set inactive</title> + <onActionProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/setstatus/children/setinactive/onActionProcess.js</onActionProcess> + <isSelectionAction v="true" /> + <iconId>VAADIN:THUMBS_DOWN</iconId> + <tooltip>Set status to inactive</tooltip> + </entityActionField> + </children> + </entityActionGroup> + <entityParameter> + <name>isDashletView_param</name> + <expose v="true" /> + </entityParameter> + </entityFields> + <recordContainers> + <dbRecordContainer> + <name>db</name> + <alias>Data_alias</alias> + <isPageable v="true" /> + <isRequireContainerFiltering v="false" /> + <hasDependentRecords v="true" /> + <fromClauseProcess>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> + <conditionProcess>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/conditionProcess.js</conditionProcess> + <linkInformation> + <linkInformation> + <name>dc5cbebc-a947-4196-937a-f665ee80cc31</name> + <tableName>DISTRICTCONTACT</tableName> + <primaryKey>DISTRICTCONTACTID</primaryKey> + <isUIDTable v="true" /> + <readonly v="false" /> + </linkInformation> + <linkInformation> + <name>058abbb3-d92f-4fe1-b326-1320cfee90df</name> + <tableName>CONTACT</tableName> + <primaryKey>CONTACTID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> + </linkInformation> + <recordFieldMappings> + <dbRecordFieldMapping> + <name>ADVISER_CONTACT_ID.value</name> + <recordfield>DISTRICTCONTACT.ADVISER_CONTACT_ID</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ADVISER_ROLE.value</name> + <recordfield>DISTRICTCONTACT.ADVISER_ROLE</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CONTACT_ID.value</name> + <recordfield>DISTRICTCONTACT.CONTACT_ID</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DISTRICT_ID.value</name> + <recordfield>DISTRICTCONTACT.DISTRICT_ID</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ORIGIN.value</name> + <recordfield>DISTRICTCONTACT.ORIGIN</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STATUS.value</name> + <recordfield>DISTRICTCONTACT.STATUS</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>VALID_FROM.value</name> + <recordfield>DISTRICTCONTACT.VALID_FROM</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>VALID_UNTIL.value</name> + <recordfield>DISTRICTCONTACT.VALID_UNTIL</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DISTRICTCONTACTID.value</name> + <recordfield>DISTRICTCONTACT.DISTRICTCONTACTID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ORIGIN.displayValue</name> + <expression>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/origin.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DISTRICT_ID.displayValue</name> + <expression>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STATUS.displayValue</name> + <expression>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + </recordFieldMappings> + </dbRecordContainer> + </recordContainers> +</entity> diff --git a/entity/DistrictContact_entity/entityfields/adviser_contact_id/displayValueProcess.js b/entity/DistrictContact_entity/entityfields/adviser_contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e5831fd4418b333578ec210e784b82b3615dd772 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/adviser_contact_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.ADVISER_CONTACT_ID"), false)); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/adviser_role/displayValueProcess.js b/entity/DistrictContact_entity/entityfields/adviser_role/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e6a904ba6ddbb8708672c21cdf25313d4829841d --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/adviser_role/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.adviserRole(), vars.get("$field.ADVISER_ROLE"))); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/advisers/children/districtid_param/valueProcess.js b/entity/DistrictContact_entity/entityfields/advisers/children/districtid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a13a013fadcab4a35ad6a795015276b1fd16be0e --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/advisers/children/districtid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.DISTRICT_ID")); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/contact_id/displayValueProcess.js b/entity/DistrictContact_entity/entityfields/contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0398a93e921deff9c9cf94e2468bdf1702bffa59 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/contact_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +result.string(ContactUtils.getFullTitleByContactId(vars.getString("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/contact_id/stateProcess.js b/entity/DistrictContact_entity/entityfields/contact_id/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c23cd0ff4912e068826819e7a7b458b864616751 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/contact_id/stateProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.neon"); +import("system.result"); + +if(vars.get("$param.currentOrganisationId_param")) + result.string(neon.COMPONENTSTATE_READONLY); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/contact_id/valueProcess.js b/entity/DistrictContact_entity/entityfields/contact_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bd8d4f8447e67f798cc0b1429919e71dec4401ad --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/contact_id/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$param.currentOrganisationId_param")); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/district_id/displayValueProcess.js b/entity/DistrictContact_entity/entityfields/district_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1f1a8b17e086f57385795d7e0fc0ee317cb59eda --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/district_id/displayValueProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.result"); +import("Sql_lib"); + +if(vars.get("$field.DISTRICT_ID") != "" && vars.get("$field.DISTRICT_ID") != null) +{ + result.string(newSelect("DISTRICT_NAME").from("DISTRICT").where("DISTRICT.DISTRICTID", "$field.DISTRICT_ID").cell()) + +} \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/district_id/valueProcess.js b/entity/DistrictContact_entity/entityfields/district_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bed0ee257efcc6af594fdae209b4e08c8b511ed0 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/district_id/valueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); + +if(vars.get("$param.DistrictId_param") && vars.get("$this.value") == null) + result.string(vars.get("$param.DistrictId_param")) \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/keywordadviserroles/children/containername_param/valueProcess.js b/entity/DistrictContact_entity/entityfields/keywordadviserroles/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..113fe991296292ec901f2c92b5042d6d50e23890 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/keywordadviserroles/children/containername_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.adviserRole()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js b/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2f4d03edea3a8ff7253f793a4c8a3585f03db848 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.contactStatus()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/excludedkeyidssubquery_param/valueProcess.js b/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/excludedkeyidssubquery_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f1da1bf38607292fdc74ba2e1247fafa1a6f99c2 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/excludedkeyidssubquery_param/valueProcess.js @@ -0,0 +1,14 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); +import("KeywordRegistry_basic"); +import("Sql_lib"); + +if(vars.get("$sys.presentationmode") != neon.CONTEXT_PRESENTATIONMODE_FILTER){ + var cond = newSelect("AB_KEYWORD_ENTRY.KEYID") + .from("AB_KEYWORD_ENTRY") + .where("AB_KEYWORD_ENTRY.CONTAINER", $KeywordRegistry.contactStatus()) + .and("AB_KEYWORD_ENTRY.KEYID", $KeywordRegistry.contactStatus$inReview(), SqlBuilder.LIKE()); + + result.string(cond.toString()); +} \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/keyworddistrictorigin/children/containername_param/valueProcess.js b/entity/DistrictContact_entity/entityfields/keyworddistrictorigin/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..80b7903c1997943568f289e076d5873d38ecd53b --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/keyworddistrictorigin/children/containername_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.districtOrigin()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/origin/displayValueProcess.js b/entity/DistrictContact_entity/entityfields/origin/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..68465c76ce5c55e9f32ff20f8870c8a0e01b352c --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/origin/displayValueProcess.js @@ -0,0 +1,15 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); +import("KeywordRegistry_basic"); +import("Keyword_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + var key = vars.get("$field.ORIGIN"); + if (key) + { + var res = KeywordUtils.getViewValue($KeywordRegistry.districtOrigin(), key); + result.string(res); + } +} \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/origin/valueProcess.js b/entity/DistrictContact_entity/entityfields/origin/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0f8bb663630e34a07f9d3738151c3093c2a57c1b --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/origin/valueProcess.js @@ -0,0 +1,9 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); +import("KeywordRegistry_basic"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + result.string($KeywordRegistry.districtOrigin$manual()); +} \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/setstatus/children/setactive/onActionProcess.js b/entity/DistrictContact_entity/entityfields/setstatus/children/setactive/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7672acc826e049b150a473086bdcf96c5737370d --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/setstatus/children/setactive/onActionProcess.js @@ -0,0 +1,12 @@ +import("system.util"); +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.neon"); +import("District_lib"); + + +var arrIds = vars.get("$sys.selection"); +DistrictUtils.setDistrictContactStatus(arrIds, $KeywordRegistry.contactStatus$active()); +//refresh only if the function is called twice +neon.refreshAll(); +neon.refreshAll(); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/setstatus/children/setinactive/onActionProcess.js b/entity/DistrictContact_entity/entityfields/setstatus/children/setinactive/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..433ee2f6b56fafd345e7e6ea0e99445d41d7ee92 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/setstatus/children/setinactive/onActionProcess.js @@ -0,0 +1,10 @@ +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.neon"); +import("District_lib"); + +var arrIds = vars.get("$sys.selection"); +DistrictUtils.setDistrictContactStatus(arrIds, $KeywordRegistry.contactStatus$inactive()); +//refresh only if the function is called twice +neon.refreshAll(); +neon.refreshAll(); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/status/displayValueProcess.js b/entity/DistrictContact_entity/entityfields/status/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c22dac90dfb488ce3db5cb39424ebe85a8d2e488 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/status/displayValueProcess.js @@ -0,0 +1,9 @@ +import("system.result"); +import("system.vars"); +import("KeywordRegistry_basic"); +import("Keyword_lib"); + +var key = vars.get("$field.STATUS"); + +var res = KeywordUtils.getViewValue($KeywordRegistry.contactStatus(), key); +result.string(res); \ No newline at end of file diff --git a/entity/DistrictContact_entity/entityfields/status/valueProcess.js b/entity/DistrictContact_entity/entityfields/status/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..13218c16514d81765c7e5dfd47c099996adfe063 --- /dev/null +++ b/entity/DistrictContact_entity/entityfields/status/valueProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); +import("KeywordRegistry_basic"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string($KeywordRegistry.contactStatus$active()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/iconIdProcess.js b/entity/DistrictContact_entity/iconIdProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..efad44f93980d3fdbd4e1830d667ce69f7090d71 --- /dev/null +++ b/entity/DistrictContact_entity/iconIdProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); + +var res = "TEXT:" + vars.get("$field.CONTACT_ID.displayValue"); +result.string(res); \ No newline at end of file diff --git a/entity/DistrictContact_entity/recordcontainers/db/conditionProcess.js b/entity/DistrictContact_entity/recordcontainers/db/conditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b8195ebfa8f2f08258f2c8dc98449b6ec7cc292c --- /dev/null +++ b/entity/DistrictContact_entity/recordcontainers/db/conditionProcess.js @@ -0,0 +1,41 @@ +import("KeywordRegistry_basic"); +import("Employee_lib"); +import("system.entities"); +import("system.result"); +import("system.vars"); +import("Sql_lib"); + +var isDashletView = vars.get("$param.isDashletView_param"); +var organisationID = vars.get("$param.currentOrganisationId_param"); +var districtID = vars.get("$param.DistrictId_param"); +var cond = newWhere(); + +if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars.exists("$param.ObjectId_param") && vars.get("$param.ObjectId_param")) +{ + cond.and("DISTRICTCONTACT.ADVISER_CONTACT_ID", newSelect("DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID") + .from("DISTRICTRESPONSIBLE") + .where("DISTRICTRESPONSIBLE.DISTRICTRESPONSIBLEID", "$param.RowId_param") + , SqlBuilder.IN()); +} +if (organisationID) +{ + cond.and("DISTRICTCONTACT.CONTACT_ID", organisationID); +} + +var statusInReview = $KeywordRegistry.contactStatus$inReview(); +var districtOrigin = $KeywordRegistry.districtOrigin$auto(); + +if(isDashletView) +{ + var currentContactId = EmployeeUtils.getCurrentContactId(); + + cond.and("DISTRICTCONTACT.STATUS", statusInReview); + cond.and("DISTRICTCONTACT.ORIGIN", districtOrigin); + cond.and("DISTRICTCONTACT.ADVISER_CONTACT_ID", currentContactId); +} + +if(districtID){ + cond.and("DISTRICTCONTACT.DISTRICT_ID", districtID); +} + +result.string(cond.toString()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js b/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..19a916d7f0b23cd1c832567ee33ea1d3c592f01f --- /dev/null +++ b/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js @@ -0,0 +1,5 @@ +import("system.result"); + +var res = "DISTRICTCONTACT \n\ + left join CONTACT on (CONTACT.CONTACTID = DISTRICTCONTACT.CONTACT_ID)"; +result.string(res); \ No newline at end of file diff --git a/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..2b6b2fc2b784294d32c6ea947086bf1e62d5d9c3 --- /dev/null +++ b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js @@ -0,0 +1,7 @@ +import("system.result"); +import("Sql_lib"); + +result.string(newSelect("DISTRICT.DISTRICT_NAME") + .from("DISTRICT") + .where("DISTRICT.DISTRICTID = DISTRICTCONTACT.DISTRICT_ID") + .toString()); \ No newline at end of file diff --git a/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/origin.displayvalue/expression.js b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/origin.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..a6e2a3e719d894bde6e9e71623b20bfc33ac1cac --- /dev/null +++ b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/origin.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("KeywordRegistry_basic"); +import("system.result"); +import("Keyword_lib"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.districtOrigin(), "DISTRICTCONTACT.ORIGIN"); +result.string(sql); \ No newline at end of file diff --git a/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..22b1e68d7238c6315da8b21edbb1fdae45744855 --- /dev/null +++ b/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("KeywordRegistry_basic"); +import("system.result"); +import("Keyword_lib"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contactStatus(), "DISTRICTCONTACT.STATUS"); +result.string(sql); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod b/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod index c883c481538e70912e94ebf3a20fdc8741321930..9c44823af47074f868a2c417bd118b865f578eaa 100644 --- a/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod +++ b/entity/DistrictResponsible_entity/DistrictResponsible_entity.aod @@ -5,27 +5,24 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/DistrictResponsible_entity/documentation.adoc</documentation> <icon>VAADIN:GLOBE</icon> + <grantDeleteProcess>%aditoprj%/entity/DistrictResponsible_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/DistrictResponsible_entity/contentTitleProcess.js</contentTitleProcess> <iconIdProcess>%aditoprj%/entity/DistrictResponsible_entity/iconIdProcess.js</iconIdProcess> <image>VAADIN:GLOBE</image> + <usePermissions v="false" /> <recordContainer>db</recordContainer> <entityFields> <entityProvider> <name>#PROVIDER</name> </entityProvider> - <entityField> - <name>DEPARTMENT_ATTRIBUTE_ID</name> - <title>Department</title> - <consumer>Departments</consumer> - <state>AUTO</state> - <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/department_attribute_id/valueProcess.js</valueProcess> - </entityField> <entityField> <name>EMPLOYEE_CONTACT_ID</name> <title>{$DISTRICT_RESPONSIBLE}</title> - <consumer>Employees</consumer> + <consumer>Persons</consumer> <linkedContext>Person</linkedContext> + <mandatory v="true" /> <selectionMode>SINGLE</selectionMode> + <stateProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/employee_contact_id/stateProcess.js</stateProcess> <displayValueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/employee_contact_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -35,29 +32,6 @@ <linkedContext>District</linkedContext> <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/district_id/valueProcess.js</valueProcess> </entityField> - <entityConsumer> - <name>Departments</name> - <dependency> - <name>dependency</name> - <entityName>Attribute_entity</entityName> - <fieldName>SpecificAttribute</fieldName> - </dependency> - <children> - <entityParameter> - <name>ParentId_param</name> - <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/departments/children/parentid_param/valueProcess.js</valueProcess> - <description>parent id, this is used for filtering by the parent in the content process</description> - </entityParameter> - </children> - </entityConsumer> - <entityConsumer> - <name>Employees</name> - <dependency> - <name>dependency</name> - <entityName>Employee_entity</entityName> - <fieldName>Employees</fieldName> - </dependency> - </entityConsumer> <entityConsumer> <name>Districts</name> <dependency> @@ -87,14 +61,13 @@ </entityField> <entityProvider> <name>DistrictResponsibles</name> - <lookupIdfield>DISTRICTRESPONSIBLEID</lookupIdfield> <documentation>%aditoprj%/entity/DistrictResponsible_entity/entityfields/districtresponsibles/documentation.adoc</documentation> <titlePlural>Responsibles</titlePlural> <dependencies> <entityDependency> - <name>ef26fdb6-5fcf-416e-bcc8-380b5751b523</name> + <name>ae1dcbbe-b302-44df-ab4c-f7937d197cd5</name> <entityName>District_entity</entityName> - <fieldName>DistrictResponsibles</fieldName> + <fieldName>DistrictResponsibleUIDs</fieldName> <isConsumer v="false" /> </entityDependency> </dependencies> @@ -146,14 +119,6 @@ </entityParameter> </children> </entityConsumer> - <entityField> - <name>departmentAttributeName</name> - <documentation>%aditoprj%/entity/DistrictResponsible_entity/entityfields/departmentattributename/documentation.adoc</documentation> - <title>Department</title> - <state>READONLY</state> - <stateProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/departmentattributename/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/departmentattributename/valueProcess.js</valueProcess> - </entityField> <entityProvider> <name>OrganisationResponsibles</name> <targetContextField>targetContext</targetContextField> @@ -205,6 +170,91 @@ <name>targetContext</name> <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/targetcontext/valueProcess.js</valueProcess> </entityField> + <entityConsumer> + <name>Persons</name> + <dependency> + <name>dependency</name> + <entityName>Person_entity</entityName> + <fieldName>Contacts</fieldName> + </dependency> + <children> + <entityParameter> + <name>ExcludedContactIds_param</name> + <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/persons/children/excludedcontactids_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>ADVISER_ROLE</name> + <title>Adviser role</title> + <consumer>AdviserRoles</consumer> + <displayValueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviser_role/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>ADVISER_STATUS</name> + <title>Adviser status</title> + <consumer>AdviserStates</consumer> + <groupable v="true" /> + <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviser_status/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviser_status/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>AdviserStates</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviserstates/children/containername_param/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ExcludedKeyIdsSubquery_param</name> + <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviserstates/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>VALID_FROM</name> + <title>Valid from</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + </entityField> + <entityField> + <name>VALID_UNTIL</name> + <title>Valid to</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + </entityField> + <entityConsumer> + <name>AdviserRoles</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviserroles/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityProvider> + <name>DistrictResponsibleAdvisers</name> + <lookupIdfield>EMPLOYEE_CONTACT_ID</lookupIdfield> + <dependencies> + <entityDependency> + <name>ac067a2d-e313-44b7-b219-f834ef4a7629</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>Advisers</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> </entityFields> <recordContainers> <dbRecordContainer> @@ -215,12 +265,23 @@ <alias>Data_alias</alias> <cacheType>GLOBAL</cacheType> <cacheKeyProcess>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/cacheKeyProcess.js</cacheKeyProcess> + <linkInformation> + <linkInformation> + <name>d0fee359-92fb-4d5e-b50c-3e74251440d8</name> + <tableName>DISTRICTRESPONSIBLE</tableName> + <primaryKey>DISTRICTRESPONSIBLEID</primaryKey> + <isUIDTable v="true" /> + <readonly v="false" /> + </linkInformation> + <linkInformation> + <name>33f6c941-5245-4847-a8a3-3cbddc30a104</name> + <tableName>CONTACT</tableName> + <primaryKey>CONTACTID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> + </linkInformation> <recordFieldMappings> - <dbRecordFieldMapping> - <name>DEPARTMENT_ATTRIBUTE_ID.value</name> - <recordfield>DISTRICTRESPONSIBLE.DEPARTMENT_ATTRIBUTE_ID</recordfield> - <isFilterable v="true" /> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DISTRICT_ID.value</name> <recordfield>DISTRICTRESPONSIBLE.DISTRICT_ID</recordfield> @@ -256,10 +317,6 @@ <recordfield>DISTRICTRESPONSIBLE.DATE_NEW</recordfield> <isFilterable v="true" /> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DEPARTMENT_ATTRIBUTE_ID.displayValue</name> - <recordfield>DISTRICTRESPONSIBLE.DEPARTMENT_ATTRIBUTE_ID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MAIL.value</name> <expression>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/mail.value/expression.js</expression> @@ -268,14 +325,36 @@ <name>PHONE.value</name> <expression>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/phone.value/expression.js</expression> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DISTRICT_ID.displayValue</name> - <expression>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>EMPLOYEE_CONTACT_ID.displayValue</name> <expression>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/employee_contact_id.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ADVISER_ROLE.value</name> + <recordfield>DISTRICTRESPONSIBLE.ADVISER_ROLE</recordfield> + <isFilterable v="true" /> + <isLookupFilter v="false" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ADVISER_STATUS.value</name> + <recordfield>DISTRICTRESPONSIBLE.ADVISER_STATUS</recordfield> + <isFilterable v="true" /> + <isLookupFilter v="false" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>VALID_FROM.value</name> + <recordfield>DISTRICTRESPONSIBLE.VALID_FROM</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>VALID_UNTIL.value</name> + <recordfield>DISTRICTRESPONSIBLE.VALID_UNTIL</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DISTRICT_ID.displayValue</name> + <expression>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> <linkInformation> <linkInformation> diff --git a/entity/DistrictResponsible_entity/contentTitleProcess.js b/entity/DistrictResponsible_entity/contentTitleProcess.js index 67d21cf41ffa951498384284c6ebdd2490f0a84e..1c40177f5576799fcf75787dac078c03a8553756 100644 --- a/entity/DistrictResponsible_entity/contentTitleProcess.js +++ b/entity/DistrictResponsible_entity/contentTitleProcess.js @@ -1,12 +1,11 @@ -import("system.logging"); import("system.vars"); import("system.result"); -import("Employee_lib"); +import("Contact_lib"); var contactId = vars.get("$field.EMPLOYEE_CONTACT_ID"); var res = ""; if(contactId) - res = EmployeeUtils.getUsersDepartment(contactId, true); + res = ContactUtils.getFullTitleByContactId(contactId, false); result.string(res) \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/adviser_role/displayValueProcess.js b/entity/DistrictResponsible_entity/entityfields/adviser_role/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1c2626f024782f6d29c7b4f7fd225796acbd250a --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/adviser_role/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.adviserRole(), vars.get("$field.ADVISER_ROLE"))); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/adviser_status/displayValueProcess.js b/entity/DistrictResponsible_entity/entityfields/adviser_status/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7f7c5a4b070b3d79992eb80365eb4666affe452b --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/adviser_status/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.contactStatus(), vars.get("$field.ADVISER_STATUS"))); diff --git a/entity/DistrictResponsible_entity/entityfields/adviser_status/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/adviser_status/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..13218c16514d81765c7e5dfd47c099996adfe063 --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/adviser_status/valueProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); +import("KeywordRegistry_basic"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string($KeywordRegistry.contactStatus$active()); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/adviserroles/children/containername_param/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/adviserroles/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..113fe991296292ec901f2c92b5042d6d50e23890 --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/adviserroles/children/containername_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.adviserRole()); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/adviserstates/children/containername_param/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/adviserstates/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2f4d03edea3a8ff7253f793a4c8a3585f03db848 --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/adviserstates/children/containername_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.contactStatus()); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/adviserstates/children/excludedkeyidssubquery_param/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/adviserstates/children/excludedkeyidssubquery_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..15b73f9705dc456af35c5d5e144cf88c436a79eb --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/adviserstates/children/excludedkeyidssubquery_param/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("KeywordRegistry_basic"); +import("Sql_lib"); + +var cond = newSelect("AB_KEYWORD_ENTRY.KEYID") +.from("AB_KEYWORD_ENTRY") +.where("AB_KEYWORD_ENTRY.CONTAINER", $KeywordRegistry.contactStatus()) +.and("AB_KEYWORD_ENTRY.KEYID", $KeywordRegistry.contactStatus$inReview(), SqlBuilder.LIKE()); + +result.string(cond.toString()); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/department_attribute_id/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/department_attribute_id/valueProcess.js deleted file mode 100644 index 3474c5398a8b48f35e4cd6f82297fecafb9e8928..0000000000000000000000000000000000000000 --- a/entity/DistrictResponsible_entity/entityfields/department_attribute_id/valueProcess.js +++ /dev/null @@ -1,12 +0,0 @@ -import("system.vars"); -import("system.result"); -import("system.tools"); - -var employeesContactId = vars.get("$field.EMPLOYEE_CONTACT_ID"); -var departmentsAttrId = "" -if (employeesContactId) -{ - departmentsAttrId = tools.getUsersByAttribute(tools.CONTACTID, [employeesContactId])[0][tools.PARAMS].department; -} - -result.string(departmentsAttrId); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/departmentattributename/documentation.adoc b/entity/DistrictResponsible_entity/entityfields/departmentattributename/documentation.adoc deleted file mode 100644 index 5bfe0dc5113c1612653d080130a887af00c71a9b..0000000000000000000000000000000000000000 --- a/entity/DistrictResponsible_entity/entityfields/departmentattributename/documentation.adoc +++ /dev/null @@ -1 +0,0 @@ -Used in DistrictPreview_view and also in the contentProcess of the JDito RC from Member_entity. \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/departmentattributename/stateProcess.js b/entity/DistrictResponsible_entity/entityfields/departmentattributename/stateProcess.js deleted file mode 100644 index 916fbbd300758fdb197ee31bb0958a12d87f6670..0000000000000000000000000000000000000000 --- a/entity/DistrictResponsible_entity/entityfields/departmentattributename/stateProcess.js +++ /dev/null @@ -1,9 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); - - -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) -{ - result.string(neon.COMPONENTSTATE_INVISIBLE); -} \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/departmentattributename/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/departmentattributename/valueProcess.js deleted file mode 100644 index 7fac5c4e3942f0e9442d679d78370ba7136b96d6..0000000000000000000000000000000000000000 --- a/entity/DistrictResponsible_entity/entityfields/departmentattributename/valueProcess.js +++ /dev/null @@ -1,15 +0,0 @@ -import("system.logging"); -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - - -var departmentAttrId = vars.get("$field.DEPARTMENT_ATTRIBUTE_ID"); -var departmentDisplayName = ""; - -if (departmentAttrId) -{ - departmentDisplayName = AttributeUtil.getSimpleAttributeName(departmentAttrId, true); -} - -result.string(departmentDisplayName); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/departments/children/parentid_param/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/departments/children/parentid_param/valueProcess.js deleted file mode 100644 index 246beece1e0537e3649fa0eeda40218eaa852864..0000000000000000000000000000000000000000 --- a/entity/DistrictResponsible_entity/entityfields/departments/children/parentid_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("AttributeRegistry_basic"); -import("system.result"); - -result.string($AttributeRegistry.departments()); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/employee_contact_id/stateProcess.js b/entity/DistrictResponsible_entity/entityfields/employee_contact_id/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b3376f73e33c298d8cefd14c9098bd6a64f62b38 --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/employee_contact_id/stateProcess.js @@ -0,0 +1,20 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Sql_lib"); +import("system.db"); + +var cond = newWhere(); + +var test = newSelect("COUNT(*)") +.from("DISTRICTCONTACT") +.join("DISTRICTRESPONSIBLE", "DISTRICTCONTACT.ADVISER_CONTACT_ID = DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID") +.where("DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID", vars.get("$field.EMPLOYEE_CONTACT_ID")) +.arrayColumn()[0]; + +if(test.toString() == 0){ + result.string(neon.COMPONENTSTATE_EDITABLE); +} +else{ + result.string(neon.COMPONENTSTATE_READONLY); +} \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/entityfields/persons/children/excludedcontactids_param/valueProcess.js b/entity/DistrictResponsible_entity/entityfields/persons/children/excludedcontactids_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7be95ea8db7b04c1066e434552da5ab2d93a2545 --- /dev/null +++ b/entity/DistrictResponsible_entity/entityfields/persons/children/excludedcontactids_param/valueProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.db"); +import("Sql_lib"); + +result.object(newSelect("EMPLOYEE_CONTACT_ID") + .from("DISTRICTRESPONSIBLE") + .where("DISTRICTRESPONSIBLE.DISTRICT_ID", "$param.DistrictId_param") + .arrayColumn(true)); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/grantDeleteProcess.js b/entity/DistrictResponsible_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7039de6df63613d5985e26ef10ab10e90161e5c9 --- /dev/null +++ b/entity/DistrictResponsible_entity/grantDeleteProcess.js @@ -0,0 +1,13 @@ +import("Context_lib"); +import("system.vars"); +import("system.result"); +import("Entity_lib"); + +var rowId = vars.get("$field.DISTRICTRESPONSIBLEID"); +var currentContext = ContextUtils.getCurrentContextId(); + +var canDelete = new HasLinkedObjectTester() + .andNoEntityRows("DistrictContact_entity", "DistrictContacts", {ObjectId_param : currentContext, RowId_param : rowId}) //District Contact + .validate(); + +result.string(canDelete); \ No newline at end of file diff --git a/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js b/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js index 2bd6b5d01756719a2e951069a73268a5bb488d9f..fc4de922e1d7f53ae4aaa5f8f91ec1dbe5382781 100644 --- a/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js +++ b/entity/DistrictResponsible_entity/recordcontainers/db/recordfieldmappings/district_id.displayvalue/expression.js @@ -4,4 +4,4 @@ import("Sql_lib"); result.string(newSelect("DISTRICT.DISTRICT_NAME") .from("DISTRICT") .where("DISTRICT.DISTRICTID = DISTRICTRESPONSIBLE.DISTRICT_ID") - .toString()); + .toString()); \ No newline at end of file diff --git a/entity/District_entity/District_entity.aod b/entity/District_entity/District_entity.aod index a592cb1d530077075ab61a6d3c0c450196117b67..ab78da8d909963bc8eecfcde4f874c19e9e48f23 100644 --- a/entity/District_entity/District_entity.aod +++ b/entity/District_entity/District_entity.aod @@ -5,6 +5,8 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/District_entity/documentation.adoc</documentation> <icon>VAADIN:GLOBE</icon> + <grantDelete v="false" /> + <grantDeleteProcess>%aditoprj%/entity/District_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/District_entity/contentTitleProcess.js</contentTitleProcess> <iconIdProcess>%aditoprj%/entity/District_entity/iconIdProcess.js</iconIdProcess> <titlePlural></titlePlural> @@ -109,20 +111,6 @@ <fieldName>ISO3Name</fieldName> </dependency> </entityConsumer> - <entityConsumer> - <name>DistrictResponsibles</name> - <dependency> - <name>dependency</name> - <entityName>DistrictResponsible_entity</entityName> - <fieldName>DistrictResponsibles</fieldName> - </dependency> - <children> - <entityParameter> - <name>DistrictId_param</name> - <valueProcess>%aditoprj%/entity/District_entity/entityfields/districtresponsibles/children/districtid_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityField> <name>USER_NEW</name> <valueProcess>%aditoprj%/entity/District_entity/entityfields/user_new/valueProcess.js</valueProcess> @@ -187,6 +175,12 @@ <entityName>LogHistory_entity</entityName> <fieldName>LogHistoryProvider</fieldName> </dependency> + <children> + <entityParameter> + <name>tablenames_param</name> + <valueProcess>%aditoprj%/entity/District_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityField> <name>parentFilter</name> @@ -243,6 +237,7 @@ <children> <entityParameter> <name>DistrictsByContactId_param</name> + <valueProcess>%aditoprj%/entity/District_entity/entityfields/validparentdistricts/children/districtsbycontactid_param/valueProcess.js</valueProcess> <expose v="false" /> </entityParameter> </children> @@ -251,6 +246,81 @@ <name>ExcludedDistrictIds_param</name> <expose v="true" /> </entityParameter> + <entityConsumer> + <name>DistrictResponsibleUIDs</name> + <dependency> + <name>dependency</name> + <entityName>DistrictResponsible_entity</entityName> + <fieldName>DistrictResponsibles</fieldName> + </dependency> + <children> + <entityParameter> + <name>DistrictId_param</name> + <valueProcess>%aditoprj%/entity/District_entity/entityfields/districtresponsibleuids/children/districtid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>DISTRICT_AUTOADD</name> + <title>Auto assignment</title> + <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/District_entity/entityfields/district_autoadd/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/District_entity/entityfields/district_autoadd/valueProcess.js</valueProcess> + </entityField> + <entityActionField> + <name>assignDistrict</name> + <title>Assign district</title> + <onActionProcess>%aditoprj%/entity/District_entity/entityfields/assigndistrict/onActionProcess.js</onActionProcess> + </entityActionField> + <entityActionGroup> + <name>ActionGroup</name> + <children> + <entityActionField> + <name>assignAllActiveDistricts</name> + <title>Assign all selected districts</title> + <onActionProcess>%aditoprj%/entity/District_entity/entityfields/actiongroup/children/assignallactivedistricts/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + </entityActionField> + </children> + </entityActionGroup> + <entityProvider> + <name>DistrictContacts</name> + <dependencies> + <entityDependency> + <name>d94c353f-c66d-489c-934b-72ca154ba37a</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>Districts</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + <children> + <entityParameter> + <name>DistrictsByContactId_param</name> + <valueProcess>%aditoprj%/entity/District_entity/entityfields/districtcontacts/children/districtsbycontactid_param/valueProcess.js</valueProcess> + <expose v="true" /> + <mandatory v="false" /> + </entityParameter> + </children> + </entityProvider> + <entityConsumer> + <name>DistrictContactUIDs</name> + <selectionMode>MULTI</selectionMode> + <dependency> + <name>dependency</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>DistrictContacts</fieldName> + </dependency> + <children> + <entityParameter> + <name>DistrictId_param</name> + <valueProcess>%aditoprj%/entity/District_entity/entityfields/districtcontactuids/children/districtid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityParameter> + <name>ResponsibleDistrictsOfCurrentUser_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -259,6 +329,7 @@ <conditionProcess>%aditoprj%/entity/District_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/District_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <alias>Data_alias</alias> + <onDBDelete>%aditoprj%/entity/District_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <cacheType>GLOBAL</cacheType> <cacheKeyProcess>%aditoprj%/entity/District_entity/recordcontainers/db/cacheKeyProcess.js</cacheKeyProcess> <recordFieldMappings> @@ -346,6 +417,11 @@ <name>totalTurnover.value</name> <isLookupFilter v="false" /> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DISTRICT_AUTOADD.value</name> + <recordfield>DISTRICT.DISTRICT_AUTOADD</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> </recordFieldMappings> <linkInformation> <linkInformation> diff --git a/entity/District_entity/entityfields/actiongroup/children/assignallactivedistricts/onActionProcess.js b/entity/District_entity/entityfields/actiongroup/children/assignallactivedistricts/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..59461e56b39556b3fdcc50ed9e2257df8d240631 --- /dev/null +++ b/entity/District_entity/entityfields/actiongroup/children/assignallactivedistricts/onActionProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.question"); +import("system.translate"); +import("District_lib"); + +var arrDistrictIds = vars.get("$sys.selection"); +question.showMessage(translate.text("Assignment for all selected districts will start now!")); + +DistrictUtils.assignDistrictOnServer(arrDistrictIds); \ No newline at end of file diff --git a/entity/District_entity/entityfields/appliedfilter/valueProcess.js b/entity/District_entity/entityfields/appliedfilter/valueProcess.js index 253bd0712af0b47b35aaa72b8d027fc9d053526d..b4542e7e2d01943cfe47e2aa1364e5be3b411753 100644 --- a/entity/District_entity/entityfields/appliedfilter/valueProcess.js +++ b/entity/District_entity/entityfields/appliedfilter/valueProcess.js @@ -1,37 +1,7 @@ +import("District_lib"); import("system.result"); import("system.vars"); -var parentFilter = vars.get("$field.parentFilter"); -var districtFilter = vars.get("$field.DISTRICT_FILTER"); - -var appliedFilter = { - entity: "Organisation_entity", - filter: { - type: "group", - operator: "AND", - childs: [] -}}; - -if (parentFilter) -{ - appliedFilter.filter.childs.push(JSON.parse(parentFilter).filter); -} -if (districtFilter) -{ - //appliedFilter = _getApplicableFilter(appliedFilter, districtFilter); - appliedFilter.filter.childs.push(JSON.parse(districtFilter).filter); -} - -result.string(JSON.stringify(appliedFilter)); - -filterArray = []; - -function _getApplicableFilter(pFilter, pAppendFilter){ - - var applicableFilter = ""; - var childFilter = JSON.parse(pFilter).filter; - - - - return applicableFilter; -} \ No newline at end of file +//Aufbau des kompletten Filters über alle Hierarchie-Ebenen hinweg +var appliedFilter = DistrictUtils.getAppliedFilter(vars.get("$field.DISTRICT_FILTER"), vars.get("$field.PARENTDISTRICT_DISTRICTID")); +result.string(appliedFilter); diff --git a/entity/District_entity/entityfields/assigndistrict/onActionProcess.js b/entity/District_entity/entityfields/assigndistrict/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f556ead9f64e28f01568cdff1828907b9db2dc14 --- /dev/null +++ b/entity/District_entity/entityfields/assigndistrict/onActionProcess.js @@ -0,0 +1,10 @@ +import("system.question"); +import("system.translate"); +import("District_lib"); +import("system.vars"); + +var arrDistrictId = [vars.get("$field.DISTRICTID")]; + +question.showMessage(translate.text("District assignment will start now!")); + +DistrictUtils.assignDistrictOnServer(arrDistrictId); diff --git a/entity/District_entity/entityfields/customercounting/valueProcess.js b/entity/District_entity/entityfields/customercounting/valueProcess.js index ccecd79603fe711a4705cd3fe0a6081a800986cc..e237bbef745d6c90b0c5b4e7bd58a592a28cca2d 100644 --- a/entity/District_entity/entityfields/customercounting/valueProcess.js +++ b/entity/District_entity/entityfields/customercounting/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.result"); import("system.entities"); @@ -20,5 +19,4 @@ if (appliedFilter) rowCount = entities.getRowCount(conf); } - result.string(rowCount); \ No newline at end of file diff --git a/entity/District_entity/entityfields/district_autoadd/dropDownProcess.js b/entity/District_entity/entityfields/district_autoadd/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e212979b8e77ec7c357dfbc0104882c01fcb7215 --- /dev/null +++ b/entity/District_entity/entityfields/district_autoadd/dropDownProcess.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.result"); + +result.object([ + ["1", translate.text("Yes")] + ,["0", translate.text("No")] + ]); \ No newline at end of file diff --git a/entity/District_entity/entityfields/district_autoadd/valueProcess.js b/entity/District_entity/entityfields/district_autoadd/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c6c5c2d61991c8cf38ac7633b769b51fa200aec4 --- /dev/null +++ b/entity/District_entity/entityfields/district_autoadd/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string("0"); \ No newline at end of file diff --git a/entity/District_entity/entityfields/district_number/displayValueProcess.js b/entity/District_entity/entityfields/district_number/displayValueProcess.js index 95a9d9d10972827b4d89b9f4ad7aa68161204049..af1a50e6fb3106b647f68b45106741f32ee4f494 100644 --- a/entity/District_entity/entityfields/district_number/displayValueProcess.js +++ b/entity/District_entity/entityfields/district_number/displayValueProcess.js @@ -1,10 +1,8 @@ import("system.vars"); -import("system.logging"); import("system.result"); import("system.neon"); import("Sql_lib"); - var districtNo = vars.get("$field.DISTRICT_NUMBER"); -result.string(districtNo.padStart(4, '0')); +result.string(districtNo.padStart(4, '0')); \ No newline at end of file diff --git a/entity/District_entity/entityfields/districtcontacts/children/districtsbycontactid_param/valueProcess.js b/entity/District_entity/entityfields/districtcontacts/children/districtsbycontactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..289f9107d46f3fabb9daf28ea42318b124ba98ea --- /dev/null +++ b/entity/District_entity/entityfields/districtcontacts/children/districtsbycontactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("$$$###ignore_param###$$$");//dummy value, for special treatment in the conditionProcess \ No newline at end of file diff --git a/entity/District_entity/entityfields/districtresponsibles/children/districtid_param/valueProcess.js b/entity/District_entity/entityfields/districtcontactuids/children/districtid_param/valueProcess.js similarity index 98% rename from entity/District_entity/entityfields/districtresponsibles/children/districtid_param/valueProcess.js rename to entity/District_entity/entityfields/districtcontactuids/children/districtid_param/valueProcess.js index d3d1d4b6cb94a84199fdc7783e0194a1a7255152..44ec9627c5e51edbe27130ba82db39ca269d2c07 100644 --- a/entity/District_entity/entityfields/districtresponsibles/children/districtid_param/valueProcess.js +++ b/entity/District_entity/entityfields/districtcontactuids/children/districtid_param/valueProcess.js @@ -1,5 +1,4 @@ import("system.result"); import("system.vars"); - result.string(vars.get("$field.DISTRICTID")); \ No newline at end of file diff --git a/entity/District_entity/entityfields/districtresponsibleuids/children/districtid_param/valueProcess.js b/entity/District_entity/entityfields/districtresponsibleuids/children/districtid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..44ec9627c5e51edbe27130ba82db39ca269d2c07 --- /dev/null +++ b/entity/District_entity/entityfields/districtresponsibleuids/children/districtid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.DISTRICTID")); \ No newline at end of file diff --git a/entity/District_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js b/entity/District_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..92a62600733c4a0b3e48ba036628bb93f372dbf7 --- /dev/null +++ b/entity/District_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.DISTRICTID"), tableNames: ["DISTRICT"]}); + +res = JSON.stringify(res);//currently only strings can be passed as param +result.object(res); \ No newline at end of file diff --git a/entity/District_entity/entityfields/parentfilter/valueProcess.js b/entity/District_entity/entityfields/parentfilter/valueProcess.js index e1c0dfd89d6d147325bc77eb3fe1e1b452c6793e..7dd066de7e904e7528f28d0e03c65b459b534579 100644 --- a/entity/District_entity/entityfields/parentfilter/valueProcess.js +++ b/entity/District_entity/entityfields/parentfilter/valueProcess.js @@ -1,64 +1,7 @@ +import("District_lib"); import("system.result"); import("system.vars"); -import("system.neon"); -import("Sql_lib"); -var res = ""; -var parentDistrictId = vars.get("$field.PARENTDISTRICT_DISTRICTID"); - -if (parentDistrictId) -{ - var completeParentFilter = _getParentFilter(parentDistrictId, null); - completeParentFilter.entity = "Organisation_entity"; - res = completeParentFilter; -} -else -{ - var entity = "Organisation_entity"; - var emptyFilter = { - entity: entity, - filter: { - type: "group", - operator: "AND", - childs: [] - } - }; - - res = emptyFilter; -} - -result.string(JSON.stringify(res)); - - -function _getParentFilter(pParentDistrictId, pPreviousFilter) -{ - var resFilter; - - if (pPreviousFilter != null) - { - resFilter = pPreviousFilter; - } - - if (pParentDistrictId) - { - var parentDistrictFilter, grandParentDistrict; - [parentDistrictFilter, grandParentDistrict] = newSelect(["DISTRICT.DISTRICT_FILTER", "DISTRICT.PARENTDISTRICT_DISTRICTID"]) - .from("DISTRICT") - .where("DISTRICT.DISTRICTID", pParentDistrictId) - .arrayRow(); - - parentDistrictFilter = JSON.parse(parentDistrictFilter); - - if (pPreviousFilter) - parentDistrictFilter.filter.childs.push(resFilter.filter);//todo: kommentar ergänzen was wir heir eigentlcih machen - - resFilter = parentDistrictFilter; - - if (grandParentDistrict.length > 0) - { - resFilter = _getParentFilter(grandParentDistrict, resFilter); - } - } - - return resFilter; -} \ No newline at end of file +//Aufbau des übergeordneten Filters +var res = DistrictUtils.getParentFilter(vars.get("$field.PARENTDISTRICT_DISTRICTID")); +result.string(res); diff --git a/entity/District_entity/entityfields/responsibledistricts/children/districtsbycontactid_param/valueProcess.js b/entity/District_entity/entityfields/responsibledistricts/children/districtsbycontactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/District_entity/entityfields/totalturnover/valueProcess.js b/entity/District_entity/entityfields/totalturnover/valueProcess.js index 40d9732b34a8c3e73b89f860524abb9f55fd77ef..ced08cd465f6508f0641e4bcafa0872957d95865 100644 --- a/entity/District_entity/entityfields/totalturnover/valueProcess.js +++ b/entity/District_entity/entityfields/totalturnover/valueProcess.js @@ -2,7 +2,6 @@ import("system.text"); import("Sql_lib"); import("system.SQLTYPES"); import("Date_lib"); -import("system.logging"); import("system.vars"); import("system.result"); import("system.entities"); diff --git a/entity/District_entity/entityfields/validparentdistricts/children/districtsbycontactid_param/valueProcess.js b/entity/District_entity/entityfields/validparentdistricts/children/districtsbycontactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..289f9107d46f3fabb9daf28ea42318b124ba98ea --- /dev/null +++ b/entity/District_entity/entityfields/validparentdistricts/children/districtsbycontactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("$$$###ignore_param###$$$");//dummy value, for special treatment in the conditionProcess \ No newline at end of file diff --git a/entity/District_entity/grantDeleteProcess.js b/entity/District_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7522748ad5fbe8f919791ccf756baa186da5b08a --- /dev/null +++ b/entity/District_entity/grantDeleteProcess.js @@ -0,0 +1,16 @@ +import("system.result"); +import("Sql_lib"); +import("system.vars"); + +//Ist das zu löschende Gebiet ein übergeordnetes Gebiet, dann ist das Löschen nicht erlaubt. +var districtId = vars.get("$field.DISTRICTID"); +var anzahl = newSelect("COUNT(*)") + .from("DISTRICT") + .where("DISTRICT.PARENTDISTRICT_DISTRICTID", districtId) + .cell(true); + +if (anzahl > 0) + result.string(false); +else + result.string(true); + diff --git a/entity/District_entity/recordcontainers/db/conditionProcess.js b/entity/District_entity/recordcontainers/db/conditionProcess.js index 8329757ab9cf0a152de9c68fc67fcb16ffcb921e..309e53986efe9dbb08ce02ffa3f0e2db7f03115a 100644 --- a/entity/District_entity/recordcontainers/db/conditionProcess.js +++ b/entity/District_entity/recordcontainers/db/conditionProcess.js @@ -1,8 +1,21 @@ +import("Employee_lib"); import("system.result"); import("system.vars"); import("Sql_lib"); -var onlyResponsibleParam = vars.get("$param.DistrictsByContactId_param"); + +var responsibleDistrictsOfCurrentUser = vars.get("$param.ResponsibleDistrictsOfCurrentUser_param"); +var onlyResponsibleParam; +if(responsibleDistrictsOfCurrentUser == "true") +{ + onlyResponsibleParam = EmployeeUtils.getCurrentContactId(); + +} +else +{ + onlyResponsibleParam = vars.get("$param.DistrictsByContactId_param"); +} + var cond = newWhere(); if (onlyResponsibleParam) { diff --git a/entity/District_entity/recordcontainers/db/onDBDelete.js b/entity/District_entity/recordcontainers/db/onDBDelete.js new file mode 100644 index 0000000000000000000000000000000000000000..20387d3b81fded387ccec7197be53354a75fa1b6 --- /dev/null +++ b/entity/District_entity/recordcontainers/db/onDBDelete.js @@ -0,0 +1,16 @@ +import("Sql_lib"); +import("system.vars"); +import("system.db"); + +var condition; +var deleteArray = []; +var districtId = vars.get("$field.DISTRICTID"); + +//Gebiet wird gelöscht -> auch die Referenzen in den folgenden Tabellen löschen +condition = newWhere("DISTRICTCONTACT.DISTRICT_ID", districtId); +deleteArray.push(["DISTRICTCONTACT", condition.build()]); + +condition = newWhere("DISTRICTRESPONSIBLE.DISTRICT_ID", districtId); +deleteArray.push(["DISTRICTRESPONSIBLE", condition.build()]); + +db.deletes(deleteArray); \ No newline at end of file diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index 1f473bcc5eaabf4aa5e4d5f6a573537e1934ef38..83b870153e45d2ca94ccc23ce0d51ec2b0d3b3f0 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -285,12 +285,6 @@ <fieldName>Leadimport_Empl</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>e9a775ab-e63d-493d-94dc-6b27dfb77173</name> - <entityName>DistrictResponsible_entity</entityName> - <fieldName>Employees</fieldName> - <isConsumer v="false" /> - </entityDependency> <entityDependency> <name>7e6bff46-4047-49da-a5ef-40510a8255a2</name> <entityName>VisitRecommendation_entity</entityName> diff --git a/entity/KeywordEntry_entity/KeywordEntry_entity.aod b/entity/KeywordEntry_entity/KeywordEntry_entity.aod index d5d2ddb6ac5262ef7dd3d593c66d7ddf34d69a16..35a6a61d75bb357dfe22c14a1f459a228578410c 100644 --- a/entity/KeywordEntry_entity/KeywordEntry_entity.aod +++ b/entity/KeywordEntry_entity/KeywordEntry_entity.aod @@ -608,6 +608,36 @@ <fieldName>KeywordVisitPlanEntryStatusAppointment</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>edde64f8-8f71-4fa3-a807-b6b3af971446</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>KeywordContactStates</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>146dc4e4-7e99-48da-9572-09f2a57ea7f6</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>KeywordAdviserRoles</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>223e4198-157d-43b5-b31e-417eb6ebf39c</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>KeywordDistrictOrigin</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>6f8ca40b-52bc-461f-8b97-083e1509c6fb</name> + <entityName>DistrictResponsible_entity</entityName> + <fieldName>AdviserStates</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>146306af-cb4e-4d60-8298-f298770e7efb</name> + <entityName>DistrictResponsible_entity</entityName> + <fieldName>AdviserRoles</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 6854c39edf4048c36eefcdfac6e6fe5ec99f12b3..3923d173bd75cf88133639410306b38ea7ac26f2 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -9,6 +9,7 @@ <contentTitleProcess>%aditoprj%/entity/Organisation_entity/contentTitleProcess.js</contentTitleProcess> <contentDescriptionProcess>%aditoprj%/entity/Organisation_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/Organisation_entity/afterUiInit.js</afterUiInit> + <afterSave>%aditoprj%/entity/Organisation_entity/afterSave.js</afterSave> <initFilterProcess>%aditoprj%/entity/Organisation_entity/initFilterProcess.js</initFilterProcess> <useFavorites v="true" /> <iconId>VAADIN:BUILDING</iconId> @@ -152,6 +153,12 @@ <fieldName>Organisations</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>b64b29e6-59c5-4250-9bc7-b08c85976e7e</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>Organisations</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -1570,6 +1577,20 @@ <expose v="true" /> <documentation>%aditoprj%/entity/Organisation_entity/entityfields/mapviewcenterlon_param/documentation.adoc</documentation> </entityParameter> + <entityConsumer> + <name>DistrictContacts</name> + <dependency> + <name>dependency</name> + <entityName>DistrictContact_entity</entityName> + <fieldName>DistrictContacts</fieldName> + </dependency> + <children> + <entityParameter> + <name>currentOrganisationId_param</name> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/districtcontacts/children/currentorganisationid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> @@ -1840,6 +1861,14 @@ <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/favorites_filter/filterConditionProcess.js</filterConditionProcess> <filtertype>BASIC</filtertype> </filterExtension> + <filterExtension> + <name>ResponsibleAssignment</name> + <title>Supervisor assignment</title> + <contentType>TEXT</contentType> + <filterValuesProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterConditionProcess.js</filterConditionProcess> + <filtertype>EXTENDED</filtertype> + </filterExtension> </filterExtensions> </dbRecordContainer> <indexRecordContainer> diff --git a/entity/Organisation_entity/afterSave.js b/entity/Organisation_entity/afterSave.js new file mode 100644 index 0000000000000000000000000000000000000000..4e40d8d824716c3690bb87b0f774ea3895246b3d --- /dev/null +++ b/entity/Organisation_entity/afterSave.js @@ -0,0 +1,11 @@ +import("system.logging"); +import("system.vars"); +import("District_lib"); +import("system.neon"); + +if (vars.get("$local.recordstate") == neon.OPERATINGSTATE_NEW) +{ + //Assign this new organisation to all according districts with auto assignment is true + //2nd parameter "undefined" means, that the current user is determined in the function + DistrictUtils.assignDistrictOnServer([], undefined, vars.get("$local.entitydata")["CONTACTID"]) +} \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/districtcontacts/children/currentorganisationid_param/valueProcess.js b/entity/Organisation_entity/entityfields/districtcontacts/children/currentorganisationid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..70a1c0fcc1293fa4bf37109294829055704eeaea --- /dev/null +++ b/entity/Organisation_entity/entityfields/districtcontacts/children/currentorganisationid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..dec63bfd984d6224a90a64f10a70daaaa670f011 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterConditionProcess.js @@ -0,0 +1,38 @@ +import("Employee_lib"); +import("KeywordRegistry_basic"); +import("Sql_lib"); +import("system.vars"); +import("system.result"); + +var operator = vars.get("$local.operator"); +var rawvalue = vars.get("$local.rawvalue"); +var operator2 = vars.get("$local.operator2"); +var sqlCond = ""; + +rawvalue = (rawvalue == "true"); + + +if(operator == "1" && rawvalue || operator == "2" && !rawvalue ) + operator2 = SqlBuilder.IN(); +else if(operator == "1" && !rawvalue || operator == "2" && rawvalue) + operator2 = SqlBuilder.NOT_IN(); +else + sqlCond = "1=1"; + + + +if (sqlCond == "") + sqlCond = new SqlBuilder().where("CONTACT.CONTACTID", + newSelect("DISTRICTCONTACT.CONTACT_ID") + .from("DISTRICTCONTACT") + .where("DISTRICTCONTACT.ADVISER_CONTACT_ID", EmployeeUtils.getCurrentContactId()) + .and( + newWhere( + newWhere("current_date >= cast(DISTRICTCONTACT.VALID_FROM as DATE)") + .and("current_date <= cast(DISTRICTCONTACT.VALID_UNTIL as DATE)")) + .or(newWhere("current_date >= cast(DISTRICTCONTACT.VALID_FROM as DATE)") + .and("DISTRICTCONTACT.VALID_UNTIL is null"))) + .and("DISTRICTCONTACT.STATUS", $KeywordRegistry.contactStatus$active()), operator2).toString(); + + +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterValuesProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4462144da5638267f7c76cce0c779305ae80c089 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterValuesProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.object([["true", translate.text("Yes")], ["false", translate.text("No")]]); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 2a6ffeac76c04b98516fd5b4f0c9841f1df0d0df..06653f4727d9ee82f50e883543cc68d511a017d2 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -722,6 +722,12 @@ <fieldName>Persons</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>6854e035-f459-41b2-84f8-9f5cca5dbe80</name> + <entityName>DistrictResponsible_entity</entityName> + <fieldName>Persons</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -1771,6 +1777,14 @@ <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/favorites_filter/filterConditionProcess.js</filterConditionProcess> <filtertype>BASIC</filtertype> </filterExtension> + <filterExtension> + <name>SupervisorAssignment</name> + <title>Supervisor assignment</title> + <contentType>TEXT</contentType> + <filterValuesProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtension> </filterExtensions> </dbRecordContainer> <indexRecordContainer> diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9b9b11b65c2fe1c8206d87c6ccc85a9b8c9e7d04 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterConditionProcess.js @@ -0,0 +1,40 @@ +import("Employee_lib"); +import("KeywordRegistry_basic"); +import("Sql_lib"); +import("system.vars"); +import("system.result"); + +var operator = vars.get("$local.operator"); +var rawvalue = vars.get("$local.rawvalue"); +var operator2 = vars.get("$local.operator2"); +var sqlCond = ""; + +rawvalue = (rawvalue == "true"); + + +if(operator == "1" && rawvalue || operator == "2" && !rawvalue ) + operator2 = SqlBuilder.IN(); +else if(operator == "1" && !rawvalue || operator == "2" && rawvalue) + operator2 = SqlBuilder.NOT_IN(); +else + sqlCond = "1=1"; + + + +if (sqlCond == "") + sqlCond = new SqlBuilder().where("CONTACT.CONTACTID", + newSelect("pers.CONTACTID") + .from("DISTRICTCONTACT") + .join("CONTACT", "DISTRICTCONTACT.CONTACT_ID = org.CONTACTID", "org") + .join("CONTACT", "pers.ORGANISATION_ID = org.ORGANISATION_ID and pers.PERSON_ID is not null", "pers") + .where("DISTRICTCONTACT.ADVISER_CONTACT_ID", EmployeeUtils.getCurrentContactId()) + .and( + newWhere( + newWhere("current_date >= cast(DISTRICTCONTACT.VALID_FROM as DATE)") + .and("current_date <= cast(DISTRICTCONTACT.VALID_UNTIL as DATE)")) + .or(newWhere("current_date >= cast(DISTRICTCONTACT.VALID_FROM as DATE)") + .and("DISTRICTCONTACT.VALID_UNTIL is null"))) + .and("DISTRICTCONTACT.STATUS", $KeywordRegistry.contactStatus$active()), operator2).toString(); + + +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterValuesProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4462144da5638267f7c76cce0c779305ae80c089 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterValuesProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.object([["true", translate.text("Yes")], ["false", translate.text("No")]]); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 632eefce7ccb9ecb02781d6e27a05e4b0435bc54..dca0fa72998aec0fb24c140019c4e4e5df05f709 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -7764,6 +7764,45 @@ <entry> <key>Import Documents</key> </entry> + <entry> + <key>Adviser Contact</key> + </entry> + <entry> + <key>Office Duty</key> + </entry> + <entry> + <key>Adviser Role</key> + </entry> + <entry> + <key>District Contacts</key> + </entry> + <entry> + <key>Area Manager</key> + </entry> + <entry> + <key>Auto assignment</key> + </entry> + <entry> + <key>Field Service</key> + </entry> + <entry> + <key>Sales Manager</key> + </entry> + <entry> + <key>Region Manager</key> + </entry> + <entry> + <key>District Contact</key> + </entry> + <entry> + <key>Supervisors</key> + </entry> + <entry> + <key>Supervisor assignment</key> + </entry> + <entry> + <key>Supervisor</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index bb47b0cdfa3d3369d4b616f19681bbc34f1d48b1..fa4126d090c660892cd0629744504ec7997bd679 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -58,6 +58,14 @@ <key>The start date has to be before the end date.</key> <value>Das Startdatum muss vor dem Enddatum sein.</value> </entry> + <entry> + <key>Supervisors</key> + <value>Betreuer</value> + </entry> + <entry> + <key>Supervisor assignment</key> + <value>Betreuerzuordnung</value> + </entry> <entry> <key>The given starting location is empty. An area search can not be performed.</key> <value>Der übergebene Startpunkt ist leer. Die Umkreissuche kann nicht ausgeführt werden.</value> @@ -942,6 +950,10 @@ <key>Social Media</key> <value>Social Media</value> </entry> + <entry> + <key>Adviser contact</key> + <value>Verantwortlicher</value> + </entry> <entry> <key>Visit</key> <value>Besuch</value> @@ -954,6 +966,10 @@ <key>Language</key> <value>Sprache</value> </entry> + <entry> + <key>Adviser role</key> + <value>Rolle des Verantwortlichen</value> + </entry> <entry> <key>Phone</key> <value>Telefon</value> @@ -2891,6 +2907,10 @@ <key>Adviser</key> <value>Berater</value> </entry> + <entry> + <key>It lists all areas that the user has to take care of.</key> + <value>Es werden alle Gebiete aufgelistet, die der Benutzer betreuen muss.</value> + </entry> <entry> <key>Company_size</key> <value>Unternehmen_Größe</value> @@ -6628,7 +6648,7 @@ </entry> <entry> <key>Payment address</key> - <value>Zahlungsadresse</value> + <value>Rechnungsadresse</value> </entry> <entry> <key>Texts</key> @@ -7007,7 +7027,7 @@ </entry> <entry> <key>Total VAT</key> - <value>gesamte Mehrwertsteuer</value> + <value>MWST</value> </entry> <entry> <key>DataPrivacy Use</key> @@ -7516,6 +7536,10 @@ <key>Info (Company)</key> <value>Info (Firma)</value> </entry> + <entry> + <key>Supervisor</key> + <value>Betreuer</value> + </entry> <entry> <key>Möglicherweise ist ein Import-Feld zu groß für das Zielfeld.</key> <value>An import field may be too large for the target field.</value> @@ -9490,8 +9514,8 @@ Bitte Datumseingabe prüfen</value> <value>Übergeordnetes Gebiet</value> </entry> <entry> - <key>Responsible Districts</key> - <value>Verantwortliche Gebiete</value> + <key>My responsible Districts</key> + <value>Meine verantwortlichen Gebiete</value> </entry> <entry> <key>District No.:</key> @@ -10233,6 +10257,98 @@ Bitte Datumseingabe prüfen</value> <key>Error: The Importfile could not be found anymore.</key> <value>Fehler: Die Importdatei konnte nicht mehr gefunden werden.</value> </entry> + <entry> + <key>Auto assignment</key> + <value>Auto-Zuordnung</value> + </entry> + <entry> + <key>District Contact</key> + <value>Gebietsverantwortlicher</value> + </entry> + <entry> + <key>District Contacts</key> + <value>Gebietsverantwortlichen</value> + </entry> + <entry> + <key>Adviser Role</key> + <value>Rolle des Verantwortlichen</value> + </entry> + <entry> + <key>Adviser Contact</key> + <value>Verantwortlicher</value> + </entry> + <entry> + <key>Sales Manager</key> + <value>Verkaufsleiter</value> + </entry> + <entry> + <key>Office Duty</key> + <value>Innendienst</value> + </entry> + <entry> + <key>Region Manager</key> + <value>Regionsleiter</value> + </entry> + <entry> + <key>Area Manager</key> + <value>Gebietsleiter</value> + </entry> + <entry> + <key>Field Service</key> + <value>Außendienst</value> + </entry> + <entry> + <key>Assign district</key> + <value>Gebiet zuordnen</value> + </entry> + <entry> + <key>District assignment will start now!</key> + <value>Die Gebietszuordnung wird jetzt gestartet!</value> + </entry> + <entry> + <key>Assignment of district \"%0\" is completed!</key> + <value>Zuordnung des Gebietes \"%0\" ist abgeschlossen!</value> + </entry> + <entry> + <key>%0 companies were newley assigned. \n%1 companies are no longer assigned (these assignments got the status 'review'). \n%2 valid assignments were unchanged.\nThe Process took %3 seconds.</key> + <value>%0 Firmen wurden neu hinzugefügt. \n %1 Firmen sind nicht länger zugeordnet (diese Zuordnungen wurden auf den Status 'zur Prüfung' gesetzt). \n %2 gültige Zuordnungen blieben unverändert. \n Der Prozess dauert %3 Sekunden. </value> + </entry> + <entry> + <key>District assignment status</key> + <value>Gebietzuordnungstatus</value> + </entry> + <entry> + <key>Assign all selected districts</key> + <value>Zuordnung für alle selektierten Gebiete</value> + </entry> + <entry> + <key>Assignment for all selected districts will start now!</key> + <value>Zuordnung für alle selektierten Gebiete wird jetzt gestartet</value> + </entry> + <entry> + <key>Assignment of all selected districts is completed!</key> + <value>Zuordnung für alle selektierten Gebiete abgeschlossen</value> + </entry> + <entry> + <key>Set active</key> + <value>Aktiv setzen</value> + </entry> + <entry> + <key>Set inactive</key> + <value>Inaktiv setzen</value> + </entry> + <entry> + <key>Set status to active</key> + <value>Status auf aktiv setzen</value> + </entry> + <entry> + <key>Set status to inactive</key> + <value>Status auf inaktiv setzen</value> + </entry> + <entry> + <key>My district assignments to check</key> + <value>Meine zu prüfenden Gebietszuweisungen</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 585caf0c3ea8ead0b0d85857d994d2253093f8c2..1ba3fb449db3d63502a443d8aef337133b98d8c6 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -7845,6 +7845,90 @@ <entry> <key>Import Documents</key> </entry> + <entry> + <key>Adviser Contact</key> + </entry> + <entry> + <key>Office Duty</key> + </entry> + <entry> + <key>Adviser Role</key> + </entry> + <entry> + <key>District Contacts</key> + </entry> + <entry> + <key>Area Manager</key> + </entry> + <entry> + <key>Auto assignment</key> + </entry> + <entry> + <key>Field Service</key> + </entry> + <entry> + <key>Sales Manager</key> + </entry> + <entry> + <key>Region Manager</key> + </entry> + <entry> + <key>District Contact</key> + </entry> + <entry> + <key>Supervisors</key> + </entry> + <entry> + <key>Supervisor assignment</key> + </entry> + <entry> + <key>Supervisor</key> + </entry> + <entry> + <key>Adviser role</key> + </entry> + <entry> + <key>Adviser contact</key> + </entry> + <entry> + <key>Assignment for all selected districts will start now!</key> + </entry> + <entry> + <key>Set status to active</key> + </entry> + <entry> + <key>Assign all selected districts</key> + </entry> + <entry> + <key>Set active</key> + </entry> + <entry> + <key>%0 companies were newley assigned. \n%1 companies are no longer assigned (these assignments got the status 'review'). \n%2 valid assignments were unchanged.\nThe Process took %3 seconds.</key> + </entry> + <entry> + <key>Assign district</key> + </entry> + <entry> + <key>Set inactive</key> + </entry> + <entry> + <key>My district assignments to check</key> + </entry> + <entry> + <key>Assignment of district \"%0\" is completed!</key> + </entry> + <entry> + <key>Set status to inactive</key> + </entry> + <entry> + <key>District assignment status</key> + </entry> + <entry> + <key>District assignment will start now!</key> + </entry> + <entry> + <key>Assignment of all selected districts is completed!</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/DistrictContact/DistrictContact.aod b/neonContext/DistrictContact/DistrictContact.aod new file mode 100644 index 0000000000000000000000000000000000000000..8db3d54af752ddd113a94b0e68df38a00c3f6bf8 --- /dev/null +++ b/neonContext/DistrictContact/DistrictContact.aod @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>DistrictContact</name> + <title>Supervisor</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:GLOBE</icon> + <filterView>DistrictContactFilter_view</filterView> + <editView>DistrictContactEdit_view</editView> + <entity>DistrictContact_entity</entity> + <references> + <neonViewReference> + <name>d3f8cf3c-bf79-4b52-a7a6-f26dcc3b6cb3</name> + <view>DistrictContactFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>a271900d-e4cb-40cf-8172-93169a513ee4</name> + <view>DistrictContactEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/DistrictResponsible/DistrictResponsible.aod b/neonContext/DistrictResponsible/DistrictResponsible.aod index 58d47bc30bb3ee9a657e860f9b9f6b45872194e5..1a7fdf7c9c460ca3d629a372a4ffba1cf1aa8cc3 100644 --- a/neonContext/DistrictResponsible/DistrictResponsible.aod +++ b/neonContext/DistrictResponsible/DistrictResponsible.aod @@ -1,8 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> <name>DistrictResponsible</name> + <title>District Responsibles</title> <majorModelMode>DISTRIBUTED</majorModelMode> <icon>VAADIN:GLOBE</icon> + <filterView>DistrictResponsibleFilter_view</filterView> + <editView>DistrictResponsibleEdit_view</editView> + <previewView>DistrictResponsiblePreviewList_view</previewView> + <lookupView>DistrictResponsibleLookup_view</lookupView> + <devices> + <element>MOBILE</element> + <element>TABLET</element> + <element>DESKTOP</element> + </devices> <entity>DistrictResponsible_entity</entity> <references> <neonViewReference> @@ -17,5 +27,17 @@ <name>cba355d3-4ef4-441e-8976-f51c8fe65eec</name> <view>DistrictResponsiblePreviewList_view</view> </neonViewReference> + <neonViewReference> + <name>4fb58e00-a771-4a2b-a820-d0f863572d89</name> + <view>DistrictResponsibleFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>bf0655aa-60e7-47b8-a3e7-eb7ba8b37cac</name> + <view>DistrictResponsibleEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>30960bbf-184a-4e4e-8058-983d4c150d89</name> + <view>DistrictResponsibleLookup_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonNotificationType/DistrictAssigned/DistrictAssigned.aod b/neonNotificationType/DistrictAssigned/DistrictAssigned.aod new file mode 100644 index 0000000000000000000000000000000000000000..d3acf304d7d808619faba61d320706818107cb06 --- /dev/null +++ b/neonNotificationType/DistrictAssigned/DistrictAssigned.aod @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonNotificationType xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonNotificationType/1.1.0"> + <name>DistrictAssigned</name> + <title>District assigned</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:GLOBE</icon> +</neonNotificationType> diff --git a/neonView/DistrictContactEdit_view/DistrictContactEdit_view.aod b/neonView/DistrictContactEdit_view/DistrictContactEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..376c4470d975652394d9a6b47d4b9baba03f3baf --- /dev/null +++ b/neonView/DistrictContactEdit_view/DistrictContactEdit_view.aod @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>DistrictContactEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <size>SMALL</size> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>genericViewTemplate</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>677efe7a-5cd1-42c1-8e4e-73bf7d634515</name> + <entityField>CONTACT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>bc016cdc-cc9a-4dec-afc2-433b65a6519e</name> + <entityField>ADVISER_CONTACT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>2b10ba7c-4da2-4fdc-99af-072ea8814237</name> + <entityField>ADVISER_ROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7f3fd6a1-1ae0-4939-86ff-22816b39feeb</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>93c3bfba-a4c0-4c39-802f-7391d9680f55</name> + <entityField>VALID_FROM</entityField> + </entityFieldLink> + <entityFieldLink> + <name>09265a39-9e44-4161-93b7-3ee4e8d78a42</name> + <entityField>VALID_UNTIL</entityField> + </entityFieldLink> + <entityFieldLink> + <name>c1b99287-3727-4470-a58a-4ecce35284cc</name> + <entityField>ORIGIN</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/DistrictContactFilter_view/DistrictContactFilter_view.aod b/neonView/DistrictContactFilter_view/DistrictContactFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..49a72f748c22e43589957c054b6ad5681e9e233e --- /dev/null +++ b/neonView/DistrictContactFilter_view/DistrictContactFilter_view.aod @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>DistrictContactFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <dashletConfigurations> + <neonDashletConfiguration> + <name>OwnDistrictContactsToCheck</name> + <title>My district assignments to check</title> + <description>Show my district assignments with status review</description> + <fragment>DistrictContact/filter</fragment> + <icon>VAADIN:GLOBE</icon> + <categories> + <neonDashletCategory> + <name>district</name> + <title>District</title> + </neonDashletCategory> + </categories> + <parameters> + <neonDashletParameter> + <name>isDashletView_param</name> + <value>true</value> + </neonDashletParameter> + </parameters> + </neonDashletConfiguration> + </dashletConfigurations> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>districtContacts</name> + <favoriteActionGroup1>setStatus</favoriteActionGroup1> + <entityField>#ENTITY</entityField> + <linkedColumns /> + <fixedFilterFields /> + <columns> + <neonTableColumn> + <name>b9295685-3242-4e15-af62-72f4adb758a3</name> + <entityField>#ICON</entityField> + </neonTableColumn> + <neonTableColumn> + <name>b2b3fd8c-2d93-4059-b4e4-24ca24874018</name> + <entityField>CONTACT_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a5b6ac69-712c-45e1-97ff-cf1101da4b95</name> + <entityField>ADVISER_CONTACT_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>06c6fc84-5025-4bb2-906a-3de1bbeafbdd</name> + <entityField>ADVISER_ROLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1870263d-a3be-41fc-989a-2fb8aebef12c</name> + <entityField>STATUS</entityField> + </neonTableColumn> + <neonTableColumn> + <name>26299d80-a74b-4c45-b599-6aec0ab6e82b</name> + <entityField>ORIGIN</entityField> + </neonTableColumn> + <neonTableColumn> + <name>e8942dc0-3661-431e-9bac-2ab15a060438</name> + <entityField>DISTRICT_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>873010c6-bd65-40bf-a8f3-7bbb82d56e8a</name> + <entityField>VALID_FROM</entityField> + </neonTableColumn> + <neonTableColumn> + <name>cdd947b0-d546-4aeb-9ec6-7d913e1c45bc</name> + <entityField>VALID_UNTIL</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/DistrictEdit_view/DistrictEdit_view.aod b/neonView/DistrictEdit_view/DistrictEdit_view.aod index ba7b2fa93c09ebe118b6ebd7f16b732bd335f919..23e446f92788c0149438b2c8a3d9818c05fd0d14 100644 --- a/neonView/DistrictEdit_view/DistrictEdit_view.aod +++ b/neonView/DistrictEdit_view/DistrictEdit_view.aod @@ -34,6 +34,10 @@ <name>941cb436-8b93-427d-ae2d-3731e55dd040</name> <entityField>DISTRICT_STATUS</entityField> </entityFieldLink> + <entityFieldLink> + <name>b7e851f6-0492-4298-98dd-87abb5d01255</name> + <entityField>DISTRICT_AUTOADD</entityField> + </entityFieldLink> <entityFieldLink> <name>f77428c6-eaff-4554-aedb-cf56d4c573d6</name> <entityField>PARENTDISTRICT_DISTRICTID</entityField> @@ -48,10 +52,5 @@ </entityFieldLink> </fields> </genericViewTemplate> - <neonViewReference> - <name>f1dddbee-5718-46b8-b682-ba4e707bf529</name> - <entityField>DistrictResponsibles</entityField> - <view>DistrictResponsibleMultiEdit_view</view> - </neonViewReference> </children> </neonView> diff --git a/neonView/DistrictFilter_view/DistrictFilter_view.aod b/neonView/DistrictFilter_view/DistrictFilter_view.aod index d60e76db2624cc64e91b5d37cc50042ccbab2324..4687e2fbd43f95815a54f16e8de9240059ba5dd0 100644 --- a/neonView/DistrictFilter_view/DistrictFilter_view.aod +++ b/neonView/DistrictFilter_view/DistrictFilter_view.aod @@ -12,6 +12,7 @@ <treeTableViewTemplate> <name>treetableViewTemplate</name> <parentField>PARENTDISTRICT_DISTRICTID</parentField> + <favoriteActionGroup1>ActionGroup</favoriteActionGroup1> <hideContentSearch v="false" /> <showChildrenCount v="false" /> <entityField>#ENTITY</entityField> @@ -44,6 +45,10 @@ <name>87184bb1-4d44-4872-bae7-9be903f71354</name> <entityField>DISTRICT_STATUS</entityField> </neonTreeTableColumn> + <neonTreeTableColumn> + <name>07781cf0-39f7-4338-8776-a936e2ac9f6e</name> + <entityField>DISTRICT_AUTOADD</entityField> + </neonTreeTableColumn> </columns> </treeTableViewTemplate> </children> diff --git a/neonView/DistrictList_view/DistrictList_view.aod b/neonView/DistrictList_view/DistrictList_view.aod index 45225faadb9410677d433a529a1d287105aa26a2..59f57e2b302ac896aa9c83f92df5fdcee8253353 100644 --- a/neonView/DistrictList_view/DistrictList_view.aod +++ b/neonView/DistrictList_view/DistrictList_view.aod @@ -3,6 +3,27 @@ <name>DistrictList_view</name> <title>Responsible Districts</title> <majorModelMode>DISTRIBUTED</majorModelMode> + <dashletConfigurations> + <neonDashletConfiguration> + <name>ResponsibleDistrictDashletConfiguration</name> + <title>My responsible Districts</title> + <description>It lists all areas that the user has to take care of.</description> + <fragment>District/DistrictList_view</fragment> + <icon>VAADIN:GLOBE</icon> + <categories> + <neonDashletCategory> + <name>Districts</name> + <title>Districts</title> + </neonDashletCategory> + </categories> + <parameters> + <neonDashletParameter> + <name>ResponsibleDistrictsOfCurrentUser_param</name> + <value>true</value> + </neonDashletParameter> + </parameters> + </neonDashletConfiguration> + </dashletConfigurations> <layout> <boxLayout> <name>layout</name> diff --git a/neonView/DistrictMain_view/DistrictMain_view.aod b/neonView/DistrictMain_view/DistrictMain_view.aod index f6d39a27cd5aefdf998581597e296bdcfca4301a..23883a51320c6325155964c7a00800fe70bb8293 100644 --- a/neonView/DistrictMain_view/DistrictMain_view.aod +++ b/neonView/DistrictMain_view/DistrictMain_view.aod @@ -14,6 +14,16 @@ <entityField>#ENTITY</entityField> <view>DistrictPreview_view</view> </neonViewReference> + <neonViewReference> + <name>a725b1a4-6c00-41e7-8577-922718e72938</name> + <entityField>DistrictResponsibleUIDs</entityField> + <view>DistrictResponsibleFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>056f1fea-5cd7-4156-a1ee-1dea0bbcef1e</name> + <entityField>DistrictContactUIDs</entityField> + <view>DistrictContactFilter_view</view> + </neonViewReference> <neonViewReference> <name>b409f300-c8b4-4052-9012-5e6b79c03a9c</name> <entityField>Organisations</entityField> diff --git a/neonView/DistrictPreview_view/DistrictPreview_view.aod b/neonView/DistrictPreview_view/DistrictPreview_view.aod index 8b7243f1f4ea2d428510b3c729c45e92093e6b80..e6c4e4075f76ef93a58698870121e137eb265fb5 100644 --- a/neonView/DistrictPreview_view/DistrictPreview_view.aod +++ b/neonView/DistrictPreview_view/DistrictPreview_view.aod @@ -18,11 +18,6 @@ <descriptionField>DISTRICT_NUMBER_fieldGroup</descriptionField> <entityField>#ENTITY</entityField> </cardViewTemplate> - <neonViewReference> - <name>a7a731e8-f93e-4d90-8459-d249a13ecf0d</name> - <entityField>DistrictResponsibles</entityField> - <view>DistrictResponsiblePreviewList_view</view> - </neonViewReference> <genericViewTemplate> <name>furtherInfosGenericViewTemplate</name> <showDrawer v="true" /> @@ -44,6 +39,10 @@ <name>98be594e-6209-4046-b0e9-07200c8c294e</name> <entityField>DISTRICT_STATUS</entityField> </entityFieldLink> + <entityFieldLink> + <name>82a03e53-5373-485c-b0e7-9ec72d7bece5</name> + <entityField>DISTRICT_AUTOADD</entityField> + </entityFieldLink> </fields> </genericViewTemplate> <scoreCardViewTemplate> diff --git a/neonView/DistrictResponsibleEdit_view/DistrictResponsibleEdit_view.aod b/neonView/DistrictResponsibleEdit_view/DistrictResponsibleEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..a6771e912541b618da76fb9fb31a4d86c7e86a34 --- /dev/null +++ b/neonView/DistrictResponsibleEdit_view/DistrictResponsibleEdit_view.aod @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>DistrictResponsibleEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <size>SMALL</size> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <genericViewTemplate> + <name>genericViewTemplate</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>9e7007c1-7b6e-45d9-961f-7877c2766688</name> + <entityField>EMPLOYEE_CONTACT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>77b9ba2a-d7ee-47ba-8908-63e45dbd1db2</name> + <entityField>ADVISER_ROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>6b4c7d81-48f0-4cc2-a0fd-2fbb090d35da</name> + <entityField>ADVISER_STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>14ba4841-19c5-4282-ae2c-97108e55ed14</name> + <entityField>VALID_FROM</entityField> + </entityFieldLink> + <entityFieldLink> + <name>4bdb4191-6452-44b2-b0b2-54fc00d445cb</name> + <entityField>VALID_UNTIL</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/DistrictResponsibleFilter_view/DistrictResponsibleFilter_view.aod b/neonView/DistrictResponsibleFilter_view/DistrictResponsibleFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..422383ea0f7572907d41c6ac8d7edf383a82d68f --- /dev/null +++ b/neonView/DistrictResponsibleFilter_view/DistrictResponsibleFilter_view.aod @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>DistrictResponsibleFilter_view</name> + <title>Responsibles</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Supervisors</name> + <entityField>#ENTITY</entityField> + <linkedColumns /> + <fixedFilterFields /> + <maxDBRow v="400" /> + <columns> + <neonTableColumn> + <name>892cf211-1d55-4976-acba-9d70a925fd26</name> + <entityField>#ICON</entityField> + </neonTableColumn> + <neonTableColumn> + <name>5821447b-a15a-49f8-97d8-cc7411afed0c</name> + <entityField>EMPLOYEE_CONTACT_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1cbd12e3-6de1-4932-afbd-0f856c030984</name> + <entityField>ADVISER_ROLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>f8b3b6e7-8e7c-41f1-aed9-f81e3f3d0bad</name> + <entityField>ADVISER_STATUS</entityField> + </neonTableColumn> + <neonTableColumn> + <name>9896476f-1b08-49c9-91ef-000579e52e0b</name> + <entityField>VALID_FROM</entityField> + </neonTableColumn> + <neonTableColumn> + <name>0ff668e7-8e9a-483d-973a-d74a7a919a5a</name> + <entityField>VALID_UNTIL</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/DistrictResponsibleList_view/DistrictResponsibleList_view.aod b/neonView/DistrictResponsibleList_view/DistrictResponsibleList_view.aod index fc2f1135c999d224c788a81c63c2c75a68554030..a71ebf6d6600490e84986e30f9e74fae303699ab 100644 --- a/neonView/DistrictResponsibleList_view/DistrictResponsibleList_view.aod +++ b/neonView/DistrictResponsibleList_view/DistrictResponsibleList_view.aod @@ -34,10 +34,6 @@ <name>32e7b066-76b4-4bd2-b440-bc7844c929a6</name> <entityField>EMPLOYEE_CONTACT_ID</entityField> </neonTableColumn> - <neonTableColumn> - <name>dc9bce22-9a99-4db9-a76a-8fd4a91d5f0f</name> - <entityField>departmentAttributeName</entityField> - </neonTableColumn> <neonTableColumn> <name>fd46a7b9-60bb-48d1-aac5-0ef28943eac9</name> <entityField>PHONE</entityField> diff --git a/neonView/DistrictResponsibleLookup_view/DistrictResponsibleLookup_view.aod b/neonView/DistrictResponsibleLookup_view/DistrictResponsibleLookup_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..20ab3ef6c626ce76ec30e576581213ab04633c02 --- /dev/null +++ b/neonView/DistrictResponsibleLookup_view/DistrictResponsibleLookup_view.aod @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>DistrictResponsibleLookup_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <tableViewTemplate> + <name>ResponsibleLookup</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>b1180c08-6e1f-459f-868f-2842d034806f</name> + <entityField>#ICON</entityField> + </neonTableColumn> + <neonTableColumn> + <name>e5b2fbc0-174d-4d0e-88d1-a798e65cd773</name> + <entityField>EMPLOYEE_CONTACT_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>db77b7a3-80bf-4dc7-9691-8d6aa7422756</name> + <entityField>ADVISER_ROLE</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/DistrictResponsiblePreviewList_view/DistrictResponsiblePreviewList_view.aod b/neonView/DistrictResponsiblePreviewList_view/DistrictResponsiblePreviewList_view.aod index d7166fc927682f5413acbf372e987ff311f79eb8..6bbfdcfc107e51a6dfc22d7551c32a3e2ef92b98 100644 --- a/neonView/DistrictResponsiblePreviewList_view/DistrictResponsiblePreviewList_view.aod +++ b/neonView/DistrictResponsiblePreviewList_view/DistrictResponsiblePreviewList_view.aod @@ -3,23 +3,37 @@ <name>DistrictResponsiblePreviewList_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> - <noneLayout> + <boxLayout> <name>layout</name> - </noneLayout> + </boxLayout> </layout> <children> - <titledListViewTemplate> - <name>titledListViewTemplate</name> - <titleField>departmentAttributeName</titleField> + <genericViewTemplate> + <name>Responsibles</name> <entityField>#ENTITY</entityField> <title>Contactperson</title> - <columns> - <neonTitledListTableColumn> - <name>007d67c4-146b-4202-a677-4390059b4a0a</name> + <fields> + <entityFieldLink> + <name>e65ad43f-0ec6-4a22-b58d-e903acd2648c</name> <entityField>EMPLOYEE_CONTACT_ID</entityField> - <fullWidth v="true" /> - </neonTitledListTableColumn> - </columns> - </titledListViewTemplate> + </entityFieldLink> + <entityFieldLink> + <name>2606d85a-1176-4067-97db-27207dfcee4c</name> + <entityField>ADVISER_ROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b882f9ff-f877-42e9-9a0c-84206bd78cea</name> + <entityField>ADVISER_STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>fde46c86-a464-4279-9fc8-71da3d6e73eb</name> + <entityField>VALID_FROM</entityField> + </entityFieldLink> + <entityFieldLink> + <name>70e68bd7-6431-4f13-92e0-9efd11a0de96</name> + <entityField>VALID_UNTIL</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> </children> </neonView> diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index 03d6b384c21ee408aa5c686a7c07557fb2ac1516..fc3cec511d94cbf68f54f3a6519d45299047848b 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -56,9 +56,9 @@ <view>OrganisationAttributeRestriction_view</view> </neonViewReference> <neonViewReference> - <name>a806bf0f-6214-4aad-872b-74e6f7fd1ee5</name> - <entityField>DistrictResponsibles</entityField> - <view>DistrictResponsibleList_view</view> + <name>c2b37e4d-3b5e-4e23-8b7c-6da02b27ffc0</name> + <entityField>DistrictContacts</entityField> + <view>DistrictContactFilter_view</view> </neonViewReference> <neonViewReference> <name>eba90ed2-5e55-4cdb-9e0b-5a09feeb7536</name> diff --git a/neonView/PersonMain_view/PersonMain_view.aod b/neonView/PersonMain_view/PersonMain_view.aod index 8ec9c55885ac9df41ea0ee360e7ebd0e64ddaf02..b45075ad6a52e6a7bc4a1b7765ff77354ed48952 100644 --- a/neonView/PersonMain_view/PersonMain_view.aod +++ b/neonView/PersonMain_view/PersonMain_view.aod @@ -44,11 +44,6 @@ <entityField>#ENTITY</entityField> <view>PersonAttributeRestriction_view</view> </neonViewReference> - <neonViewReference> - <name>1f6cf193-61c3-4681-bafd-c7f9c906cdf6</name> - <entityField>Districts</entityField> - <view>DistrictList_view</view> - </neonViewReference> <neonViewReference> <name>19a5f9ed-228d-4352-9e82-e7aa690648e9</name> <entityField>DistrictResponsibles</entityField> diff --git a/neonView/PrivatePersonPreview_view/PrivatePersonPreview_view.aod b/neonView/PrivatePersonPreview_view/PrivatePersonPreview_view.aod index 51fe925b724839743ded63ea77cd62a24630ac3e..ac3fd91d1912be4dbdca69812f8193197f335d0e 100644 --- a/neonView/PrivatePersonPreview_view/PrivatePersonPreview_view.aod +++ b/neonView/PrivatePersonPreview_view/PrivatePersonPreview_view.aod @@ -10,7 +10,7 @@ <children> <neonViewReference> <name>0a66aea5-bf81-47e4-941d-9158ff8f4f51</name> - <entityField>Persons</entityField> + <entityField>Organisations</entityField> <view>ContactTitledList_view</view> </neonViewReference> </children> diff --git a/others/language_DE.txt b/others/language_DE.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce1c36aeb0b3c83f7afb78b4662318fcdcf99a92 --- /dev/null +++ b/others/language_DE.txt @@ -0,0 +1,88 @@ + <entry> + <key>Auto assignment</key> + <value>Auto-Zuordnung</value> + </entry> + <entry> + <key>District Contact</key> + <value>Gebietsverantwortlicher</value> + </entry> + <entry> + <key>District Contacts</key> + <value>Gebietsverantwortlichen</value> + </entry> + <entry> + <key>Adviser Role</key> + <value>Rolle des Verantwortlichen</value> + </entry> + <entry> + <key>Adviser Contact</key> + <value>Verantwortlicher</value> + </entry> + <entry> + <key>Office Duty</key> + <value>Innendienst</value> + </entry> + <entry> + <key>Region Manager</key> + <value>Regionsleiter</value> + </entry> + <entry> + <key>Area Manager</key> + <value>Gebietsleiter</value> + </entry> + <entry> + <key>Field Service</key> + <value>Außendienst</value> + </entry> + <entry> + <key>Assign district</key> + <value>Gebiet zuordnen</value> + </entry> + <entry> + <key>District assignment will start now!</key> + <value>Die Gebietszuordnung wird jetzt gestartet!</value> + </entry> + <entry> + <key>Assignment of district \"%0\" is completed!</key> + <value>Zuordnung des Gebietes \"%0\" ist abgeschlossen!</value> + </entry> + <entry> + <key>%0 companies were newley assigned. \n%1 companies are no longer assigned (these assignments got the status 'review'). \n%2 valid assignments were unchanged.\nThe Process took %3 seconds.</key> + <value>%0 Firmen wurden neu hinzugefügt. \n %1 Firmen sind nicht länger zugeordnet (diese Zuordnungen wurden auf den Status 'zur Prüfung' gesetzt). \n %2 gültige Zuordnungen blieben unverändert. \n Der Prozess dauert %3 Sekunden. </value> + </entry> + <entry> + <key>District assignment status</key> + <value>Gebietzuordnungstatus</value> + </entry> + <entry> + <key>Assign all selected districts</key> + <value>Zuordnung für alle selektierten Gebiete</value> + </entry> + <entry> + <key>Assignment for all selected districts will start now!</key> + <value>Zuordnung für alle selektierten Gebiete wird jetzt gestartet</value> + </entry> + <entry> + <key>Assignment of all selected districts is completed!</key> + <value>Zuordnung für alle selektierten Gebiete abgeschlossen</value> + </entry> + <entry> + <key>Set active</key> + <value>Aktiv setzen</value> + </entry> + <entry> + <key>Set inactive</key> + <value>Inaktiv setzen</value> + </entry> + <entry> + <key>Set status to active</key + <value>Status auf aktiv setzen</value> + </entry> + <entry> + <key>Set status to inactive</key> + <value>Status auf inaktiv setzen</value> + </entry> + <entry> + <key>My district assignments to check</key> + <value>Meine zu prüfenden Gebietszuweisungen</value> + </entry> \ No newline at end of file diff --git a/others/language_EN.txt b/others/language_EN.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed4fb3d3337cb9dcb36550a281b8f11eaab86294 --- /dev/null +++ b/others/language_EN.txt @@ -0,0 +1,69 @@ + <entry> + <key>Auto assignment</key> + </entry> + <entry> + <key>District Contact</key> + </entry> + <entry> + <key>District Contacts</key> + </entry> + <entry> + <key>Adviser Role</key> + </entry> + <entry> + <key>Adviser Contact</key> + </entry> + <entry> + <key>Sales Manager</key> + </entry> + <entry> + <key>Office Duty</key> + </entry> + <entry> + <key>Region Manager</key> + </entry> + <entry> + <key>Area Manager</key> + </entry> + <entry> + <key>Field Service</key> + </entry> + <entry> + <key>Assign district</key> + </entry> + <entry> + <key>District assignment will start now!</key> + </entry> + <entry> + <key>Assignment of district \"%0\" is completed!</key> + </entry> + <entry> + <key>%0 companies were newley assigned. \n%1 companies are no longer assigned (these assignments got the status 'review'). \n%2 valid assignments were unchanged.\nThe Process took %3 seconds.</key> + </entry> + <entry> + <key>District assignment status</key> + </entry> + <entry> + <key>Assign all selected districts</key> + </entry> + <entry> + <key>Assignment for all selected districts will start now!</key> + </entry> + <entry> + <key>Assignment of all selected districts is completed!</key> + </entry> + <entry> + <key>Set active</key> + </entry> + <entry> + <key>Set inactive</key> + </entry> + <entry> + <key>Set status to active</key> + </entry> + <entry> + <key>Set status to inactive</key> + </entry> + <entry> + <key>My district assignments to check</key> + </entry> \ No newline at end of file diff --git a/process/District_lib/District_lib.aod b/process/District_lib/District_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..e349479bbe39378afa83ce81559bda59e9ad12d6 --- /dev/null +++ b/process/District_lib/District_lib.aod @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"> + <name>District_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/District_lib/process.js</process> + <alias>Data_alias</alias> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/District_lib/process.js b/process/District_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..6f77c41867db968f82bf6e6421c03b72bf34f8b1 --- /dev/null +++ b/process/District_lib/process.js @@ -0,0 +1,423 @@ +import("system.tools"); +import("system.text"); +import("system.datetime"); +import("system.notification"); +import("system.translate"); +import("Contact_lib"); +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.util"); +import("Sql_lib"); +import("Util_lib"); +import("system.db"); +import("system.indexsearch"); +import("JditoFilter_lib"); +import("Util_lib"); +import("system.process"); +import("Employee_lib"); + +/** + * Functions for district. + */ +function DistrictUtils () {} + +/** + * Gets the name of a district + * + * @param {String} pDistrictId <p> + * Id of the district.<br> + * @return {String} <p> + * Name of the district.<br> + */ +DistrictUtils.getDistrictName = function (pDistrictId) +{ + var districtName = newSelect("DISTRICT_NAME") + .from("DISTRICT") + .where("DISTRICT.DISTRICTID", pDistrictId) + .cell(true); + + return(districtName) +} + +/** + * Get data from district + * + * @param {String} pDistrictId <p> + * ID of a district<br> + * @return {Array} <p> + * array of data from a district <br> + */ +DistrictUtils.getDataFromDistrict = function (pDistrictId) +{ + var districtData = newSelect("DISTRICT_FILTER, PARENTDISTRICT_DISTRICTID") + .from("DISTRICT") + .where("DISTRICT.DISTRICTID", pDistrictId) + .arrayRow(); + return(districtData); +} + + +/** + * Get data from a special district + * + * @param {String} pDistrictContactId <p> + * Id of the districtcontact.<br> + * @return {Array} <p> + * array of data from one districtcontact dataset <br> + */ +DistrictUtils.getDataFromDistrictContact = function (pDistrictContactId) +{ + var arrData = newSelect("DISTRICT_ID, ADVISER_CONTACT_ID, CONTACT_ID") + .from("DISTRICTCONTACT") + .where("DISTRICTCONTACT.DISTRICTCONTACTID", pDistrictContactId) + .arrayRow(); + + return(arrData); +} + + +/** + * Executes a process to assign districts on the server and creates a notification when finished. + * + * @param {Array} pArrDistrictIds <p> + * Array of district-IDs.<br> + * @param {String} pUser=currentUser (optional) <p> + * User who will get the notification, <br> + * User who will start the batch job <br> + * @param {String} pContactId (optional) <p> + * Organisation which should be assigned to all <br> + * according districts with auto assignment is true <br> + */ +DistrictUtils.assignDistrictOnServer = function (pArrDistrictIds, pUser, pContactId) +{ + //pUser hat folgendes Format: _____USER_bcdfb521-c7d0-4ef1-8916-78e7d3232046 + if (pUser === undefined) + pUser = EmployeeUtils.getCurrentUserId(); + var processConfig = process.createStartAsyncConfig() + .setName("assignDistrict_serverProcess") + .setLocalVariables({ + arrDistrictIds : pArrDistrictIds.join(";"), + user : pUser || "", + contactId : pContactId || "" + }) + .setUser(pUser); + process.startAsync(processConfig); +} + +/** + * Assignes a district to companies. You should only call this function on the server because it + * can take some time to execute, use DistrictUtils.assignDistrictOnServer instead. + * + * @param {String} pDistrictId <p> + * Id of the district.<br> + * @param {String} pAppliedFilter <p> + * Filter condition to get the assigned companies.<br> + * @param {String} pContactId (opt) <p> + * Only filled when a special contact-ID should assigned to a district.<br>* + * @return {Object} <p> + * Count of new assigned companies and no longer assigned companies.<br> + */ +DistrictUtils.assignDistrict = function (pDistrictId, pAppliedFilter, pContactId) +{ + if (pContactId == undefined) + pContactId = null; + + var newAssigned = 0; + var unchanged = 0; + var invalid = 0; + + //Einlesen von allen bereits existierenden automatischen Zuordnungen, + //die nicht auf Status 'zur Prüfung' stehen + //Nur notwendig, wenn pContactId leer ist. Ansonsten soll ja gezielt ein neuer Datensatz angelegt werden + var arrExistingIds = []; + if (!pContactId) + { + arrExistingIds = new SqlBuilder() + .select("DISTRICTCONTACT.DISTRICTCONTACTID, DISTRICTCONTACT.CONTACT_ID, DISTRICTCONTACT.ADVISER_CONTACT_ID") + .from("DISTRICTCONTACT") + .where("DISTRICTCONTACT.DISTRICT_ID", pDistrictId) + .and ("DISTRICTCONTACT.ORIGIN", $KeywordRegistry.districtOrigin$auto()) + .and ("DISTRICTCONTACT.STATUS", $KeywordRegistry.contactStatus$inReview(), SqlBuilder.NOT_EQUAL()) + .table(); + } + + //Einlesen aller Betreuer, die dem übergebenen Gebiet zugeordnet sind + var arrResponsibleIds = new SqlBuilder() + .select("DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID, DISTRICTRESPONSIBLE.ADVISER_ROLE, " + + "DISTRICTRESPONSIBLE.ADVISER_STATUS, DISTRICTRESPONSIBLE.VALID_FROM, DISTRICTRESPONSIBLE.VALID_UNTIL") + .from("DISTRICTRESPONSIBLE") + .where("DISTRICTRESPONSIBLE.DISTRICT_ID", pDistrictId) + .table(); + + //Aufbereiten des im JSON-Format übergebenen Filters in eine SQL-Condition + var appliedFilterCondition = JSON.parse(pAppliedFilter).filter; + appliedFilterCondition = JSON.stringify(appliedFilterCondition); + var sqlCondition = db.toFilterCondition(appliedFilterCondition, "Organisation_entity"); + + //Einlesen der Contact-IDs zu den Firmen, die gemäß Filter diesem Gebiet zugeordnet sind + var arrOrgContactIds = new SqlBuilder() + .selectDistinct("CONTACT.CONTACTID") + .from("ORGANISATION") + .join("CONTACT", newWhere("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID").and("CONTACT.PERSON_ID is null")) + .leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID") + .leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID") + .whereIfSet(sqlCondition) + .andIfSet("CONTACT.CONTACTID", pContactId) + .arrayColumn(); + + var insertArray = []; + var colsInsert = [ + "DISTRICTCONTACTID", + "CONTACT_ID", + "DISTRICT_ID", + "ADVISER_CONTACT_ID", + "ADVISER_ROLE", + "STATUS", + "VALID_FROM", + "VALID_UNTIL", + "ORIGIN", + "USER_NEW", + "DATE_NEW" + ]; + var updateArray = []; + var colsUpdate = [ + "STATUS", + "USER_EDIT", + "DATE_EDIT" + ]; + + //Anlegen der Firmen-Betreuer-Datensätze in der Tabelle DISTRICTCONTACT + for (var i=0; i<arrOrgContactIds.length; i++) + { + for (var j=0; j<arrResponsibleIds.length; j++) + { + //Existiert der Firmen-Betreuer-Datensatz bereits? + var found = 'N'; + for (var k=0; k<arrExistingIds.length; k++) + { + if (arrExistingIds[k][1] == arrOrgContactIds[i] && arrExistingIds[k][2] == arrResponsibleIds[j][0]) + { + unchanged++; + found = 'Y'; + //Gefundenen Eintrag aus dem Array entfernen + //-> Am Schluss bleiben in dem Array alle ungültigen Datensätze übrig. Bei diesen wird weiter unten der Status geändert + arrExistingIds.splice(k, 1); + break; + } + } + //Firmen-Betreuer-Datensatz existiert noch nicht -> Insert + if (found == 'N') + { + //Falls Status null, dann auf active setzen + if (Utils.isNullOrEmpty(arrResponsibleIds[j][2])) + arrResponsibleIds[j][2] = $KeywordRegistry.contactStatus$active(); + + var valsInsert = [ + util.getNewUUID(), + arrOrgContactIds[i], + pDistrictId, + arrResponsibleIds[j][0], + arrResponsibleIds[j][1], + arrResponsibleIds[j][2], + arrResponsibleIds[j][3], + arrResponsibleIds[j][4], + $KeywordRegistry.districtOrigin$auto(), + vars.get("$sys.user"), + vars.get("$sys.date") + ]; + insertArray.push(["DISTRICTCONTACT", colsInsert, null, valsInsert]); + } + } + } + newAssigned = insertArray.length; + db.inserts(insertArray); + + //Gibt es noch ungültige Zuordnungen, dann bei diesen den Status auf "zur Prüfung setzen" + if (arrExistingIds.length > 0) + { + invalid = arrExistingIds.length; + + //die erste Spalte enthält die Ids der zu aktualisierenden Datensätze + var arrIds = arrExistingIds.map(function(value) { return value[0]; }); + DistrictUtils.setDistrictContactStatus (arrIds, $KeywordRegistry.contactStatus$inReview()); + } + + return { + newAssigned : newAssigned, + invalid : invalid, + unchanged : unchanged + }; +} + + +/** + * Get the complete hierarchical filter + * + * @param {JSON-String} pDistrictFilter <p> + * The filter of the current level<br> + * @param {String} pParentDistrict_DistrictId <p> + * District-ID of the parent district<br>* + * @return {JSON-String} <p> + * JSON-String of the complete filter (all levels) <br> + */ +DistrictUtils.getAppliedFilter = function (pDistrictFilter, pParentDistrict_DistrictId) +{ + var parentFilter = DistrictUtils.getParentFilter(pParentDistrict_DistrictId); + + var appliedFilter = { + entity: "Organisation_entity", + filter: { + type: "group", + operator: "AND", + childs: [] + } + }; + + if (parentFilter) + { + appliedFilter.filter.childs.push(JSON.parse(parentFilter).filter); + } + if (pDistrictFilter) + { + appliedFilter.filter.childs.push(JSON.parse(pDistrictFilter).filter); + } + + return JSON.stringify(appliedFilter); +} + +/** + * Get the filter starting with the parent level + * @param {String} pParentDistrict_DistrictId <p> + * District-ID of the parent district<br> + * @return {JSON-String} <p> + * JSON-String of the filter starting with the parent<br> + */ +DistrictUtils.getParentFilter = function (pParentDistrict_DistrictId) +{ + var res = ""; + + if (pParentDistrict_DistrictId) + { + var completeParentFilter = DistrictUtils._getParentFilter(pParentDistrict_DistrictId, null); + completeParentFilter.entity = "Organisation_entity"; + res = completeParentFilter; + } + else + { + var entity = "Organisation_entity"; + var emptyFilter = { + entity: entity, + filter: { + type: "group", + operator: "AND", + childs: [] + } + }; + + res = emptyFilter; + } + + return JSON.stringify(res); +} + +/** + * This function will recursively go through each filter level up to the root. + * @param {String} pParentDistrict_DistrictId <p> + * District-ID of the parent district<br> + * @param {JSON} pPreviousFilter <p> + * Collected filters so far<br> + * @return {JSON} <p> + * JSON-Object of the collected filters<br> + */ +DistrictUtils._getParentFilter = function (pParentDistrict_DistrictId, pPreviousFilter) +{ + var resFilter; + + if (pPreviousFilter != null) + { + resFilter = pPreviousFilter; + } + + if (pParentDistrict_DistrictId) + { + var parentDistrictFilter, grandParentDistrict; + [parentDistrictFilter, grandParentDistrict] = newSelect(["DISTRICT.DISTRICT_FILTER", "DISTRICT.PARENTDISTRICT_DISTRICTID"]) + .from("DISTRICT") + .where("DISTRICT.DISTRICTID", pParentDistrict_DistrictId) + .arrayRow(); + + parentDistrictFilter = JSON.parse(parentDistrictFilter); + + if (pPreviousFilter) + parentDistrictFilter.filter.childs.push(resFilter.filter); + + resFilter = parentDistrictFilter; + + if (grandParentDistrict.length > 0) + { + resFilter = DistrictUtils._getParentFilter(grandParentDistrict, resFilter); + } + } + + return resFilter; +} + + +/** + * This function will set the status of districtcontact datasets + * @param {Array} pArrIds <p> + * IDs of districtcontact<br> + * @param {String} pStatus <p> + * Status, for example $KeywordRegistry.contactStatus$active<br> + * @return {none} <p> + */ +DistrictUtils.setDistrictContactStatus = function (pArrIds, pStatus) +{ + var updateArray = []; + var colsUpdate = [ + "STATUS", + "USER_EDIT", + "DATE_EDIT" + ]; + var valsUpdate = [ + pStatus, + vars.get("$sys.user"), + vars.get("$sys.date") + ]; + + for (var i=0; i<pArrIds.length; i++) + { + var condition = newWhere("DISTRICTCONTACT.DISTRICTCONTACTID", pArrIds[i]); + updateArray.push(["DISTRICTCONTACT", colsUpdate, null, valsUpdate, condition.build()]); + } + db.updates(updateArray); +} + + +/** + * This function will notificate the district contact that he/she was assigned + * + * @param {String} pDistrictContactId <p> + * DistrictContact-ID of the new Dataset<br> + * @return <none> <p> + */ +DistrictUtils.notificateNewDistrictContact = function(pDistrictContactId){ + message = translate.text("Assignment to a new district/company!"); + + //[0]: DISTRICT_ID, [1]: ADVISER_CONTACT_ID, [2]: CONTACT_ID + var arrayDistrictContact = DistrictUtils.getDataFromDistrictContact(pDistrictContactId); + //get corresponding profile information of the systemalias + var user = tools.getUserByAttribute(tools.CONTACTID, arrayDistrictContact[1], tools.PROFILE_DEFAULT); + + //You can only send a notification, if the user is an employee + if (user) + { + var userName = user[tools.NAME]; + var districtName = DistrictUtils.getDistrictName(arrayDistrictContact[0]); + var organisationName = ContactUtils.getFullTitleByContactId(arrayDistrictContact[2]); + // Benachrichtigung am Ende der Zuordnungen + description = translate.withArguments("You were assigned as new district contact to district %0 and organisation %1.", + [districtName, organisationName]); + notification.addNotification(util.getNewUUID(), text.encodeMS(["Organisation", arrayDistrictContact[2]]), null, null, "DistrictAssigned", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [userName], message, description); + } +} diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js index f76621e56ac920ebd2006f1eb2ac513cb1339af0..1d937e5cd44537e202469b544d0cf9d8f8c1fdce 100644 --- a/process/KeywordRegistry_basic/process.js +++ b/process/KeywordRegistry_basic/process.js @@ -41,6 +41,7 @@ $KeywordRegistry.activityDirection$internal = function(){return "x";}; $KeywordRegistry.contactStatus = function(){return "ContactStatus";}; $KeywordRegistry.contactStatus$active = function(){return "CONTACTSTATACTIVE";}; $KeywordRegistry.contactStatus$inactive = function(){return "CONTACTSTATINACTIVE";}; +$KeywordRegistry.contactStatus$inReview = function(){return "CONTACTSTATREVIEW";}; $KeywordRegistry.currency = function(){return "Currency";}; $KeywordRegistry.currency$eur = function(){return "EUR";}; @@ -297,6 +298,11 @@ $KeywordRegistry.notificationState = function(){ return "NotificationState";}; $KeywordRegistry.notificationState$unseen = function(){return "UNSEEN";}; $KeywordRegistry.notificationState$seen = function(){return "SEEN";}; +$KeywordRegistry.adviserRole = function(){ return "ADVISER_ROLE";}; + +$KeywordRegistry.districtOrigin = function(){ return "DISTRICT_ORIGIN";}; +$KeywordRegistry.districtOrigin$manual = function(){ return "DistrictOrigin_manual";}; +$KeywordRegistry.districtOrigin$auto = function(){ return "DistrictOrigin_auto";}; $KeywordRegistry.discussionStatus = function(){return "DiscussionStatus";} $KeywordRegistry.discussionStatus$acitve = function(){return "ACTIVE";} $KeywordRegistry.discussionStatus$closed = function(){return "CLOSED";} diff --git a/process/assignDistrict_serverProcess/assignDistrict_serverProcess.aod b/process/assignDistrict_serverProcess/assignDistrict_serverProcess.aod new file mode 100644 index 0000000000000000000000000000000000000000..27ebc6a30b9f8341d70305bbda3555fd2a9e4bc5 --- /dev/null +++ b/process/assignDistrict_serverProcess/assignDistrict_serverProcess.aod @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"> + <name>assignDistrict_serverProcess</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/assignDistrict_serverProcess/process.js</process> + <alias>Data_alias</alias> + <variants> + <element>EXECUTABLE</element> + </variants> +</process> diff --git a/process/assignDistrict_serverProcess/process.js b/process/assignDistrict_serverProcess/process.js new file mode 100644 index 0000000000000000000000000000000000000000..f3434cef31913e4ff8323905783bdf0a3f9710eb --- /dev/null +++ b/process/assignDistrict_serverProcess/process.js @@ -0,0 +1,85 @@ +import("system.datetime"); +import("Sql_lib"); +import("system.db"); +import("system.util"); +import("system.translate"); +import("system.vars"); +import("system.notification"); +import("District_lib"); + +var i; +var districtData; +var completeFilter; +var res; + +var user = vars.get("$local.user"); +var arrDistrictIds = vars.get("$local.arrDistrictIds").split(";"); +var contactId = vars.get("$local.contactId"); + +// Do the assignment for all transferred districts +if (vars.get("$local.arrDistrictIds").length > 0 && arrDistrictIds.length > 0) +{ + var message; + var description; + + var newAssigned = 0; + var unchanged = 0; + var invalid = 0; + + var startTime = datetime.date(); + + //Assign all transferred districts + for (i=0; i<arrDistrictIds.length; i++) + { + //Build the complete hierarchical filter for every district + districtData = DistrictUtils.getDataFromDistrict(arrDistrictIds[i]); + completeFilter = DistrictUtils.getAppliedFilter(districtData[0], districtData[1]); + + //Automatic assignment + res = DistrictUtils.assignDistrict(arrDistrictIds[i], completeFilter); + + newAssigned += res.newAssigned; + unchanged += res.unchanged; + invalid += res.invalid; + } + + if (arrDistrictIds.length == 1) + { + var districtName = DistrictUtils.getDistrictName(arrDistrictIds[0]); + message = translate.withArguments("Assignment of district \"%0\" is completed!", [districtName]); + } + else + message = translate.text("Assignment of all selected districts is completed!"); + + // Notification at the end of the assignment + description = translate.withArguments("%0 companies were newley assigned. \n" + + "%1 companies are no longer assigned (these assignments got the status 'review'). \n" + + "%2 valid assignments were unchanged.\n" + + "The Process took %3 seconds.", + [newAssigned, invalid, unchanged, Math.round((datetime.date() - startTime) / datetime.ONE_SECOND)]); + notification.addNotification(util.getNewUUID(), null, null, null, "DistrictAssigned", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [user], message, description); +} + + +//Assign a new organisation to all according districts with auto assignment is true +//NOTICE: The new organisation must be part of the filter of the district +if (contactId != "") +{ + //Get all filters where auto assingment is true + var allAutoDistricts = newSelect("DISTRICTID") + .from("DISTRICT") + .where("DISTRICT.DISTRICT_AUTOADD", 1) + .arrayColumn(); + + for (i=0; i<allAutoDistricts.length; i++) + { + //Build the complete filter + districtData = DistrictUtils.getDataFromDistrict(allAutoDistricts[i]); + completeFilter = DistrictUtils.getAppliedFilter(districtData[0], districtData[1]); + + //Check if the new contactid is part ot this filter + //if so, write data in table districtcontact + res = DistrictUtils.assignDistrict(allAutoDistricts[i], completeFilter, contactId); + } +} + \ No newline at end of file diff --git a/process/process_audit/process.js b/process/process_audit/process.js index 023a6e0dbf0888fc4021b7aef9e215dd0a5e4879..5b0cb6d15d46bed1c566b4a21f9f91c5def3392d 100644 --- a/process/process_audit/process.js +++ b/process/process_audit/process.js @@ -1,3 +1,4 @@ +import("District_lib"); import("Loghistory_lib"); import("system.vars"); import("system.process"); @@ -15,3 +16,7 @@ if (sqlAction != 'X') { (new LogHistoryExecutor(tableName, userLogin, columns, newvalues, oldvalues, timestamp, sqlAction, id)).execute(); } + +if(sqlAction == 'I' && tableName == 'DISTRICTCONTACT'){ + DistrictUtils.notificateNewDistrictContact(id); +} \ No newline at end of file