diff --git a/.aditoprj/project.version b/.aditoprj/project.version index b22e039f1702c0039d393f8be0f0dfec2e3d920c..de72e6b0e88876034e7c2bd459c0dc5297e57f7e 100644 --- a/.aditoprj/project.version +++ b/.aditoprj/project.version @@ -1,3 +1,3 @@ #This file is generated by ADITO designer. Do NOT delete or modify! -#Wed Aug 14 09:57:23 CEST 2019 +#Thu Aug 01 14:30:02 CEST 2019 version=6.0.1 diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/ActivityDirectionKeyword_add_icon_attr.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/ActivityDirectionKeyword_add_icon_attr.xml index eb2fe92e77c66f859c14fee4050918d3edc4f492..1980fd972959f7569d0ca28c2f011f7d8264c8e2 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/ActivityDirectionKeyword_add_icon_attr.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/ActivityDirectionKeyword_add_icon_attr.xml @@ -6,7 +6,7 @@ <column name="NAME" value="icon"/> <column name="CONTAINER" value="ActivityDirection"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="7770bafa-22f0-4a74-a2cf-5001b620a4b2"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_ActivityCategory.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_ActivityCategory.xml index 74c2587a8fc14d2c228058b6205ca08fb83ed143..f31849e8ea038f0ce0af4c030cf3fa513e9dcad6 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_ActivityCategory.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_ActivityCategory.xml @@ -6,7 +6,7 @@ <column name="NAME" value="defaultAvatarRepresentation"/> <column name="CONTAINER" value="ActivityCategory"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="94529505-1913-4827-9812-026053bfcb51"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AddressType.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AddressType.xml index 38fae576ae0d2683bf922e746e4983b006a3c799..85edbfdc45c7833a43caf50fb858b411ca3a39d6 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AddressType.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AddressType.xml @@ -6,14 +6,14 @@ <column name="NAME" value="organisation"/> <column name="CONTAINER" value="AddressType"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="c4c5352b-ff72-4323-80b9-631a24dd7245"/> <column name="NAME" value="contact"/> <column name="CONTAINER" value="AddressType"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="49bb6904-dd20-4ede-aaff-ae80131ed274"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AttributeType.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AttributeType.xml index a168eafe5bfdc7246c898f476ff5a6b77743a480..6e0ff735549785852293a11abfd2f5eb9a9e15df 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AttributeType.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_AttributeType.xml @@ -48,7 +48,7 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="307ecfc6-15c8-4ab9-8afa-e97b90a00c5f"/> <column name="NAME" value="defaultAvatarRepresentation"/> <column name="CONTAINER" value="AttributeType"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="0c537ea0-6ba2-4d9a-a27c-7c6a6920e303"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMedium.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMedium.xml index f03f93fd3ed0c0c9a3c284fbab8d866be95b26bd..4284472481bd67f83ba939da6e9d8db67f002415 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMedium.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMedium.xml @@ -6,14 +6,14 @@ <column name="NAME" value="category"/> <column name="CONTAINER" value="CommunicationMedium"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="3ea2ea72-e615-4e77-befb-e664fa5ec4e1"/> <column name="NAME" value="contentType"/> <column name="CONTAINER" value="CommunicationMedium"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="cc16d938-b95f-4e07-a3b4-73f8524bb664"/> @@ -45,7 +45,7 @@ <column name="CONTAINER" value="CommunicationMedium"/> <column name="SORTING" valueNumeric="1"/> <column name="ISACTIVE" valueNumeric="1"/> - <column name="ISESSENTIAL" valueNumeric="0"/> + <column name="ISESSENTIAL" valueNumeric="1"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="ace352ee-b9ba-47eb-a55d-4619a4b41e61"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMediumCampaign.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMediumCampaign.xml index c9f6397ead225fa63119c38593e29da5df5ef2e1..ff16d322be8478f34a2779032d6946e37d436163 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMediumCampaign.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_CommunicationMediumCampaign.xml @@ -6,14 +6,14 @@ <column name="NAME" value="AdvertisingBan"/> <column name="CONTAINER" value="CommunicationMediumCampaign"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="d6c0fd72-ded2-4e4d-adf5-f8832d7b24f2"/> <column name="NAME" value="AdvertisingBanIcon"/> <column name="CONTAINER" value="CommunicationMediumCampaign"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="2acd3694-ccef-4d0b-ae7a-b3d31f8d9cc0"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_DocumentTemplateTypeCategory.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_DocumentTemplateTypeCategory.xml index 6d75abdd21c241eeafbece321f7774bec687a11e..90f1647e01caacfd358e30dc9fc35eb87121ce5f 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_DocumentTemplateTypeCategory.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_DocumentTemplateTypeCategory.xml @@ -5,25 +5,25 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="14c2d515-a42f-4618-b534-7a23369d2001"/> <column name="NAME" value="LET"/> <column name="CONTAINER" value="DocumentTemplateTypeCategory"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="14c2d515-a42f-4618-b534-7a23369d2002"/> <column name="NAME" value="MAI"/> <column name="CONTAINER" value="DocumentTemplateTypeCategory"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="14c2d515-a42f-4618-b534-7a23369d2003"/> <column name="NAME" value="ATT"/> <column name="CONTAINER" value="DocumentTemplateTypeCategory"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="14c2d515-a42f-4618-b534-7a23369d2004"/> <column name="NAME" value="TEX"/> <column name="CONTAINER" value="DocumentTemplateTypeCategory"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="c564719a-18ef-423e-b130-dp88b2b51123"/> @@ -97,5 +97,35 @@ <column name="AB_KEYWORD_ATTRIBUTE_ID" value="14c2d515-a42f-4618-b534-7a23369d2004"/> <column name="BOOL_VALUE" valueNumeric="1"/> </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="beb7691f-ff9e-4344-89e1-d2664f7384e0"/> + <column name="KEYID" value="5"/> + <column name="TITLE" value="Receipt Header Text"/> + <column name="CONTAINER" value="DocumentTemplateTypeCategory"/> + <column name="SORTING" valueNumeric="4"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="d57bf04f-574e-42b4-99e5-31f630239bf6"/> + <column name="AB_KEYWORD_ENTRY_ID" value="beb7691f-ff9e-4344-89e1-d2664f7384e0"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="14c2d515-a42f-4618-b534-7a23369d2004"/> + <column name="BOOL_VALUE" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="267d1707-99db-40fa-914a-e36ba22e3ad6"/> + <column name="KEYID" value="6"/> + <column name="TITLE" value="Receipt Footer Text"/> + <column name="CONTAINER" value="DocumentTemplateTypeCategory"/> + <column name="SORTING" valueNumeric="5"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="0"/> + </insert> + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="0d7d908e-6b0b-45ec-9e2f-d5b83e8d96df"/> + <column name="AB_KEYWORD_ENTRY_ID" value="267d1707-99db-40fa-914a-e36ba22e3ad6"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="14c2d515-a42f-4618-b534-7a23369d2004"/> + <column name="BOOL_VALUE" valueNumeric="1"/> + </insert> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_NotificationPriority.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_NotificationPriority.xml new file mode 100644 index 0000000000000000000000000000000000000000..a717fd622a08e57b0197e116b84445cc6de98151 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_NotificationPriority.xml @@ -0,0 +1,47 @@ +<?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="a.schindlbeck" id="127c4edc-1f86-4329-a907-bff3f6bf211e"> + + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="678f61e5-ef27-4e1c-b52b-0e19188b038d"/> + <column name="KEYID" value="UNSEEN"/> + <column name="TITLE" value="UNSEEN"/> + <column name="CONTAINER" value="NotificationState"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="f568c222-7ac5-475e-b916-cea0e0e8612a"/> + <column name="KEYID" value="SEEN"/> + <column name="TITLE" value="SEEN"/> + <column name="CONTAINER" value="NotificationState"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="b5f402a0-29a0-43e9-8db3-454fdbcfc9d1"/> + <column name="KEYID" value="CONFIRMED"/> + <column name="TITLE" value="CONFIRMED"/> + <column name="CONTAINER" value="NotificationState"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="1c40a2de-e6c1-469b-b324-d7089893ca5c"/> + <column name="KEYID" value="ARCHIVE"/> + <column name="TITLE" value="ARCHIVE"/> + <column name="CONTAINER" value="NotificationState"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_NotificationState.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_NotificationState.xml new file mode 100644 index 0000000000000000000000000000000000000000..715074d354c2ce228d9628ae20d29ecd4947b1cb --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_NotificationState.xml @@ -0,0 +1,57 @@ +<?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="a.schindlbeck" id="8ddce9af-b5ae-422f-8dda-5191723e867b"> + + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="0fdcfc0f-ba82-4881-813d-9f169339ab57"/> + <column name="KEYID" value="NONE"/> + <column name="TITLE" value="NONE"/> + <column name="CONTAINER" value="NotificationPriority"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="6aaddcc6-a94e-4267-a52e-f0dd1df62023"/> + <column name="KEYID" value="LOW"/> + <column name="TITLE" value="LOW"/> + <column name="CONTAINER" value="NotificationPriority"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="1290323b-82d4-4f34-95d7-44c453eef3bb"/> + <column name="KEYID" value="NORMAL"/> + <column name="TITLE" value="NORMAL"/> + <column name="CONTAINER" value="NotificationPriority"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="6f35ab82-7905-472a-b635-954bd5fac1e5"/> + <column name="KEYID" value="HIGH"/> + <column name="TITLE" value="HIGH"/> + <column name="CONTAINER" value="NotificationPriority"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="faa99798-c68f-435a-95d5-77bcd2bbabef"/> + <column name="KEYID" value="MAX"/> + <column name="TITLE" value="MAX"/> + <column name="CONTAINER" value="NotificationPriority"/> + <column name="SORTING" valueNumeric="4"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_OfferProbability.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_OfferProbability.xml index 9887c9db19130091d058f422e1cb6d276bdbda6e..3abd6233333cbf4762910e29b7c27f15e4f85bfd 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_OfferProbability.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_OfferProbability.xml @@ -6,7 +6,7 @@ <column name="NAME" value="percentValue"/> <column name="CONTAINER" value="OfferProbability"/> - <column name="TYPE" value="NUMBER_VALUE"/> + <column name="KIND" value="NUMBER_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="e14fab55-4a85-48c2-a109-125eaed9dc3f"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_TaskPriority.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_TaskPriority.xml index 30192dcbe9d125d1c9e9fb2acb02d34095d65859..9d827ad4ea8bf8d7390e374d3297165d8db3ec0e 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_TaskPriority.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/init_TaskPriority.xml @@ -6,7 +6,7 @@ <column name="NAME" value="defaultAvatarRepresentation"/> <column name="CONTAINER" value="TaskPriority"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="97ec9a7e-a1dd-4167-bf7d-57ee3d79d46f"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/salesprojectsource_add_icon_attr.xml b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/salesprojectsource_add_icon_attr.xml index a8099715835eb541392625c9c63b1cf7e6bf9210..7a6b7e2acbf97b179e4194a7db47ef61efabc57c 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/salesprojectsource_add_icon_attr.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AditoBasic/salesprojectsource_add_icon_attr.xml @@ -6,7 +6,7 @@ <column name="NAME" value="defaultAvatarRepresentation"/> <column name="CONTAINER" value="SalesprojectSource"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> diff --git a/.liquibase/Data_alias/basic/2019.1.4/AttributeKeyword.xml b/.liquibase/Data_alias/basic/2019.1.4/AttributeKeyword.xml index dba5cdc84a7f3fc3ad29b646e6a42ed5e781cdc7..9ff598e1434a61a29de0ad379cf9c9858dee7096 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/AttributeKeyword.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/AttributeKeyword.xml @@ -5,6 +5,7 @@ <column name="DROPDOWNDEFINITION" type="VARCHAR(80)"/> <column name="ATTRIBUTE_INFO" type="NCLOB"/> <column name="SORTING" type="INTEGER"/> + <column name="DROPDOWNFILTER" type="NVARCHAR(512)"/> </addColumn> <addColumn tableName="AB_ATTRIBUTERELATION"> <column name="INT_VALUE" type="INTEGER"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/BulkMail/bulkMail_keywords.xml b/.liquibase/Data_alias/basic/2019.1.4/BulkMail/bulkMail_keywords.xml index 8e54b9eef3b41bb4c7e83cbf725f252f8aa31374..26262bd6e78374cfcca5802b8e3647db7470827f 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/BulkMail/bulkMail_keywords.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/BulkMail/bulkMail_keywords.xml @@ -55,7 +55,7 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="ec51253e-9b45-468d-aafa-42331e54f32b"/> <column name="NAME" value="bulkMailIcon"/> <column name="CONTAINER" value="BulkMailStatus"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="801268a9-e93e-4481-b98d-1e37ca308e10"/> diff --git a/.liquibase/Data_alias/basic/2019.1.4/BulkMail/create_bulkmail.xml b/.liquibase/Data_alias/basic/2019.1.4/BulkMail/create_bulkmail.xml index ba2bdc4fb1d1e794b0e24d2da6d1ac2de7ae22fa..aeab847c94b732991397ea433804c7be13cd2d4d 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/BulkMail/create_bulkmail.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/BulkMail/create_bulkmail.xml @@ -12,6 +12,9 @@ <column name="SENDER" type="NVARCHAR(50)"/> <column name="NAME" type="NVARCHAR(50)"/> <column name="SUBJECT" type="NVARCHAR(100)"/> + <column name="CREATEACTIVITIES" type="TINYINT"/> + <column name="TESTING_CONTACT_ID" type="CHAR(36)"/> + <column name="TESTING_EMAIL_ADDRESS" type="NVARCHAR(50)"/> </createTable> </changeSet> </databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaign.xml b/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaign.xml index 54404f2efe3b9073b0fe44e34f8176c728ac236e..a44dd8524126086d762d8f98563be9c7fcf679de 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaign.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaign.xml @@ -20,7 +20,7 @@ </column> <column name="USER_EDIT" type="NVARCHAR(50)" /> <column name="DATE_EDIT" type="DATE" /> - <column name="STATE" type="CHAR(36)"> + <column name="STATUS" type="CHAR(36)"> <constraints nullable="false"/> </column> </createTable> diff --git a/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignParticipantLog.xml b/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignParticipantLog.xml index feb64016d7fa3df9cf99212167dde3c277fadf7e..eafc67e596a16b39cd2a74010e4b21ec8db08af2 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignParticipantLog.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignParticipantLog.xml @@ -14,6 +14,7 @@ <column name="CAMPAIGNSTEP_ID" type="CHAR(36)"> <constraints nullable="false"/> </column> + <column name="PREVIOUS_CAMPAIGNSTEP_ID" type="CHAR(36)"/> <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> diff --git a/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignStep.xml b/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignStep.xml index 226e5c831882c6ff6158b917e2564f996ddb2b96..87e96561083065d24fde900fa591ea810a4536c4 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignStep.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/CampaignManagement/create_campaignStep.xml @@ -21,7 +21,7 @@ <column name="DATE_END" type="DATE"> <constraints nullable="false"/> </column> - <column name="STATE" type="CHAR(36)"> + <column name="STATUS" type="CHAR(36)"> <constraints nullable="false"/> </column> <column name="SORTING" type="INTEGER"> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Contact_add_columns.xml b/.liquibase/Data_alias/basic/2019.1.4/Contact_add_columns.xml index 780b48296710114efc6602379aa4e0c63c549725..413d3b2922db8a87607b678927bb070efc3c4d3f 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/Contact_add_columns.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/Contact_add_columns.xml @@ -8,7 +8,7 @@ <column name="CONTACTROLE" type="NVARCHAR(50)"/> </addColumn> <addColumn tableName="CONTACT"> - <column name="POSITION" type="NVARCHAR(50)"/> + <column name="CONTACTPOSITION" type="NVARCHAR(50)"/> </addColumn> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/KeywordRelatedStructureChanges/SalesProjectState.xml b/.liquibase/Data_alias/basic/2019.1.4/KeywordRelatedStructureChanges/SalesProjectState.xml index 2f63980104102d820e5ab1b1caa9f23167dde818..f5fe365464f9f5b1b6dba7049506e572d0437619 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/KeywordRelatedStructureChanges/SalesProjectState.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/KeywordRelatedStructureChanges/SalesProjectState.xml @@ -1,34 +1,34 @@ <?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="a.voegl" id="8de6cb0d-0dc3-4440-9ad9-a3c084b0d470"> - <renameColumn newColumnName="STATE_OLD" oldColumnName="STATE" columnDataType="INTEGER" tableName="SALESPROJECT"/> + <renameColumn newColumnName="STATUS_OLD" oldColumnName="STATUS" columnDataType="INTEGER" tableName="SALESPROJECT"/> <addColumn tableName="SALESPROJECT"> - <column name="STATE" type="CHAR(36)"/> + <column name="STATUS" type="CHAR(36)"/> </addColumn> <update tableName="SALESPROJECT"> - <column name="STATE" value="SALPROJSTATOPEN"/> - <where>STATE_OLD = 1</where> + <column name="STATUS" value="SALPROJSTATOPEN"/> + <where>STATUS_OLD = 1</where> </update> <update tableName="SALESPROJECT"> - <column name="STATE" value="SALPROJSTATPOSTPONED"/> - <where>STATE_OLD = 2</where> + <column name="STATUS" value="SALPROJSTATPOSTPONED"/> + <where>STATUS_OLD = 2</where> </update> <update tableName="SALESPROJECT"> - <column name="STATE" value="SALPROJSTATABORT"/> - <where>STATE_OLD = 3</where> + <column name="STATUS" value="SALPROJSTATABORT"/> + <where>STATUS_OLD = 3</where> </update> <update tableName="SALESPROJECT"> - <column name="STATE" value="SALPROJSTATPARTIAL"/> - <where>STATE_OLD = 4</where> + <column name="STATUS" value="SALPROJSTATPARTIAL"/> + <where>STATUS_OLD = 4</where> </update> <update tableName="SALESPROJECT"> - <column name="STATE" value="SALPROJSTATORDER"/> - <where>STATE_OLD = 5</where> + <column name="STATUS" value="SALPROJSTATORDER"/> + <where>STATUS_OLD = 5</where> </update> <update tableName="SALESPROJECT"> - <column name="STATE" value="SALPROJSTATLOST"/> - <where>STATE_OLD = 6</where> + <column name="STATUS" value="SALPROJSTATLOST"/> + <where>STATUS_OLD = 6</where> </update> - <dropColumn tableName="SALESPROJECT" columnName="STATE_OLD"/> + <dropColumn tableName="SALESPROJECT" columnName="STATUS_OLD"/> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/ORGANISATION_private.xml b/.liquibase/Data_alias/basic/2019.1.4/ORGANISATION_private.xml index 77e650768a11c404c698a720b08e0be8a34f80de..f895e8fee7fa0646906ad3020fb20aa7ce61ce16 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/ORGANISATION_private.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/ORGANISATION_private.xml @@ -5,12 +5,12 @@ <column name="ORGANISATIONID" value="0"/> <column name="NAME" value="privat"/> <column name="CUSTOMERCODE" value=""/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> </insert> <insert tableName="CONTACT"> <column name="CONTACTID" value="0"/> <column name="ORGANISATION_ID" value="0"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="ADDRESS_ID" value="0"/> </insert> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Product_added_ImageBlobs.xml b/.liquibase/Data_alias/basic/2019.1.4/Product_added_ImageBlobs.xml new file mode 100644 index 0000000000000000000000000000000000000000..f9028a849a3a07428876944e6de72175280c4224 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/Product_added_ImageBlobs.xml @@ -0,0 +1,10 @@ +<?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.hoermann" id="27dd5dea-94f2-47e6-88c3-5d5a50d781fa"> + <addColumn tableName="PRODUCT"> + <column name="PICTURE" type="LONGBLOB"/> + </addColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/Salesorder/create_dunninglevel_keyword.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesorder/create_dunninglevel_keyword.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa62c603a6ad757a723aa10ead2ca5c1631e2901 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesorder/create_dunninglevel_keyword.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="m.mansour" id="9c7ad936-eb94-4e61-b0f8-99e8c88f510c"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="b5087465-4a80-4f2e-8515-7598fea11f56"/> + <column name="KEYID" value="3148b773-73b8-43dd-8830-123470ffd91a"/> + <column name="TITLE" value="1"/> + <column name="CONTAINER" value="DunningLevel"/> + <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="460f37dd-2589-499f-89be-7184ff5e0c8a"/> + <column name="KEYID" value="937cda17-d0a8-4814-858b-f32ec53ed33f"/> + <column name="TITLE" value="2"/> + <column name="CONTAINER" value="DunningLevel"/> + <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/2019.1.4/Salesorder/create_ordertype_keyword.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesorder/create_ordertype_keyword.xml new file mode 100644 index 0000000000000000000000000000000000000000..3524b9219d1666aaebd92c5a9863e62497fd410a --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesorder/create_ordertype_keyword.xml @@ -0,0 +1,50 @@ +<?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="m.mansour" id="e4e4d996-3739-449f-97fc-5d28489298d1"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="5e5524d7-c8be-4bd2-b9cf-1974d8c7a2f5"/> + <column name="KEYID" value="ORDTYPECONF"/> + <column name="TITLE" value="Order confirmation"/> + <column name="CONTAINER" value="OrderType"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="9882b909-b952-4f47-ac63-bb49f8c8eb6a"/> + <column name="KEYID" value="ORDTYPENOTE"/> + <column name="TITLE" value="Delivery note"/> + <column name="CONTAINER" value="OrderType"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="383aa333-cc14-4ea5-9baf-23aaa7d7ec4e"/> + <column name="KEYID" value="ORDTYPEINVO"/> + <column name="TITLE" value="Invoice"/> + <column name="CONTAINER" value="OrderType"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="0d9eab1f-8e07-4b0d-a92b-bdc6a5b3bd18"/> + <column name="KEYID" value="ORDTYPECRED"/> + <column name="TITLE" value="Credit"/> + <column name="CONTAINER" value="OrderType"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="18abd018-4eb4-44ae-b0c0-0e63ad6286b1"/> + <column name="KEYID" value="ORDTYPECANC"/> + <column name="TITLE" value="Cancellation"/> + <column name="CONTAINER" value="OrderType"/> + <column name="SORTING" valueNumeric="4"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/Salesorder/update_Salesorder.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesorder/update_Salesorder.xml new file mode 100644 index 0000000000000000000000000000000000000000..ea7efbd9835a54a7e55a2c90af6f6f80091ca2ed --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesorder/update_Salesorder.xml @@ -0,0 +1,36 @@ +<?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="m.mansour" id="a48f9e54-16ac-4bb8-8f2a-395f3035c55e"> + + <addColumn tableName="SALESORDER"> + <column name="OBJECT_TYPE" type="NVARCHAR(63)"/> + <column name="CANCELLATION " type="TINYINT"/> + <column name="UNPAID" type="INTEGER"/> + <column name="PAID" type="INTEGER"/> + <column name="PAYDUEDATE" type="DATETIME"/> + <column name="PAYDATE" type="DATETIME"/> + <column name="DUNNINGDATE" type="DATETIME"/> + <column name="DUNNINGLEVEL" type="CHAR(36)"/> + <column name="ORDERTYPE" type="CHAR(36)"/> + <column name="ORDERSTATUS" type="TINYINT"/> + <column name="PAYMENTTERMS" type="CHAR(36)"/> + <column name="DELIVERYTERMS" type="CHAR(36)"/> + <column name="DELIVERYADDRESS" type="NCLOB"/> + <column name="PAYMENTADDRESS" type="NCLOB"/> + <column name="NOTICE" type="NCLOB"/> + <column name="DUNNINGTEXT" type="NCLOB"/> + </addColumn> + <renameColumn newColumnName="OBJECT_ROWID" oldColumnName="SALESPROJECT_ID" tableName="SALESORDER" columnDataType="CHAR(36)"/> + <update tableName="SALESORDER"> + <column name="OBJECT_TYPE" value="Salesproject" /> + <where>OBJECT_ROWID = '0833465c-8851-4fbb-b7e3-8c1d73c903da' </where> + </update> + + + <addNotNullConstraint + tableName="SALESORDER" + columnName="OBJECT_TYPE" + columnDataType="NVARCHAR(63)"/> + + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/Salesorder_Payment_DayNumber.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesorder_Payment_DayNumber.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b97cf25f56e39ae45ff227d606919e3db5c539a --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesorder_Payment_DayNumber.xml @@ -0,0 +1,34 @@ +<?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="m.mansour" id="13c8eaf7-39d2-41c0-aff4-9cca30d32422"> + <insert tableName="AB_KEYWORD_ATTRIBUTE"> + <column name="AB_KEYWORD_ATTRIBUTEID" value="b5a322c7-41a0-4713-b90a-3c3151833f8d"/> + <column name="NAME" value="dayNumber"/> + <column name="CONTAINER" value="PaymentTerm"/> + <column name="KIND" value="NUMBER_VALUE"/> + </insert> + + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="eb80b4ae-f931-4000-9e48-ee9da528efa5"/> + <column name="AB_KEYWORD_ENTRY_ID" value="b8409c4a-6447-408a-bd06-dfe67054a4f1"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="b5a322c7-41a0-4713-b90a-3c3151833f8d"/> + <column name="NUMBER_VALUE" valueNumeric="7"/> + </insert> + + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="f9a1bdf4-15a6-48d7-a427-34845320cab8"/> + <column name="AB_KEYWORD_ENTRY_ID" value="edba1a8f-766b-4dfa-9360-1a2aca8569d6"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="b5a322c7-41a0-4713-b90a-3c3151833f8d"/> + <column name="NUMBER_VALUE" valueNumeric="30"/> + </insert> + + <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> + <column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="47140d0b-7820-469d-929d-d6d6f0513899"/> + <column name="AB_KEYWORD_ENTRY_ID" value="ed1b3d39-9cab-4c3c-84c5-438a8b67be53"/> + <column name="AB_KEYWORD_ATTRIBUTE_ID" value="b5a322c7-41a0-4713-b90a-3c3151833f8d"/> + <column name="NUMBER_VALUE" valueNumeric="38"/> + </insert> + + + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_LongNames.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_LongNames.xml index 2f5fae70ad39f6302717c63396c499967f66e0e1..c7864cd24f17b5c8fbba7b3384692c0fe4072466 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_LongNames.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_LongNames.xml @@ -5,7 +5,7 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="f1413a2f-6631-4255-9dc9-a28e6eb30497"/> <column name="NAME" value="longName"/> <column name="CONTAINER" value="SalesprojectPhase"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_icons.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_icons.xml index 9d3be8b53fd4c5c629b78e409d7796af2c2cceda..271e18769b16b223b28d3c67980ebbdc87c18621 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_icons.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesproject_Phase_icons.xml @@ -5,7 +5,7 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="93d60e4b-e984-423e-b97f-d2abf61de41d"/> <column name="NAME" value="icon"/> <column name="CONTAINER" value="SalesprojectPhase"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Salesproject_add_column.xml b/.liquibase/Data_alias/basic/2019.1.4/Salesproject_add_column.xml index a40ddf6bd75ea8cfbbe67b3da653db70d1cd58a3..93352abb698b455ce441fc4f22774b7991ba6b28 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/Salesproject_add_column.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/Salesproject_add_column.xml @@ -1,8 +1,8 @@ <?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="m.hofmann" id="e148d42d-ba3c-4cb7-a414-f2da9a9f2ae0"> - <addColumn tableName="SALESPROJECT"> - <!-- space for 13 entries as Multistring encoded --> + <addColumn tableName="SALESPROJECT"> + <!-- space for 13 entries as Multistring encoded --> <column name="REASONS" type="VARCHAR(498)"/> </addColumn> </changeSet> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insertTaskStatus.xml b/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insertTaskStatus.xml index 21258fe56abf1ec10be130fabe1bd233c022d293..b17b28d0ce1656378e18442eab990d66daab6554 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insertTaskStatus.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insertTaskStatus.xml @@ -5,7 +5,7 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="472f9bc2-3331-49f9-aba2-72d5eeb89654"/> <column name="NAME" value="icon"/> <column name="CONTAINER" value="TaskStatus"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <!-- new --> diff --git a/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insert_TicketTypes.xml b/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insert_TicketTypes.xml index 5f2ac9ffa2aca9de416161bb4afc769b611610f6..c489501a6da45c30a5ab1df13ba333ca3c6523f3 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insert_TicketTypes.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/Ticketmanagement/insert_TicketTypes.xml @@ -5,19 +5,19 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="af6a0af9-0102-426b-a1f7-c8abfea79793"/> <column name="NAME" value="attributes"/> <column name="CONTAINER" value="TicketType"/> - <column name="TYPE" value="LONG_CHAR_VALUE"/> + <column name="KIND" value="LONG_CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="6f10015d-b7ee-43aa-99f9-87960ec2e4fd"/> <column name="NAME" value="availableStatus"/> <column name="CONTAINER" value="TicketType"/> - <column name="TYPE" value="LONG_CHAR_VALUE"/> + <column name="KIND" value="LONG_CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="729a41d1-0463-480d-bf7b-0eb6c2e96f37"/> <column name="NAME" value="defaultStatus"/> <column name="CONTAINER" value="TicketType"/> - <column name="TYPE" value="CHAR_VALUE"/> + <column name="KIND" value="CHAR_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ENTRY"> diff --git a/.liquibase/Data_alias/basic/2019.1.4/change_Milestone_datatype_to_new_Keyword_logic.xml b/.liquibase/Data_alias/basic/2019.1.4/change_Milestone_datatype_to_new_Keyword_logic.xml index 6eee124a8c12c2870b013401622c68324bc8f065..6e80ad7b50179868765a656e787f907efddf9440 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/change_Milestone_datatype_to_new_Keyword_logic.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/change_Milestone_datatype_to_new_Keyword_logic.xml @@ -2,15 +2,15 @@ <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 dbms="derby" author="j.hoermann" id="be098ba0-30ed-4e01-893e-928b1ac86923"> <sql> - ALTER TABLE SALESPROJECT_MILESTONE ADD COLUMN TYPE_NEW VARCHAR(80); - UPDATE SALESPROJECT_MILESTONE SET TYPE_NEW=CHAR(TYPE); - ALTER TABLE SALESPROJECT_MILESTONE DROP COLUMN TYPE; - RENAME COLUMN SALESPROJECT_MILESTONE.TYPE_NEW TO TYPE; + ALTER TABLE SALESPROJECT_MILESTONE ADD COLUMN KIND_NEW VARCHAR(80); + UPDATE SALESPROJECT_MILESTONE SET KIND_NEW=CHAR(KIND); + ALTER TABLE SALESPROJECT_MILESTONE DROP COLUMN KIND; + RENAME COLUMN SALESPROJECT_MILESTONE.KIND_NEW TO KIND; - ALTER TABLE SALESPROJECT_MILESTONE ADD COLUMN VALUE_NEW CHAR(36); - UPDATE SALESPROJECT_MILESTONE SET VALUE_NEW=CHAR(VALUE); - ALTER TABLE SALESPROJECT_MILESTONE DROP COLUMN VALUE; - RENAME COLUMN SALESPROJECT_MILESTONE.VALUE_NEW TO VALUE; + ALTER TABLE SALESPROJECT_MILESTONE ADD COLUMN MILESTONEVALUE_NEW CHAR(36); + UPDATE SALESPROJECT_MILESTONE SET MILESTONEVALUE_NEW=CHAR(MILESTONEVALUE); + ALTER TABLE SALESPROJECT_MILESTONE DROP COLUMN MILESTONEVALUE; + RENAME COLUMN SALESPROJECT_MILESTONE.MILESTONEVALUE_NEW TO MILESTONEVALUE; </sql> </changeSet> @@ -21,7 +21,7 @@ </not> </preConditions> - <modifyDataType tableName="SALESPROJECT_MILESTONE" columnName="TYPE" newDataType="NVARCHAR(80)"/> - <modifyDataType tableName="SALESPROJECT_MILESTONE" columnName="VALUE" newDataType="CHAR(36)"/> + <modifyDataType tableName="SALESPROJECT_MILESTONE" columnName="KIND" newDataType="NVARCHAR(80)"/> + <modifyDataType tableName="SALESPROJECT_MILESTONE" columnName="MILESTONEVALUE" newDataType="CHAR(36)"/> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/changelog.xml b/.liquibase/Data_alias/basic/2019.1.4/changelog.xml index 181fad001408b09af521efa7013741ac81ec59e4..d4bc2d5982724c87887af2cb493edd31c63bcb3e 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/changelog.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/changelog.xml @@ -4,8 +4,6 @@ <include relativeToChangelogFile="true" file="update_TaskType_Task.xml"/> - <include relativeToChangelogFile="true" file="removeTaskCode.xml"/> - <include relativeToChangelogFile="true" file="activity_add_parent.xml"/> <include relativeToChangelogFile="true" file="task_add_parent.xml"/> @@ -182,6 +180,15 @@ <include relativeToChangelogFile="true" file="AditoBasic/init_CallAnswerMode.xml"/> <include relativeToChangelogFile="true" file="alter_appointmentlink.xml"/> - <include relativeToChangelogFile="true" file="DuplicateScan/create_duplicateScanner.xml"/> - <include relativeToChangelogFile="true" file="DuplicateScan/create_duplicateScanConditionConfig.xml"/> + + <include relativeToChangelogFile="true" file="AditoBasic/init_NotificationPriority.xml"/> + <include relativeToChangelogFile="true" file="AditoBasic/init_NotificationState.xml"/> + + <include relativeToChangelogFile="true" file="Product_added_ImageBlobs.xml"/> + + <include relativeToChangelogFile="true" file="Salesorder/create_ordertype_keyword.xml"/> + <include relativeToChangelogFile="true" file="Salesorder/create_dunninglevel_keyword.xml"/> + <include relativeToChangelogFile="true" file="Salesorder/update_Salesorder.xml"/> + <include relativeToChangelogFile="true" file="Salesproject_Phase_LongNames.xml"/> + <include relativeToChangelogFile="true" file="Salesorder_Payment_DayNumber.xml"/> </databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.1.4/create_documenttemplate.xml b/.liquibase/Data_alias/basic/2019.1.4/create_documenttemplate.xml index 385f93d9d62f07219383c3178aed1b3af13b173c..e5e037f53b7f69c3b9dac5de520615c5f99b838c 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/create_documenttemplate.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/create_documenttemplate.xml @@ -6,18 +6,18 @@ <constraints primaryKey="true" primaryKeyName="PK_DOCUMENTTEMPLATE_DOCUMENTTEMPLATEID"/> </column> <column name="NAME" type="NVARCHAR(50)"/> - <column name="TYPE" type="CHAR(36)"/> + <column name="KIND" type="CHAR(36)"/> <column name="CLASSIFICATION" type="CHAR(36)"/> - <column name="LANGUAGE" type="CHAR(3)"/> + <column name="ISOLANGUAGE" type="CHAR(3)"/> <column name="DESCRIPTION" type="NVARCHAR(500)"/> <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> - <column name="DATE_NEW" type="DATE"> + <column name="DATE_NEW" type="DATETIME"> <constraints nullable="false"/> </column> <column name="USER_EDIT" type="NVARCHAR(50)" /> - <column name="DATE_EDIT" type="DATE" /> + <column name="DATE_EDIT" type="DATETIME" /> </createTable> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/create_salutation.xml b/.liquibase/Data_alias/basic/2019.1.4/create_salutation.xml index 67338c9e4c8f7493a7221d9fbdd03c66e69d8492..bd03a1284b944ce6b09d0fac8fc996f19a5e4d7d 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/create_salutation.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/create_salutation.xml @@ -6,7 +6,7 @@ <constraints primaryKey="true" primaryKeyName="PK_SALUTATION_SALUTATIONID"/> </column> <column name="HEADLINE" type="NVARCHAR(50)"/> - <column name="LANGUAGE" type="CHAR(3)"/> + <column name="ISOLANGUAGE" type="CHAR(3)"/> <column name="LETTERSALUTATION" type="NVARCHAR(200)"/> <column name="SALUTATION" type="NVARCHAR(200)"/> <column name="SEX" type="CHAR(36)"/> @@ -20,7 +20,7 @@ <column name="SEX" value="m"/> <column name="TITLE"/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="1"/> <column name="SALUTATIONID" value="c98c8644-9e00-4715-a775-827a364f5cef"/> </insert> @@ -30,7 +30,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Bürgermeister"/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="2"/> <column name="SALUTATIONID" value="8feaf27b-1fae-4d8c-a742-9cd023f46409"/> </insert> @@ -40,7 +40,7 @@ <column name="SEX" value="f"/> <column name="TITLE"/> <column name="SALUTATION" value="Frau"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="3"/> <column name="SALUTATIONID" value="cbcc2c2b-9b64-442b-a6be-aaf8e462128c"/> </insert> @@ -50,7 +50,7 @@ <column name="SEX"/> <column name="TITLE"/> <column name="SALUTATION"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="4"/> <column name="SALUTATIONID" value="6b835563-5d3e-4c4c-807b-63c5bdb82e68"/> </insert> @@ -60,7 +60,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr."/> <column name="SALUTATION" value="Mr."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="5"/> <column name="SALUTATIONID" value="f9135efb-ebd4-4c9f-bfa1-3beedb647009"/> </insert> @@ -70,7 +70,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr."/> <column name="SALUTATION" value="Mrs."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="6"/> <column name="SALUTATIONID" value="0b9a3d9b-a56c-47e9-a984-e88cface58db"/> </insert> @@ -80,7 +80,7 @@ <column name="SEX"/> <column name="TITLE"/> <column name="SALUTATION"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="7"/> <column name="SALUTATIONID" value="ff97826d-a8ea-45e5-b426-2a27f4fa9201"/> </insert> @@ -90,7 +90,7 @@ <column name="SEX" value="m"/> <column name="TITLE"/> <column name="SALUTATION" value="Monsieur"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="8"/> <column name="SALUTATIONID" value="c1095e86-38d6-4329-a388-4cfabab10eae"/> </insert> @@ -100,7 +100,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr."/> <column name="SALUTATION" value="Frau"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="9"/> <column name="SALUTATIONID" value="6b35b8c5-920c-408b-b172-453a506aa775"/> </insert> @@ -110,7 +110,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Prof."/> <column name="SALUTATION" value="Monsieur"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="10"/> <column name="SALUTATIONID" value="67fa73ae-a739-44fd-9244-28a49bc0d01d"/> </insert> @@ -120,7 +120,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr."/> <column name="SALUTATION" value="Monsieur"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="11"/> <column name="SALUTATIONID" value="516b740d-b932-4a64-b611-af0ea69f6bd0"/> </insert> @@ -130,7 +130,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Professor"/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="12"/> <column name="SALUTATIONID" value="5d9ad542-27b8-4dec-bcbd-a2c7d223f012"/> </insert> @@ -140,7 +140,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr."/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="13"/> <column name="SALUTATIONID" value="76fe57c0-cf68-4240-ba6d-eb7d52f46317"/> </insert> @@ -150,7 +150,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Präsident"/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="14"/> <column name="SALUTATIONID" value="4b9af3f4-f34a-4170-a28c-ffdbca80c4d3"/> </insert> @@ -160,7 +160,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Prof. Dr."/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="15"/> <column name="SALUTATIONID" value="1f19ba34-8346-4620-a10e-fb39fdd0be9b"/> </insert> @@ -170,7 +170,7 @@ <column name="SEX" value="m"/> <column name="TITLE"/> <column name="SALUTATION" value="Mr."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="16"/> <column name="SALUTATIONID" value="801efd2a-41ce-4a5d-8ed5-c2db7fedb4e8"/> </insert> @@ -180,7 +180,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Professor"/> <column name="SALUTATION" value="Mr."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="17"/> <column name="SALUTATIONID" value="ce348b08-c1bf-4e76-8272-6d6b32ecdd6a"/> </insert> @@ -190,7 +190,7 @@ <column name="SEX" value="f"/> <column name="TITLE"/> <column name="SALUTATION" value="Mrs."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="18"/> <column name="SALUTATIONID" value="11816f93-f6e9-427f-af68-fbf29c3e3544"/> </insert> @@ -200,7 +200,7 @@ <column name="SEX" value="f"/> <column name="TITLE"/> <column name="SALUTATION" value="Madame"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="19"/> <column name="SALUTATIONID" value="2360e24d-1784-47b8-b0e9-3b57bd704e8a"/> </insert> @@ -210,7 +210,7 @@ <column name="SEX"/> <column name="TITLE"/> <column name="SALUTATION"/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="20"/> <column name="SALUTATIONID" value="f7b3c876-366d-438a-a1e6-f17ceb641f36"/> </insert> @@ -220,7 +220,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Prof."/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="21"/> <column name="SALUTATIONID" value="75f4f04f-1877-425d-8d5d-56604d0040b2"/> </insert> @@ -230,7 +230,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Prof.Dr."/> <column name="SALUTATION" value="Monsieur"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="22"/> <column name="SALUTATIONID" value="2d8ec97f-38d7-45a8-9c45-ed672f4b035d"/> </insert> @@ -240,7 +240,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr."/> <column name="SALUTATION" value="Madame"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="23"/> <column name="SALUTATIONID" value="4e76c69b-ee75-49e5-8581-2a808b29a117"/> </insert> @@ -250,7 +250,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Monsieur"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="24"/> <column name="SALUTATIONID" value="f3ea547a-d744-4ce8-815a-126d9697e037"/> </insert> @@ -260,7 +260,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Madame"/> - <column name="LANGUAGE" value="fra"/> + <column name="ISOLANGUAGE" value="fra"/> <column name="SORT" valueNumeric="25"/> <column name="SALUTATIONID" value="e8e001ab-b200-480f-917b-33d57e2a8734"/> </insert> @@ -270,7 +270,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Frau"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="26"/> <column name="SALUTATIONID" value="0e719a2a-1018-49e0-b056-c90779955bf9"/> </insert> @@ -280,7 +280,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Herr"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="SORT" valueNumeric="27"/> <column name="SALUTATIONID" value="0500939e-5820-457d-a95f-6835b9501df9"/> </insert> @@ -290,7 +290,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Mr."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="28"/> <column name="SALUTATIONID" value="5260f79c-1001-41dc-b3ff-28b4ce7091b9"/> </insert> @@ -300,7 +300,7 @@ <column name="SEX" value="m"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Señor"/> - <column name="LANGUAGE" value="spa"/> + <column name="ISOLANGUAGE" value="spa"/> <column name="SORT" valueNumeric="29"/> <column name="SALUTATIONID" value="7617a199-82b7-40ef-b2f7-0e85d32fad64"/> </insert> @@ -310,7 +310,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Señora"/> - <column name="LANGUAGE" value="spa"/> + <column name="ISOLANGUAGE" value="spa"/> <column name="SORT" valueNumeric="30"/> <column name="SALUTATIONID" value="25b28c87-edb5-4686-a3c4-92a5136aadc0"/> </insert> @@ -320,7 +320,7 @@ <column name="SEX" value="f"/> <column name="TITLE" value="Dr. Ing."/> <column name="SALUTATION" value="Mrs."/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="SORT" valueNumeric="31"/> <column name="SALUTATIONID" value="4505783d-8a9f-4a18-ba2e-091794db3812"/> </insert> diff --git a/.liquibase/Data_alias/basic/2019.1.4/removeTaskCode.xml b/.liquibase/Data_alias/basic/2019.1.4/removeTaskCode.xml deleted file mode 100644 index 6ec2c773c5db07904d0302f9d16fa92f03da0863..0000000000000000000000000000000000000000 --- a/.liquibase/Data_alias/basic/2019.1.4/removeTaskCode.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?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.goderbauer" id="598345d1-691b-4cae-b1c0-44c9c48705c8"> - <dropNotNullConstraint tableName="TASK" columnName="CODE" columnDataType="INTEGER"/> - <update tableName="TASK"> - <column name="CODE"/> - </update> - <rollback> - <addNotNullConstraint tableName="TASK" columnName="CODE" /> - <!--the update which sets everything to null cannot be rolled back--> - </rollback> -</changeSet> -</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.1.4/update_Memberrole_InternExtern.xml b/.liquibase/Data_alias/basic/2019.1.4/update_Memberrole_InternExtern.xml index 40aafe37e6091f0446fa6b16f6e77185f123fc2e..abf87e86bbc083a77d9c94f93d0dcc6426595264 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/update_Memberrole_InternExtern.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/update_Memberrole_InternExtern.xml @@ -5,7 +5,7 @@ <column name="AB_KEYWORD_ATTRIBUTEID" value="0bdeb691-f90a-4d7e-a99a-08c60816232c"/> <column name="NAME" value="Intern"/> <column name="CONTAINER" value="MemberRole"/> - <column name="TYPE" value="BOOL_VALUE"/> + <column name="KIND" value="BOOL_VALUE"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> diff --git a/.liquibase/Data_alias/basic/2019.1.4/update_Milestone_to_new_Keyword.xml b/.liquibase/Data_alias/basic/2019.1.4/update_Milestone_to_new_Keyword.xml index 9d79ee64c1a69c2855f927681cf5c9a590b2d7ed..20fa0cd9303ab1ac28af19bd1140c126fb018d0e 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/update_Milestone_to_new_Keyword.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/update_Milestone_to_new_Keyword.xml @@ -2,15 +2,15 @@ <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.hoermann" id="ec9bae68-ca27-4597-9808-fc333246b3a0"> <update tableName="SALESPROJECT_MILESTONE"> - <column name="TYPE" value="SalesprojectPhase"/> - <where>TYPE = ?</where> + <column name="KIND" value="SalesprojectPhase"/> + <where>KIND = ?</where> <whereParams> <param value="1" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASENQC"/> - <where>TYPE = ? and VALUE in (?,?,?,?,?,?,?,?,?,?,?)</where> + <column name="MILESTONEVALUE" value="SALPROJPHASENQC"/> + <where>KIND = ? and MILESTONEVALUE in (?,?,?,?,?,?,?,?,?,?,?)</where> <whereParams> <param value="SalesprojectPhase" /> <param value="1" /> @@ -27,48 +27,48 @@ </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASEMAL"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJPHASEMAL"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectPhase" /> <param value="2" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASEMQL"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJPHASEMQL"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectPhase" /> <param value="3" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASESAL"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJPHASESAL"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectPhase" /> <param value="4" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASESQO"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJPHASESQO"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectPhase" /> <param value="5" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASEOFFER"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJPHASEOFFER"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectPhase" /> <param value="6" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJPHASENEGO"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJPHASENEGO"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectPhase" /> <param value="7" /> @@ -77,55 +77,55 @@ <update tableName="SALESPROJECT_MILESTONE"> - <column name="TYPE" value="SalesprojectState"/> - <where>TYPE = ?</where> + <column name="KIND" value="SalesprojectState"/> + <where>KIND = ?</where> <whereParams> <param value="2" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJSTATOPEN"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJSTATOPEN"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectState" /> <param value="1" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJSTATPOST"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJSTATPOST"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectState" /> <param value="2" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJSTATABORT"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJSTATABORT"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectState" /> <param value="3" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJSTATPARTIAL"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJSTATPARTIAL"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectState" /> <param value="4" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="SALPROJSTATLOST"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="SALPROJSTATLOST"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectState" /> <param value="5" /> </whereParams> </update> <update tableName="SALESPROJECT_MILESTONE"> - <column name="VALUE" value="d8a60f60-a4e6-46ee-88ec-bac53e1afedd"/> - <where>TYPE = ? and VALUE = ?</where> + <column name="MILESTONEVALUE" value="d8a60f60-a4e6-46ee-88ec-bac53e1afedd"/> + <where>KIND = ? and MILESTONEVALUE = ?</where> <whereParams> <param value="SalesprojectState" /> <param value="6" /> diff --git a/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Forecast.xml b/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Forecast.xml index bd97822e3351649c3631fe5d095ac608b42833f7..a592cab3bab7007155580474df9ec121b16af26e 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Forecast.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Forecast.xml @@ -19,6 +19,5 @@ columnDataType="NVARCHAR(63)"/> <renameTable oldTableName="SALESPROJECT_FORECAST" newTableName="FORECAST"/> - </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Member.xml b/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Member.xml index f9ca66f2dc76e89f99f8df7faabe2508038da1d5..56744dc5078e2a1355435a01cf03c504a8bb5677 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Member.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/update_Salesproject_Member.xml @@ -4,11 +4,14 @@ <addColumn tableName="SALESPROJECT_MEMBER"> <column name="OBJECT_TYPE" type="NVARCHAR(63)"/> - <column name="DECIDER" type="BOOLEAN"/> + <!-- Booleans in basic are always TINYINT with 1 = true, 0 = false see others/guide/whichDatatype.adoc --> + <column name="DECIDER" type="TINYINT" defaultValueNumeric="0"> + <constraints nullable="false"/> + </column> </addColumn> <renameColumn newColumnName="OBJECT_ROWID" oldColumnName="SALESPROJECT_ID" tableName="SALESPROJECT_MEMBER" columnDataType="CHAR(36)"/> - <renameColumn newColumnName="MEMBERID" oldColumnName="SALESPROJECT_MEMBERID" tableName="SALESPROJECT_MEMBER" columnDataType="CHAR(36)"/> - <renameColumn newColumnName="ROLE" oldColumnName="SALESPROJECT_ROLE" tableName="SALESPROJECT_MEMBER" columnDataType="CHAR(36)"/> + <renameColumn newColumnName="OBJECTMEMBERID" oldColumnName="SALESPROJECT_MEMBERID" tableName="SALESPROJECT_MEMBER" columnDataType="CHAR(36)"/> + <renameColumn newColumnName="MEMBERROLE" oldColumnName="SALESPROJECT_MEMBERROLE" tableName="SALESPROJECT_MEMBER" columnDataType="CHAR(36)"/> <update tableName="SALESPROJECT_MEMBER"> <column name="OBJECT_TYPE" value="Salesproject" /> <where>OBJECT_ROWID = '0833465c-8851-4fbb-b7e3-8c1d73c903da'</where> @@ -19,7 +22,7 @@ columnName="OBJECT_TYPE" columnDataType="NVARCHAR(63)"/> - <renameTable oldTableName="SALESPROJECT_MEMBER" newTableName="MEMBER"/> + <renameTable oldTableName="SALESPROJECT_MEMBER" newTableName="OBJECTMEMBER"/> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2019.2.1/alter_Campaign_currency.xml b/.liquibase/Data_alias/basic/2019.2.1/alter_Campaign_currency.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a09edddd07545cad3650647e1d05d3b3194b8f0 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/alter_Campaign_currency.xml @@ -0,0 +1,9 @@ +<?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="s.listl" id="28c04b3e-c643-4ef9-b1fa-4a8816e9ad0d"> + <addColumn tableName="CAMPAIGN"> + <column name="CURRENCY" type="CHAR(36)"/> + </addColumn> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.2.1/alter_SerialLetter.xml b/.liquibase/Data_alias/basic/2019.2.1/alter_SerialLetter.xml new file mode 100644 index 0000000000000000000000000000000000000000..de3d63640b8f58836f30da4224ea3637ef577529 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/alter_SerialLetter.xml @@ -0,0 +1,9 @@ +<?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="s.listl" id="f1a65325-8a60-409e-9271-512c14b5e1b7"> + <addColumn tableName="SERIALLETTER"> + <column name="STATUS" type="CHAR(36)"/> + </addColumn> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.2.1/changelog.xml b/.liquibase/Data_alias/basic/2019.2.1/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..5293ca357349f7c7d00378562582849490cb2ecd --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/changelog.xml @@ -0,0 +1,11 @@ +<?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"> + <include relativeToChangelogFile="true" file="update_attribute_Ticket_Support_Product.xml"/> + + <include relativeToChangelogFile="true" file="alter_SerialLetter.xml"/> + <include relativeToChangelogFile="true" file="insert_SerialLetterStatus_keyword.xml"/> + <include relativeToChangelogFile="true" file="insert_AttributeType_Theme_keyword.xml"/> + + <include relativeToChangelogFile="true" file="alter_Campaign_currency.xml"/> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.2.1/insert_AttributeType_Theme_keyword.xml b/.liquibase/Data_alias/basic/2019.2.1/insert_AttributeType_Theme_keyword.xml new file mode 100644 index 0000000000000000000000000000000000000000..d5543dba499f36e83c8dd907e1e8b10ca9284335 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/insert_AttributeType_Theme_keyword.xml @@ -0,0 +1,22 @@ +<?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="s.listl" id="ec0f5419-353e-4643-8f08-03651d530401"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="49dc7423-21c7-47b1-ac1e-b01e8eb5c822"/> + <column name="KEYID" value="THEME "/> + <column name="TITLE" value="Theme"/> + <column name="CONTAINER" value="AttributeType"/> + <column name="SORTING" valueNumeric="11"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <update tableName="AB_KEYWORD_ENTRY"> + <column name="ISACTIVE" valueNumeric="1" /> + <where>AB_KEYWORD_ENTRYID = ?</where> + <whereParams> + <param value="75a67526-6b7c-400d-b958-e1f8f45466aa"/> + </whereParams> + </update> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.2.1/insert_SerialLetterStatus_keyword.xml b/.liquibase/Data_alias/basic/2019.2.1/insert_SerialLetterStatus_keyword.xml new file mode 100644 index 0000000000000000000000000000000000000000..343f39f023e0e2e52c66b70043273a5d574d87b6 --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/insert_SerialLetterStatus_keyword.xml @@ -0,0 +1,22 @@ +<?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="s.listl" id="4c5659dd-16cb-435a-b573-74bc697989d1"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="8898350e-fd68-45b5-97d6-618d867e53b7"/> + <column name="KEYID" value="SERIALLETTERNOTSENT "/> + <column name="TITLE" value="Not sent"/> + <column name="CONTAINER" value="SerialLetterStatus"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="f2fb362a-97d3-4c1d-8496-20abc99973ec"/> + <column name="KEYID" value="SERIALLETTERSENT "/> + <column name="TITLE" value="Sent"/> + <column name="CONTAINER" value="SerialLetterStatus"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + </insert> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2019.2.1/update_attribute_Ticket_Support_Product.xml b/.liquibase/Data_alias/basic/2019.2.1/update_attribute_Ticket_Support_Product.xml new file mode 100644 index 0000000000000000000000000000000000000000..adc095cef072fc4bf8f0c122a4067377ccacfdec --- /dev/null +++ b/.liquibase/Data_alias/basic/2019.2.1/update_attribute_Ticket_Support_Product.xml @@ -0,0 +1,22 @@ +<?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 id="8fc5d294-43b5-4b1c-af5f-cded38dee6f0" author="a.loreth"> + <update tableName="AB_ATTRIBUTE"> + <column name="DROPDOWNDEFINITION" value="Product_entity" /> + <where>AB_ATTRIBUTEID = ?</where> + <whereParams> + <param value="af312508-8a9b-4b8f-88f3-6b98005c749e" /> + </whereParams> + </update> + <rollback> + <update tableName="AB_ATTRIBUTE"> + <column name="DROPDOWNDEFINITION" value="Product" /> + <where>AB_ATTRIBUTEID = ?</where> + <whereParams> + <param value="af312508-8a9b-4b8f-88f3-6b98005c749e" /> + </whereParams> + </update> + </rollback> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/_demoData/changelog.xml b/.liquibase/Data_alias/basic/_demoData/changelog.xml index fadb02846c3c9b2c3402abe2501f5451e8006cba..272312eb6df688b304e58dca580d3275e85076fd 100644 --- a/.liquibase/Data_alias/basic/_demoData/changelog.xml +++ b/.liquibase/Data_alias/basic/_demoData/changelog.xml @@ -19,7 +19,7 @@ <include relativeToChangelogFile="true" file="generatedData/SALESORDERITEM.xml"/> <include relativeToChangelogFile="true" file="generatedData/SALESPROJECT.xml"/> <include relativeToChangelogFile="true" file="generatedData/FORECAST.xml"/> - <include relativeToChangelogFile="true" file="generatedData/MEMBER.xml"/> + <include relativeToChangelogFile="true" file="generatedData/OBJECTMEMBER.xml"/> <include relativeToChangelogFile="true" file="generatedData/SALESPROJECT_MILESTONE.xml"/> <include relativeToChangelogFile="true" file="generatedData/SALESPROJECT_SOURCE.xml"/> <include relativeToChangelogFile="true" file="generatedData/TASK.xml"/> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/ADDRESS.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/ADDRESS.xml index 1c6edf7f001f3d117f664da2732ca6f845e17d65..3992ba1838939e8cff2f170498463e6ca9c8a300 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/ADDRESS.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/ADDRESS.xml @@ -11,7 +11,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="33739"/> </insert> @@ -25,7 +25,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Mecklenburg-Vorpommern"/> - <column name="STATE" value="Mecklenburg-Vorpommern"/> + <column name="PROVINCE" value="Mecklenburg-Vorpommern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="18074"/> </insert> @@ -38,7 +38,7 @@ <column name="CONTACT_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-15T03:21:35"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="20095"/> </insert> @@ -51,7 +51,7 @@ <column name="CONTACT_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-15T03:28:49"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="88045"/> </insert> @@ -64,7 +64,7 @@ <column name="CONTACT_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-15T03:41:53"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="70173"/> </insert> @@ -77,7 +77,7 @@ <column name="CONTACT_ID" value="a3fd3c23-12e1-4820-b76e-2cd70103d94d"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:40:30"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84028"/> </insert> @@ -90,7 +90,7 @@ <column name="CONTACT_ID" value="cabf6192-f9c3-4bd4-9366-ad2b073bdfa3"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:42:01"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84144"/> </insert> @@ -103,7 +103,7 @@ <column name="CONTACT_ID" value="2c14fb05-d48e-4eeb-8a7f-85d423746848"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:44:21"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="10409"/> </insert> @@ -116,7 +116,7 @@ <column name="CONTACT_ID" value="5a52304e-65e8-40ed-9aca-a76af6c8c3a0"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:46:28"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="80228"/> </insert> @@ -129,7 +129,7 @@ <column name="CONTACT_ID" value="8eecb5e5-40d9-4bf0-a152-1ca456795563"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:47:43"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="93047"/> </insert> @@ -141,7 +141,7 @@ <column name="CONTACT_ID" value="e450d126-eab8-4517-ba7c-8b6804f8c859"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:49:41"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="85051"/> </insert> @@ -154,7 +154,7 @@ <column name="CONTACT_ID" value="019651a4-503e-4e06-aefd-e7e631bf3144"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T09:50:42"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="86130"/> </insert> @@ -167,7 +167,7 @@ <column name="CONTACT_ID" value="8707accf-b1fd-4bde-97b1-ab44b75f66f9"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-17T10:01:27"/> - <column name="STATE" value="Bremen"/> + <column name="PROVINCE" value="Bremen"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="28103"/> </insert> @@ -181,7 +181,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_EDIT" valueDate="2019-06-07T02:49:33"/> <column name="DATE_NEW" valueDate="2019-05-17T10:04:16"/> - <column name="STATE" value="Deutschland"/> + <column name="PROVINCE" value="Deutschland"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="24534"/> @@ -197,7 +197,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="80807"/> </insert> @@ -213,7 +213,7 @@ <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="DISTRICT" value="Nürnberg"/> <column name="REGION" value="Mittelfranken"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="90419"/> </insert> @@ -228,7 +228,7 @@ <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="DISTRICT" value="Niederbayern"/> <column name="REGION" value="Niederbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84034"/> </insert> @@ -243,7 +243,7 @@ <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="DISTRICT" value="Niederbayern"/> <column name="REGION" value="Niederbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84034"/> </insert> @@ -258,7 +258,7 @@ <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="DISTRICT" value="Niederbayern"/> <column name="REGION" value="Niederbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84034"/> </insert> @@ -273,7 +273,7 @@ <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="DISTRICT" value="Oberbayern"/> <column name="REGION" value="Landsberg am Lech"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="86949"/> </insert> @@ -287,7 +287,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Bayern"/> - <column name="STATE" value="Freistaat Bayern"/> + <column name="PROVINCE" value="Freistaat Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="18074"/> </insert> @@ -302,7 +302,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="80807"/> </insert> @@ -318,7 +318,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:50:21"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="80807"/> @@ -335,7 +335,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:44:48"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84034"/> @@ -351,7 +351,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="54595"/> </insert> @@ -365,7 +365,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="85230"/> </insert> @@ -379,7 +379,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="80456"/> </insert> @@ -393,7 +393,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="DISTRICT" value="Oberbayern"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="67700"/> </insert> @@ -406,7 +406,7 @@ <column name="CONTACT_ID" value="33ae2997-7bff-4c3c-8038-2fa6781dbe9d"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-23T08:40:12"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="86150"/> </insert> @@ -419,7 +419,7 @@ <column name="CONTACT_ID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-23T10:54:10"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84028"/> </insert> @@ -432,7 +432,7 @@ <column name="CONTACT_ID" value="777246d5-7a73-4c52-af14-84df66128e5d"/> <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-05-23T10:56:16"/> - <column name="STATE" value="Bayern"/> + <column name="PROVINCE" value="Bayern"/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="86150"/> </insert> @@ -447,7 +447,7 @@ <column name="COUNTRY" value="DE"/> <column name="DATE_NEW" valueDate="2019-06-07T02:45:53"/> <column name="REGION" value="Niederbayern "/> - <column name="STATE" value="Bayern "/> + <column name="PROVINCE" value="Bayern "/> <column name="USER_NEW" value="Admin"/> <column name="ZIP" value="84034"/> </insert> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/COMMUNICATION.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/COMMUNICATION.xml index 624e841c2a02368247cf28359c764788456e7b88..940310cc150071e6aa0c743a976e17d5772a09b8 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/COMMUNICATION.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/COMMUNICATION.xml @@ -8,7 +8,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:48:55"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -19,7 +19,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:46:11"/> <column name="DATE_NEW" valueDate="2019-05-15T03:21:35"/> <column name="MEDIUM_ID" value="COMMINTERNET"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -30,7 +30,7 @@ <column name="DATE_EDIT" valueDate="2019-06-06T02:50:34"/> <column name="DATE_NEW" valueDate="2019-05-15T03:28:49"/> <column name="MEDIUM_ID" value="COMMINTERNET"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -40,7 +40,7 @@ <column name="CONTACT_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="DATE_NEW" valueDate="2019-05-15T03:41:53"/> <column name="MEDIUM_ID" value="COMMINTERNET"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -50,7 +50,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:36:32"/> <column name="DATE_NEW" valueDate="2019-05-15T03:56:26"/> <column name="MEDIUM_ID" value="COMMMOBIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -60,7 +60,7 @@ <column name="CONTACT_ID" value="45635aca-7971-43df-a683-c80c86cb58cc"/> <column name="DATE_NEW" valueDate="2019-05-15T05:10:34"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -69,7 +69,7 @@ <column name="CONTACT_ID" value="d3ec3869-b710-44d9-b20f-50f0724631ac"/> <column name="DATE_NEW" valueDate="2019-05-15T05:13:19"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -78,7 +78,7 @@ <column name="CONTACT_ID" value="a8a5f214-8165-4627-bee2-bceb3578147e"/> <column name="DATE_NEW" valueDate="2019-05-16T01:24:26"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -88,7 +88,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:41:37"/> <column name="DATE_NEW" valueDate="2019-05-16T01:26:03"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -99,7 +99,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:32:33"/> <column name="DATE_NEW" valueDate="2019-05-19T08:03:15"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -110,7 +110,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T08:26:27"/> <column name="DATE_NEW" valueDate="2019-05-19T08:04:03"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -121,7 +121,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:50:57"/> <column name="DATE_NEW" valueDate="2019-05-19T08:06:21"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -132,7 +132,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:59:10"/> <column name="DATE_NEW" valueDate="2019-05-19T08:06:21"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -142,7 +142,7 @@ <column name="CONTACT_ID" value="d4c1bec3-656f-45ec-ae03-1c4d729d99fe"/> <column name="DATE_NEW" valueDate="2019-05-19T08:10:21"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -152,7 +152,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:57:27"/> <column name="DATE_NEW" valueDate="2019-05-19T08:10:21"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -162,7 +162,7 @@ <column name="CONTACT_ID" value="73d73404-e7f5-11e8-9f32-f2801f1b9fd1"/> <column name="DATE_NEW" valueDate="2019-05-19T08:11:20"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -171,7 +171,7 @@ <column name="CONTACT_ID" value="73d731a2-e7f5-11e8-9f32-f2801f1b9fd1"/> <column name="DATE_NEW" valueDate="2019-05-19T08:13:02"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -181,7 +181,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:35:59"/> <column name="DATE_NEW" valueDate="2019-05-19T08:14:38"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -192,7 +192,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:39:42"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -203,7 +203,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T10:41:56"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -213,7 +213,7 @@ <column name="CONTACT_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMINTERNET"/> - <column name="STANDARD" valueNumeric="0"/> + <column name="ISSTANDARD" valueNumeric="0"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -223,7 +223,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:48:25"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -234,7 +234,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:38:02"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -245,7 +245,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:49:15"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -256,7 +256,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:41:47"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -266,7 +266,7 @@ <column name="CONTACT_ID" value="d5a2dc64-e503-4aed-a0c6-d54f49b8db87"/> <column name="DATE_NEW" valueDate="2019-05-19T08:14:38"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -276,7 +276,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:36:21"/> <column name="DATE_NEW" valueDate="2019-05-19T08:16:40"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -286,7 +286,7 @@ <column name="CONTACT_ID" value="1a67eaa7-21da-4a18-97ab-755ac5cb74f7"/> <column name="DATE_NEW" valueDate="2019-05-19T08:16:40"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -296,7 +296,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:59:17"/> <column name="DATE_NEW" valueDate="2019-05-19T08:20:04"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -307,7 +307,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:50:35"/> <column name="DATE_NEW" valueDate="2019-05-19T08:20:04"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -318,7 +318,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:57:36"/> <column name="DATE_NEW" valueDate="2019-05-19T08:22:23"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -328,7 +328,7 @@ <column name="CONTACT_ID" value="7a34d9d0-04c7-478c-a8e2-f584fe625c45"/> <column name="DATE_NEW" valueDate="2019-05-19T08:22:24"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -337,7 +337,7 @@ <column name="CONTACT_ID" value="f0fb7676-8183-4bc7-beca-ca32c1e11c10"/> <column name="DATE_NEW" valueDate="2019-05-19T08:23:58"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -347,7 +347,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:37:07"/> <column name="DATE_NEW" valueDate="2019-05-19T08:23:58"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -358,7 +358,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:37:23"/> <column name="DATE_NEW" valueDate="2019-05-19T08:26:54"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -368,7 +368,7 @@ <column name="CONTACT_ID" value="57d524f6-ad66-4550-be83-fee6e31b7a52"/> <column name="DATE_NEW" valueDate="2019-05-19T08:26:54"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -378,7 +378,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:57:45"/> <column name="DATE_NEW" valueDate="2019-05-19T08:30:47"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -388,7 +388,7 @@ <column name="CONTACT_ID" value="3ac53b27-450d-4a2a-9160-bb223b8deef8"/> <column name="DATE_NEW" valueDate="2019-05-19T08:30:48"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -398,7 +398,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:41:28"/> <column name="DATE_NEW" valueDate="2019-05-19T08:31:51"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -408,7 +408,7 @@ <column name="CONTACT_ID" value="d105f7f4-afd1-4a98-adc2-13fd6934b7e9"/> <column name="DATE_NEW" valueDate="2019-05-19T08:31:51"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -417,7 +417,7 @@ <column name="CONTACT_ID" value="2c427e51-0434-40b3-ad00-3a9076067e03"/> <column name="DATE_NEW" valueDate="2019-05-19T08:32:30"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -427,7 +427,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:59:36"/> <column name="DATE_NEW" valueDate="2019-05-19T08:35:38"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -437,7 +437,7 @@ <column name="CONTACT_ID" value="29271db0-4253-46c9-b7c2-5e25376b9d19"/> <column name="DATE_NEW" valueDate="2019-05-19T08:35:38"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -447,7 +447,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:57:53"/> <column name="DATE_NEW" valueDate="2019-05-19T08:39:25"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -458,7 +458,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:51:51"/> <column name="DATE_NEW" valueDate="2019-05-19T08:39:25"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -469,7 +469,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:59:26"/> <column name="DATE_NEW" valueDate="2019-05-19T08:41:21"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -479,7 +479,7 @@ <column name="CONTACT_ID" value="1868bd3a-05af-4b7f-a633-e3aec50ac45c"/> <column name="DATE_NEW" valueDate="2019-05-19T08:41:21"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -489,7 +489,7 @@ <column name="DATE_EDIT" valueDate="2019-06-05T03:52:13"/> <column name="DATE_NEW" valueDate="2019-05-19T08:42:07"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -499,7 +499,7 @@ <column name="CONTACT_ID" value="449080f6-b714-4189-a261-37439d0d4010"/> <column name="DATE_NEW" valueDate="2019-05-21T09:09:20"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -508,7 +508,7 @@ <column name="CONTACT_ID" value="019651a4-503e-4e06-aefd-e7e631bf3144"/> <column name="DATE_NEW" valueDate="2019-05-21T09:10:07"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -517,7 +517,7 @@ <column name="CONTACT_ID" value="8707accf-b1fd-4bde-97b1-ab44b75f66f9"/> <column name="DATE_NEW" valueDate="2019-05-21T09:10:46"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -526,7 +526,7 @@ <column name="CONTACT_ID" value="e450d126-eab8-4517-ba7c-8b6804f8c859"/> <column name="DATE_NEW" valueDate="2019-05-21T09:11:18"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -535,7 +535,7 @@ <column name="CONTACT_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="DATE_NEW" valueDate="2019-05-21T09:19:53"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -544,7 +544,7 @@ <column name="CONTACT_ID" value="eda61ea6-35ed-4a92-a93c-6118fc67d533"/> <column name="DATE_NEW" valueDate="2019-05-21T09:20:31"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -554,7 +554,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:44:07"/> <column name="DATE_NEW" valueDate="2019-05-21T09:21:42"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -564,7 +564,7 @@ <column name="CONTACT_ID" value="a3fd3c23-12e1-4820-b76e-2cd70103d94d"/> <column name="DATE_NEW" valueDate="2019-05-21T09:22:21"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -574,7 +574,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:43:55"/> <column name="DATE_NEW" valueDate="2019-05-21T09:24:31"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -584,7 +584,7 @@ <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="DATE_NEW" valueDate="2019-05-22T03:27:25"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -593,7 +593,7 @@ <column name="CONTACT_ID" value="fd082db5-be43-4219-a705-588f9c06e59b"/> <column name="DATE_NEW" valueDate="2019-05-22T03:27:48"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -602,7 +602,7 @@ <column name="CONTACT_ID" value="2c14fb05-d48e-4eeb-8a7f-85d423746848"/> <column name="DATE_NEW" valueDate="2019-05-22T03:30:12"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -612,7 +612,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:41:44"/> <column name="DATE_NEW" valueDate="2019-05-22T03:31:52"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -622,7 +622,7 @@ <column name="CONTACT_ID" value="8eecb5e5-40d9-4bf0-a152-1ca456795563"/> <column name="DATE_NEW" valueDate="2019-05-22T03:32:15"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -632,7 +632,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:41:08"/> <column name="DATE_NEW" valueDate="2019-05-22T03:32:54"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -643,7 +643,7 @@ <column name="DATE_EDIT" valueDate="2019-06-07T02:40:05"/> <column name="DATE_NEW" valueDate="2019-05-22T03:33:16"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -654,7 +654,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:43:26"/> <column name="DATE_NEW" valueDate="2019-05-22T03:34:41"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -665,7 +665,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:43:37"/> <column name="DATE_NEW" valueDate="2019-05-22T03:45:42"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -676,7 +676,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:43:48"/> <column name="DATE_NEW" valueDate="2019-05-22T03:46:23"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -687,7 +687,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:43:59"/> <column name="DATE_NEW" valueDate="2019-05-22T03:46:57"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -698,7 +698,7 @@ <column name="DATE_EDIT" valueDate="2019-05-23T11:23:53"/> <column name="DATE_NEW" valueDate="2019-05-22T03:48:09"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -709,7 +709,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:44:31"/> <column name="DATE_NEW" valueDate="2019-05-22T03:48:35"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -720,7 +720,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:44:43"/> <column name="DATE_NEW" valueDate="2019-05-22T03:49:12"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -731,7 +731,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:44:52"/> <column name="DATE_NEW" valueDate="2019-05-22T03:49:30"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -742,7 +742,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:45:02"/> <column name="DATE_NEW" valueDate="2019-05-22T03:49:52"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -753,7 +753,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:45:29"/> <column name="DATE_NEW" valueDate="2019-05-22T05:29:24"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -764,7 +764,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:45:57"/> <column name="DATE_NEW" valueDate="2019-05-22T05:30:33"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -775,7 +775,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:57:16"/> <column name="DATE_NEW" valueDate="2019-05-22T05:31:22"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -786,7 +786,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:45:46"/> <column name="DATE_NEW" valueDate="2019-05-22T05:32:03"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -797,7 +797,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:46:14"/> <column name="DATE_NEW" valueDate="2019-05-22T05:32:40"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -808,7 +808,7 @@ <column name="DATE_EDIT" valueDate="2019-06-11T11:58:59"/> <column name="DATE_NEW" valueDate="2019-05-22T05:36:18"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -819,7 +819,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:46:49"/> <column name="DATE_NEW" valueDate="2019-05-22T05:36:39"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -829,7 +829,7 @@ <column name="CONTACT_ID" value="33ae2997-7bff-4c3c-8038-2fa6781dbe9d"/> <column name="DATE_NEW" valueDate="2019-05-23T10:42:41"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -839,7 +839,7 @@ <column name="DATE_EDIT" valueDate="2019-05-28T07:45:37"/> <column name="DATE_NEW" valueDate="2019-05-23T10:42:51"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -849,7 +849,7 @@ <column name="CONTACT_ID" value="a8a5f214-8165-4627-bee2-bceb3578147e"/> <column name="DATE_NEW" valueDate="2019-05-23T11:42:52"/> <column name="MEDIUM_ID" value="COMMXING"/> - <column name="STANDARD" valueNumeric="0"/> + <column name="ISSTANDARD" valueNumeric="0"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -858,7 +858,7 @@ <column name="CONTACT_ID" value="6e667085-bb97-4039-8dfe-2230002985e0"/> <column name="DATE_NEW" valueDate="2019-06-05T03:52:59"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -867,7 +867,7 @@ <column name="CONTACT_ID" value="777246d5-7a73-4c52-af14-84df66128e5d"/> <column name="DATE_NEW" valueDate="2019-06-07T02:39:32"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -876,7 +876,7 @@ <column name="CONTACT_ID" value="777246d5-7a73-4c52-af14-84df66128e5d"/> <column name="DATE_NEW" valueDate="2019-06-07T02:39:32"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -885,7 +885,7 @@ <column name="CONTACT_ID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/> <column name="DATE_NEW" valueDate="2019-06-07T02:47:29"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -894,7 +894,7 @@ <column name="CONTACT_ID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/> <column name="DATE_NEW" valueDate="2019-06-07T02:47:29"/> <column name="MEDIUM_ID" value="COMMEMAIL"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -903,7 +903,7 @@ <column name="CONTACT_ID" value="d3ec3869-b710-44d9-b20f-50f0724631ac"/> <column name="DATE_NEW" valueDate="2019-06-11T08:26:11"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -912,7 +912,7 @@ <column name="CONTACT_ID" value="45635aca-7971-43df-a683-c80c86cb58cc"/> <column name="DATE_NEW" valueDate="2019-06-11T08:26:49"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="COMMUNICATION"> @@ -921,7 +921,7 @@ <column name="CONTACT_ID" value="d8c1e4c9-35b4-45c8-bf4c-eb55137cd25c"/> <column name="DATE_NEW" valueDate="2019-06-11T11:58:07"/> <column name="MEDIUM_ID" value="COMMPHONE"/> - <column name="STANDARD" valueNumeric="1"/> + <column name="ISSTANDARD" valueNumeric="1"/> <column name="USER_NEW" value="Admin"/> </insert> </changeSet> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/CONTACT.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/CONTACT.xml index b976d26396755e4c3e7828b9afd50bfcbab2da5a..8414b8a100e16f5734b0e1f0e9691749cb9e0548 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/CONTACT.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/CONTACT.xml @@ -5,7 +5,7 @@ <column name="ADDRESS_ID" value="14d03432-985b-4efe-a634-da71ae482907"/> <column name="CONTACTID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -14,7 +14,7 @@ <column name="ADDRESS_ID" value="6a3f6232-7a66-4a72-8d2d-66a3a9f1b9ea"/> <column name="CONTACTID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -23,7 +23,7 @@ <column name="ADDRESS_ID" value="f54606ee-ecdd-4859-ad7d-aa096c5e9596"/> <column name="CONTACTID" value="e83c45e0-c30b-436e-b445-00a8b58383b0"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="e83c45e0-c30b-436e-b445-00a8b58383b0"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -32,7 +32,7 @@ <column name="ADDRESS_ID" value="2825d85f-879a-4899-a1bb-a6750ad2aee9"/> <column name="CONTACTID" value="eda61ea6-35ed-4a92-a93c-6118fc67d533"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="eda61ea6-35ed-4a92-a93c-6118fc67d533"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -41,7 +41,7 @@ <column name="ADDRESS_ID" value="90726b19-f23c-42dd-847a-7eacf4c71d18"/> <column name="CONTACTID" value="fd082db5-be43-4219-a705-588f9c06e59b"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fd082db5-be43-4219-a705-588f9c06e59b"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -50,7 +50,7 @@ <column name="ADDRESS_ID" value="14d01332-985b-4efe-a634-da71ae482907"/> <column name="CONTACTID" value="a2e084e2-d68a-4f1e-a1bb-f8d46ad6293d"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="a2e084e2-d68a-4f1e-a1bb-f8d46ad6293d"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -61,7 +61,7 @@ <column name="ADDRESS_ID" value="11d01332-985b-4efe-a634-da71ae482907"/> <column name="CONTACTID" value="ef345d11-a40d-59e0-a24c-afcb6095d2cb"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="ef345d11-a40d-59e0-a24c-afcb6095d2cb"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -72,7 +72,7 @@ <column name="ADDRESS_ID" value="5773392d-cc7a-4170-8ffe-867807634c3c"/> <column name="CONTACTID" value="f0fb7676-8183-4bc7-beca-ca32c1e11c10"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="f0fb7676-8183-4bc7-beca-ca32c1e11c10"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -83,7 +83,7 @@ <column name="ADDRESS_ID" value="ce990566-3b86-48fe-bd0c-1167142e584b"/> <column name="CONTACTID" value="d5a2dc64-e503-4aed-a0c6-d54f49b8db87"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="d5a2dc64-e503-4aed-a0c6-d54f49b8db87"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -94,7 +94,7 @@ <column name="ADDRESS_ID" value="8f6da43d-adc5-410e-8bc5-14adca88ebfe"/> <column name="CONTACTID" value="73d731a2-e7f5-11e8-9f32-f2801f1b9fd1"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="0 "/> <column name="PERSON_ID" value="4a55726c-4ca6-43cb-9d3f-8e55d97b7aaf"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -105,7 +105,7 @@ <column name="ADDRESS_ID" value="84e040be-5a5f-48e7-be2c-769d4a169390"/> <column name="CONTACTID" value="73d73404-e7f5-11e8-9f32-f2801f1b9fd1"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="0 "/> <column name="PERSON_ID" value="7c1efe4c-cc73-4e95-bdf0-208a3ff699b5"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -116,7 +116,7 @@ <column name="ADDRESS_ID" value="f00966ec-693b-4bb5-8c66-26a40f18394f"/> <column name="CONTACTID" value="57d524f6-ad66-4550-be83-fee6e31b7a52"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="57d524f6-ad66-4550-be83-fee6e31b7a52"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -127,7 +127,7 @@ <column name="ADDRESS_ID" value="85bc81b9-5553-42a8-a643-eb47e1ed3c42"/> <column name="CONTACTID" value="d105f7f4-afd1-4a98-adc2-13fd6934b7e9"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="d105f7f4-afd1-4a98-adc2-13fd6934b7e9"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -138,7 +138,7 @@ <column name="ADDRESS_ID" value="89cbad0e-9901-42e2-ae40-a5a20c7ed5c8"/> <column name="CONTACTID" value="1a67eaa7-21da-4a18-97ab-755ac5cb74f7"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="1a67eaa7-21da-4a18-97ab-755ac5cb74f7"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -149,7 +149,7 @@ <column name="ADDRESS_ID" value="0e6d2504-adda-453a-bb36-981e6d0f06c7"/> <column name="CONTACTID" value="c7ddf982-0e58-4152-b82b-8f5673b0b729"/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:38"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> <column name="PERSON_ID" value="b16282bd-254e-4569-a56e-675449821467"/> <column name="RELATIONSHIP" valueNumeric="1"/> @@ -160,7 +160,7 @@ <column name="ADDRESS_ID" value="4eb7039a-1515-4545-86b4-85426a67fcd5"/> <column name="CONTACTID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="DATE_NEW" valueDate="2019-05-15T03:16:58"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -169,7 +169,7 @@ <column name="ADDRESS_ID" value="7d116e5e-0c6b-475b-91e7-7cae94b65321"/> <column name="CONTACTID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="DATE_NEW" valueDate="2019-05-15T03:23:13"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -178,7 +178,7 @@ <column name="ADDRESS_ID" value="35e93f95-d723-46d6-955f-9192e41e3d83"/> <column name="CONTACTID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="DATE_NEW" valueDate="2019-05-15T03:33:57"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -189,7 +189,7 @@ <column name="CONTACTROLE" value="Vertriebsmitarbeiter"/> <column name="DATE_NEW" valueDate="2019-05-15T03:54:25"/> <column name="DEPARTMENT" value="Vertrieb"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="PERSON_ID" value="08c36adc-cd2b-4ce9-a51b-944667084f7f"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -202,7 +202,7 @@ <column name="CONTACTROLE" value="Marketingmitarbeiterin"/> <column name="DATE_NEW" valueDate="2019-05-15T05:08:54"/> <column name="DEPARTMENT" value="Marketing"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="PERSON_ID" value="b4c37f47-b4b8-4fe4-812a-9043530cce84"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -215,7 +215,7 @@ <column name="CONTACTROLE" value="IT-Leiter"/> <column name="DATE_NEW" valueDate="2019-05-15T05:11:10"/> <column name="DEPARTMENT" value="IT"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="PERSON_ID" value="c4e24800-e9f3-4226-afd7-cfd5dd670d93"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -227,10 +227,10 @@ <column name="CONTACTID" value="a8a5f214-8165-4627-bee2-bceb3578147e"/> <column name="DATE_NEW" valueDate="2019-05-16T01:23:15"/> <column name="DEPARTMENT" value="Produktion"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="PERSON_ID" value="0a611832-9476-481e-bde5-af3c3a98f1b4"/> - <column name="POSITION" value="Produktionsleiter"/> + <column name="CONTACTPOSITION" value="Produktionsleiter"/> <column name="RELATIONSHIP" valueNumeric="2"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -241,7 +241,7 @@ <column name="CONTACTROLE" value="Marketingleiter"/> <column name="DATE_NEW" valueDate="2019-05-16T01:25:07"/> <column name="DEPARTMENT" value="Marketing"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> <column name="PERSON_ID" value="e35de858-6eca-4328-9efb-dc705ca6792c"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -253,7 +253,7 @@ <column name="CONTACTID" value="6c612f91-0160-4f09-9103-dccee7f7a6b7"/> <column name="DATE_NEW" valueDate="2019-05-17T08:02:26"/> <column name="DEPARTMENT" value="Management"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="PERSON_ID" value="528d7307-295c-4829-a2e4-9b59e43cf3bb"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -266,7 +266,7 @@ <column name="CONTACTROLE" value="Marketingleiter"/> <column name="DATE_NEW" valueDate="2019-05-17T08:03:16"/> <column name="DEPARTMENT" value="Marketing"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="PERSON_ID" value="9874de9b-d517-42f2-81b9-b5f3f0b0dae3"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -279,7 +279,7 @@ <column name="CONTACTROLE" value="IT-Leiter"/> <column name="DATE_NEW" valueDate="2019-05-17T08:04:06"/> <column name="DEPARTMENT" value="IT"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="PERSON_ID" value="3660abd7-73de-4825-83a1-e1992469cf56"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -292,7 +292,7 @@ <column name="CONTACTROLE" value="Vertriebsleiter"/> <column name="DATE_NEW" valueDate="2019-05-17T08:04:51"/> <column name="DEPARTMENT" value="Vertrieb"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="PERSON_ID" value="57ec6707-e4a4-4702-9356-ee43dd4c5b00"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -304,7 +304,7 @@ <column name="CONTACTID" value="d4c1bec3-656f-45ec-ae03-1c4d729d99fe"/> <column name="DATE_NEW" valueDate="2019-05-17T08:06:15"/> <column name="DEPARTMENT" value="Vertrieb"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="PERSON_ID" value="44c5d7db-b96e-4f67-a00f-c206cd3f7e1b"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -317,7 +317,7 @@ <column name="CONTACTROLE" value="Vertriebsleiter"/> <column name="DATE_NEW" valueDate="2019-05-17T08:39:57"/> <column name="DEPARTMENT" value="Vertrieb"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="PERSON_ID" value="9f4528ce-3d83-4292-ae23-d9b314271f69"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -330,7 +330,7 @@ <column name="CONTACTROLE" value="Marketingleiter"/> <column name="DATE_NEW" valueDate="2019-05-17T08:41:40"/> <column name="DEPARTMENT" value="Marketing"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="PERSON_ID" value="c41afea2-c4b5-45dd-a4a7-05826b9dd38c"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -341,7 +341,7 @@ <column name="ADDRESS_ID" value="7d116e5e-0c6b-475b-91e7-7cae94b65321"/> <column name="CONTACTID" value="29271db0-4253-46c9-b7c2-5e25376b9d19"/> <column name="DATE_NEW" valueDate="2019-05-17T08:42:37"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="PERSON_ID" value="22a497cb-39c3-4e72-9f88-423d7630c7e1"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -352,7 +352,7 @@ <column name="ADDRESS_ID" value="7d116e5e-0c6b-475b-91e7-7cae94b65321"/> <column name="CONTACTID" value="1868bd3a-05af-4b7f-a633-e3aec50ac45c"/> <column name="DATE_NEW" valueDate="2019-05-17T08:43:42"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="PERSON_ID" value="09514fe1-a0d6-465e-883b-6cc93cc758a2"/> <column name="RELATIONSHIP" valueNumeric="2"/> @@ -363,7 +363,7 @@ <column name="ADDRESS_ID" value="8923fff3-4294-4892-b3f3-8470ae89555e"/> <column name="CONTACTID" value="a3fd3c23-12e1-4820-b76e-2cd70103d94d"/> <column name="DATE_NEW" valueDate="2019-05-17T09:39:15"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="a3fd3c23-12e1-4820-b76e-2cd70103d94d"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -372,7 +372,7 @@ <column name="ADDRESS_ID" value="2a03d8cb-ffb7-4d04-b8b2-e55354380fb7"/> <column name="CONTACTID" value="cabf6192-f9c3-4bd4-9366-ad2b073bdfa3"/> <column name="DATE_NEW" valueDate="2019-05-17T09:40:51"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="cabf6192-f9c3-4bd4-9366-ad2b073bdfa3"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -381,7 +381,7 @@ <column name="ADDRESS_ID" value="36723051-8a5f-47d3-8185-71c82d463eb3"/> <column name="CONTACTID" value="2c14fb05-d48e-4eeb-8a7f-85d423746848"/> <column name="DATE_NEW" valueDate="2019-05-17T09:42:16"/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="ORGANISATION_ID" value="2c14fb05-d48e-4eeb-8a7f-85d423746848"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -390,7 +390,7 @@ <column name="ADDRESS_ID" value="1a20347c-ab56-41cb-a7dc-bd61de7e2106"/> <column name="CONTACTID" value="5a52304e-65e8-40ed-9aca-a76af6c8c3a0"/> <column name="DATE_NEW" valueDate="2019-05-17T09:44:27"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="5a52304e-65e8-40ed-9aca-a76af6c8c3a0"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -399,7 +399,7 @@ <column name="ADDRESS_ID" value="85ab4644-98f1-41ae-8678-67e76dd03706"/> <column name="CONTACTID" value="8eecb5e5-40d9-4bf0-a152-1ca456795563"/> <column name="DATE_NEW" valueDate="2019-05-17T09:46:35"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="8eecb5e5-40d9-4bf0-a152-1ca456795563"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -408,7 +408,7 @@ <column name="ADDRESS_ID" value="25360df5-104e-4903-8440-f848d025a24b"/> <column name="CONTACTID" value="e450d126-eab8-4517-ba7c-8b6804f8c859"/> <column name="DATE_NEW" valueDate="2019-05-17T09:47:59"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="e450d126-eab8-4517-ba7c-8b6804f8c859"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -417,7 +417,7 @@ <column name="ADDRESS_ID" value="e1aef1b7-569b-46be-bc50-f02332a42ef1"/> <column name="CONTACTID" value="019651a4-503e-4e06-aefd-e7e631bf3144"/> <column name="DATE_NEW" valueDate="2019-05-17T09:49:58"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="019651a4-503e-4e06-aefd-e7e631bf3144"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -426,7 +426,7 @@ <column name="ADDRESS_ID" value="e0a93855-d573-405b-8ee2-3b3927762d21"/> <column name="CONTACTID" value="8707accf-b1fd-4bde-97b1-ab44b75f66f9"/> <column name="DATE_NEW" valueDate="2019-05-17T10:00:09"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="8707accf-b1fd-4bde-97b1-ab44b75f66f9"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -435,7 +435,7 @@ <column name="ADDRESS_ID" value="ea50cb02-7d4d-433d-9cd3-c262d5a0bb27"/> <column name="CONTACTID" value="449080f6-b714-4189-a261-37439d0d4010"/> <column name="DATE_NEW" valueDate="2019-05-17T10:03:12"/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="ORGANISATION_ID" value="449080f6-b714-4189-a261-37439d0d4010"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -444,7 +444,7 @@ <column name="ADDRESS_ID" value="dd1a1831-b05a-41a7-a4e9-d73be9d77934"/> <column name="CONTACTID" value="33ae2997-7bff-4c3c-8038-2fa6781dbe9d"/> <column name="DATE_NEW" valueDate="2019-05-23T08:38:50"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="33ae2997-7bff-4c3c-8038-2fa6781dbe9d"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -453,7 +453,7 @@ <column name="ADDRESS_ID" value="da05619e-47c6-4144-a698-f0f830d9f755"/> <column name="CONTACTID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/> <column name="DATE_NEW" valueDate="2019-05-23T10:53:07"/> - <column name="LANGUAGE" value="eng"/> + <column name="ISOLANGUAGE" value="eng"/> <column name="ORGANISATION_ID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> @@ -462,7 +462,7 @@ <column name="ADDRESS_ID" value="8ac42a08-6e71-4bc4-a46d-5cf17e4a941c"/> <column name="CONTACTID" value="777246d5-7a73-4c52-af14-84df66128e5d"/> <column name="DATE_NEW" valueDate="2019-05-23T10:54:17"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="ORGANISATION_ID" value="777246d5-7a73-4c52-af14-84df66128e5d"/> <column name="STATUS" value="CONTACTSTATACTIVE"/> <column name="USER_NEW" value="Admin"/> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/DOCUMENTTEMPLATE.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/DOCUMENTTEMPLATE.xml index 25f71603c87de7fb9198c6e8ee02e9cb891b4755..ad2cfa2445e950d478f0b1f5b3aa18b7f05a2170 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/DOCUMENTTEMPLATE.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/DOCUMENTTEMPLATE.xml @@ -2,20 +2,20 @@ <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="autogenerated" id="6bbd2406-6a0d-4181-a3af-a0bf75eced39"> <insert tableName="DOCUMENTTEMPLATE"> - <column name="DATE_NEW" valueDate="2019-05-24"/> + <column name="DATE_NEW" valueDate="2019-05-29T00:00:00"/> <column name="DOCUMENTTEMPLATEID" value="f032c593-f108-47dd-9fc2-357c14757a9d"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NAME" value="Erstkontakt "/> - <column name="TYPE" value="MAI "/> + <column name="KIND" value="MAI "/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="DOCUMENTTEMPLATE"> - <column name="DATE_NEW" valueDate="2019-05-29"/> + <column name="DATE_NEW" valueDate="2019-05-29T00:00:00"/> <column name="DESCRIPTION" value="Rahmenvertrag"/> <column name="DOCUMENTTEMPLATEID" value="1269c31d-4173-434f-b2db-9154fa651a25"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NAME" value="Rahmenvertrag "/> - <column name="TYPE" value="ATT "/> + <column name="KIND" value="ATT "/> <column name="USER_NEW" value="Admin"/> </insert> </changeSet> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/MEMBER.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/OBJECTMEMBER.xml similarity index 62% rename from .liquibase/Data_alias/basic/_demoData/generatedData/MEMBER.xml rename to .liquibase/Data_alias/basic/_demoData/generatedData/OBJECTMEMBER.xml index 3c65f994e289f4a10bb660d47fe7e5a05a1cd6cc..75dc704dff44f5141eb98e6d0681d114b5c61027 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/MEMBER.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/OBJECTMEMBER.xml @@ -3,61 +3,61 @@ 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="autogenerated" id="9830be31-7d74-46f8-a006-06d25b8229eb"> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="d4c1bec3-656f-45ec-ae03-1c4d729d99fe"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="MEMBERID" value="336e8c10-376c-422e-afd9-1faef77c6f0c"/> - <column name="ROLE" value="MEMROLEPROJMANAG"/> + <column name="OBJECTMEMBERID" value="336e8c10-376c-422e-afd9-1faef77c6f0c"/> + <column name="MEMBERROLE" value="MEMROLEPROJMANAG"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="7a34d9d0-04c7-478c-a8e2-f584fe625c45"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="MEMBERID" value="c3b8a835-e9b2-40d1-aa4d-83838c5714ba"/> - <column name="ROLE" value="MEMROLEPROJASSIST"/> + <column name="OBJECTMEMBERID" value="c3b8a835-e9b2-40d1-aa4d-83838c5714ba"/> + <column name="MEMBERROLE" value="MEMROLEPROJASSIST"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="a8a5f214-8165-4627-bee2-bceb3578147e"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> - <column name="MEMBERID" value="8d69dc7e-ae24-46e8-b0a0-3217b208c564"/> - <column name="ROLE" value="70cbad1b-eac6-4369-ba50-4946e0fbcb3a"/> + <column name="OBJECTMEMBERID" value="8d69dc7e-ae24-46e8-b0a0-3217b208c564"/> + <column name="MEMBERROLE" value="70cbad1b-eac6-4369-ba50-4946e0fbcb3a"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="d3ec3869-b710-44d9-b20f-50f0724631ac"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> - <column name="MEMBERID" value="685666f6-6545-4a51-8340-d98115b3d710"/> - <column name="ROLE" value="MEMROLEPROJMANAG"/> + <column name="OBJECTMEMBERID" value="685666f6-6545-4a51-8340-d98115b3d710"/> + <column name="MEMBERROLE" value="MEMROLEPROJMANAG"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="ef345d11-a40d-59e0-a24c-afcb6095d2cb"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> - <column name="MEMBERID" value="3bd6db09-063c-43a5-828d-9fe6e958d142"/> - <column name="ROLE" value="MEMROLEADVISE"/> + <column name="OBJECTMEMBERID" value="3bd6db09-063c-43a5-828d-9fe6e958d142"/> + <column name="MEMBERROLE" value="MEMROLEADVISE"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="4cc98357-25f3-462b-898c-440f9faf4b97"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> - <column name="MEMBERID" value="100e2d29-2d34-4a5d-adc9-c09f9949d136"/> - <column name="ROLE" value="70cbad1b-eac6-4369-ba50-4946e0fbcb3a"/> + <column name="OBJECTMEMBERID" value="100e2d29-2d34-4a5d-adc9-c09f9949d136"/> + <column name="MEMBERROLE" value="70cbad1b-eac6-4369-ba50-4946e0fbcb3a"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="19c6bf30-cd8b-40df-980c-ce71c92c194c"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> - <column name="MEMBERID" value="094fa52f-28ee-4988-9169-c4fcf0fd58e7"/> - <column name="ROLE" value="MEMROLEADVISE"/> + <column name="OBJECTMEMBERID" value="094fa52f-28ee-4988-9169-c4fcf0fd58e7"/> + <column name="MEMBERROLE" value="MEMROLEADVISE"/> </insert> - <insert tableName="MEMBER"> + <insert tableName="OBJECTMEMBER"> <column name="CONTACT_ID" value="1a67eaa7-21da-4a18-97ab-755ac5cb74f7"/> <column name="OBJECT_TYPE" value="Salesproject"/> <column name="OBJECT_ROWID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> - <column name="MEMBERID" value="b91e741e-6e23-4a0a-a3de-06b9be398ed6"/> - <column name="ROLE" value="MEMROLEEXSALEMANAG"/> + <column name="OBJECTMEMBERID" value="b91e741e-6e23-4a0a-a3de-06b9be398ed6"/> + <column name="MEMBERROLE" value="MEMROLEEXSALEMANAG"/> </insert> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/OFFER.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/OFFER.xml index 3e526eb45e64283012ae02094f22f72f02ea8bac..7c2eff130441cabbc08d94d88f9d83f3860db5ec 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/OFFER.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/OFFER.xml @@ -10,7 +10,7 @@ <column name="DATE_NEW" valueDate="2019-05-16T01:35:17"/> <column name="DELIVERYTERMS" value="DELIVERCARRIAGE"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="210.00"/> <column name="OFFERCODE" valueNumeric="1005"/> <column name="OFFERDATE" valueDate="2019-05-16T02:00:00"/> @@ -32,7 +32,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T08:23:52"/> <column name="DELIVERYTERMS" value="DELIVERFREE"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="3500.00"/> <column name="OFFERCODE" valueNumeric="1006"/> <column name="OFFERDATE" valueDate="2019-03-08T01:00:00"/> @@ -54,7 +54,7 @@ <column name="DATE_EDIT" valueDate="2019-05-17T11:01:46"/> <column name="DATE_NEW" valueDate="2019-05-17T08:27:21"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="28500.00"/> <column name="OFFERCODE" valueNumeric="1007"/> <column name="OFFERDATE" valueDate="2019-05-17T02:00:00"/> @@ -75,7 +75,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T09:03:46"/> <column name="DELIVERYTERMS" value="DELIVERCARRIAGE"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="192500.00"/> <column name="OFFERCODE" valueNumeric="1008"/> <column name="OFFERDATE" valueDate="2019-02-22T01:00:00"/> @@ -97,7 +97,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T09:27:12"/> <column name="DELIVERYTERMS" value="DELIVERCARRIAGE"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="175000.00"/> <column name="OFFERCODE" valueNumeric="1009"/> <column name="OFFERDATE" valueDate="2018-08-14T02:00:00"/> @@ -119,7 +119,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T10:28:20"/> <column name="DELIVERYTERMS" value="DELIVERCIF"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="17500.00"/> <column name="OFFERCODE" valueNumeric="1010"/> <column name="OFFERDATE" valueDate="2019-05-17T02:00:00"/> @@ -139,7 +139,7 @@ <column name="CURRENCY" value="EUR "/> <column name="DATE_NEW" valueDate="2019-05-22T11:40:03"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an: Produkt: Produkt:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="53500.00"/> <column name="OFFERCODE" valueNumeric="1011"/> <column name="OFFERDATE" valueDate="2017-07-11T02:00:00"/> @@ -160,7 +160,7 @@ <column name="DATE_NEW" valueDate="2019-05-23T09:00:44"/> <column name="DELIVERYTERMS" value="DELIVERCARRIAGE"/> <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="45000.00"/> <column name="OFFERCODE" valueNumeric="1012"/> <column name="OFFERDATE" valueDate="2019-03-25T01:00:00"/> @@ -182,7 +182,7 @@ <column name="DATE_NEW" valueDate="2019-05-23T09:04:28"/> <column name="DELIVERYTERMS" value="DELIVERCARRIAGE"/> <column name="HEADER" value="Für die bisherigen Gespräche möchten wir uns bei Ihnen bedanken. Gerne bieten wir Ihnen wie folgt an: "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="25000.00"/> <column name="OFFERCODE" valueNumeric="1013"/> <column name="OFFERDATE" valueDate="2019-03-25T01:00:00"/> @@ -202,7 +202,7 @@ <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="210.00"/> <column name="OFFERCODE" valueNumeric="1000"/> <column name="OFFERDATE" valueDate="2018-11-21T01:00:00"/> @@ -220,7 +220,7 @@ <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="OFFERCODE" valueNumeric="1001"/> <column name="OFFERDATE" valueDate="2018-08-12T02:00:00"/> @@ -238,7 +238,7 @@ <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="630.00"/> <column name="OFFERCODE" valueNumeric="1002"/> <column name="OFFERDATE" valueDate="2018-06-14T02:00:00"/> @@ -256,7 +256,7 @@ <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="OFFERCODE" valueNumeric="1003"/> <column name="OFFERDATE" valueDate="2018-02-23T01:00:00"/> @@ -274,7 +274,7 @@ <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="840.00"/> <column name="OFFERCODE" valueNumeric="1004"/> <column name="OFFERDATE" valueDate="2017-11-09T01:00:00"/> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/ORGANISATION.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/ORGANISATION.xml index c8e0ccf77f2cf09dde719e882b6dc9432c0589bb..8cbcf443b3bbcb7bd60b98b0e4183a73d3dfaf54 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/ORGANISATION.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/ORGANISATION.xml @@ -8,7 +8,7 @@ <column name="INFO" value="Die Industrial Steal AG ist einer der führenden Stahlhersteller weltweit. Das Unternehmen agiert mit über 5.000 Mitarbeitern in über 30 Ländern. "/> <column name="NAME" value="Industrial Steel AG"/> <column name="ORGANISATIONID" value="dec94545-2487-46d5-978d-26ee0fcf0f5f"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -19,7 +19,7 @@ <column name="INFO" value="Die Transatlantik Logistic Gruppe ist ein Zusammenschluss aus mehreren Logistik Unternehmen. Über 3.000 Mitarbeiter sind bei dem europäischen Logistikriesen beschäftigt. "/> <column name="NAME" value="Transatlantik Logistics GmbH"/> <column name="ORGANISATIONID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -29,7 +29,7 @@ <column name="INFO" value="Die Skyscraper Bau GmbH zählt zu den führenden Unternehmen in der Baubranche. Mit ihrem breiten Portfolio überzeugen sie regelmäßig und diversifizieren sich von ihren Mitbewerbern. "/> <column name="NAME" value="Skyscraper Bau GmbH"/> <column name="ORGANISATIONID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="ORGANISATION"> @@ -46,7 +46,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T09:40:51"/> <column name="NAME" value="JPM Touristik GmbH"/> <column name="ORGANISATIONID" value="cabf6192-f9c3-4bd4-9366-ad2b073bdfa3"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="ORGANISATION"> @@ -56,7 +56,7 @@ <column name="INFO" value="Automobilvermietung"/> <column name="NAME" value="Sevent SE"/> <column name="ORGANISATIONID" value="2c14fb05-d48e-4eeb-8a7f-85d423746848"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -75,7 +75,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T09:46:35"/> <column name="NAME" value="SuperBauer AG"/> <column name="ORGANISATIONID" value="8eecb5e5-40d9-4bf0-a152-1ca456795563"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -85,7 +85,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T09:47:59"/> <column name="NAME" value="Grobbe-Werk GmbH"/> <column name="ORGANISATIONID" value="e450d126-eab8-4517-ba7c-8b6804f8c859"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -103,7 +103,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T10:00:09"/> <column name="NAME" value="Firmengruppe Matthias Bogen"/> <column name="ORGANISATIONID" value="8707accf-b1fd-4bde-97b1-ab44b75f66f9"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_NEW" value="Admin"/> </insert> <insert tableName="ORGANISATION"> @@ -112,7 +112,7 @@ <column name="DATE_NEW" valueDate="2019-05-17T10:03:12"/> <column name="NAME" value="Aquire GmbH"/> <column name="ORGANISATIONID" value="449080f6-b714-4189-a261-37439d0d4010"/> - <column name="TYPE" value="ORGMANUF"/> + <column name="KIND" value="ORGMANUF"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -122,7 +122,7 @@ <column name="DATE_NEW" valueDate="2019-05-23T08:38:50"/> <column name="NAME" value="Netro AG"/> <column name="ORGANISATIONID" value="33ae2997-7bff-4c3c-8038-2fa6781dbe9d"/> - <column name="TYPE" value="ORGMANUF"/> + <column name="KIND" value="ORGMANUF"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -132,7 +132,7 @@ <column name="DATE_NEW" valueDate="2019-05-23T10:53:07"/> <column name="NAME" value="Glob Group"/> <column name="ORGANISATIONID" value="fb07cb0e-c391-4503-9c47-a39ec7388f4f"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -142,7 +142,7 @@ <column name="DATE_NEW" valueDate="2019-05-23T10:54:17"/> <column name="NAME" value="Schild AG"/> <column name="ORGANISATIONID" value="777246d5-7a73-4c52-af14-84df66128e5d"/> - <column name="TYPE" value="ORGPARTNER"/> + <column name="KIND" value="ORGPARTNER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> @@ -152,7 +152,7 @@ <column name="DATE_NEW" valueDate="2019-05-13T01:16:36"/> <column name="NAME" value="meine Firma"/> <column name="ORGANISATIONID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/> - <column name="TYPE" value="ORGCUTOMER"/> + <column name="KIND" value="ORGCUTOMER"/> <column name="USER_EDIT" value="Admin"/> <column name="USER_NEW" value="Admin"/> </insert> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESORDER.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESORDER.xml index c31392d80602cfce21f1add32f068ce48eddebc2..66917057ed7cf54a277b7301bcc23bb0bf35ffa2 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESORDER.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESORDER.xml @@ -4,206 +4,315 @@ <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="210.00"/> <column name="SALESORDERCODE" valueNumeric="1000"/> <column name="SALESORDERDATE" valueDate="2017-11-21T01:00:00"/> <column name="SALESORDERID" value="2e661772-951f-47bc-a862-5aa3c5aa2731"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATSENT"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECONF"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM7"/> + <column name="DELIVERYTERMS" value="DELIVERCIF"/> <column name="VAT" valueNumeric="39.90"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="SALESORDERCODE" valueNumeric="1001"/> <column name="SALESORDERDATE" valueDate="2018-08-12T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="41197800-027b-47f5-923a-f1004d09a969"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATSENT"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPEINVO"/> + <column name="DUNNINGDATE" valueDate="2019-09-01T02:00:00"/> + <column name="DUNNINGLEVEL" value="1"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="DELIVEREX"/> <column name="VAT" valueNumeric="79.80"/> + <column name="PAID" valueNumeric="300.00"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="630.00"/> <column name="SALESORDERCODE" valueNumeric="1002"/> <column name="SALESORDERDATE" valueDate="2016-06-14T02:00:00"/> + <column name="PAYDATE" valueDate="2018-07-25T01:00:00"/> <column name="SALESORDERID" value="373f28a5-a812-433b-8196-a6bf8bdd5656"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATSENT"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECRED"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="1"/> + <column name="PAYMENTTERMS" value="PAYTERMDISCOUNT"/> + <column name="DELIVERYTERMS" value="DELIVEREX"/> <column name="VAT" valueNumeric="119.70"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="SALESORDERCODE" valueNumeric="1003"/> <column name="SALESORDERDATE" valueDate="2018-08-23T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="5a34f4a2-13b2-46ec-8f61-939fe27ba484"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATCHECK"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECANC"/> + <column name="ORDERSTATUS" valueNumeric="0"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="FREE"/> <column name="VAT" valueNumeric="79.80"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="SALESORDERCODE" valueNumeric="1004"/> <column name="SALESORDERDATE" valueDate="2017-05-09T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="545ffd81-cfa5-4be6-b62c-df269909dcd4"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATCHECK"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPENOTE"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="DELIVERCIF"/> <column name="VAT" valueNumeric="79.80"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="210.00"/> <column name="SALESORDERCODE" valueNumeric="1005"/> <column name="SALESORDERDATE" valueDate="2017-11-21T01:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="de09c9c2-7560-4f3f-9284-853ad1341cf9"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATSENT"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECANC"/> + <column name="ORDERSTATUS" valueNumeric="0"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM7"/> + <column name="DELIVERYTERMS" value="DELIVEREX"/> <column name="VAT" valueNumeric="39.90"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="SALESORDERCODE" valueNumeric="1006"/> <column name="SALESORDERDATE" valueDate="2018-08-12T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="3ce30718-ecc6-4543-95c8-1b25e1b6db43"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATSENT"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECRED"/> + <column name="ORDERSTATUS" valueNumeric="0"/> + <column name="CANCELLATION" valueNumeric="1"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="FREE"/> <column name="VAT" valueNumeric="79.80"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="630.00"/> <column name="SALESORDERCODE" valueNumeric="1007"/> <column name="SALESORDERDATE" valueDate="2016-06-14T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="fae74315-d7ac-4757-b952-cc71ae83f4b5"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATSENT"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPEINVO"/> + <column name="DUNNINGDATE" valueDate="2019-08-25T02:00:00"/> + <column name="DUNNINGLEVEL" value="2"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERMDISCOUNT"/> + <column name="DELIVERYTERMS" value="FREE"/> <column name="VAT" valueNumeric="119.70"/> + <column name="PAID" valueNumeric="545.50"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="SALESORDERCODE" valueNumeric="1008"/> <column name="SALESORDERDATE" valueDate="2018-08-23T02:00:00"/> <column name="SALESORDERID" value="4b0e2423-d09d-47fc-b274-5a9fde013b64"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATCHECK"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECONF"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="DELIVEREX"/> <column name="VAT" valueNumeric="79.80"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="e6da1393-f46b-41a4-826b-2c7d22de2246"/> <column name="CURRENCY" value="EUR "/> - <column name="LANGUAGE" value="deu"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="420.00"/> <column name="SALESORDERCODE" valueNumeric="1009"/> <column name="SALESORDERDATE" valueDate="2017-05-09T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="f5cf5ef9-ce09-4885-bcb0-421cd9cfac69"/> - <column name="SALESPROJECT_ID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> - <column name="STATUS" value="SALORDERSTATCHECK"/> + <column name="OBJECT_ROWID" value="0833465c-8851-4fbb-b7e3-8c1d73c903da"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPENOTE"/> + <column name="ORDERSTATUS" valueNumeric="0"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERMDISCOUNT"/> + <column name="DELIVERYTERMS" value="DELIVEREX"/> <column name="VAT" valueNumeric="79.80"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> <column name="CONTACT_ID" value="7a34d9d0-04c7-478c-a8e2-f584fe625c45"/> - <column name="LANGUAGE" value="deu"/> + <column name="CURRENCY" value="EUR "/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="0.00"/> <column name="SALESORDERCODE" valueNumeric="1010"/> <column name="SALESORDERDATE" valueDate="2019-05-17T02:00:00"/> <column name="SALESORDERID" value="a846d596-b9ce-4a73-a842-e9084ebf612a"/> - <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> + <column name="OBJECT_ROWID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPEINVO"/> + <column name="DUNNINGDATE" valueDate="2019-08-25T02:00:00"/> + <column name="DUNNINGLEVEL" value="2"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="PAYMENTTERMS" value="PAYTERM7"/> + <column name="DELIVERYTERMS" value="FREE"/> + <column name="PAID" valueNumeric="0.00"/> <column name="VAT" valueNumeric="0.00"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> - <column name="ADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> + <column name="PAYMENTADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> + <column name="DELIVERYADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> <column name="CONTACT_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="CURRENCY" value="EUR "/> <column name="FOOTER" value="Unsere Zahlungkonditionen finden sie hier:"/> - <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="HEADER" value="Gerne bieten wir Ihnen wie folgt an:"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="28500.00"/> <column name="OFFER_ID" value="3d13ef72-0f23-40fc-a66f-af29511a6ad9"/> <column name="SALESORDERCODE" valueNumeric="1011"/> <column name="SALESORDERDATE" valueDate="2019-05-22T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="1b9bd530-f45b-4074-872f-b8362cfc5ed0"/> - <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="STATUS" value="SALORDERSTATWON"/> + <column name="OBJECT_ROWID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPENOTE"/> + <column name="ORDERSTATUS" valueNumeric="0"/> + <column name="CANCELLATION" valueNumeric="1"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="DELIVEREX"/> <column name="VAT" valueNumeric="0.00"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> - <column name="ADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> + <column name="PAYMENTADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> + <column name="DELIVERYADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> <column name="CONTACT_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="CURRENCY" value="EUR "/> - <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="HEADER" value="Gerne bieten wir Ihnen wie folgt an:"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="3500.00"/> <column name="OFFER_ID" value="5abae3a9-8d96-4709-b6be-7fc7e87f002b"/> <column name="SALESORDERCODE" valueNumeric="1012"/> <column name="SALESORDERDATE" valueDate="2019-05-22T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="9069d098-7237-4fed-a365-ad2e60bf740f"/> - <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="STATUS" value="SALORDERSTATWON"/> + <column name="OBJECT_ROWID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPECRED"/> + <column name="ORDERSTATUS" valueNumeric="0"/> + <column name="CANCELLATION" valueNumeric="1"/> + <column name="PAYMENTTERMS" value="PAYTERMDISCOUNT"/> + <column name="DELIVERYTERMS" value="DELIVERCIF"/> <column name="VAT" valueNumeric="0.00"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> - <column name="ADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> + <column name="PAYMENTADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> + <column name="DELIVERYADDRESS" value="Skyscraper Bau GmbH Baustraße 64 70173 Stuttgart"/> <column name="CONTACT_ID" value="fc465f2f-803b-4a1f-b79d-7b466d7ecff4"/> <column name="CURRENCY" value="EUR "/> - <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an: Produkt: Produkt:"/> - <column name="LANGUAGE" value="deu"/> + <column name="HEADER" value="Gerne bieten wir Ihnen wie folgt an: Produkt: Produkt:"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="53500.00"/> <column name="OFFER_ID" value="30ff28e2-062f-4950-b4a1-71e51ff71acf"/> <column name="SALESORDERCODE" valueNumeric="1013"/> - <column name="SALESORDERDATE" valueDate="2019-05-22T02:00:00"/> + <column name="SALESORDERDATE" valueDate="2019-06-14T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="5e082fe5-99d4-43be-aaad-e596f844fa8a"/> - <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="STATUS" value="SALORDERSTATWON"/> + <column name="OBJECT_ROWID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPEINVO"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="DUNNINGDATE" valueDate="2019-07-13T02:00:00"/> + <column name="DUNNINGLEVEL" value="1"/> + <column name="PAYMENTTERMS" value="PAYTERM30"/> + <column name="DELIVERYTERMS" value="DELIVERCIF"/> + <column name="PAID" valueNumeric="10000.00"/> <column name="VAT" valueNumeric="10165.00"/> <column name="VERSNR" valueNumeric="1"/> </insert> <insert tableName="SALESORDER"> - <column name="ADDRESS" value="Transatlantik Logistics GmbH Hafenstraße 12 88045 Friedrichshafen"/> + <column name="PAYMENTADDRESS" value="Transatlantik Logistics GmbH Hafenstraße 12 88045 Friedrichshafen"/> + <column name="DELIVERYADDRESS" value="Transatlantik Logistics GmbH Hafenstraße 12 88045 Friedrichshafen"/> <column name="CONTACT_ID" value="6efb4fab-64f9-4d8e-aa6f-a158d13fc273"/> <column name="CURRENCY" value="EUR "/> - <column name="HEADER" value="gerne bieten wir Ihnen wie folgt an:"/> - <column name="LANGUAGE" value="deu"/> + <column name="HEADER" value="Gerne bieten wir Ihnen wie folgt an:"/> + <column name="ISOLANGUAGE" value="deu"/> <column name="NET" valueNumeric="175000.00"/> <column name="OFFER_ID" value="fc02f9d0-06c5-4073-ac95-a59403988697"/> <column name="SALESORDERCODE" valueNumeric="1014"/> <column name="SALESORDERDATE" valueDate="2019-05-22T02:00:00"/> + <column name="PAYDATE" valueDate="2018-06-30T01:00:00"/> <column name="SALESORDERID" value="fc691949-4f61-485c-8e97-8f3d0d3d3962"/> - <column name="SALESPROJECT_ID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> - <column name="STATUS" value="SALORDERSTATWON"/> + <column name="OBJECT_ROWID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> + <column name="OBJECT_TYPE" value="Salesproject"/> + <column name="ORDERTYPE" value="ORDTYPEINVO"/> + <column name="ORDERSTATUS" valueNumeric="1"/> + <column name="CANCELLATION" valueNumeric="0"/> + <column name="DUNNINGDATE" valueDate="2019-05-29T02:00:00"/> + <column name="DUNNINGLEVEL" value="2"/> + <column name="PAYMENTTERMS" value="PAYTERM7"/> + <column name="DELIVERYTERMS" value="DELIVERCIF"/> + <column name="PAID" valueNumeric="40000.00"/> <column name="VAT" valueNumeric="0.00"/> <column name="VERSNR" valueNumeric="1"/> </insert> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT.xml index 7f9edcfca85b80eef78a6716a8b31e861daa3277..cfea469e359903933da88331d0957fd624d857e9 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT.xml @@ -10,7 +10,7 @@ <column name="PROJECTTITLE" value="Erstprojekt"/> <column name="SALESPROJECTID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> <column name="STARTDATE" valueDate="2019-05-16T02:00:00"/> - <column name="STATE" value="SALPROJSTATOPEN"/> + <column name="STATUS" value="SALPROJSTATOPEN"/> <column name="VOLUME" valueNumeric="200000.00"/> </insert> <insert tableName="SALESPROJECT"> @@ -22,7 +22,7 @@ <column name="PROJECTTITLE" value="Skyscraper / Pilotprojekt"/> <column name="SALESPROJECTID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> <column name="STARTDATE" valueDate="2019-05-17T02:00:00"/> - <column name="STATE" value="SALPROJSTATOPEN"/> + <column name="STATUS" value="SALPROJSTATOPEN"/> <column name="VOLUME" valueNumeric="120000.00"/> </insert> <insert tableName="SALESPROJECT"> @@ -34,7 +34,7 @@ <column name="PROJECTTITLE" value="Transatlantik Initialprojekt"/> <column name="SALESPROJECTID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> <column name="STARTDATE" valueDate="2019-05-17T02:00:00"/> - <column name="STATE" value="SALPROJSTATOPEN"/> + <column name="STATUS" value="SALPROJSTATOPEN"/> <column name="VOLUME" valueNumeric="250000.00"/> </insert> <insert tableName="SALESPROJECT"> @@ -46,7 +46,7 @@ <column name="PROJECTTITLE" value="Kronen Pilotprojekt"/> <column name="SALESPROJECTID" value="7e2680f6-a438-45aa-956a-787363f85923"/> <column name="STARTDATE" valueDate="2017-05-16T02:00:00"/> - <column name="STATE" value="SALPROJSTATOPEN"/> + <column name="STATUS" value="SALPROJSTATOPEN"/> <column name="VOLUME" valueNumeric="350000.00"/> </insert> <insert tableName="SALESPROJECT"> @@ -58,7 +58,7 @@ <column name="PROJECTTITLE" value="Buchner Neuprojekt"/> <column name="SALESPROJECTID" value="ef7f4726-4476-4f59-97c2-706dc1e0046f"/> <column name="STARTDATE" valueDate="2016-02-05T01:00:00"/> - <column name="STATE" value="SALPROJSTATOPEN"/> + <column name="STATUS" value="SALPROJSTATOPEN"/> <column name="VOLUME" valueNumeric="450000.00"/> </insert> </changeSet> diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_MILESTONE.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_MILESTONE.xml index 63753bb7742ecf2f273981b04aef739a8e2f0149..ec5b3c041e4d9402d769c1b081dcfbe0d78e0f17 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_MILESTONE.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_MILESTONE.xml @@ -6,15 +6,15 @@ <column name="DATE_START" valueDate="2019-05-16T01:34:58"/> <column name="SALESPROJECT_ID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> <column name="SALESPROJECT_MILESTONEID" value="b2cb428d-b76b-423a-9b61-04d03213e6d3"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASENQC"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASENQC"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-06-15T01:34:58"/> <column name="SALESPROJECT_ID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> <column name="SALESPROJECT_MILESTONEID" value="ae7fe604-2fea-4aa1-be75-e990e8f31c74"/> - <column name="TYPE" value="SalesprojectState"/> - <column name="VALUE" value="SALPROJSTATOPEN"/> + <column name="KIND" value="SalesprojectState"/> + <column name="MILESTONEVALUE" value="SALPROJSTATOPEN"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> @@ -22,8 +22,8 @@ <column name="DATE_END" valueDate="2019-05-10T08:08:07"/> <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> <column name="SALESPROJECT_MILESTONEID" value="063a2c02-4b21-459a-8ae3-558ba67973dd"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASENQC"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASENQC"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-10T08:08:07"/> @@ -31,61 +31,61 @@ <column name="PARENT_ID" value="063a2c02-4b21-459a-8ae3-558ba67973dd"/> <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> <column name="SALESPROJECT_MILESTONEID" value="122a232c-0b24-45f1-a55f-d827a3d993de"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASEMAL"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASEMAL"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-06-17T08:08:07"/> <column name="PARENT_ID" value="122a232c-0b24-45f1-a55f-d827a3d993de"/> <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> <column name="SALESPROJECT_MILESTONEID" value="737a988e-8779-4449-ba82-50f4361974eb"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASESAL"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASESAL"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-17T08:08:08"/> <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> <column name="SALESPROJECT_MILESTONEID" value="5189697c-5dbf-4d10-a163-dfde87e490ab"/> - <column name="TYPE" value="SalesprojectState"/> - <column name="VALUE" value="SALPROJSTATOPEN"/> + <column name="KIND" value="SalesprojectState"/> + <column name="MILESTONEVALUE" value="SALPROJSTATOPEN"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_END" valueDate="2019-05-23T10:44:48"/> <column name="DATE_START" valueDate="2019-05-10T08:39:38"/> <column name="SALESPROJECT_ID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> <column name="SALESPROJECT_MILESTONEID" value="4e764ba9-8f81-4e01-93de-f9769205dd3c"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASESAL"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASESAL"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-17T08:39:38"/> <column name="SALESPROJECT_ID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> <column name="SALESPROJECT_MILESTONEID" value="d77dc2ae-f12d-49ac-9a8f-ee0b5086f6ef"/> - <column name="TYPE" value="SalesprojectState"/> - <column name="VALUE" value="SALPROJSTATOPEN"/> + <column name="KIND" value="SalesprojectState"/> + <column name="MILESTONEVALUE" value="SALPROJSTATOPEN"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_END" valueDate="2019-05-23T10:44:26"/> <column name="DATE_START" valueDate="2019-05-14T11:51:20"/> <column name="SALESPROJECT_ID" value="7e2680f6-a438-45aa-956a-787363f85923"/> <column name="SALESPROJECT_MILESTONEID" value="d77a1712-bd57-4d4f-bc58-69ce58f31685"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASESAL"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASESAL"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-22T11:51:20"/> <column name="SALESPROJECT_ID" value="7e2680f6-a438-45aa-956a-787363f85923"/> <column name="SALESPROJECT_MILESTONEID" value="4529f6d1-2d4d-4dfc-b404-6a3d30e7153b"/> - <column name="TYPE" value="SalesprojectState"/> - <column name="VALUE" value="SALPROJSTATOPEN"/> + <column name="KIND" value="SalesprojectState"/> + <column name="MILESTONEVALUE" value="SALPROJSTATOPEN"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-22T01:42:51"/> <column name="DATE_END" valueDate="2019-06-19T08:08:07"/> <column name="SALESPROJECT_ID" value="ef7f4726-4476-4f59-97c2-706dc1e0046f"/> <column name="SALESPROJECT_MILESTONEID" value="eff31d24-4434-4b92-9de9-eeb8eb43cb72"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASESQO"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASESQO"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> @@ -93,16 +93,16 @@ <column name="PARENT_ID" value="eff31d24-4434-4b92-9de9-eeb8eb43cb72"/> <column name="SALESPROJECT_ID" value="ef7f4726-4476-4f59-97c2-706dc1e0046f"/> <column name="SALESPROJECT_MILESTONEID" value="40512b52-d0f4-4a07-a894-88f72455e700"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASEMAL"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASEMAL"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-22T01:42:51"/> <column name="SALESPROJECT_ID" value="ef7f4726-4476-4f59-97c2-706dc1e0046f"/> <column name="SALESPROJECT_MILESTONEID" value="381b808e-d0a7-408b-a794-55c10b0399b5"/> - <column name="TYPE" value="SalesprojectState"/> - <column name="VALUE" value="SALPROJSTATOPEN"/> + <column name="KIND" value="SalesprojectState"/> + <column name="MILESTONEVALUE" value="SALPROJSTATOPEN"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> @@ -111,24 +111,24 @@ <column name="PARENT_ID" value="b2cb428d-b76b-423a-9b61-04d03213e6d3"/> <column name="SALESPROJECT_ID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> <column name="SALESPROJECT_MILESTONEID" value="47999521-d6ea-4a4d-959c-e72776ba5a25"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASEOFFER"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASEOFFER"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-23T10:44:26"/> <column name="PARENT_ID" value="d77a1712-bd57-4d4f-bc58-69ce58f31685"/> <column name="SALESPROJECT_ID" value="7e2680f6-a438-45aa-956a-787363f85923"/> <column name="SALESPROJECT_MILESTONEID" value="61f7f5d6-01a6-4088-9387-820cb71ea526"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASENEGO"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASENEGO"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-23T10:44:48"/> <column name="PARENT_ID" value="4e764ba9-8f81-4e01-93de-f9769205dd3c"/> <column name="SALESPROJECT_ID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> <column name="SALESPROJECT_MILESTONEID" value="8a33dafb-4a1b-4ec9-a1cd-37a6c75e3721"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASESQO"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASESQO"/> </insert> <insert tableName="SALESPROJECT_MILESTONE"> <column name="DATE_START" valueDate="2019-05-23T11:30:10"/> @@ -136,8 +136,8 @@ <column name="PARENT_ID" value="b2cb428d-b76b-423a-9b61-04d03213e6d3"/> <column name="SALESPROJECT_ID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> <column name="SALESPROJECT_MILESTONEID" value="14da1165-ed6c-4f2a-8766-11d3533804cb"/> - <column name="TYPE" value="SalesprojectPhase"/> - <column name="VALUE" value="SALPROJPHASEMQC"/> + <column name="KIND" value="SalesprojectPhase"/> + <column name="MILESTONEVALUE" value="SALPROJPHASEMQC"/> </insert> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_SOURCE.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_SOURCE.xml index 234622c0aa677b4aec5d0a74bb6ef57271e40648..8edcdac3a50377b6d28c16b2c6b60696087446f7 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_SOURCE.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/SALESPROJECT_SOURCE.xml @@ -1,45 +1,45 @@ <?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="autogenerated" id="a4a96fc2-81cb-41a6-ac45-e935fe7378db"> - <insert tableName="SALESPROJECT_SOURCE"> + <insert tableName="SALESPROJECT_TOUCHPOINT"> <column name="ENTRYDATE" valueDate="2019-05-17T08:22:56"/> <column name="INFO" value="Kontakt über die Webseite"/> <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="SALESPROJECT_SOURCEID" value="2290111c-005b-4602-8adb-fb13844e065f"/> - <column name="SOURCE" value="SALPROJSCOWNWEB"/> + <column name="SALESPROJECT_TOUCHPOINTID" value="2290111c-005b-4602-8adb-fb13844e065f"/> + <column name="TOUCHPOINT" value="SALPROJSCOWNWEB"/> </insert> - <insert tableName="SALESPROJECT_SOURCE"> + <insert tableName="SALESPROJECT_TOUCHPOINT"> <column name="ENTRYDATE" valueDate="2019-05-17T08:23:27"/> <column name="INFO" value="Besuch bei der Messe"/> <column name="SALESPROJECT_ID" value="6d3d16cd-733e-41d1-ab6c-8a6cba63ba4a"/> - <column name="SALESPROJECT_SOURCEID" value="a3e94450-561f-43a8-bdec-64b093056187"/> - <column name="SOURCE" value="SALPROJSCFAIR"/> + <column name="SALESPROJECT_TOUCHPOINTID" value="a3e94450-561f-43a8-bdec-64b093056187"/> + <column name="TOUCHPOINT" value="SALPROJSCFAIR"/> </insert> - <insert tableName="SALESPROJECT_SOURCE"> + <insert tableName="SALESPROJECT_TOUCHPOINT"> <column name="ENTRYDATE" valueDate="2019-03-12T01:00:00"/> <column name="SALESPROJECT_ID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> - <column name="SALESPROJECT_SOURCEID" value="d178bb9e-0b6f-4f61-ac5e-f29b14488185"/> - <column name="SOURCE" value="SALPROJSCFAIR"/> + <column name="SALESPROJECT_TOUCHPOINTID" value="d178bb9e-0b6f-4f61-ac5e-f29b14488185"/> + <column name="TOUCHPOINT" value="SALPROJSCFAIR"/> </insert> - <insert tableName="SALESPROJECT_SOURCE"> + <insert tableName="SALESPROJECT_TOUCHPOINT"> <column name="ENTRYDATE" valueDate="2019-03-25T01:00:00"/> <column name="SALESPROJECT_ID" value="d422ad81-717f-42b0-bd64-fc892744aac7"/> - <column name="SALESPROJECT_SOURCEID" value="f42c0831-5f10-4b32-af21-62b334fd21d7"/> - <column name="SOURCE" value="SALPROJSCOWNWEB"/> + <column name="SALESPROJECT_TOUCHPOINTID" value="f42c0831-5f10-4b32-af21-62b334fd21d7"/> + <column name="TOUCHPOINT" value="SALPROJSCOWNWEB"/> </insert> - <insert tableName="SALESPROJECT_SOURCE"> + <insert tableName="SALESPROJECT_TOUCHPOINT"> <column name="ENTRYDATE" valueDate="2019-05-23T10:19:16"/> <column name="INFO" value="Die relevanten AP's waren am Stand. Hatten ein sehr produktives Gespräch."/> <column name="SALESPROJECT_ID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> - <column name="SALESPROJECT_SOURCEID" value="675253dd-0337-44c0-b230-71f030ee0246"/> - <column name="SOURCE" value="SALPROJSCFAIR"/> + <column name="SALESPROJECT_TOUCHPOINTID" value="675253dd-0337-44c0-b230-71f030ee0246"/> + <column name="TOUCHPOINT" value="SALPROJSCFAIR"/> </insert> - <insert tableName="SALESPROJECT_SOURCE"> + <insert tableName="SALESPROJECT_TOUCHPOINT"> <column name="ENTRYDATE" valueDate="2019-05-23T10:33:18"/> <column name="INFO" value="Erster Kontakt mit uns."/> <column name="SALESPROJECT_ID" value="438537db-0dc6-4aed-b1d1-813011baf88c"/> - <column name="SALESPROJECT_SOURCEID" value="515ac173-4eab-4783-9c3f-e637c462f6b3"/> - <column name="SOURCE" value="SALPROJSCOWNWEB"/> + <column name="SALESPROJECT_TOUCHPOINTID" value="515ac173-4eab-4783-9c3f-e637c462f6b3"/> + <column name="TOUCHPOINT" value="SALPROJSCOWNWEB"/> </insert> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/TASK.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/TASK.xml index f90edd2e0c2a4287f37989e817570e532b389278..b81beaf2db174b65691dc7dcccd572080ab9e7c7 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/TASK.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/TASK.xml @@ -12,7 +12,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Forecast anpassen"/> <column name="TASKID" value="7d404da2-78bf-427b-8abb-4c7e953220ca"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Kunde wollte ein Angebot, hierzu die offenen Posten klären"/> @@ -25,7 +25,7 @@ <column name="STATUS" value="IN-PROGRESS"/> <column name="SUBJECT" value="Nachfassen bei Kunden"/> <column name="TASKID" value="783f38b6-db71-42b5-9117-848553905c93"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="EDITOR_CONTACT_ID" value="4cc98357-25f3-462b-898c-440f9faf4b97"/> @@ -38,7 +38,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Besuch vorbereiten"/> <column name="TASKID" value="d6217dc5-5585-4919-a545-9cdc64a1ca58"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Kampagnenplanung für dieses Jahr beenden."/> @@ -51,7 +51,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Kampagne zu Akquise planen"/> <column name="TASKID" value="380c1ae1-c7d4-49b7-87e1-4fe2e16c4c52"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="EDITOR_CONTACT_ID" value="c7ddf982-0e58-4152-b82b-8f5673b0b729"/> @@ -64,7 +64,7 @@ <column name="STATUS" value="IN-PROGRESS"/> <column name="SUBJECT" value="Skyscraper VP für nächste Schritte"/> <column name="TASKID" value="f8fcdce1-da60-46d6-9ce3-3866e093730d"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="EDITOR_CONTACT_ID" value="c7ddf982-0e58-4152-b82b-8f5673b0b729"/> @@ -77,7 +77,7 @@ <column name="STATUS" value="IN-PROGRESS"/> <column name="SUBJECT" value="Vorbereitung Präsentation"/> <column name="TASKID" value="2e50d2cd-9429-433c-8f6e-2e31a9e7908e"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Kunde ist sehr interessiert an unserem Produkten, weitere Produktabstimmung intern."/> @@ -91,7 +91,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Lead nachfassen"/> <column name="TASKID" value="67afcc4b-f71b-4da6-a8b3-e7947c411a2a"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="MATURITY_DATE" valueDate="2019-06-21T06:03:00"/> @@ -103,7 +103,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Produkt Präsentation vorbereiten und mit Lisa Sommer abstimmen"/> <column name="TASKID" value="cf99cace-a6e1-46a6-ad83-c634e373f320"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Strategieevent 2-Tage"/> @@ -116,7 +116,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Event im Hause"/> <column name="TASKID" value="d8f35764-2c56-45be-93c7-f1e0695e2417"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Winterreifen draufmachen lassen"/> @@ -129,7 +129,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Autoreifen wechseln"/> <column name="TASKID" value="0d126a7e-4308-4857-9245-5a40f3e2b36e"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Preisabstimmung."/> @@ -142,7 +142,7 @@ <column name="STATUS" value="WAITING"/> <column name="SUBJECT" value="Mit der Vertriebsleitung abstimmen wie viel Prozent Rabatt gegeben werden kann."/> <column name="TASKID" value="81a4c8e7-4429-41e1-a534-f1be21e56b5e"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="MATURITY_DATE" valueDate="2019-05-30T09:21:00"/> @@ -154,7 +154,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Präsentation vor Ort vorbereiten"/> <column name="TASKID" value="96ec8b48-9fac-4216-bc98-a8323f0592f9"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="MATURITY_DATE" valueDate="2019-05-30T11:50:00"/> @@ -166,7 +166,7 @@ <column name="STATUS" value="NEW"/> <column name="SUBJECT" value="Test"/> <column name="TASKID" value="81a4d411-f317-4080-84b6-55ed91d26d34"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> <insert tableName="TASK"> <column name="DESCRIPTION" value="Es sollen die effizienten Wertschöpfungsketten der Prozessdefinitionseinheiten im primären Schritt gebündelt und sekundär analysiert und verifiziert werden."/> @@ -179,7 +179,7 @@ <column name="STATUS" value="IN-PROGRESS"/> <column name="SUBJECT" value="effiziente Wertschöpfungsketten bündeln und anlaysieren"/> <column name="TASKID" value="e9cb198d-c420-4192-9c29-b23682457d8e"/> - <column name="TYPE" value="TASK"/> + <column name="KIND" value="TASK"/> </insert> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_attribute/init_SalesprojectProbability_percentValue.xml b/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_attribute/init_SalesprojectProbability_percentValue.xml index e7425b24dcd38e28003820d50f3e5f846c0e7b66..1bbc33e49759629863c8f1dce3d7112d2cb80082 100644 --- a/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_attribute/init_SalesprojectProbability_percentValue.xml +++ b/.liquibase/Data_alias/basic/init/data/AditoBasic/ab_keyword_attribute/init_SalesprojectProbability_percentValue.xml @@ -4,7 +4,7 @@ <insert tableName="AB_KEYWORD_ATTRIBUTE"> <column name="AB_KEYWORD_ATTRIBUTEID" value="2fabbd9a-89d2-49e3-b3aa-1dcbc77252c7"/> <column name="NAME" value="percentValue"/> - <column name="TYPE" value="NUMBER_VALUE"/> + <column name="KIND" value="NUMBER_VALUE"/> <column name="CONTAINER" value="SalesprojectProbability"/> </insert> <insert tableName="AB_KEYWORD_ATTRIBUTERELATION"> diff --git a/.liquibase/Data_alias/basic/init/struct/AditoBasic/create_ab_keyword_attribute.xml b/.liquibase/Data_alias/basic/init/struct/AditoBasic/create_ab_keyword_attribute.xml index a39bf989d429478b93618c47e518fe3f908f768b..47b8c016a7220033aae4ec3c23dfbdac2a25c3c8 100644 --- a/.liquibase/Data_alias/basic/init/struct/AditoBasic/create_ab_keyword_attribute.xml +++ b/.liquibase/Data_alias/basic/init/struct/AditoBasic/create_ab_keyword_attribute.xml @@ -9,7 +9,7 @@ <column name="NAME" type="VARCHAR(100)"> <constraints nullable="false"/> </column> - <column name="TYPE" type="CHAR(36)"> + <column name="KIND" type="CHAR(36)"> <constraints nullable="false"/> </column> <column name="CONTAINER" type="VARCHAR(80)"> diff --git a/.liquibase/Data_alias/basic/init/struct/create_address.xml b/.liquibase/Data_alias/basic/init/struct/create_address.xml index 73309576ecf5dfdd54e072c1b3b3e9f4269a1474..986128ab48f3f7f66e1f28368b4ec1e5aeb1c758 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_address.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_address.xml @@ -17,7 +17,7 @@ <column name="CONTACT_ID" type="CHAR(36)"> <constraints nullable="false"/> </column> - <column name="STATE" type="NVARCHAR(50)"/> + <column name="PROVINCE" type="NVARCHAR(50)"/> <column name="ZIP" type="NVARCHAR(50)"/> </createTable> <addColumn diff --git a/.liquibase/Data_alias/basic/init/struct/create_communication.xml b/.liquibase/Data_alias/basic/init/struct/create_communication.xml index 954f264cfc12cecf80c02f12cf7dad3429dcac8d..c441f60b67d07767be90c4bd70ccf2b8fd76dddb 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_communication.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_communication.xml @@ -8,7 +8,7 @@ <column name="ADDR" type="NVARCHAR(255)"/> <column name="MEDIUM_ID" type="INTEGER"/> <column name="CONTACT_ID" type="CHAR(36)"/> - <column name="STANDARD" type="TINYINT"> + <column name="ISSTANDARD" type="TINYINT"> <constraints nullable="false"/> </column> </createTable> diff --git a/.liquibase/Data_alias/basic/init/struct/create_contact.xml b/.liquibase/Data_alias/basic/init/struct/create_contact.xml index 2530314f22796fb706e6bcfdcf1ee3a94ce2b4d1..eb998c454c5dd1fb930659185495f6151e4ec3fe 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_contact.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_contact.xml @@ -3,7 +3,7 @@ <changeSet author="j.hoermann" id="1f8bb402-3dd8-4732-8409-0ffc784f84f4"> <createTable tableName="CONTACT"> <column name="STATUS" type="CHAR(36)"/> - <column name="LANGUAGE" type="CHAR(3)"/> + <column name="ISOLANGUAGE" type="CHAR(3)"/> <column name="ORGANISATION_ID" type="CHAR(36)"/> <column name="PERSON_ID" type="CHAR(36)" /> <column name="RELATIONSHIP" type="INTEGER"/> diff --git a/.liquibase/Data_alias/basic/init/struct/create_offer.xml b/.liquibase/Data_alias/basic/init/struct/create_offer.xml index 52542b01b49c654d2c42800b1a65159bf2cd20ab..e26fc3909e6b3fee290a9622d7deb62fede104ef 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_offer.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_offer.xml @@ -13,7 +13,7 @@ <column name="HEADER" type="NCLOB"/> <column name="FOOTER" type="NCLOB"/> <column name="OFFERDATE" type="DATETIME"/> - <column name="LANGUAGE" type="CHAR(3)"/> + <column name="ISOLANGUAGE" type="CHAR(3)"/> <column name="OFFERCODE" type="INTEGER"/> <column name="VERSNR" type="INTEGER"/> <column name="STATUS" type="CHAR(36)"/> diff --git a/.liquibase/Data_alias/basic/init/struct/create_organisation.xml b/.liquibase/Data_alias/basic/init/struct/create_organisation.xml index a094020428880547fa4f3ab5dc16cdfe6b342695..0bc211b582064b4a97e5bd86b03f48028e56df26 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_organisation.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_organisation.xml @@ -6,7 +6,7 @@ <constraints nullable="false"/> </column> <column name="INFO" type="NCLOB"/> - <column name="TYPE" type="CHAR(36)"/> + <column name="KIND" type="CHAR(36)"/> <column name="CUSTOMERCODE" type="NVARCHAR(30)"/> <column name="ORGANISATIONID" type="CHAR(36)"> <constraints primaryKey="true" primaryKeyName="PK_ORG_ORGID"/> diff --git a/.liquibase/Data_alias/basic/init/struct/create_product.xml b/.liquibase/Data_alias/basic/init/struct/create_product.xml index 1047d6c1dc1619d1e201099107a938fffa84d177..c221bb25aa1977dda1dd0f56f2624a63eff3c5bd 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_product.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_product.xml @@ -1,23 +1,22 @@ <?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="m.schroeger" id="40ad5330-2163-400c-8fa7-d0d2461774b7"> - <createTable tableName="PRODUCT"> - <column name="PRODUCTID" type="CHAR(36)"> - <constraints primaryKey="true" primaryKeyName="PK_PRODUCT_PRODUCTID"/> - </column> - <column name="ADVERTISING" type="CHAR(1)"/> - <column name="GROUPCODEID" type="CHAR(36)"/> - <column name="MINSTOCK" type="INTEGER"/> - <column name="CONTACT_ID" type="CHAR(36)"/> - <column name="PRODUCTCODE" type="NVARCHAR(50)"> - <constraints nullable="false" unique="true" uniqueConstraintName="UNIQUE_PRODUCT_PRODUCTCODE"/> - </column> - <column name="PRODUCTNAME" type="NVARCHAR(50)"/> - <column name="LANGUAGE" type="CHAR(3)"/> - <column name="INFO" type="NCLOB"/> - <column name="STATUS" type="INTEGER"/> - <column name="UNIT" type="CHAR(36)"/> - <column name="STANDARD" type="INTEGER"/> - </createTable> -</changeSet> + <changeSet author="m.schroeger" id="40ad5330-2163-400c-8fa7-d0d2461774b7"> + <createTable tableName="PRODUCT"> + <column name="PRODUCTID" type="CHAR(36)"> + <constraints primaryKey="true" primaryKeyName="PK_PRODUCT_PRODUCTID"/> + </column> + <column name="ADVERTISING" type="CHAR(1)"/> + <column name="GROUPCODEID" type="CHAR(36)"/> + <column name="MINSTOCK" type="INTEGER"/> + <column name="CONTACT_ID" type="CHAR(36)"/> + <column name="PRODUCTCODE" type="NVARCHAR(50)"> + <constraints nullable="false" unique="true" uniqueConstraintName="UNIQUE_PRODUCT_PRODUCTCODE"/> + </column> + <column name="PRODUCTNAME" type="NVARCHAR(50)"/> + <column name="LANGUAGE" type="CHAR(3)"/> + <column name="INFO" type="NCLOB"/> + <column name="STATUS" type="INTEGER"/> + <column name="UNIT" type="CHAR(36)"/> + </createTable> + </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/init/struct/create_salesorder.xml b/.liquibase/Data_alias/basic/init/struct/create_salesorder.xml index e5b5409e8b77e821c09c4692af22005f7f400f1c..031624d87e135fd3c83d38194470e13b2d50a4ae 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_salesorder.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_salesorder.xml @@ -13,14 +13,12 @@ <column name="HEADER" type="NCLOB"/> <column name="FOOTER" type="NCLOB"/> <column name="SALESORDERDATE" type="DATETIME"/> - <column name="LANGUAGE" type="CHAR(3)"/> + <column name="ISOLANGUAGE" type="CHAR(3)"/> <column name="SALESORDERCODE" type="INTEGER"/> <column name="VERSNR" type="INTEGER"/> - <column name="STATUS" type="CHAR(36)"/> <column name="NET" type="NUMERIC(14,2)"/> <column name="VAT" type="NUMERIC(14,2)"/> <column name="CURRENCY" type="CHAR(36)"/> - <column name="ADDRESS" type="NCLOB"/> </createTable> </changeSet> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/init/struct/create_salesproject.xml b/.liquibase/Data_alias/basic/init/struct/create_salesproject.xml index 1a18e814008c98a7093a6ed5648f0f19ae3d4db4..31c58ec2084b853a34f713edabc4e2c283990268 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_salesproject.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_salesproject.xml @@ -11,7 +11,7 @@ <constraints nullable="false"/> </column> <column name="INFO" type="NCLOB"/> - <column name="STATE" type="INTEGER"/> + <column name="STATUS" type="INTEGER"/> <column name="PHASE" type="INTEGER"/> <column name="VOLUME" type="NUMERIC(14,2)"/> <column name="STARTDATE" type="DATETIME"/> diff --git a/.liquibase/Data_alias/basic/init/struct/create_salesproject_cycle.xml b/.liquibase/Data_alias/basic/init/struct/create_salesproject_cycle.xml index 8e380f42b103d1e134848f21054dab4060fd9591..34aa92987db6112d1b4610894fd1c0ecd52f3c12 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_salesproject_cycle.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_salesproject_cycle.xml @@ -9,8 +9,8 @@ <constraints nullable="false"/> </column> - <column name="TYPE" type="INTEGER"/> - <column name="VALUE" type="INTEGER"/> + <column name="KIND" type="INTEGER"/> + <column name="MILESTONEVALUE" type="INTEGER"/> <column name="DATE_START" type="DATETIME"/> <column name="DATE_END" type="DATETIME"/> diff --git a/.liquibase/Data_alias/basic/init/struct/create_salesproject_forecast.xml b/.liquibase/Data_alias/basic/init/struct/create_salesproject_forecast.xml index 72dc20ee0bcb58ae013e9d92c35b4bd38970f7ec..99f74a434195f079fccb852c10803f773306b5a0 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_salesproject_forecast.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_salesproject_forecast.xml @@ -15,7 +15,6 @@ <column name="GROUPCODE" type="CHAR(36)"/> <column name="INFO" type="NCLOB"/> <column name="DATE_START" type="DATETIME"/> - <column name="TYPE" type="NVARCHAR(10)"/> <column name="VOLUME" type="INTEGER"/> diff --git a/.liquibase/Data_alias/basic/init/struct/create_salesproject_member.xml b/.liquibase/Data_alias/basic/init/struct/create_salesproject_member.xml index 6a3207693ed51fb19ea25575c29b0328f80942f9..328e0e9e13300bf7b694775ffc32bc364894d6a1 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_salesproject_member.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_salesproject_member.xml @@ -12,7 +12,7 @@ <constraints nullable="false"/> </column> <column name="RELATIONSHIP" type="INTEGER"/> - <column name="SALESPROJECT_ROLE" type="CHAR(36)"/> + <column name="SALESPROJECT_MEMBERROLE" type="CHAR(36)"/> </createTable> </changeSet> diff --git a/.liquibase/Data_alias/basic/init/struct/create_salesproject_source.xml b/.liquibase/Data_alias/basic/init/struct/create_salesproject_source.xml index c3c501035e881f454615ebd9d5e41c6b94ec82b1..771ed02dce4cae85d0ae7a0604817df91f1dd3ce 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_salesproject_source.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_salesproject_source.xml @@ -1,9 +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"> <changeSet author="j.hoermann" id="806bee79-e178-4e35-9cb5-4bd9dc8ce6ae"> - <createTable tableName="SALESPROJECT_SOURCE"> - <column name="SALESPROJECT_SOURCEID" type="CHAR(36)"> - <constraints primaryKey="true" primaryKeyName="PK_SALESPROJECT_SOURCE_SALESPROJECT_SOURCEID"/> + <createTable tableName="SALESPROJECT_TOUCHPOINT"> + <column name="SALESPROJECT_TOUCHPOINTID" type="CHAR(36)"> + <constraints primaryKey="true" primaryKeyName="PK_SALESPROJECT_TOUCHPOINT_SALESPROJECT_TOUCHPOINTID"/> </column> <column name="ENTRYDATE" type="DATETIME"/> @@ -11,7 +11,7 @@ <column name="SALESPROJECT_ID" type="CHAR(36)"> <constraints nullable="false"/> </column> - <column name="SOURCE" type="CHAR(36)"/> + <column name="TOUCHPOINT" type="CHAR(36)"/> </createTable> diff --git a/.liquibase/Data_alias/basic/init/struct/create_task.xml b/.liquibase/Data_alias/basic/init/struct/create_task.xml index 89727f63dfe0eed7747652cdcd10f15803c3f9a3..cf34a7d007566480062fbb76001f1f8ad33ee961 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_task.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_task.xml @@ -16,7 +16,7 @@ <column name="EDITOR_CONTACT_ID" type="CHAR(36)"/> <column name="START_DATE" type="DATETIME"/> <column name="MATURITY_DATE" type="DATETIME"/> - <column name="TYPE" type="CHAR(36)"/> + <column name="KIND" type="CHAR(36)"/> <column name="DESCRIPTION" type="NCLOB"/> <column name="PROTECTIONLEVEL" type="SMALLINT"/> </createTable> diff --git a/.liquibase/Data_alias/basic/init/struct/create_timetracking.xml b/.liquibase/Data_alias/basic/init/struct/create_timetracking.xml index 1f7bf1ed6cdd1e12c8c0c0216a92bec0f8fa51a2..0838384d44cc78d9d623d6bc6c61293aa6d98507 100644 --- a/.liquibase/Data_alias/basic/init/struct/create_timetracking.xml +++ b/.liquibase/Data_alias/basic/init/struct/create_timetracking.xml @@ -6,7 +6,7 @@ <constraints primaryKey="true" primaryKeyName="PK_TIMETRACKING_TIMETRACKINGID"/> </column> <column name="INFO" type="NCLOB"/> - <column name="MINUTES" type="INTEGER"> + <column name="TRACKINGMINUTES" type="INTEGER"> <constraints nullable="false"/> </column> <column name="OBJECT_ID" type="NVARCHAR(36)"> @@ -19,7 +19,7 @@ <constraints foreignKeyName="FK_TIMETRACKING_CONTACT_ID" references="CONTACT(CONTACTID)"/> </column> - <column name="DATE" type="DATETIME"> + <column name="TRACKINGDATE" type="DATETIME"> <constraints nullable="false"/> </column> diff --git a/.liquibase/Data_alias/changelog.xml b/.liquibase/Data_alias/changelog.xml index 76148abdb97c4f986cae214bd9ebdf04ea5b69e7..20071741803c2e51aa5c685e51cd78d2250301df 100644 --- a/.liquibase/Data_alias/changelog.xml +++ b/.liquibase/Data_alias/changelog.xml @@ -2,6 +2,7 @@ <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="basic/init/init.xml"/> <include relativeToChangelogFile="true" file="basic/2019.1.4/changelog.xml"/> + <include relativeToChangelogFile="true" file="basic/2019.2.1/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/_____SYSTEMALIAS/basic/2019.1.4/permission/create_asys_permission.xml b/.liquibase/_____SYSTEMALIAS/basic/2019.1.4/permission/create_asys_permission.xml index ab5313229af678139f5d2adcd3002afddc28609c..0cef84bf418e856f38eb2ca376b8b45584ca6526 100644 --- a/.liquibase/_____SYSTEMALIAS/basic/2019.1.4/permission/create_asys_permission.xml +++ b/.liquibase/_____SYSTEMALIAS/basic/2019.1.4/permission/create_asys_permission.xml @@ -1,12 +1,12 @@ <?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="s.leipold" id="746f6e0c-3eab-4424-867f-4cf4fb4c45bb"> + <changeSet author="s.leipold" id="746f6e0c-3eab-4424-867f-4cf4fb4c45ba"> <createTable tableName="ASYS_PERMISSION"> <column name="ASYS_PERMISSIONID" type="CHAR(36)"> <constraints primaryKey="true" primaryKeyName="PK_ASYS_PERMISSION_ID"/> </column> <column name="ASYS_PERMISSIONSET_ID" type="CHAR(36)"/> - <column name="COND" type="VARCHAR(255)"/> + <column name="COND" type="CLOB"/> <column name="CONDTYPE" type="BOOLEAN"/> </createTable> </changeSet> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 462fc44014858e92711efb27a74d92b092f05711..b56cd2af80797dafd4c2563ff958c0d19f9544e3 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -86,7 +86,7 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>TYPE</name> + <name>KIND</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -241,7 +241,7 @@ </auditSyncConfig> <entityFields> <entityFieldDb> - <name>LANGUAGE</name> + <name>ISOLANGUAGE</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -392,7 +392,7 @@ <customBooleanProperty> <name>log</name> <global v="false" /> - <property v="true" /> + <property v="false" /> </customBooleanProperty> </customProperties> </entityFieldDb> @@ -439,7 +439,7 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>POSITION</name> + <name>CONTACTPOSITION</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="12" /> @@ -850,7 +850,7 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>STATE</name> + <name>PROVINCE</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="12" /> @@ -1245,7 +1245,7 @@ </dependencies> </entityFieldDb> <entityFieldDb> - <name>STANDARD</name> + <name>ISSTANDARD</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="5" /> @@ -1734,26 +1734,6 @@ </customBooleanProperty> </customProperties> </entityFieldDb> - <entityFieldDb> - <name>STANDARD</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="4" /> - <size v="10" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <title>Standard</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> <entityFieldDb> <name>CONTACT_ID</name> <dbName></dbName> @@ -1835,6 +1815,20 @@ <title>Creation user</title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>PICTURE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="2004" /> + <size v="2147483647" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -2601,31 +2595,6 @@ </customBooleanProperty> </customProperties> </entityFieldDb> - <entityFieldDb> - <name>LANGUAGE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="3" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <title>Language</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/offer/entityfields/language/customproperties/translate4log/property.js</property> - </customJDitoProperty> - </customProperties> - </entityFieldDb> <entityFieldDb> <name>VAT</name> <dbName></dbName> @@ -3072,6 +3041,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>ISOLANGUAGE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="3" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -3634,17 +3617,17 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>STATE</name> + <name>REASONS</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="1" /> - <size v="36" /> + <columnType v="12" /> + <size v="498" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Status</title> + <title>Reason</title> <description></description> <customProperties> <customBooleanProperty> @@ -3652,45 +3635,33 @@ <global v="false" /> <property v="true" /> </customBooleanProperty> - <customStringProperty> - <name>keyword</name> + <customJDitoProperty> + <name>translate4Log</name> <global v="false" /> - <property>SalesprojectState</property> - </customStringProperty> + <property>%aditoprj%/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesproject/entityfields/reasons/customproperties/translate4log/property.js</property> + </customJDitoProperty> </customProperties> </entityFieldDb> <entityFieldDb> - <name>REASONS</name> + <name>STATUS</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="498" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Reason</title> + <title></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/salesproject/entityfields/reasons/customproperties/translate4log/property.js</property> - </customJDitoProperty> - </customProperties> </entityFieldDb> </entityFields> </entityDb> <entityDb> - <name>SALESPROJECT_SOURCE</name> + <name>TIMETRACKING</name> <dbName></dbName> - <idColumn>SALESPROJECT_SOURCEID</idColumn> + <idColumn>TIMETRACKINGID</idColumn> <idGeneratorType v="0" /> <idGeneratorInterval v="1" /> <title></title> @@ -3705,7 +3676,7 @@ </auditSyncConfig> <entityFields> <entityFieldDb> - <name>SALESPROJECT_SOURCEID</name> + <name>TIMETRACKINGID</name> <dbName></dbName> <primaryKey v="true" /> <columnType v="1" /> @@ -3715,21 +3686,21 @@ <isUnique v="true" /> <index v="false" /> <documentation></documentation> - <title>Salesproject source Id</title> + <title>Timetracking Id</title> <description></description> </entityFieldDb> <entityFieldDb> - <name>SOURCE</name> + <name>OBJECT_ID</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="1" /> + <columnType v="12" /> <size v="36" /> <scale v="0" /> - <notNull v="false" /> + <notNull v="true" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Touchpoint</title> + <title>Object Id</title> <description></description> <customProperties> <customBooleanProperty> @@ -3737,25 +3708,20 @@ <global v="false" /> <property v="true" /> </customBooleanProperty> - <customStringProperty> - <name>keyword</name> - <global v="false" /> - <property>SalesprojectSource</property> - </customStringProperty> </customProperties> </entityFieldDb> <entityFieldDb> - <name>ENTRYDATE</name> + <name>CONTACT_ID</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="93" /> - <size v="29" /> - <scale v="9" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Date</title> + <title>Creator</title> <description></description> <customProperties> <customBooleanProperty> @@ -3776,7 +3742,7 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Info</title> + <title>Description</title> <description></description> <customProperties> <customBooleanProperty> @@ -3787,7 +3753,7 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>SALESPROJECT_ID</name> + <name>ROW_ID</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -3797,27 +3763,50 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Salesproject Id</title> + <title>Connection</title> <description></description> <customProperties> <customBooleanProperty> <name>log</name> <global v="false" /> - <property v="false" /> + <property v="true" /> </customBooleanProperty> - <customStringProperty> - <name>tableRef</name> - <global v="false" /> - <property>SALESPROJECT</property> - </customStringProperty> </customProperties> </entityFieldDb> + <entityFieldDb> + <name>TRACKINGMINUTES</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="4" /> + <size v="10" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>TRACKINGDATE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> - <name>TIMETRACKING</name> + <name>ACTIVITY</name> <dbName></dbName> - <idColumn>TIMETRACKINGID</idColumn> + <idColumn>ACTIVITYID</idColumn> <idGeneratorType v="0" /> <idGeneratorInterval v="1" /> <title></title> @@ -3832,17 +3821,17 @@ </auditSyncConfig> <entityFields> <entityFieldDb> - <name>DATE</name> + <name>DIRECTION</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="93" /> - <size v="29" /> - <scale v="9" /> - <notNull v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Date</title> + <title>Direction</title> <description></description> <customProperties> <customBooleanProperty> @@ -3853,31 +3842,38 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>TIMETRACKINGID</name> + <name>SUBJECT</name> <dbName></dbName> - <primaryKey v="true" /> - <columnType v="1" /> - <size v="36" /> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="254" /> <scale v="0" /> - <notNull v="true" /> - <isUnique v="true" /> + <notNull v="false" /> + <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Timetracking Id</title> + <title>Subject</title> <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> </entityFieldDb> <entityFieldDb> - <name>OBJECT_ID</name> + <name>ENTRYDATE</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="36" /> - <scale v="0" /> - <notNull v="true" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> <isUnique v="false" /> - <index v="false" /> + <index v="true" /> <documentation></documentation> - <title>Object Id</title> + <title>Entry date</title> <description></description> <customProperties> <customBooleanProperty> @@ -3888,17 +3884,17 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>MINUTES</name> + <name>INFO</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="4" /> - <size v="10" /> + <columnType v="2005" /> + <size v="2147483647" /> <scale v="0" /> - <notNull v="true" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Time</title> + <title>Description</title> <description></description> <customProperties> <customBooleanProperty> @@ -3909,7 +3905,21 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>CONTACT_ID</name> + <name>ACTIVITYID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="false" /> + <documentation></documentation> + <title>Activity Id</title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CATEGORY</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -3919,7 +3929,7 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Creator</title> + <title>Category</title> <description></description> <customProperties> <customBooleanProperty> @@ -3930,17 +3940,17 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>INFO</name> + <name>PARENT_CONTEXT</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="2005" /> - <size v="2147483647" /> + <columnType v="12" /> + <size v="64" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title>Description</title> + <title>Parent context</title> <description></description> <customProperties> <customBooleanProperty> @@ -3951,193 +3961,13 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>ROW_ID</name> + <name>PARENT_ID</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> <size v="36" /> <scale v="0" /> - <notNull v="true" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Connection</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - </entityFields> - </entityDb> - <entityDb> - <name>ACTIVITY</name> - <dbName></dbName> - <idColumn>ACTIVITYID</idColumn> - <idGeneratorType v="0" /> - <idGeneratorInterval v="1" /> - <title></title> - <description></description> - <auditSyncConfig> - <name>auditSyncConfig</name> - <auditMode v="2" /> - <syncActive v="false" /> - <syncComplete v="true" /> - <syncDirection v="1" /> - <syncIds></syncIds> - </auditSyncConfig> - <entityFields> - <entityFieldDb> - <name>DIRECTION</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>Direction</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - <entityFieldDb> - <name>SUBJECT</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="12" /> - <size v="254" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Subject</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - <entityFieldDb> - <name>ENTRYDATE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="93" /> - <size v="29" /> - <scale v="9" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="true" /> - <documentation></documentation> - <title>Entry date</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - <entityFieldDb> - <name>INFO</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="2005" /> - <size v="2147483647" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Description</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - <entityFieldDb> - <name>ACTIVITYID</name> - <dbName></dbName> - <primaryKey v="true" /> - <columnType v="1" /> - <size v="36" /> - <scale v="0" /> - <notNull v="true" /> - <isUnique v="true" /> - <index v="false" /> - <documentation></documentation> - <title>Activity Id</title> - <description></description> - </entityFieldDb> - <entityFieldDb> - <name>CATEGORY</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>Category</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - <entityFieldDb> - <name>PARENT_CONTEXT</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="12" /> - <size v="64" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Parent context</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> - <entityFieldDb> - <name>PARENT_ID</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="36" /> - <scale v="0" /> - <notNull v="false" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -4268,32 +4098,6 @@ </customBooleanProperty> </customProperties> </entityFieldDb> - <entityFieldDb> - <name>LANGUAGE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="3" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Language</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/salesorder/entityfields/language/customproperties/translate4log/property.js</property> - </customJDitoProperty> - </customProperties> - </entityFieldDb> <entityFieldDb> <name>VERSNR</name> <dbName></dbName> @@ -4596,6 +4400,20 @@ </customBooleanProperty> </customProperties> </entityFieldDb> + <entityFieldDb> + <name>ISOLANGUAGE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="3" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -5195,7 +5013,7 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>TYPE</name> + <name>KIND</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -5723,6 +5541,20 @@ </customBooleanProperty> </customProperties> </entityFieldDb> + <entityFieldDb> + <name>DROPDOWNFILTER</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="512" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -6463,7 +6295,7 @@ </customProperties> </entityFieldDb> <entityFieldDb> - <name>TYPE</name> + <name>KIND</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -7022,27 +6854,6 @@ <syncIds></syncIds> </auditSyncConfig> <entityFields> - <entityFieldDb> - <name>LANGUAGE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="3" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Language</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> <entityFieldDb> <name>SALUTATION</name> <dbName></dbName> @@ -7183,13 +6994,27 @@ </customBooleanProperty> </customProperties> </entityFieldDb> - </entityFields> - </entityDb> - <entityDb> - <name>DATABASECHANGELOG</name> - <dbName></dbName> - <idColumn></idColumn> - <idGeneratorType v="1" /> + <entityFieldDb> + <name>ISOLANGUAGE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="3" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> + <entityDb> + <name>DATABASECHANGELOG</name> + <dbName></dbName> + <idColumn></idColumn> + <idGeneratorType v="1" /> <idGeneratorInterval v="1" /> <documentation></documentation> <title></title> @@ -7767,27 +7592,6 @@ </customBooleanProperty> </customProperties> </entityFieldDb> - <entityFieldDb> - <name>VALUE</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>Value</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> <entityFieldDb> <name>SALESPROJECT_ID</name> <dbName></dbName> @@ -7809,27 +7613,6 @@ </customBooleanProperty> </customProperties> </entityFieldDb> - <entityFieldDb> - <name>TYPE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="12" /> - <size v="80" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title>Type</title> - <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> - </entityFieldDb> <entityFieldDb> <name>DATE_END</name> <dbName></dbName> @@ -7879,6 +7662,34 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>KIND</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="80" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>MILESTONEVALUE</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></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -8031,27 +7842,13 @@ <syncIds></syncIds> </auditSyncConfig> <entityFields> - <entityFieldDb> - <name>LANGUAGE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="3" /> - <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="91" /> - <size v="10" /> - <scale v="0" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -8105,9 +7902,9 @@ <name>DATE_NEW</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="91" /> - <size v="10" /> - <scale v="0" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> <notNull v="true" /> <isUnique v="false" /> <index v="false" /> @@ -8130,11 +7927,11 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>TYPE</name> + <name>USER_EDIT</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="1" /> - <size v="36" /> + <columnType v="12" /> + <size v="50" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -8144,7 +7941,7 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>USER_EDIT</name> + <name>NAME</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="12" /> @@ -8158,11 +7955,25 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>NAME</name> + <name>ISOLANGUAGE</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="50" /> + <columnType v="1" /> + <size v="3" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>KIND</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -8351,20 +8162,6 @@ <title></title> <description></description> </entityFieldDb> - <entityFieldDb> - <name>STATE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="36" /> - <scale v="0" /> - <notNull v="true" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> <entityFieldDb> <name>DATE_NEW</name> <dbName></dbName> @@ -8435,6 +8232,20 @@ <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="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -8483,20 +8294,6 @@ <title></title> <description></description> </entityFieldDb> - <entityFieldDb> - <name>STATE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="1" /> - <size v="36" /> - <scale v="0" /> - <notNull v="true" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> <entityFieldDb> <name>CAMPAIGNSTEPID</name> <dbName></dbName> @@ -8679,6 +8476,20 @@ <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="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -8811,6 +8622,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>PREVIOUS_CAMPAIGNSTEP_ID</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></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -9331,20 +9156,6 @@ <title></title> <description></description> </entityFieldDb> - <entityFieldDb> - <name>TYPE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="12" /> - <size v="10" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -9488,31 +9299,8 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> - </entityFields> - </entityDb> - <entityDb> - <name>MEMBER</name> - <dbName></dbName> - <idColumn>MEMBERID</idColumn> - <idGeneratorType v="0" /> - <idGeneratorInterval v="1" /> - <documentation></documentation> - <title></title> - <description></description> - <auditSyncConfig> - <name>auditSyncConfig</name> - <auditMode v="0" /> - <syncActive v="false" /> - <syncComplete v="true" /> - <syncDirection v="1" /> - <syncIds></syncIds> - </auditSyncConfig> - <entityFields> <entityFieldDb> - <name>ROLE</name> + <name>CURRENCY</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -9526,13 +9314,13 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>OBJECT_ROWID</name> + <name>CURRENCY</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> <size v="36" /> <scale v="0" /> - <notNull v="true" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -9540,11 +9328,11 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>DECIDER</name> + <name>CURRENCY</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="16" /> - <size v="1" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -9554,27 +9342,27 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>MEMBERID</name> + <name>CURRENCY</name> <dbName></dbName> - <primaryKey v="true" /> + <primaryKey v="false" /> <columnType v="1" /> <size v="36" /> <scale v="0" /> - <notNull v="true" /> - <isUnique v="true" /> + <notNull v="false" /> + <isUnique v="false" /> <index v="false" /> <documentation></documentation> <title></title> <description></description> </entityFieldDb> <entityFieldDb> - <name>CONTACT_ID</name> + <name>CURRENCY</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> <size v="36" /> <scale v="0" /> - <notNull v="true" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -9582,11 +9370,11 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>RELATIONSHIP</name> + <name>CURRENCY</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="4" /> - <size v="10" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -9596,19 +9384,148 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>OBJECT_TYPE</name> + <name>CURRENCY</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="63" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> - <notNull v="true" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CURRENCY</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></title> <description></description> </entityFieldDb> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -9726,7 +9643,7 @@ <description></description> <auditSyncConfig> <name>auditSyncConfig</name> - <auditMode v="0" /> + <auditMode v="1" /> <syncActive v="false" /> <syncComplete v="true" /> <syncDirection v="1" /> @@ -9744,8 +9661,20 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Document Template</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/bulkmail/entityfields/documenttemplate_id/customproperties/translate4log/property.js</property> + </customJDitoProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>BULKMAILID</name> @@ -9772,8 +9701,15 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Description</title> <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>SUBJECT</name> @@ -9786,8 +9722,15 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Subject</title> <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>NAME</name> @@ -9800,8 +9743,15 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Name</title> <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>SENDER</name> @@ -9814,8 +9764,15 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Sender</title> <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>STATUS</name> @@ -9831,6 +9788,48 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>CREATEACTIVITIES</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> + <entityFieldDb> + <name>TESTING_CONTACT_ID</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></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>TESTING_EMAIL_ADDRESS</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> @@ -10285,6 +10284,20 @@ <name>MAIL</name> <dbName></dbName> <primaryKey v="false" /> + <entityFieldDb> + <name>CURRENCY</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></title> + <description></description> + </entityFieldDb> <columnType v="2005" /> <size v="2147483647" /> <scale v="0" /> @@ -10732,7 +10745,7 @@ <description></description> <auditSyncConfig> <name>auditSyncConfig</name> - <auditMode v="0" /> + <auditMode v="1" /> <syncActive v="false" /> <syncComplete v="true" /> <syncDirection v="1" /> @@ -10750,8 +10763,20 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Document Template</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/serialletter/entityfields/documenttemplate_id/customproperties/translate4log/property.js</property> + </customJDitoProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>SERIALLETTERID</name> @@ -10778,8 +10803,15 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> - <title></title> + <title>Title</title> <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> </entityFieldDb> <entityFieldDb> <name>DESCRIPTION</name> @@ -10792,15 +10824,36 @@ <isUnique v="false" /> <index v="false" /> <documentation></documentation> + <title>Description</title> + <description></description> + <customProperties> + <customBooleanProperty> + <name>log</name> + <global v="false" /> + <property v="true" /> + </customBooleanProperty> + </customProperties> + </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></title> <description></description> </entityFieldDb> </entityFields> </entityDb> <entityDb> - <name>DUPLICATESCANCONDITIONCONFIG</name> + <name>OBJECTMEMBER</name> <dbName></dbName> - <idColumn>ID</idColumn> + <idColumn>OBJECTMEMBERID</idColumn> <idGeneratorType v="0" /> <idGeneratorInterval v="1" /> <documentation></documentation> @@ -10816,81 +10869,39 @@ </auditSyncConfig> <entityFields> <entityFieldDb> - <name>DATE_EDIT</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="91" /> - <size v="10" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> - <entityFieldDb> - <name>CONDITION</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="2005" /> - <size v="2147483647" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> - <entityFieldDb> - <name>COUNT_CHARACTERS_TO_USE</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="4" /> - <size v="10" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> - <entityFieldDb> - <name>DATE_NEW</name> + <name>OBJECTMEMBERID</name> <dbName></dbName> - <primaryKey v="false" /> - <columnType v="91" /> - <size v="10" /> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="true" /> - <isUnique v="false" /> + <isUnique v="true" /> <index v="false" /> <documentation></documentation> <title></title> <description></description> </entityFieldDb> <entityFieldDb> - <name>ID</name> + <name>OBJECT_ROWID</name> <dbName></dbName> - <primaryKey v="true" /> + <primaryKey v="false" /> <columnType v="1" /> <size v="36" /> <scale v="0" /> <notNull v="true" /> - <isUnique v="true" /> + <isUnique v="false" /> <index v="false" /> <documentation></documentation> <title></title> <description></description> </entityFieldDb> <entityFieldDb> - <name>USER_NEW</name> + <name>DECIDER</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="50" /> + <columnType v="5" /> + <size v="5" /> <scale v="0" /> <notNull v="true" /> <isUnique v="false" /> @@ -10900,7 +10911,7 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>DUPLICATESCAN_ID</name> + <name>CONTACT_ID</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="1" /> @@ -10914,11 +10925,11 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>CONDITION_CONFIG_NAME</name> + <name>RELATIONSHIP</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="200" /> + <columnType v="4" /> + <size v="10" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -10928,13 +10939,13 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>USER_EDIT</name> + <name>OBJECT_TYPE</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="12" /> - <size v="50" /> + <size v="63" /> <scale v="0" /> - <notNull v="false" /> + <notNull v="true" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -10942,11 +10953,11 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>MAX_RESULTS_THRESHOLD</name> + <name>MEMBERROLE</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="4" /> - <size v="10" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -10958,9 +10969,9 @@ </entityFields> </entityDb> <entityDb> - <name>DUPLICATESCANNER</name> + <name>SALESPROJECT_TOUCHPOINT</name> <dbName></dbName> - <idColumn>ID</idColumn> + <idColumn>SALESPROJECT_TOUCHPOINTID</idColumn> <idGeneratorType v="0" /> <idGeneratorInterval v="1" /> <documentation></documentation> @@ -10976,49 +10987,7 @@ </auditSyncConfig> <entityFields> <entityFieldDb> - <name>DATE_EDIT</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="91" /> - <size v="10" /> - <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> - <entityFieldDb> - <name>FILTER_NAME</name> - <dbName></dbName> - <primaryKey v="false" /> - <columnType v="12" /> - <size v="200" /> - <scale v="0" /> - <notNull v="true" /> - <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="91" /> - <size v="10" /> - <scale v="0" /> - <notNull v="true" /> - <isUnique v="false" /> - <index v="false" /> - <documentation></documentation> - <title></title> - <description></description> - </entityFieldDb> - <entityFieldDb> - <name>ID</name> + <name>SALESPROJECT_TOUCHPOINTID</name> <dbName></dbName> <primaryKey v="true" /> <columnType v="1" /> @@ -11032,13 +11001,13 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>USER_NEW</name> + <name>TOUCHPOINT</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="50" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> - <notNull v="true" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -11046,13 +11015,13 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>ENTITY_TO_SCAN_NAME</name> + <name>ENTRYDATE</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="200" /> - <scale v="0" /> - <notNull v="true" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -11060,13 +11029,13 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>EXTERNAL_SERVICE_USAGE_ALLOWED</name> + <name>INFO</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="16" /> - <size v="1" /> + <columnType v="2005" /> + <size v="2147483647" /> <scale v="0" /> - <notNull v="true" /> + <notNull v="false" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> @@ -11074,13 +11043,13 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>USER_EDIT</name> + <name>SALESPROJECT_ID</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="50" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> - <notNull v="false" /> + <notNull v="true" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/bulkmail/entityfields/documenttemplate_id/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/bulkmail/entityfields/documenttemplate_id/customproperties/translate4log/property.js new file mode 100644 index 0000000000000000000000000000000000000000..0323e52461762d8b246786c89c2fda67412ef534 --- /dev/null +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/bulkmail/entityfields/documenttemplate_id/customproperties/translate4log/property.js @@ -0,0 +1,12 @@ +import("Sql_lib"); +import("Contact_lib"); +import("system.db"); +import("system.result"); +import("Loghistory_lib"); + +var params = Translate4LogParams.load(); +var res = db.cell(SqlCondition.begin() + .andPrepare("DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID", params.value) + .buildSql("select NAME from DOCUMENTTEMPLATE", "1=2")); + +result.string(res); diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js deleted file mode 100644 index 55d6016dbe6d95243137051081e9960282555264..0000000000000000000000000000000000000000 --- a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("Loghistory_lib"); -import("Keyword_lib"); - -var params = Translate4LogParams.load(); -var res = LanguageKeywordUtils.getViewValue(params.value, params.locale); -result.string(res); \ No newline at end of file diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/offer/entityfields/language/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/offer/entityfields/language/customproperties/translate4log/property.js deleted file mode 100644 index 55d6016dbe6d95243137051081e9960282555264..0000000000000000000000000000000000000000 --- a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/offer/entityfields/language/customproperties/translate4log/property.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("Loghistory_lib"); -import("Keyword_lib"); - -var params = Translate4LogParams.load(); -var res = LanguageKeywordUtils.getViewValue(params.value, params.locale); -result.string(res); \ No newline at end of file diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/language/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/language/customproperties/translate4log/property.js deleted file mode 100644 index 55d6016dbe6d95243137051081e9960282555264..0000000000000000000000000000000000000000 --- a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/language/customproperties/translate4log/property.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("Loghistory_lib"); -import("Keyword_lib"); - -var params = Translate4LogParams.load(); -var res = LanguageKeywordUtils.getViewValue(params.value, params.locale); -result.string(res); \ No newline at end of file diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/salesproject_id/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/salesproject_id/customproperties/translate4log/property.js deleted file mode 100644 index d92ff2dc841e7ce025d71bdd381ed45b90924885..0000000000000000000000000000000000000000 --- a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/salesorder/entityfields/salesproject_id/customproperties/translate4log/property.js +++ /dev/null @@ -1,8 +0,0 @@ -import("Loghistory_lib"); -import("system.vars"); -import("system.result"); -import("Salesproject_lib"); - -var params = Translate4LogParams.load(); -var id = params.value; -result.string(Salesproject.getSalesProjectTitleById(id)); diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/serialletter/entityfields/documenttemplate_id/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/serialletter/entityfields/documenttemplate_id/customproperties/translate4log/property.js new file mode 100644 index 0000000000000000000000000000000000000000..0323e52461762d8b246786c89c2fda67412ef534 --- /dev/null +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/serialletter/entityfields/documenttemplate_id/customproperties/translate4log/property.js @@ -0,0 +1,12 @@ +import("Sql_lib"); +import("Contact_lib"); +import("system.db"); +import("system.result"); +import("Loghistory_lib"); + +var params = Translate4LogParams.load(); +var res = db.cell(SqlCondition.begin() + .andPrepare("DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID", params.value) + .buildSql("select NAME from DOCUMENTTEMPLATE", "1=2")); + +result.string(res); diff --git a/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js b/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js index b5db958b18fdb85576d0ee3ce7e7a929188e9297..079117e9028cc73670823798d0325902cc451055 100644 --- a/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js +++ b/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js @@ -1,26 +1,26 @@ -import("system.translate"); -import("system.result"); -import("system.vars"); -import("system.calendars"); -import("system.db"); -import("Keyword_lib"); -import("Sql_lib"); -import("KeywordRegistry_basic"); - -var sqlQuery, sqlHelper, queryCondition, affectedIds; -queryCondition = ""; -if (vars.exists("$local.idvalue")) { - affectedIds = vars.get("$local.idvalue"); - queryCondition = "where SALESPROJECTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')"; - //TODO: refactor this for incremental indexer (injections?) -} -sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select SALESPROJECTID, PROJECTTITLE as TITLECOLUMN, " - + sqlHelper.concat([ - "'" + translate.text("Status") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATE"), - "'| " + translate.text("Phase") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "PHASE") - ]) - + " as DESCCOLUMN, PROJECTCODE " - + " from SALESPROJECT " - + queryCondition + " order by PROJECTCODE "; +import("system.translate"); +import("system.result"); +import("system.vars"); +import("system.calendars"); +import("system.db"); +import("Keyword_lib"); +import("Sql_lib"); +import("KeywordRegistry_basic"); + +var sqlQuery, sqlHelper, queryCondition, affectedIds; +queryCondition = ""; +if (vars.exists("$local.idvalue")) { + affectedIds = vars.get("$local.idvalue"); + queryCondition = "where SALESPROJECTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')"; + //TODO: refactor this for incremental indexer (injections?) +} +sqlHelper = new SqlMaskingUtils(); +sqlQuery = "select SALESPROJECTID, PROJECTTITLE as TITLECOLUMN, " + + sqlHelper.concat([ + "'" + translate.text("Status") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATUS"), + "'| " + translate.text("Phase") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "PHASE") + ]) + + " as DESCCOLUMN, PROJECTCODE " + + " from SALESPROJECT " + + queryCondition + " order by PROJECTCODE "; result.string(sqlQuery); \ No newline at end of file diff --git a/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod b/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod index 751381ea326145969cf7f8067ef9629590238e39..e796fca2499b709a0d03fe7099b824ae4251ac93 100644 --- a/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod +++ b/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod @@ -3214,25 +3214,25 @@ </auditSyncConfig> <entityFields> <entityFieldDb> - <name>PERMISSIONID</name> + <name>CONDTYPE</name> <dbName></dbName> - <primaryKey v="true" /> - <columnType v="1" /> - <size v="36" /> + <primaryKey v="false" /> + <columnType v="16" /> + <size v="1" /> <scale v="0" /> - <notNull v="true" /> - <isUnique v="true" /> + <notNull v="false" /> + <isUnique v="false" /> <index v="false" /> <documentation></documentation> <title></title> <description></description> </entityFieldDb> <entityFieldDb> - <name>PERMISSIONSET_ID</name> + <name>COND</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="1" /> - <size v="36" /> + <columnType v="2005" /> + <size v="2147483647" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -3242,25 +3242,25 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>CONDTYPE</name> + <name>ASYS_PERMISSIONID</name> <dbName></dbName> - <primaryKey v="false" /> - <columnType v="16" /> - <size v="1" /> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> - <notNull v="false" /> - <isUnique v="false" /> + <notNull v="true" /> + <isUnique v="true" /> <index v="false" /> <documentation></documentation> <title></title> <description></description> </entityFieldDb> <entityFieldDb> - <name>COND</name> + <name>ASYS_PERMISSIONSET_ID</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="255" /> + <columnType v="1" /> + <size v="36" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> diff --git a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod index ceb6b40b3184f51360f11345c58e37a7dd87df74..410fe391ef714edad68ea6ccc50ee2e9466eac7d 100644 --- a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod +++ b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod @@ -61,6 +61,14 @@ <name>Salesproject</name> <kind v="10077" /> </entityNode> + <entityNode> + <name>Offer</name> + <kind v="10077" /> + </entityNode> + <entityNode> + <name>Order</name> + <kind v="10077" /> + </entityNode> <entityNode> <name>PROJECT_FieldStaff</name> <kind v="159" /> @@ -72,20 +80,17 @@ <title></title> </entityNode> <entityNode> - <name>Offer</name> - <kind v="10077" /> - </entityNode> - <entityNode> - <name>Order</name> + <name>Contract</name> <kind v="10077" /> </entityNode> <entityNode> - <name>Contract</name> + <name>Product</name> <kind v="10077" /> </entityNode> <entityNode> - <name>Product</name> + <name>Productprice</name> <kind v="10077" /> + <title></title> </entityNode> </childNodes> </entityNode> @@ -165,6 +170,7 @@ <name>Group</name> <kind v="123" /> <title>Service</title> + <icon>VAADIN:CHAT</icon> <childNodes> <entityNode> <name>Group6</name> diff --git a/entity/360Degree_entity/360Degree_entity.aod b/entity/360Degree_entity/360Degree_entity.aod index 470fea20c7fd427a74e7a9156b5d7d58c36342f3..cdeab537951f0d5e6e2cc62e94a246e25de72125 100644 --- a/entity/360Degree_entity/360Degree_entity.aod +++ b/entity/360Degree_entity/360Degree_entity.aod @@ -3,6 +3,8 @@ <name>360Degree_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>360 Degree</title> + <grantUpdate v="false" /> + <grantDelete v="false" /> <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> @@ -134,6 +136,19 @@ <stateProcess>%aditoprj%/entity/360Degree_entity/entityfields/newmodule/children/newcampaignparticipant/stateProcess.js</stateProcess> <tooltip>Choose a campaign and a step to add the contact to a campaign</tooltip> </entityActionField> + <entityActionField> + <name>newSupportticket</name> + <title>New Supportticket</title> + <onActionProcess>%aditoprj%/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js</onActionProcess> + <iconId>VAADIN:QUESTION</iconId> + </entityActionField> + <entityActionField> + <name>newOrder</name> + <title>Order</title> + <onActionProcess>%aditoprj%/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js</onActionProcess> + <iconId>VAADIN:DOLLAR</iconId> + <stateProcess>%aditoprj%/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js</stateProcess> + </entityActionField> </children> </entityActionGroup> <entityField> @@ -178,6 +193,7 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ACTIVE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> diff --git a/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5fa0055caaa5b62913e4a4cf16bfabf5fd542696 --- /dev/null +++ b/entity/360Degree_entity/entityfields/newmodule/children/neworder/onActionProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("Order_lib"); + +OrderUtils.createNewOrder(null, vars.getString("$param.ObjectRowId_param")); \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1c2b2b9123cb9512962e66ccf03bc2c7fecef0ab --- /dev/null +++ b/entity/360Degree_entity/entityfields/newmodule/children/neworder/stateProcess.js @@ -0,0 +1,22 @@ +import("system.vars"); +import("system.neon"); +import("system.result"); + +var contextList = JSON.parse(vars.getString("$param.ObjectType_param")); +if (contextList) +{ + var found = false; + contextList.forEach(function (context) + { + if(context == "Order") + found = true; + }); + if(found) + result.string(neon.COMPONENTSTATE_AUTO); + else + result.string(neon.COMPONENTSTATE_INVISIBLE); +} +else +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); +} \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9fa788e332e620073941436097faff4ca5269345 --- /dev/null +++ b/entity/360Degree_entity/entityfields/newmodule/children/newsupportticket/onActionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("ActivityTask_lib"); +import("Context_lib"); +import("Ticket_lib") + +TicketUtils.createNewTicket(undefined, [[vars.get("$param.BaseContextId_param"), vars.get("$param.ObjectRowId_param")]]) \ No newline at end of file diff --git a/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js b/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js index 357494dd61670f70bd6bc10c72650a47e22e4e92..187ce75fa946f9b4db58e301233fec55025e39c7 100644 --- a/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js +++ b/entity/360Degree_entity/entityfields/organisationobjects/children/objecttype_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.object(["Salesproject", "Offer", "Contract", "Campaign", "Order"]); \ No newline at end of file +result.object(["Salesproject", "Offer", "Order", "Contract", "Campaign", "Order"]); \ No newline at end of file diff --git a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js index 953a229acb9dc610df8b3fb5cfec1bda71aa0b20..92fef480e511705c8f175b3190c3bbb40303a32d 100644 --- a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.util"); import("system.db"); import("system.vars"); @@ -97,7 +96,6 @@ function _get360Data(pSelectMap, pBaseContextId, pContactId, pContextList, pActi subContextContactIds.forEach(function(pId) { // V-- do not add subcontexts deeper than one layer var subcontextRes = _get360Data(pSelectMap, pBaseContextId, pId, subContexts[subContextId][1], pActive, pExcludedObjectIds, false); - logging.log(subcontextRes.toSource()) resultList = resultList.concat(subcontextRes); }); } diff --git a/entity/ActivityLink_entity/ActivityLink_entity.aod b/entity/ActivityLink_entity/ActivityLink_entity.aod index eca362ef63ac9b2b5959978baeae26df907791b8..dd052b4473a40c0225d4e1e32bc95e80d07685d6 100644 --- a/entity/ActivityLink_entity/ActivityLink_entity.aod +++ b/entity/ActivityLink_entity/ActivityLink_entity.aod @@ -64,7 +64,6 @@ <entityParameter> <name>ObjectType_param</name> <valueProcess>%aditoprj%/entity/ActivityLink_entity/entityfields/objects/children/objecttype_param/valueProcess.js</valueProcess> - <expose v="true" /> </entityParameter> </children> </entityConsumer> @@ -129,10 +128,6 @@ <name>OBJECT_TYPE.value</name> <recordfield>ACTIVITYLINK.OBJECT_TYPE</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/ActivityLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_NEW.value</name> <recordfield>ACTIVITYLINK.USER_NEW</recordfield> diff --git a/entity/ActivityLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/ActivityLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index 33554680cccd2c3d363443686457c41e0c1c5729..0000000000000000000000000000000000000000 --- a/entity/ActivityLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getNameSubselectSql("OBJECT_TYPE", "OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index dc25d31dcba896e7e7373a64dffb2a650db31255..d94015b2c511c97d6615b82a80d53ffb28ca3df0 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Activity_entity/documentation.adoc</documentation> <title>Activity</title> + <grantDeleteProcess>%aditoprj%/entity/Activity_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Activity_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Activity_entity/afterUiInit.js</afterUiInit> <iconId>VAADIN:HOURGLASS_END</iconId> @@ -18,6 +19,7 @@ <consumer>KeywordDirections</consumer> <groupable v="true" /> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/direction/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Activity_entity/entityfields/direction/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -40,6 +42,7 @@ <title>Description</title> <contentType>HTML</contentType> <mandatory v="false" /> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/info/valueProcess.js</valueProcess> </entityField> <entityField> <name>CATEGORY</name> @@ -55,6 +58,7 @@ <title>Subject</title> <groupable v="false" /> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/subject/valueProcess.js</valueProcess> </entityField> <entityParameter> <name>RowId_param</name> @@ -111,6 +115,10 @@ <name>AssignmentTable_param</name> <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js</valueProcess> </entityParameter> + <entityParameter> + <name>AssignmentName_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/documents/children/assignmentname_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityConsumer> @@ -259,6 +267,10 @@ <name>ParentId_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>PresetDocuments_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityField> @@ -459,13 +471,81 @@ <iconId>VAADIN:CURLY_BRACKETS</iconId> <stateProcess>%aditoprj%/entity/Activity_entity/entityfields/openadminview/stateProcess.js</stateProcess> </entityActionField> + <entityParameter> + <name>PresetDocuments_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>Direction_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>Info_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>Subject_param</name> + <expose v="true" /> + </entityParameter> + <entityConsumer> + <name>ActivityAtrributes</name> + <dependency> + <name>dependency</name> + <entityName>Attribute_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + <children> + <entityParameter> + <name>ObjectType_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/activityatrributes/children/objecttype_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>AttributeTypes_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/activityatrributes/children/attributetypes_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ObjectRowId_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/activityatrributes/children/objectrowid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>AttributeTreeIsTheme</name> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>TreeProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>IsTheme_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/attributetreeistheme/children/istheme_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ObjectType_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/attributetreeistheme/children/objecttype_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ObjectRowId_param</name> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/attributetreeistheme/children/objectrowid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>ENTRYYEAR</name> + <title>Entrydate (Year)</title> + <groupable v="true" /> + <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/entryyear/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> + <maximumDbRows v="10000" /> <conditionProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBDelete>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> @@ -484,22 +564,27 @@ <dbRecordFieldMapping> <name>DIRECTION.value</name> <recordfield>ACTIVITY.DIRECTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>ACTIVITY.INFO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SUBJECT.value</name> <recordfield>ACTIVITY.SUBJECT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ENTRYDATE.value</name> <recordfield>ACTIVITY.ENTRYDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CATEGORY.value</name> <recordfield>ACTIVITY.CATEGORY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DIRECTION.displayValue</name> @@ -540,6 +625,7 @@ <dbRecordFieldMapping> <name>RESPONSIBLE.value</name> <recordfield>ACTIVITY.RESPONSIBLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>entryDateTimelineDate.value</name> @@ -550,6 +636,15 @@ <recordfield>ACTIVITY.ENTRYDATE</recordfield> </dbRecordFieldMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> </recordContainers> </entity> diff --git a/entity/Activity_entity/entityfields/activityatrributes/children/attributetypes_param/valueProcess.js b/entity/Activity_entity/entityfields/activityatrributes/children/attributetypes_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ad16e0d607228dd4e88a09fdf00e80c9e39261aa --- /dev/null +++ b/entity/Activity_entity/entityfields/activityatrributes/children/attributetypes_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Attribute_lib"); + +result.object([$AttributeTypes.THEME.toString()]); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/moduletrees/children/id/valueProcess.js b/entity/Activity_entity/entityfields/activityatrributes/children/objectrowid_param/valueProcess.js similarity index 100% rename from entity/Activity_entity/entityfields/moduletrees/children/id/valueProcess.js rename to entity/Activity_entity/entityfields/activityatrributes/children/objectrowid_param/valueProcess.js diff --git a/entity/Activity_entity/entityfields/activityatrributes/children/objecttype_param/valueProcess.js b/entity/Activity_entity/entityfields/activityatrributes/children/objecttype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e8b4e72e74a0a4696ff39e83135aa6100ef908c0 --- /dev/null +++ b/entity/Activity_entity/entityfields/activityatrributes/children/objecttype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getCurrentContextId()); diff --git a/entity/Activity_entity/entityfields/attributes/onValidation.js b/entity/Activity_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..4c641875fc8f39158fd12db73b3483aa60982a57 100644 --- a/entity/Activity_entity/entityfields/attributes/onValidation.js +++ b/entity/Activity_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.ACTIVITYID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/attributetreeistheme/children/istheme_param/valueProcess.js b/entity/Activity_entity/entityfields/attributetreeistheme/children/istheme_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/Activity_entity/entityfields/attributetreeistheme/children/istheme_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/attributetreeistheme/children/objectrowid_param/valueProcess.js b/entity/Activity_entity/entityfields/attributetreeistheme/children/objectrowid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a8267b62060b4bd30cedaba4713f4421a6e6f9ff --- /dev/null +++ b/entity/Activity_entity/entityfields/attributetreeistheme/children/objectrowid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.ACTIVITYID")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/attributetreeistheme/children/objecttype_param/valueProcess.js b/entity/Activity_entity/entityfields/attributetreeistheme/children/objecttype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e8b4e72e74a0a4696ff39e83135aa6100ef908c0 --- /dev/null +++ b/entity/Activity_entity/entityfields/attributetreeistheme/children/objecttype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getCurrentContextId()); diff --git a/entity/Activity_entity/entityfields/direction/displayValueProcess.js b/entity/Activity_entity/entityfields/direction/displayValueProcess.js index db0eefa7c09b3968b41810ad94bc54cdbdff1cef..75deea02b4efd83a4bac92ddd3cb7bf8c9e86787 100644 --- a/entity/Activity_entity/entityfields/direction/displayValueProcess.js +++ b/entity/Activity_entity/entityfields/direction/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("KeywordRegistry_basic"); import("Keyword_lib"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.activityDirection(), vars.get("$this.value"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.activityDirection(), vars.get("$field.DIRECTION"))); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/direction/valueProcess.js b/entity/Activity_entity/entityfields/direction/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e219a5baf3adfbaf2d1706cbf721703e81e93a7a --- /dev/null +++ b/entity/Activity_entity/entityfields/direction/valueProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Direction_param")) + result.string(vars.get("$param.Direction_param")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/entrydate/onValidation.js b/entity/Activity_entity/entityfields/entrydate/onValidation.js index 63235b240b7df91d447c5f2f5a2cc371c51f4c23..437a5ee635ebbcb597bd5445d14249f9ac93f1c9 100644 --- a/entity/Activity_entity/entityfields/entrydate/onValidation.js +++ b/entity/Activity_entity/entityfields/entrydate/onValidation.js @@ -1,9 +1,9 @@ -import("system.datetime"); +import("Date_lib"); import("system.translate"); import("system.vars"); import("system.result"); import("Entity_lib"); -var entryDate = ProcessHandlingUtils.getOnValidationValue(); -if (Number(datetime.clearTime(entryDate)) > Number(vars.get("$sys.today"))) +var entryDate = vars.get("local.value"); +if (!DateUtils.validateNotInFuture(entryDate)) result.string(translate.text("Entrydate must not be in the future")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/entryyear/valueProcess.js b/entity/Activity_entity/entityfields/entryyear/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d0a0b4c3271e345217e289de3c0514efe3a6889a --- /dev/null +++ b/entity/Activity_entity/entityfields/entryyear/valueProcess.js @@ -0,0 +1,6 @@ +import("system.datetime"); +import("system.result"); +import("system.vars"); + +var entryDate = vars.get("$field.ENTRYDATE"); +result.string(datetime.toDate(entryDate, "yyyy")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/info/valueProcess.js b/entity/Activity_entity/entityfields/info/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..627b3f2736925b4f40b2df3f4211828457ffa37c --- /dev/null +++ b/entity/Activity_entity/entityfields/info/valueProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Info_param")) + result.string(vars.get("$param.Info_param")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/responsible/displayValueProcess.js b/entity/Activity_entity/entityfields/responsible/displayValueProcess.js index 0dde82e7728286629b1c210326725aac2ebb92c5..4a1a4bf92b1c7ff37398bec253e24f100e3259af 100644 --- a/entity/Activity_entity/entityfields/responsible/displayValueProcess.js +++ b/entity/Activity_entity/entityfields/responsible/displayValueProcess.js @@ -2,7 +2,6 @@ import("system.result"); import("system.vars"); import("Contact_lib"); -var id = vars.get("$this.value"); //show the simpel title since this will be later an employee-entry and therefore no organisation is needed -var title = ContactUtils.getTitleByContactId(id); +var title = ContactUtils.getTitleByContactId(vars.get("$field.RESPONSIBLE")); result.string(title); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/subject/valueProcess.js b/entity/Activity_entity/entityfields/subject/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7a61fe8af530df8d332a5c8048bb974b7cc8a039 --- /dev/null +++ b/entity/Activity_entity/entityfields/subject/valueProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Subject_param")) + result.string(vars.get("$param.Subject_param")); \ No newline at end of file diff --git a/entity/Activity_entity/grantDeleteProcess.js b/entity/Activity_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b8b033f79ad04aedecbc9ae7384b631d32c70c24 --- /dev/null +++ b/entity/Activity_entity/grantDeleteProcess.js @@ -0,0 +1,5 @@ +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("ACTIVITY", null, vars.get("$field.ACTIVITYID"))); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/conditionProcess.js b/entity/Activity_entity/recordcontainers/db/conditionProcess.js index c3afc35018132f81d6ec3e3d82a081ad5c539595..9f488eeee91343b281765163cd04b54c0f48157c 100644 --- a/entity/Activity_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Activity_entity/recordcontainers/db/conditionProcess.js @@ -19,7 +19,7 @@ if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars. from CONTACT \n\ where CONTACT.PERSON_ID = (select CONTACT.PERSON_ID from CONTACT", null, ")")); } - var activityLinkCond = SqlCondition.begin().and("ACTIVITYLINK.OBJECT_ROWID in ('" + rowIds.join(", ") + "')") + var activityLinkCond = SqlCondition.begin().andIn("ACTIVITYLINK.OBJECT_ROWID", rowIds) .andPrepareVars("ACTIVITYLINK.OBJECT_TYPE", "$param.ObjectId_param"); // TODO: more performant way than IN. Maybe a join?? diff --git a/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Activity_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/onDBInsert.js b/entity/Activity_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..c687b6e1624de972c662d31003d3dcdb31628893 --- /dev/null +++ b/entity/Activity_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,10 @@ +import("ActivityTask_lib"); +import("system.vars"); +import("system.db"); + +var documents = vars.exists("$param.PresetDocuments_param") && vars.getString("$param.PresetDocuments_param"); +if (documents) +{ + documents = JSON.parse(documents); + ActivityUtils.insertDocuments(vars.get("$local.uid"), documents); +} \ No newline at end of file diff --git a/entity/AddressValidation_entity/AddressValidation_entity.aod b/entity/AddressValidation_entity/AddressValidation_entity.aod index 95c79ab94fb8874a304e8498f3f6ae094b8b4b2e..3b44b38b5d25db3aa2097bbb4ff5414881bc0ead 100644 --- a/entity/AddressValidation_entity/AddressValidation_entity.aod +++ b/entity/AddressValidation_entity/AddressValidation_entity.aod @@ -48,7 +48,7 @@ </entityField> <entityField> <name>ZIP</name> - <title>Zip</title> + <title>Postcode</title> </entityField> <entityField> <name>CITY</name> @@ -198,6 +198,9 @@ <jDitoRecordFieldMapping> <name>LAT.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>VALUE.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/AddressValidation_entity/contentTitleProcess.js b/entity/AddressValidation_entity/contentTitleProcess.js index 30fb575601790eed36da8614b22e5fdbea1fbf25..64f2ed681b1b7e753664056da7d27583e5112f5c 100644 --- a/entity/AddressValidation_entity/contentTitleProcess.js +++ b/entity/AddressValidation_entity/contentTitleProcess.js @@ -1,4 +1,5 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.VALUE")); \ No newline at end of file +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.VALUE")); +//result.string("sdfghj") \ No newline at end of file diff --git a/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js b/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js index 23d093d4cfac35df3f945324673a3718d1f5a2d2..08e0650767e3f17d79a07386a56db05c1e3bddb5 100644 --- a/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/AddressValidation_entity/recordcontainers/jdito/contentProcess.js @@ -26,4 +26,6 @@ if (!filter && vars.exists("$param.CurrentValue_param") && vars.get("$param.Curr filter = vars.get("$param.CurrentValue_param"); var foundAddresses = WsValidationUtils.validate(filter, type, country, city); -result.object(foundAddresses); \ No newline at end of file +result.object(foundAddresses.map(function(row) { + return row.concat([filter]) +})); \ No newline at end of file diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod index f655d17f40ac4652812b16540f06302a6130623f..4873f86ea5ed1b7bd92f6322b21865fa5448987d 100644 --- a/entity/Address_entity/Address_entity.aod +++ b/entity/Address_entity/Address_entity.aod @@ -12,9 +12,9 @@ <entityField> <name>ADDRESS</name> <title>Street</title> - <consumer>StreetValidation</consumer> <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/address/mandatoryProcess.js</mandatoryProcess> <textInputAllowed v="true" /> + <valueProcess>%aditoprj%/entity/Address_entity/entityfields/address/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/address/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Address_entity/entityfields/address/onValueChange.js</onValueChange> <onValueChangeTypes> @@ -23,6 +23,7 @@ </entityField> <entityField> <name>ADDRESSADDITION</name> + <title>Address addition</title> </entityField> <entityField> <name>ADDRESSID</name> @@ -47,9 +48,9 @@ <entityField> <name>CITY</name> <title>City</title> - <consumer>CityValidation</consumer> <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/city/mandatoryProcess.js</mandatoryProcess> <textInputAllowed v="true" /> + <valueProcess>%aditoprj%/entity/Address_entity/entityfields/city/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/city/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Address_entity/entityfields/city/onValueChange.js</onValueChange> <onValueChangeTypes> @@ -62,7 +63,6 @@ <consumer>Countries</consumer> <mandatory v="true" /> <valueProcess>%aditoprj%/entity/Address_entity/entityfields/country/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/country/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>DISTRICT</name> @@ -85,9 +85,9 @@ <entityField> <name>ZIP</name> <title>Postcode</title> - <consumer>ZipValidation</consumer> <mandatoryProcess>%aditoprj%/entity/Address_entity/entityfields/zip/mandatoryProcess.js</mandatoryProcess> <textInputAllowed v="true" /> + <valueProcess>%aditoprj%/entity/Address_entity/entityfields/zip/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/zip/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Address_entity/entityfields/zip/onValueChange.js</onValueChange> <onValueChangeTypes> @@ -242,9 +242,9 @@ <isConsumer v="false" /> </entityDependency> <entityDependency> - <name>716aac15-99cb-4032-bf97-06101f0718f3</name> - <entityName>DSGVO_entity</entityName> - <fieldName>OrganisationAndContactAdresses</fieldName> + <name>2f162626-bd99-4e2a-b9cf-e95864d9ed0e</name> + <entityName>Order_entity</entityName> + <fieldName>PossibleAddresses</fieldName> <isConsumer v="false" /> </entityDependency> </dependencies> @@ -353,7 +353,7 @@ <title>Search</title> <consumer>FullAddressValidation</consumer> <stateProcess>%aditoprj%/entity/Address_entity/entityfields/addresssearch/stateProcess.js</stateProcess> - <displayValueProcess>%aditoprj%/entity/Address_entity/entityfields/addresssearch/displayValueProcess.js</displayValueProcess> + <valueProcess>%aditoprj%/entity/Address_entity/entityfields/addresssearch/valueProcess.js</valueProcess> <onValueChange>%aditoprj%/entity/Address_entity/entityfields/addresssearch/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> @@ -468,7 +468,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATE.value</name> - <recordfield>ADDRESS.STATE</recordfield> + <recordfield>ADDRESS.PROVINCE</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ZIP.value</name> @@ -494,6 +494,10 @@ <name>USER_NEW.value</name> <recordfield>ADDRESS.USER_NEW</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>COUNTRY.displayValue</name> + <expression>%aditoprj%/entity/Address_entity/recordcontainers/db/recordfieldmappings/country.displayvalue/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> <indexRecordContainer> diff --git a/entity/Address_entity/conditionProcess.js b/entity/Address_entity/conditionProcess.js index 029bece9162d3a87ea09053626efcef906a8d9ef..fccfe75da2c5adf71d2f3fdbed4695f49ec76ea6 100644 --- a/entity/Address_entity/conditionProcess.js +++ b/entity/Address_entity/conditionProcess.js @@ -1,7 +1,7 @@ import("system.result"); import("system.vars"); -if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param") != null && vars.get("$param.ContactId_param") != "") +if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) result.string("ADDRESS.CONTACT_ID = ('" + vars.getString("$param.ContactId_param") + "')"); else - result.string("1 = 1"); + result.string("1=1"); diff --git a/entity/Address_entity/entityfields/addr_type/documentation.adoc b/entity/Address_entity/entityfields/addr_type/documentation.adoc index ba58622a4b016736576a965edcfb54c79aca8fe3..a374543b872cd92d666ef6c9ce9dbef377aa9c89 100644 --- a/entity/Address_entity/entityfields/addr_type/documentation.adoc +++ b/entity/Address_entity/entityfields/addr_type/documentation.adoc @@ -5,5 +5,5 @@ The `ADDR_TYPE` field represents the type of address (like "shipping address", " Possible values depend on the type of object it's connect to since a contactperson has different types than a company (organisation). -The Keyword ADDRESS.TYPE contains the following custom properties: {org: true, person: false} +The Keyword ADDRESS.KIND contains the following custom properties: {org: true, person: false} The types are filtered by the current contact type in the possibleItemsProcess. \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address/displayValueProcess.js b/entity/Address_entity/entityfields/address/displayValueProcess.js index de2c5e835eaf4fe6dd8b3521b3e17a39c9ac23c1..18985f7a004b046c160746de13e8970eb6c87ece 100644 --- a/entity/Address_entity/entityfields/address/displayValueProcess.js +++ b/entity/Address_entity/entityfields/address/displayValueProcess.js @@ -1,5 +1,6 @@ import("system.vars"); import("system.result"); -// needed for instant display name change if value set by neon.setFieldValue -result.string(vars.get("$this.value")) \ No newline at end of file +// Needed for instant refresh if set by neon.setFieldValue +// use the code if address webservice is active +//result.string(vars.get("$field.ADDRESS")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address/mandatoryProcess.js b/entity/Address_entity/entityfields/address/mandatoryProcess.js index fdba45809693e06d2fa403eb0955864e64ce18c8..7c898f01828b8da4b9712687a66dac8914b3b137 100644 --- a/entity/Address_entity/entityfields/address/mandatoryProcess.js +++ b/entity/Address_entity/entityfields/address/mandatoryProcess.js @@ -1,5 +1,5 @@ -import("Entity_lib"); -import("system.result"); -import("AddressEntity_lib"); - +import("Entity_lib"); +import("system.result"); +import("AddressEntity_lib"); + result.object(AddressEntityValidation.isMandatoryField()); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address/onValueChange.js b/entity/Address_entity/entityfields/address/onValueChange.js index 5634474c9dabbfeec7a11ee3c23680b765030b4a..abec5ca7ea53495f6a64fbb7eee7ed6fa3f53b25 100644 --- a/entity/Address_entity/entityfields/address/onValueChange.js +++ b/entity/Address_entity/entityfields/address/onValueChange.js @@ -1,3 +1,5 @@ +import("system.vars"); import("WsValidation_lib"); -WsValidationUtils.setAddressFields(); \ No newline at end of file +// use the code if address webservice is active +//WsValidationUtils.setAddressFields(vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/address/valueProcess.js b/entity/Address_entity/entityfields/address/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2c9d496185be419f31c762709ca97d83a1ae4bd4 --- /dev/null +++ b/entity/Address_entity/entityfields/address/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("WsValidation_lib"); +import("system.vars"); + +// use the code if address webservice is active +//result.string(WsValidationUtils.valueFromJSON(vars.get("$this.value"))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/addresssearch/displayValueProcess.js b/entity/Address_entity/entityfields/addresssearch/displayValueProcess.js deleted file mode 100644 index de2c5e835eaf4fe6dd8b3521b3e17a39c9ac23c1..0000000000000000000000000000000000000000 --- a/entity/Address_entity/entityfields/addresssearch/displayValueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); -import("system.result"); - -// needed for instant display name change if value set by neon.setFieldValue -result.string(vars.get("$this.value")) \ No newline at end of file diff --git a/entity/Address_entity/entityfields/addresssearch/onValueChange.js b/entity/Address_entity/entityfields/addresssearch/onValueChange.js index 57c7beb53f9d1efaedb15b20b93902ed878cb750..c19e660f1099559c1b027aba2317e52eee3e6495 100644 --- a/entity/Address_entity/entityfields/addresssearch/onValueChange.js +++ b/entity/Address_entity/entityfields/addresssearch/onValueChange.js @@ -1,3 +1,4 @@ +import("system.vars"); import("WsValidation_lib"); -WsValidationUtils.setAddressFields("$field.AddressSearch"); \ No newline at end of file +WsValidationUtils.setAddressFields(vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/addresssearch/valueProcess.js b/entity/Address_entity/entityfields/addresssearch/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e5e514c90862ca236702c6dabc10e44ddaa4d1e5 --- /dev/null +++ b/entity/Address_entity/entityfields/addresssearch/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("WsValidation_lib"); +import("system.vars"); + +result.string(WsValidationUtils.valueFromJSON(vars.get("$this.value"))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/displayValueProcess.js b/entity/Address_entity/entityfields/city/displayValueProcess.js index feac45906bc212c120bbc05a111433398994ddf2..0738ded17951195fb9050da641ec78c256a3ee38 100644 --- a/entity/Address_entity/entityfields/city/displayValueProcess.js +++ b/entity/Address_entity/entityfields/city/displayValueProcess.js @@ -1,5 +1,6 @@ -import("system.vars"); -import("system.result"); - -// needed for instant display name change if value set by neon.setFieldValue -result.string(vars.get("$this.value")) \ No newline at end of file +import("system.vars"); +import("system.result"); + +// Needed for instant refresh if set by neon.setFieldValue +// use the code if address webservice is active +//result.string(vars.get("$field.CITY")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/mandatoryProcess.js b/entity/Address_entity/entityfields/city/mandatoryProcess.js index fdba45809693e06d2fa403eb0955864e64ce18c8..7c898f01828b8da4b9712687a66dac8914b3b137 100644 --- a/entity/Address_entity/entityfields/city/mandatoryProcess.js +++ b/entity/Address_entity/entityfields/city/mandatoryProcess.js @@ -1,5 +1,5 @@ -import("Entity_lib"); -import("system.result"); -import("AddressEntity_lib"); - +import("Entity_lib"); +import("system.result"); +import("AddressEntity_lib"); + result.object(AddressEntityValidation.isMandatoryField()); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/onValueChange.js b/entity/Address_entity/entityfields/city/onValueChange.js index b8245bb197f1e070f4011c302f9e7f47168fafa1..abec5ca7ea53495f6a64fbb7eee7ed6fa3f53b25 100644 --- a/entity/Address_entity/entityfields/city/onValueChange.js +++ b/entity/Address_entity/entityfields/city/onValueChange.js @@ -1,3 +1,5 @@ -import("WsValidation_lib"); - -WsValidationUtils.setAddressFields(); \ No newline at end of file +import("system.vars"); +import("WsValidation_lib"); + +// use the code if address webservice is active +//WsValidationUtils.setAddressFields(vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/city/valueProcess.js b/entity/Address_entity/entityfields/city/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2c9d496185be419f31c762709ca97d83a1ae4bd4 --- /dev/null +++ b/entity/Address_entity/entityfields/city/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("WsValidation_lib"); +import("system.vars"); + +// use the code if address webservice is active +//result.string(WsValidationUtils.valueFromJSON(vars.get("$this.value"))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/country/displayValueProcess.js b/entity/Address_entity/entityfields/country/displayValueProcess.js deleted file mode 100644 index 91e2f20f24cdb6b86c5f5c742fa9838037d05828..0000000000000000000000000000000000000000 --- a/entity/Address_entity/entityfields/country/displayValueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.vars"); -import("system.result"); -import("CountryInfo_lib"); - -//TODO: temporary testing code -> will be replaced with title-mechanic -var isoCode = vars.get("$field.COUNTRY"); -var countryName = CountryUtils.getLatinNameByIso2(isoCode); -result.string(countryName); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/country/valueProcess.js b/entity/Address_entity/entityfields/country/valueProcess.js index 0bbec92588a0d5155ba8f200c1c8699e0c106ed7..ed4f8415e482aab730551c90508dd80dc5d7779c 100644 --- a/entity/Address_entity/entityfields/country/valueProcess.js +++ b/entity/Address_entity/entityfields/country/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string("DE"); } \ No newline at end of file diff --git a/entity/Address_entity/entityfields/state/mandatoryProcess.js b/entity/Address_entity/entityfields/state/mandatoryProcess.js index fdba45809693e06d2fa403eb0955864e64ce18c8..7c898f01828b8da4b9712687a66dac8914b3b137 100644 --- a/entity/Address_entity/entityfields/state/mandatoryProcess.js +++ b/entity/Address_entity/entityfields/state/mandatoryProcess.js @@ -1,5 +1,5 @@ -import("Entity_lib"); -import("system.result"); -import("AddressEntity_lib"); - +import("Entity_lib"); +import("system.result"); +import("AddressEntity_lib"); + result.object(AddressEntityValidation.isMandatoryField()); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js b/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js index 210aab5135161a47229a09613e2ed186ebf9528f..6cd3c4544e56fa57ad04b119be620aa650f4a849 100644 --- a/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js +++ b/entity/Address_entity/entityfields/streetvalidation/children/currentvalue_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$this.value")) \ No newline at end of file +result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/displayValueProcess.js b/entity/Address_entity/entityfields/zip/displayValueProcess.js index feac45906bc212c120bbc05a111433398994ddf2..219ae2ffc092fe47ebcd3b427c2c4f28052cd0d4 100644 --- a/entity/Address_entity/entityfields/zip/displayValueProcess.js +++ b/entity/Address_entity/entityfields/zip/displayValueProcess.js @@ -1,5 +1,6 @@ -import("system.vars"); -import("system.result"); - -// needed for instant display name change if value set by neon.setFieldValue -result.string(vars.get("$this.value")) \ No newline at end of file +import("system.vars"); +import("system.result"); + +// Needed for instant refresh if set by neon.setFieldValue +// use the code if address webservice is active +//result.string(vars.get("$field.ZIP")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/mandatoryProcess.js b/entity/Address_entity/entityfields/zip/mandatoryProcess.js index fdba45809693e06d2fa403eb0955864e64ce18c8..7c898f01828b8da4b9712687a66dac8914b3b137 100644 --- a/entity/Address_entity/entityfields/zip/mandatoryProcess.js +++ b/entity/Address_entity/entityfields/zip/mandatoryProcess.js @@ -1,5 +1,5 @@ -import("Entity_lib"); -import("system.result"); -import("AddressEntity_lib"); - +import("Entity_lib"); +import("system.result"); +import("AddressEntity_lib"); + result.object(AddressEntityValidation.isMandatoryField()); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/onValidation.js b/entity/Address_entity/entityfields/zip/onValidation.js index 4ab5fababa786a02ee290896bd38c6b648fb2150..d676d5911b0c9fbe9ad578821db2c08f56e1b5df 100644 --- a/entity/Address_entity/entityfields/zip/onValidation.js +++ b/entity/Address_entity/entityfields/zip/onValidation.js @@ -6,7 +6,7 @@ import("Entity_lib"); var countryCode = vars.get("$field.COUNTRY"); -var zipCode = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.ZIP")); +var zipCode = vars.get("local.value"); var message = ""; var isValid = AddressValidationUtils.isValidZip(countryCode, zipCode); if (!isValid) diff --git a/entity/Address_entity/entityfields/zip/onValueChange.js b/entity/Address_entity/entityfields/zip/onValueChange.js index b8245bb197f1e070f4011c302f9e7f47168fafa1..abec5ca7ea53495f6a64fbb7eee7ed6fa3f53b25 100644 --- a/entity/Address_entity/entityfields/zip/onValueChange.js +++ b/entity/Address_entity/entityfields/zip/onValueChange.js @@ -1,3 +1,5 @@ -import("WsValidation_lib"); - -WsValidationUtils.setAddressFields(); \ No newline at end of file +import("system.vars"); +import("WsValidation_lib"); + +// use the code if address webservice is active +//WsValidationUtils.setAddressFields(vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zip/valueProcess.js b/entity/Address_entity/entityfields/zip/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..92c7fae75dc7a1b51668e4685fe75ed5d197a85b --- /dev/null +++ b/entity/Address_entity/entityfields/zip/valueProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); +import("WsValidation_lib"); + +// use the code if address webservice is active +//result.string(WsValidationUtils.valueFromJSON(vars.get("$this.value"))); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js b/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js index 210aab5135161a47229a09613e2ed186ebf9528f..6cd3c4544e56fa57ad04b119be620aa650f4a849 100644 --- a/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js +++ b/entity/Address_entity/entityfields/zipvalidation/children/currentvalue_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$this.value")) \ No newline at end of file +result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Address_entity/recordcontainers/childgroup/query.js b/entity/Address_entity/recordcontainers/childgroup/query.js index 968036a197b0d04ae5aa60f910b75b92aae025a2..4cf4bcc1d9115cf0e3f038deb2444c85fbd28c1e 100644 --- a/entity/Address_entity/recordcontainers/childgroup/query.js +++ b/entity/Address_entity/recordcontainers/childgroup/query.js @@ -10,9 +10,9 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } -sqlQuery = "select ADDRESS.ADDRESSID as uid" +sqlQuery = 'select ADDRESS.ADDRESSID as "_uid_"' + ', ADDRESS.ADDRESSID' - + ', ADDRESS.ZIP as "ZIP.value"' + + ', ADDRESS.ZIP as ZIP' + ', ADDRESS.CITY as CITY' + ', ADDRESS.COUNTRY' + ', ADDRESS.ADDRESS' diff --git a/entity/Address_entity/recordcontainers/db/onDBInsert.js b/entity/Address_entity/recordcontainers/db/onDBInsert.js index 14c04e5fc957168514bd24185fa04f2bea97cd79..62ff605c220f8a1d0b6b127ef3e312fac3827af4 100644 --- a/entity/Address_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Address_entity/recordcontainers/db/onDBInsert.js @@ -9,7 +9,8 @@ if (typeParam === "contact") else if (typeParam === "organisation") scopeType = "Organisation" -new StandardObject("Address", vars.get("$field.ADDRESSID"), scopeType, vars.get("$field.CONTACT_ID")) +var rowdata = vars.get("$local.rowdata"); +new StandardObject("Address", vars.get("$local.uid"), scopeType, rowdata["ADDRESS.CONTACT_ID"]) .onObjectInsert() -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$field.CONTACT_ID"), vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(rowdata["ADDRESS.CONTACT_ID"], vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file diff --git a/entity/Address_entity/recordcontainers/db/onDBUpdate.js b/entity/Address_entity/recordcontainers/db/onDBUpdate.js index c20ad6c82f89a2b68f03054caaea4d64a04a20f0..70056d7ef369d32d2c42adc14a9afea82ef68414 100644 --- a/entity/Address_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Address_entity/recordcontainers/db/onDBUpdate.js @@ -1,4 +1,6 @@ import("system.vars"); import("DataPrivacy_lib"); - -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$field.CONTACT_ID"), vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file + +var rowdata = vars.get("$local.rowdata"); + +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(rowdata["ADDRESS.CONTACT_ID"], vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file diff --git a/entity/Address_entity/recordcontainers/db/recordfieldmappings/country.displayvalue/expression.js b/entity/Address_entity/recordcontainers/db/recordfieldmappings/country.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..5e5700d67054f2bda11deb8ca963112d50bb2717 --- /dev/null +++ b/entity/Address_entity/recordcontainers/db/recordfieldmappings/country.displayvalue/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("CountryInfo_lib"); + +var res = CountryUtils.getResolvedNameFromIso2Sql("ADDRESS.COUNTRY"); +result.string(res); \ No newline at end of file diff --git a/entity/Analyses_entity/Analyses_entity.aod b/entity/Analyses_entity/Analyses_entity.aod index a510c53513c3ffbcf3af1d291854d266220c42fc..bc2c77e31f4cc4021ae69dbe62fa3434ef549b00 100644 --- a/entity/Analyses_entity/Analyses_entity.aod +++ b/entity/Analyses_entity/Analyses_entity.aod @@ -29,6 +29,7 @@ </entityField> <entityActionField> <name>openCalendar</name> + <onActionProcess>%aditoprj%/entity/Analyses_entity/entityfields/opencalendar/onActionProcess.js</onActionProcess> </entityActionField> <entityActionField> <name>openNewTasks</name> diff --git a/entity/Analyses_entity/entityfields/opencalendar/onActionProcess.js b/entity/Analyses_entity/entityfields/opencalendar/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cee3ed9ab41998ce28c572ed63fbbfd43b86a195 --- /dev/null +++ b/entity/Analyses_entity/entityfields/opencalendar/onActionProcess.js @@ -0,0 +1,3 @@ +import("system.tools"); +import("system.neon"); +neon.openCalendar(4, tools.getCurrentUser()["title"], null); \ No newline at end of file diff --git a/entity/AnyContact_entity/AnyContact_entity.aod b/entity/AnyContact_entity/AnyContact_entity.aod index 26a50a06003e436db6f8d53c2f4d57e78e4db1f7..6f36172e79513e874e73272cc1ccdc7eabe2aec3 100644 --- a/entity/AnyContact_entity/AnyContact_entity.aod +++ b/entity/AnyContact_entity/AnyContact_entity.aod @@ -50,6 +50,24 @@ <fieldName>Contacts</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>471b6e37-13ce-4e84-a797-82bccbe4e39a</name> + <entityName>UnlinkedMailMappingLink_entity</entityName> + <fieldName>AnyContacts</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>aca9e52c-9138-4ef1-b039-1efeb3deb822</name> + <entityName>BulkMailTesting_entity</entityName> + <fieldName>Contacts</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>bbd2bf84-7cad-4156-b736-32749949f97c</name> + <entityName>BulkMail_entity</entityName> + <fieldName>Contacts</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityField> @@ -144,6 +162,11 @@ See ContactUtils.getRelationTypeByPersOrg for possible values</description> </entityParameter> </children> </entityProvider> + <entityParameter> + <name>WithPrivatePersons_param</name> + <valueProcess>%aditoprj%/entity/AnyContact_entity/entityfields/withprivatepersons_param/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -189,7 +212,7 @@ See ContactUtils.getRelationTypeByPersOrg for possible values</description> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LANGUAGE.value</name> - <recordfield>CONTACT.LANGUAGE</recordfield> + <recordfield>CONTACT.ISOLANGUAGE</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORGANISATION_ID.value</name> diff --git a/entity/AnyContact_entity/entityfields/withprivatepersons_param/valueProcess.js b/entity/AnyContact_entity/entityfields/withprivatepersons_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/AnyContact_entity/entityfields/withprivatepersons_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/AnyContact_entity/recordcontainers/db/conditionProcess.js b/entity/AnyContact_entity/recordcontainers/db/conditionProcess.js index 565287dccb22ad6f19f9b527caa276b87dd618bd..72bf4814198ca16718074a516805a6d7c2c1565f 100644 --- a/entity/AnyContact_entity/recordcontainers/db/conditionProcess.js +++ b/entity/AnyContact_entity/recordcontainers/db/conditionProcess.js @@ -16,15 +16,18 @@ if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) } } +var conditionPrivateOrganisation = SqlCondition.begin() + .andPrepare("CONTACT.ORGANISATION_ID", "0", "# != ?"); + +if (vars.getString("$param.WithPrivatePersons_param") == "true") + conditionPrivateOrganisation.orSqlCondition(SqlCondition.begin() + .andPrepare("CONTACT.ORGANISATION_ID", "0") + .and("CONTACT.PERSON_ID is not null") + ); + //exclude private organisation var cond = SqlCondition.begin() - .andSqlCondition(SqlCondition.begin() - .andPrepare("CONTACT.ORGANISATION_ID", "0", "# != ?") - .orSqlCondition(SqlCondition.begin() - .andPrepare("CONTACT.ORGANISATION_ID", "0") - .and("CONTACT.PERSON_ID is not null") - ) - ) + .andSqlCondition(conditionPrivateOrganisation) .andPrepareIfSet("CONTACT.ORGANISATION_ID", orgContactId); result.string(db.translateCondition(cond.build())); \ No newline at end of file diff --git a/entity/AppointmentLink_entity/AppointmentLink_entity.aod b/entity/AppointmentLink_entity/AppointmentLink_entity.aod index 96f1092d82fc931390eaaf3c60647074329777df..092996034c1a7593a76ee2e45d5735dafd69b16f 100644 --- a/entity/AppointmentLink_entity/AppointmentLink_entity.aod +++ b/entity/AppointmentLink_entity/AppointmentLink_entity.aod @@ -2,6 +2,8 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>AppointmentLink_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Connection</title> + <titlePlural>Connections</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -21,6 +23,7 @@ <title>{$OBJECTLINK_OBJECT}</title> <consumer>Objects</consumer> <linkedContext>Object</linkedContext> + <stateProcess>%aditoprj%/entity/AppointmentLink_entity/entityfields/objectid/stateProcess.js</stateProcess> <displayValueProcess>%aditoprj%/entity/AppointmentLink_entity/entityfields/objectid/displayValueProcess.js</displayValueProcess> <onValueChangeTypes> <element>MASK</element> @@ -33,6 +36,7 @@ <title>{$OBJECTLINK_TYPE}</title> <consumer>Context</consumer> <linkedContext>Context</linkedContext> + <stateProcess>%aditoprj%/entity/AppointmentLink_entity/entityfields/objecttype/stateProcess.js</stateProcess> <displayValueProcess>%aditoprj%/entity/AppointmentLink_entity/entityfields/objecttype/displayValueProcess.js</displayValueProcess> </entityField> <entityParameter> @@ -79,7 +83,6 @@ <entityParameter> <name>ObjectType_param</name> <valueProcess>%aditoprj%/entity/AppointmentLink_entity/entityfields/objects/children/objecttype_param/valueProcess.js</valueProcess> - <expose v="true" /> </entityParameter> </children> </entityConsumer> @@ -93,6 +96,17 @@ <description>PARAMETER </description> </entityParameter> + <entityConsumer> + <name>AppointmentId</name> + <dependency> + <name>dependency</name> + </dependency> + </entityConsumer> + <entityParameter> + <name>AppointmentState_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/AppointmentLink_entity/entityfields/objectid/stateProcess.js b/entity/AppointmentLink_entity/entityfields/objectid/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..86bedbb9132874384726af15947b37cb8ffaa13d --- /dev/null +++ b/entity/AppointmentLink_entity/entityfields/objectid/stateProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("Appointment_lib"); +import("system.result"); + + +result.object(AppointmentUtils.setAppointmentLinkComponentState(vars.get("$sys.recordstate"), vars.get("$param.AppointmentState_param"), vars.get("$param.AppointmentId_param"), vars.get("$field.APPOINTMENT_ID"))); \ No newline at end of file diff --git a/entity/AppointmentLink_entity/entityfields/objecttype/stateProcess.js b/entity/AppointmentLink_entity/entityfields/objecttype/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e16281dbd490cb5be18c9cd4165791806615ff1d --- /dev/null +++ b/entity/AppointmentLink_entity/entityfields/objecttype/stateProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("Appointment_lib"); +import("system.result"); + + +result.object(AppointmentUtils.setAppointmentLinkComponentState(vars.get("$sys.recordstate"), vars.get("$param.AppointmentState_param"), vars.get("$param.AppointmentId_param"), vars.get("$field.APPOINTMENT_ID"))); + \ No newline at end of file diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index 2eb3ce3578a726d7ba9931a61e0cbf9376dfafb1..8df4714f502f274317ac3494694e278133d4b0c0 100644 --- a/entity/Appointment_entity/Appointment_entity.aod +++ b/entity/Appointment_entity/Appointment_entity.aod @@ -3,9 +3,10 @@ <name>Appointment_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Appointment_entity/documentation.adoc</documentation> - <title>Termin</title> + <title>Appointment</title> <siblings /> <afterUiInit>%aditoprj%/entity/Appointment_entity/afterUiInit.js</afterUiInit> + <titlePlural>Appointments</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> <entityField> @@ -74,6 +75,7 @@ <entityField> <name>ATTENDEES</name> <dropDownProcess>%aditoprj%/entity/Appointment_entity/entityfields/attendees/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/attendees/valueProcess.js</valueProcess> </entityField> <entityField> <name>TRANSPARENCY</name> @@ -122,6 +124,7 @@ </entityParameter> <entityField> <name>ORGANIZER</name> + <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/organizer/valueProcess.js</valueProcess> </entityField> <entityField> <name>RRULE</name> @@ -175,6 +178,10 @@ <name>AppointmentId_param</name> <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentid_param/valueProcess.js</valueProcess> </entityParameter> + <entityParameter> + <name>AppointmentState_param</name> + <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentstate_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityActionField> diff --git a/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentstate_param/valueProcess.js b/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentstate_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c7f221d6c7139420b24baeeab9e3100de3abf39c --- /dev/null +++ b/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentstate_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("system.vars"); + + +result.string(vars.get("$sys.recordstate")); \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/attendees/valueProcess.js b/entity/Appointment_entity/entityfields/attendees/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..859cad665fdec3af8f47a5426d501905d1623e18 --- /dev/null +++ b/entity/Appointment_entity/entityfields/attendees/valueProcess.js @@ -0,0 +1,17 @@ +import("system.neon"); +import("system.vars"); +import("system.calendars"); +import("system.result"); + +/** + * Following if() is only for passing param-parts from "new Appointment"-Dialog to AppointmentEditViewTemplate + */ +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Entry_param") && vars.get("$this.value") == null) +{ + var event = JSON.parse(vars.getString("$param.Entry_param")); + + if(event[calendars.AFFECTEDUSERS]) + result.string(event[calendars.AFFECTEDUSERS]); +} +else + result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/begin/valueProcess.js b/entity/Appointment_entity/entityfields/begin/valueProcess.js index 0ec0da52b21a9bb3169b5447365dda3006449bfb..f87cdc03567024fded757914d9ee6b1587f2a258 100644 --- a/entity/Appointment_entity/entityfields/begin/valueProcess.js +++ b/entity/Appointment_entity/entityfields/begin/valueProcess.js @@ -1,3 +1,4 @@ +import("system.logging"); import("system.neon"); import("system.vars"); import("system.calendars"); @@ -10,6 +11,8 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$para { var event = JSON.parse(vars.getString("$param.Entry_param")); - if(event[calendars.DTSTART]) + if(vars.get("$this.value")) + result.string(vars.get("$this.value")); + else if(event[calendars.DTSTART]) result.string(event[calendars.DTSTART]); } \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js b/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js index f4c74851bc407a263811db26812e1ebfb750bbee..2ca0974708bebf947414e02acea304389cdad456 100644 --- a/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js +++ b/entity/Appointment_entity/entityfields/deleteseries/stateProcess.js @@ -11,10 +11,14 @@ var event = JSON.parse(vars.getString("$param.Entry_param")); if(event) //event not empty { - var ownerCn = event[calendars.USER2]["cn"]; + var orga = event[calendars.ORGANIZER2]; + var orgaCn; + if(orga) + orgaCn = orga["cn"]; + var currentUserTitle = vars.getString("$sys.user"); - if(event[calendars.RECURRENCEID] && ownerCn == currentUserTitle) //serientermin und currentUser der TerminOwner + if(event[calendars.RECURRENCEID] && ((orgaCn == currentUserTitle)))//) || calendars.getBackendType() == calendars.BACKEND_EXCHANGEWS)) //serientermin und currentUser der TerminOwner result.object(neon.COMPONENTSTATE_AUTO); else result.object(neon.COMPONENTSTATE_INVISIBLE); diff --git a/entity/Appointment_entity/entityfields/end/valueProcess.js b/entity/Appointment_entity/entityfields/end/valueProcess.js index 3ed796fe837b42f4eec0696316a9f20e6654a7eb..284d2d66518b86d3727a04d3ab07ebe1ba250662 100644 --- a/entity/Appointment_entity/entityfields/end/valueProcess.js +++ b/entity/Appointment_entity/entityfields/end/valueProcess.js @@ -10,6 +10,8 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$para { var event = JSON.parse(vars.getString("$param.Entry_param")); - if(event[calendars.DTEND]) + if(vars.get("$this.value")) + result.string(vars.get("$this.value")); + else if(event[calendars.DTEND]) result.string(event[calendars.DTEND]); } \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/organizer/valueProcess.js b/entity/Appointment_entity/entityfields/organizer/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6b6bc2ad590eb64263ab1584a2e78b7c1e3bfaea --- /dev/null +++ b/entity/Appointment_entity/entityfields/organizer/valueProcess.js @@ -0,0 +1,19 @@ +import("system.logging"); +import("system.neon"); +import("system.vars"); +import("system.calendars"); +import("system.result"); + +/** + * Following if() is only for passing param-parts from "new Appointment"-Dialog to AppointmentEditViewTemplate + */ +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Entry_param")) +{ + var event = JSON.parse(vars.getString("$param.Entry_param")); + + if(vars.get("$this.value")) + result.object(vars.get("$this.value")); + + else if(event[calendars.ORGANIZER2]) + result.object(event[calendars.ORGANIZER2]["paramvalue"]); +} \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js index dfd62b94a1176ede906519a489deb05f5aeb06d1..d8b40a8d06cb04e1ebfde21704f5c00f74d85de3 100644 --- a/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js +++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js @@ -1,22 +1,22 @@ -import("system.calendars"); -import("system.vars"); -import("system.text"); -import("system.neon"); -import("Appointment_lib"); - -var currentUserEncodedString = calendars.getCalendarUser(vars.getString("$sys.user")); -var currentUserDecodedArray = text.decodeMS(currentUserEncodedString); -var currentUserUri = currentUserDecodedArray[0]; - -var newState = "ACCEPTED"; - -if(calendars.getBackendType() == calendars.BACKEND_EXCHANGEWS) -{ - AppointmentUtils.sendExchangedAction(vars.getString("$param.Entry_param"), newState); -} -else -{ - var currentAttendees = vars.get("$field.ATTENDEES"); - var updatedAttendees = AppointmentUtils.setPartStat(currentUserUri, currentAttendees, newState); - neon.setFieldValue("$field.ATTENDEES", updatedAttendees); -} +import("system.calendars"); +import("system.vars"); +import("system.text"); +import("system.neon"); +import("Appointment_lib"); + +var currentUserEncodedString = calendars.getCalendarUser(vars.getString("$sys.user")); +var currentUserDecodedArray = text.decodeMS(currentUserEncodedString); +var currentUserUri = currentUserDecodedArray[0]; + +var newState = "ACCEPTED"; + +if(calendars.getBackendType() == calendars.BACKEND_EXCHANGEWS) +{ + AppointmentUtils.sendExchangedAction(vars.getString("$param.Entry_param"), newState); +} +else +{ + var currentAttendees = vars.get("$field.ATTENDEES"); + var updatedAttendees = AppointmentUtils.setPartStat(currentUserUri, currentAttendees, newState); + neon.setFieldValue("$field.ATTENDEES", updatedAttendees); +} diff --git a/entity/Appointment_entity/entityfields/summary/onValueChange.js b/entity/Appointment_entity/entityfields/summary/onValueChange.js index 5c77a90fc3af3a8375d03d5fe6e2ca4634f0027a..968228a7cd631a96b8dec4ad234b787d16ac3953 100644 --- a/entity/Appointment_entity/entityfields/summary/onValueChange.js +++ b/entity/Appointment_entity/entityfields/summary/onValueChange.js @@ -1,10 +1,10 @@ -import("system.neon"); -import("system.vars"); -import("system.calendars"); - - -//var entry = JSON.parse(vars.get("$param.Entry_param")); -// -//entry[calendars.SUMMARY] = vars.get("$field.SUMMARY"); -// +import("system.neon"); +import("system.vars"); +import("system.calendars"); + + +//var entry = JSON.parse(vars.get("$param.Entry_param")); +// +//entry[calendars.SUMMARY] = vars.get("local.value"); +// //neon.setFieldValue("$param.Entry_param", JSON.stringify(entry)); \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/summary/valueProcess.js b/entity/Appointment_entity/entityfields/summary/valueProcess.js index 11b4a7d531c3c796fc2fc75a60121f402f08d628..ce113bfd4192021c64648fbde097edb7f970ff3d 100644 --- a/entity/Appointment_entity/entityfields/summary/valueProcess.js +++ b/entity/Appointment_entity/entityfields/summary/valueProcess.js @@ -6,7 +6,7 @@ import("system.result"); /** * Following if() is only for passing param-parts from "new Appointment"-Dialog to AppointmentEditViewTemplate */ -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Entry_param") && !vars.get("$field.SUMMARY")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.Entry_param") && vars.get("$this.value") == null) { var event = JSON.parse(vars.getString("$param.Entry_param")); @@ -14,4 +14,4 @@ if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$para result.string(event[calendars.SUMMARY]); } else - result.string(vars.get("$field.SUMMARY")); \ No newline at end of file + result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Appointment_entity/entityfields/uid/valueProcess.js b/entity/Appointment_entity/entityfields/uid/valueProcess.js index 85c485a5e49ef24d8752fb4bc217ed12223c1ca3..5b429ea087f9fe0b00ec62303ac056d2eeff5f3d 100644 --- a/entity/Appointment_entity/entityfields/uid/valueProcess.js +++ b/entity/Appointment_entity/entityfields/uid/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.util"); -if(!(vars.get("$field.UID"))) +if(!(vars.get("$this.value"))) result.string(util.getNewUUID()); else - result.string(vars.get("$field.UID")); \ No newline at end of file + result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js index 240de2d44397c0acee5d8311b5b41941549b68c2..2d95082b91c6b532bed64f995ff13141ad8c9c27 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js @@ -13,6 +13,8 @@ import("system.entities") var cond = SqlCondition.begin(); +var appointmentUids; +var idscond; if(vars.get("$local.idvalues") != null && vars.get("$local.idvalues") != "") { @@ -24,10 +26,10 @@ else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param")) { var contactid = tools.getCurrentUser()["params"]["contactID"]; - cond.andPrepareValue("AB_APPOINTMENTLINK.OBJECT_ROWID", contactid) - var idscond = db.translateCondition(cond.build("1 = 1")); + cond.andPrepareIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", contactid) + idscond = db.translateCondition(cond.build("1 = 1")); - var appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond); + appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond); result.object(buildEntriesFromUids(appointmentUids)); } @@ -37,9 +39,9 @@ else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param")) else if(vars.getString("$param.LinkedObjectId_param") != undefined) { cond.andPrepareVars("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param") - var idscond = db.translateCondition(cond.build("1 = 1")); + idscond = db.translateCondition(cond.build("1 = 1")); - var appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond); + appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond); result.object(buildEntriesFromUids(appointmentUids)); } /** diff --git a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js index 7abca1e85cd72262cbcde93854d041f1a6956211..a10d6981b7cb7688e62071048e10588f7d1cfc58 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js @@ -11,14 +11,15 @@ if (vars.exists("$param.Entry_param")) var reccurenceid = entry[calendars.RECURRENCEID]; if (reccurenceid == undefined) reccurenceid = null; - calendars.removeEntryByUID(calendars.VEVENT, vars.get("$sys.user"), entry[calendars.ID], reccurenceid) + + calendars.removeEntryByUID(calendars.VEVENT, entry[calendars.USER2]["cn"], entry[calendars.ID], reccurenceid) /** * Deletes ApointmentLinks referring to the deleted Appointment. */ var cond = SqlCondition.begin(); - cond.andPrepareValue("AB_APPOINTMENTLINK.APPOINTMENT_ID", entry[calendars.ID]) + cond.andPrepareIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", entry[calendars.ID]) var idscond = db.translateCondition(cond.build("1 = 2")); db.deleteData("AB_APPOINTMENTLINK", idscond); diff --git a/entity/Appointment_entity/recordcontainers/jdito/onInsert.js b/entity/Appointment_entity/recordcontainers/jdito/onInsert.js index c995f2f3bdbb6abd8627f27d33e9f3c0103fee7a..0fae64a0fc169097998751a3476c91180f32f7a6 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Appointment_entity/recordcontainers/jdito/onInsert.js @@ -13,22 +13,9 @@ import("system.tools"); var event = JSON.parse(vars.getString("$param.Entry_param")); var fields = vars.get("$local.rowdata"); -logging.log(JSON.stringify(fields)); event[calendars.TYPE] = calendars.VEVENT; event[calendars.ID] = ""; //wenn hier neue id erstellt und mitgegeben wird, wird versucht einen termin mit dieser id zu finden, den es nicht gibt. also leer. -//event[calendars.AFFECTEDUSERS] = vars.get("$field.ATTENDEES"); -//event[calendars.STATUS] = vars.getString("$field.STATUS"); -//event[calendars.SUMMARY] = vars.getString("$field.SUMMARY"); -//event[calendars.LOCATION] = vars.get("$field.LOCATION"); -//event[calendars.DESCRIPTION] = vars.get("$field.DESCRIPTION"); -//event[calendars.DTSTART] = vars.get("$field.BEGIN"); -//event[calendars.DTEND] = vars.get("$field.END"); -//event["X-ADITO-ISALLDAYEVENT"] = vars.get("$field.ALLDAY"); -//event[calendars.CLASSIFICATION] = vars.get("$field.CLASSIFICATION"); -//event[calendars.TRANSPARENCY] = vars.get("$field.TRANSPARENCY"); -//event[calendars.CATEGORIES] = vars.get("$field.CATEGORIES"); - event[calendars.AFFECTEDUSERS] = fields["ATTENDEES.value"]; event[calendars.STATUS] = fields["STATUS.value"]; event[calendars.SUMMARY] = fields["SUMMARY.value"]; @@ -40,6 +27,7 @@ event["X-ADITO-ISALLDAYEVENT"] = fields["ALLDAY.value"]; event[calendars.CLASSIFICATION] = fields["CLASSIFICATION.value"]; event[calendars.TRANSPARENCY] = fields["TRANSPARENCY.value"]; event[calendars.CATEGORIES] = fields["CATEGORIES.value"]; +event[calendars.ORGANIZER] = fields["ORGANIZER.value"]; if(fields["RRULE.value"]) event[calendars.RRULE] = [fields["RRULE.value"]]; @@ -48,264 +36,10 @@ if (fields["REMINDER.value"]) event[calendars.HASREMINDER] = "true"; event[calendars.REMINDER_DURATION] = fields["REMINDER.value"]; } + + var idstringarray = calendars.insert([event]); event[calendars.ID] = idstringarray[0]; neon.setFieldValue("$field.UID", event[calendars.ID]); vars.set("$context.editmode", calendars.MODE_UPDATE); - - - -// Liefert die Benutzer zurück, auf die keine Schreibrechte bestehen -function getReadOnlyUser() -{ - var writeable = calendars.getFullCalendarUsers(calendars.RIGHT_WRITE); - var affectedusers = vars.get("$context.affectedusers"); - var readonly = new Array(); - - for ( i = 0; i < affectedusers.length; i++) - { - var user = affectedusers[i][0]; - if (!isWriteable(user, writeable)) - readonly.push(affectedusers[i][3]); - } - return readonly; -} - -// Liefert TRUE, wenn der Benutzer bei denen mit Schreibberechtigungen enthalten ist -function isWriteable(user, writeable) -{ - for (var i = 0; i < writeable.length; i++) - { - if (writeable[i][0] == calendars.getCalendarUser(user)) - return true; - } - return false; -} - -// Berechnet das Ende der Recurrence -function recurrencend(event) -{ - var rec_end = vars.getString("$field.rec_end"); - - // Automatische Erkennung, was gewollt ist - if (rec_end == "") - { - if (vars.get("$field.rec_end_count") != "") - rec_end = "Endet nach Anzahl Terminen"; - else if (vars.get("$field.rec_end_date") != "") - rec_end = "Endet am"; - } - - if (rec_end == "" || rec_end == "Kein Enddatum") - { - // Nichts - } - else if (rec_end == "Endet nach Anzahl Terminen") - { - event[calendars.RRULE][0] += (";COUNT=" + vars.get("$field.rec_end_count")); - } - else if (rec_end == "Endet am") - { - var dat = vars.get("$field.rec_end_date"); - var start = vars.get("$field.start_date"); - var localTime = datetime.toDate(dat, translate.text("yyyyMMdd")) + datetime.toDate(start, "HHmmss"); - var utcTime = datetime.toLong(localTime, "yyyyMMddHHmmss"); - event[calendars.RRULE][0] += (";UNTIL=" + datetime.toDate(utcTime, "yyyyMMdd\'T\'HHmmss\'Z\'", "UTC")); - } -} - -/** - * Berechnet die Wiederholung - * - * @param event Das fertige Event. Hier die Reccurrence speichern - */ -function calcrecurrence(event) -{ - var rec_type = vars.get("$field.rec_type"); - - if (rec_type == "") - { - // Nichts - } - else if (rec_type == "Keine") - { - } - else if (rec_type == "Täglich") - { - rec_daily(event); - } - else if (rec_type == "Wöchentlich") - { - rec_weekly(event); - } - else if (rec_type == "Monatlich") - { - rec_monthly(event); - } - else if (rec_type == "Jährlich") - { - rec_yearly(event); - } - else - { - question.showMessage("Internal (1) " + rec_type); - } -} -/***********************/ -function rec_yearly(event) -{ - var rec_year = vars.get("$field.rec_yearly"); - var rec_yearly_month = vars.get("$field.rec_yearly_month"); - var rec_yearly_day = vars.get("$field.rec_yearly_day"); - var month; - var day; - - if (rec_year == "") - { - if (rec_yearly_month != "" && rec_yearly_day != "") - rec_year = "Jeden # #"; - else if (rec_yearly_month != "" && vars.get("$field.rec_yearly_day2") != "" && vars.get("$field.rec_yearly_number2") != "") - rec_year = "Am #. # im #"; - } - - if (rec_year == "" || (rec_yearly_month == "" && rec_yearly_day == "" )) - { - question.showMessage(translate.text("yearly series not specified")); - } - else if (rec_year == "Jeden # #") - { - month = rec_yearly_month; - day = rec_yearly_day; - event[calendars.RRULE] = new Array("FREQ=YEARLY;BYMONTHDAY="+day+";BYMONTH="+month); - } - else if (rec_year == "Am #. # im #") - { - month = vars.get("$field.rec_yearly_month2"); - day = vars.get("$field.rec_yearly_day2"); - var number = vars.get("$field.rec_yearly_number2"); - event[calendars.RRULE] = new Array("FREQ=YEARLY;BYMONTH="+month+";BYDAY="+number+day); - } -} -/***********************/ -function rec_monthly(event) -{ - var rec_month = vars.get("$field.rec_month"); - var rec_monthly_day = vars.get("$field.rec_monthly_day"); - var rec_monthly_interval = vars.get("$field.rec_monthly_interval"); - var day; - var interval; - - if (rec_month == "") - - { - if (rec_monthly_day != "" && rec_monthly_interval != "") - rec_month = "Am #. jedes #. Monat"; - else if (vars.get("$field.rec_monthly_day2") != "" && vars.get("$field.rec_monthly_interval2") != "" && vars.get("$field.rec_monthly_weekday2") != "") - rec_month = "Am #. # jeden #. Monat"; - } - - if (rec_month == "" || (rec_monthly_day == "" && rec_monthly_interval != "")) - { - question.showMessage(translate.text("Ignore series")); - } - else if (rec_month == "Am #. jedes #. Monat") - { - day = rec_monthly_day; - interval = rec_monthly_interval; - event[calendars.RRULE] = new Array("FREQ=MONTHLY;INTERVAL=" + interval + ";BYMONTHDAY=" + day); - } - else if(rec_month == "Am #. # jeden #. Monat") - { - day = vars.get("$field.rec_monthly_day2"); - interval = vars.get("$field.rec_monthly_interval2"); - var weekday = vars.get("$field.rec_monthly_weekday2"); - event[calendars.RRULE] = new Array("FREQ=MONTHLY;INTERVAL=" + interval + ";BYDAY=" + day + weekday); - } -} -/***********************/ -function rec_weekly(event) -{ - - var rec_weekly_intervall = vars.get("$field.rec_weekly_intervall"); - if (rec_weekly_intervall == "") - rec_weekly_intervall = "1"; - - var days = new Array(); - var count = 0; - if (vars.get("$field.rec_weekly_mo") == "true") - { - days[count] = "MO"; - count++; - } - if (vars.get("$field.rec_weekly_di") == "true") - { - days[count] = "TU"; - count++; - } - if (vars.get("$field.rec_weekly_mi") == "true") - { - days[count] = "WE"; - count++; - } - if (vars.get("$field.rec_weekly_do") == "true") - { - days[count] = "TH"; - count++; - } - if (vars.get("$field.rec_weekly_fr") == "true") - { - days[count] = "FR"; - count++; - } - if (vars.get("$field.rec_weekly_sa") == "true") - { - days[count] = "SA"; - count++; - } - if (vars.get("$field.rec_weekly_so") == "true") - { - days[count] = "SU"; - count++; - } - if (count > 0) - { - event[calendars.RRULE] = new Array("FREQ=WEEKLY;INTERVAL=" + rec_weekly_intervall + ";WKST=MO;BYDAY="); - for (var i = 0; i < count; i++) - { - event[calendars.RRULE][0] += days[i]; - if (i+1 < count) - { - event[calendars.RRULE][0] += ","; - } - } - } -} -/***********************/ -function rec_daily(event) -{ - var rec_dailytype = vars.get("$field.rec_dailytype"); - var rec_dailydays = vars.get("$field.rec_daily_days"); - if (rec_dailytype == "") - { - if (rec_dailydays != "") - rec_dailytype = "Alle # Tage"; - } - - if (rec_dailytype == "" || rec_dailydays == "") - { - question.showMessage(translate.text("Ignore daily series")); - } - else if (rec_dailytype == "Alle # Tage") - { - event[calendars.RRULE] = new Array("FREQ=DAILY;INTERVAL=" + rec_dailydays); - } - else if (rec_dailytype == "Jeden Arbeitstag") - { - event[calendars.RRULE][0] = new Array("FREQ=WEEKLY;WKST=MO;BYDAY=MO,TU,WE,TH,FR"); - } - else - { - question.showMessage(translate.text("Internal (2)") + " " + rec_dailytype); - } -} \ No newline at end of file diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index cd169c8439d2fd697db68e5506a7abf41173eed5..7d902eb40b03b991a7849f18053fed0c49458420 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -2,6 +2,7 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>AttributeRelation_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Attribute</title> <grantDeleteProcess>%aditoprj%/entity/AttributeRelation_entity/grantDeleteProcess.js</grantDeleteProcess> <titlePlural>Attributes</titlePlural> <recordContainer>jdito</recordContainer> @@ -77,6 +78,18 @@ <fieldName>AttributeTree</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>661f5b91-f71e-429e-a170-8bd18781bc69</name> + <entityName>Campaign_entity</entityName> + <fieldName>AttributeTree</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>80a034ee-c3fd-45e3-986c-d3854608c148</name> + <entityName>Activity_entity</entityName> + <fieldName>AttributeTreeIsTheme</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -91,6 +104,7 @@ <title>Attribute</title> <consumer>SpecificAttribute</consumer> <mandatory v="false" /> + <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/onValueChange.js</onValueChange> @@ -107,6 +121,7 @@ <mandatoryProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/mandatoryProcess.js</mandatoryProcess> <dropDownProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/dropDownProcess.js</dropDownProcess> <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/value/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> @@ -133,6 +148,10 @@ <name>DisplaySimpleName_param</name> <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificattribute/children/displaysimplename_param/valueProcess.js</valueProcess> </entityParameter> + <entityParameter> + <name>AttributeTypes_param</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributetypes_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityParameter> @@ -253,6 +272,22 @@ <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/showdsgvomessage_param/valueProcess.js</valueProcess> <expose v="true" /> </entityParameter> + <entityField> + <name>PROTECTED</name> + <state>READONLY</state> + </entityField> + <entityField> + <name>ATTRIBUTE_TYPE</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attribute_type/valueProcess.js</valueProcess> + </entityField> + <entityParameter> + <name>AttributeId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>IsTheme_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -281,6 +316,12 @@ <jDitoRecordFieldMapping> <name>AB_ATTRIBUTE_ID.displayValue</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>PROTECTED.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ATTRIBUTE_TYPE.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..426197aa821da710cc50a22ee501178a5a6f6f99 --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + result.string(vars.exists("$param.GetTree_param") && vars.getString("$param.GetTree_param") == "true" + ? neon.COMPONENTSTATE_READONLY + : neon.COMPONENTSTATE_EDITABLE + ); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/valueProcess.js b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/valueProcess.js index d275fe78758974383fb7699c954e3f72cbdf5c3e..10be88dcbfaf76cace1f3b58644b421caf116da8 100644 --- a/entity/AttributeRelation_entity/entityfields/ab_attribute_id/valueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/ab_attribute_id/valueProcess.js @@ -1,5 +1,5 @@ import("system.vars"); import("system.result"); -if (vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") && !vars.get("$this.value")) +if (vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") && vars.get("$this.value") == null) result.string(vars.get("$param.AttributeId_param")); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/attribute_type/valueProcess.js b/entity/AttributeRelation_entity/entityfields/attribute_type/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d2aeff72515cf0dce2c07099fec46586c29dc9a8 --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/attribute_type/valueProcess.js @@ -0,0 +1,5 @@ +import("Attribute_lib"); +import("system.vars"); +import("system.result"); + +result.string(AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID"))); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributetypes_param/valueProcess.js b/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributetypes_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8a91185ddf26e070218c0793881aceb78648a8cb --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/specificattribute/children/attributetypes_param/valueProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var isTheme = vars.exists("$param.IsTheme_param") && vars.getString("$param.IsTheme_param") == "true"; +if (isTheme) + result.object([$AttributeTypes.THEME.toString()]); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value/contentTypeProcess.js b/entity/AttributeRelation_entity/entityfields/value/contentTypeProcess.js index e692170633914456e09edf154860eb0a1f6842ef..e67d19d3de3d5cff26269573eb67d37da0891d69 100644 --- a/entity/AttributeRelation_entity/entityfields/value/contentTypeProcess.js +++ b/entity/AttributeRelation_entity/entityfields/value/contentTypeProcess.js @@ -1,6 +1,6 @@ -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - -var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = vars.get("$field.ATTRIBUTE_TYPE"); result.string(AttributeTypeUtil.getContentType(attributeType)); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value/displayValueProcess.js b/entity/AttributeRelation_entity/entityfields/value/displayValueProcess.js index 771696f538471395d9e0012ab3397d7964414feb..415b66e5b08b02ef55d723874a37a2ea8c83b1c5 100644 --- a/entity/AttributeRelation_entity/entityfields/value/displayValueProcess.js +++ b/entity/AttributeRelation_entity/entityfields/value/displayValueProcess.js @@ -7,7 +7,7 @@ import("Keyword_lib"); import("system.tools"); import("Sql_lib"); -var attrType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); +var attrType = vars.get("$field.ATTRIBUTE_TYPE"); var dropDownDef = db.cell( SqlCondition.begin() .andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID") diff --git a/entity/AttributeRelation_entity/entityfields/value/dropDownProcess.js b/entity/AttributeRelation_entity/entityfields/value/dropDownProcess.js index 376abc7f398336a703ed8f3eb2e62efa6c14cadc..97299f24fac3871d22f298898155e7cb99f9b172 100644 --- a/entity/AttributeRelation_entity/entityfields/value/dropDownProcess.js +++ b/entity/AttributeRelation_entity/entityfields/value/dropDownProcess.js @@ -7,58 +7,7 @@ import("Attribute_lib"); import("Sql_lib"); var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); -var attrType = AttributeUtil.getAttributeType(attributeId); +var attrType = vars.get("$field.ATTRIBUTE_TYPE"); -if (attrType == $AttributeTypes.COMBO) -{ - var valueSql = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_ACTIVE", "1") - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", attributeId) - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE) - .buildSql("select AB_ATTRIBUTEID, ATTRIBUTE_NAME from AB_ATTRIBUTE", "1=2", "order by SORTING asc"); - var valueList = db.table(valueSql); - for (let i = 0; i < valueList.length; i++) - { - valueList[i][1] = translate.text(valueList[i][1]); - } - result.object(valueList); -} -else if (attrType == $AttributeTypes.BOOLEAN) -{ - result.object([ - ["1", translate.text("Yes")], - ["0", translate.text("No")] - ]); -} - -//TODO this is a workaround for keywords, when it's possible to use the consumer remove this -else if (attrType == $AttributeTypes.KEYWORD) -{ - var attrKeywordSelect = "select DROPDOWNDEFINITION from AB_ATTRIBUTE"; - attrKeywordSelect = SqlCondition.begin() - .andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID") - .buildSql(attrKeywordSelect); - - var sql = SqlCondition.begin() - .andPrepare("AB_KEYWORD_ENTRY.CONTAINER", db.cell(attrKeywordSelect)) - .buildSql("select AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ENTRY.TITLE from AB_KEYWORD_ENTRY", "1=2", "order by SORTING asc"); - var keywords = db.table(sql).map(function (row) - { - return [row[0], translate.text(row[1])]; - }); - - result.object(keywords); -} -else if (attrType == $AttributeTypes.OBJECTSELECTION) -{ - var module = db.cell(SqlCondition.begin() - .andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$field.AB_ATTRIBUTE_ID") - .buildSql("select DROPDOWNDEFINITION from AB_ATTRIBUTE") - ); - var objects = []; - objects = db.table(ContextUtils.getContextDataSql(module)); - - result.object(objects); -} -else - result.object(null) \ No newline at end of file +var res = AttributeUtil.getPossibleListValues(attributeId, attrType); +result.object(res); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value/mandatoryProcess.js b/entity/AttributeRelation_entity/entityfields/value/mandatoryProcess.js index 74867490f68c0e9893aaba0269418c05d73f29cf..010fc7942edf14e1b87047b12448baa43f0ebcf8 100644 --- a/entity/AttributeRelation_entity/entityfields/value/mandatoryProcess.js +++ b/entity/AttributeRelation_entity/entityfields/value/mandatoryProcess.js @@ -1,7 +1,7 @@ -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - -var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); -var contentType = AttributeTypeUtil.getContentType(attributeType); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = vars.get("$field.ATTRIBUTE_TYPE"); +var contentType = AttributeTypeUtil.getContentType(attributeType); result.string(contentType != null && contentType != "BOOLEAN"); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value/stateProcess.js b/entity/AttributeRelation_entity/entityfields/value/stateProcess.js index 0b23749b7d7d3fcb6da503602a3d618f05383802..48ef8ec666c62831d18b91612449fbaf40a2722c 100644 --- a/entity/AttributeRelation_entity/entityfields/value/stateProcess.js +++ b/entity/AttributeRelation_entity/entityfields/value/stateProcess.js @@ -1,14 +1,14 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - -var attributeType = AttributeUtil.getAttributeType(vars.get("$field.AB_ATTRIBUTE_ID")); -result.string(AttributeTypeUtil.getContentType(attributeType)); -var fieldState; -if (AttributeTypeUtil.getContentType(attributeType) != null) - fieldState = neon.COMPONENTSTATE_EDITABLE; -else - fieldState = neon.COMPONENTSTATE_READONLY; - +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var attributeType = vars.get("$field.ATTRIBUTE_TYPE"); +result.string(AttributeTypeUtil.getContentType(attributeType)); +var fieldState; +if (AttributeTypeUtil.getContentType(attributeType) != null) + fieldState = neon.COMPONENTSTATE_EDITABLE; +else + fieldState = neon.COMPONENTSTATE_READONLY; + result.string(fieldState); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/entityfields/value/valueProcess.js b/entity/AttributeRelation_entity/entityfields/value/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0257edcb7c0a24334e29b733a1267c1dcc49d641 --- /dev/null +++ b/entity/AttributeRelation_entity/entityfields/value/valueProcess.js @@ -0,0 +1,9 @@ +import("Attribute_lib"); +import("system.vars"); +import("system.result"); + + +var attributeType = vars.get("$field.ATTRIBUTE_TYPE"); +var contentType = AttributeTypeUtil.getContentType(attributeType); +if (!vars.get("$this.value") && contentType == "BOOLEAN") + result.string("0"); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/grantDeleteProcess.js b/entity/AttributeRelation_entity/grantDeleteProcess.js index cb200b5bf984c5adbe8866c533160887bfe4e202..6e445404085795938d5735c51d61f73e865d4176 100644 --- a/entity/AttributeRelation_entity/grantDeleteProcess.js +++ b/entity/AttributeRelation_entity/grantDeleteProcess.js @@ -1,8 +1,4 @@ -import("Attribute_lib"); import("system.result"); import("system.vars"); -var objectType = vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"); -var rowId = vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"); -if (vars.get("$param.GetTree_param") == "true" && rowId) - result.object(AttributeRelationUtils.countAttributeRelations(rowId, objectType) != 0); \ No newline at end of file +result.object(vars.get("$field.PROTECTED") != "true"); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js b/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js index c13cda25c21f4704cdc9e39fbf9b6e0843395c13..691df5362c933e7f12bbad797908bfb221ff8cf9 100644 --- a/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/AttributeRelation_entity/recordcontainers/jdito/contentProcess.js @@ -22,6 +22,8 @@ var sqlCondition = new SqlCondition(); //where-condition (condition for the Attr var joinCondition = new SqlCondition(); //condition for the joined values (for AttributeRelation) //=> these are two distinct conditions because if showEmpty is true, a left join is used for the relations +var possibleAttributes = AttributeUtil.getPossibleAttributes(objectType); + if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) { let idVals = vars.get("$local.idvalues"); @@ -45,7 +47,6 @@ else if (showEmpty || rowId) { let filtered = vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param"); - let possibleAttributes = AttributeUtil.getPossibleAttributes(objectType); sqlCondition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", possibleAttributes); } if (vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param")) @@ -73,6 +74,12 @@ if (rowId) sqlCondition.and("1=1"); } +var isTheme = vars.exists("$param.IsTheme_param") && vars.getString("$param.IsTheme_param") == "true"; +if (isTheme) + sqlCondition.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.THEME); +else + sqlCondition.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.THEME, "# != ?"); + joinCondition.and("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID"); var defaultFields = [ @@ -98,6 +105,23 @@ else attributeSql.leftJoin("AB_ATTRIBUTE", "COMBOVAL.AB_ATTRIBUTEID = " + $AttributeTypes.COMBO.databaseField, "COMBOVAL"); +var countCheck = {}; +if (getTree) +{ + let minUsages = db.table(SqlCondition.begin() + .andIn("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", possibleAttributes) + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", objectType) + .buildSql("select AB_ATTRIBUTE_ID, MIN_COUNT from AB_ATTRIBUTEUSAGE", "1=2") + ); + minUsages.forEach(function (usage) + { + this[usage[0]] = { + count : 0, + min : usage[1] + }; + }, countCheck); +} + var attributeValues = db.table(attributeSql.build()).map(function (row) { var attributeId = row[1]; @@ -115,11 +139,20 @@ var attributeValues = db.table(attributeSql.build()).map(function (row) else viewValue = AttributeTypeUtil.getAttributeViewValue(type, value, row[5]); + if (attributeId in countCheck) + countCheck[attributeId].count++; + //TODO: what should be the uid if showEmpty is true? // V-- set "," to mark this as new generated UUID - return [row[0] || util.getNewUUID() + "," + attributeId, row[2], value, viewValue, attributeId, attributeName]; + return [row[0] || util.getNewUUID() + "," + attributeId, row[2], value, viewValue, attributeId, attributeName, "", row[3].trim()]; }); +for (let i = 0; i < attributeValues.length; i++) +{ + let attrId = attributeValues[i][4]; + if (attrId in countCheck && countCheck[attrId].min >= countCheck[attrId].count) + attributeValues[i][6] = "true"; +} var parentAttributes = []; var attributeObj = {}; //object of attribute ids to avoid duplicates @@ -151,7 +184,7 @@ function _fetchAttributes (pAttributeIds) else row[1] = null; row[2] = translate.text(row[2]); //translate attribute name - parentAttributes.push([row[0], row[1], "", "", "", row[2]]); + parentAttributes.push([row[0], row[1], "", "", "", row[2], "true", ""]); }, attributeObj); if (nextIds.length) diff --git a/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js b/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js index 9efed36fc2699e14e3c6f4baa4cd4c62ceef938e..37bcaa77b0db79fa17fea2c66c834500bec6d8c9 100644 --- a/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js +++ b/entity/AttributeUsage_entity/entityfields/ab_attribute_id/valueProcess.js @@ -1,8 +1,8 @@ -import("system.vars"); -import("system.result"); -import("system.neon"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") != null) - result.string(vars.get("$param.AttributeId_param")); -else if (vars.get("$field.AB_ATTRIBUTE_ID")) - result.string(vars.get("$field.AB_ATTRIBUTE_ID")); \ No newline at end of file +import("system.vars"); +import("system.result"); +import("system.neon"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") != null) + result.string(vars.get("$param.AttributeId_param")); +else if (vars.get("$this.value")) + result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/max_count/displayValueProcess.js b/entity/AttributeUsage_entity/entityfields/max_count/displayValueProcess.js index 8d45182f23c7ed4583c8b410ab827802792cf959..f1159a248acb0d346960c575a29530e1bcb5a622 100644 --- a/entity/AttributeUsage_entity/entityfields/max_count/displayValueProcess.js +++ b/entity/AttributeUsage_entity/entityfields/max_count/displayValueProcess.js @@ -2,5 +2,5 @@ import("system.translate"); import("system.result"); import("system.vars"); -var minCount = vars.get("$this.value"); +var minCount = vars.get("$field.MAX_COUNT"); result.string(minCount != 0 ? translate.text("Maximal") + " " + minCount : ""); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js b/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js index 96735194f37f6ce825c6d1ad41109100193ae56f..0a2f0bdb56a56e509e8977dfd6e93d0eb02994c3 100644 --- a/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js +++ b/entity/AttributeUsage_entity/entityfields/max_count/onValidation.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.translate"); import("Entity_lib"); -var maxCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MAX_COUNT")); +var maxCount = vars.get("local.value"); if (maxCount) { diff --git a/entity/AttributeUsage_entity/entityfields/min_count/displayValueProcess.js b/entity/AttributeUsage_entity/entityfields/min_count/displayValueProcess.js index 891ef3951fb86a9caa2840f3d731797fdbb3577f..93dcdeb41607c332bef72f8af48d3447a7123500 100644 --- a/entity/AttributeUsage_entity/entityfields/min_count/displayValueProcess.js +++ b/entity/AttributeUsage_entity/entityfields/min_count/displayValueProcess.js @@ -2,5 +2,5 @@ import("system.translate"); import("system.result"); import("system.vars"); -var minCount = vars.get("$this.value"); +var minCount = vars.get("$field.MIN_COUNT"); result.string(minCount != 0 ? translate.text("Minimal") + " " + minCount : ""); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js b/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js index 2f28221a1b6275fe7bf3dc84a2fe25b49f54f1c7..2536dedb73b98b6155d33b75f36cc5df94bc0b63 100644 --- a/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js +++ b/entity/AttributeUsage_entity/entityfields/min_count/onValidation.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.translate"); import("Entity_lib"); -var minCount = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MIN_COUNT")); +var minCount = vars.get("local.value"); if (minCount) { diff --git a/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js b/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js index 03fa933bbc75f782259828e7771b24d8912ef0a5..f28818dcfa611f2cdae014095414c5ce2383a129 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/conditionProcess.js @@ -1,7 +1,7 @@ import("system.result"); import("system.vars"); -if(vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param") != null) +if(vars.exists("$param.AttributeId_param") && vars.get("$param.AttributeId_param")) result.string("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = ('" + vars.getString("$param.AttributeId_param") + "')"); else result.string("1 = 2"); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js b/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js index b41e99cd82af7be8fd94faddd41fda7feb3e733e..c3a22ddade799d36cd601b8c6651923aeb730984 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/onDBDelete.js @@ -1,7 +1,7 @@ import("system.vars"); import("Attribute_lib"); -var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); -var objectType = vars.get("$field.OBJECT_TYPE"); +var data = vars.get("$local.rowdata"); +var objectType = data["OBJECT_TYPE.value"]; AttributeUsageUtil.deleteChildrenUsages(attributeId, objectType); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js b/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js index 73c28f291697502a3d36b35e3b5878ecefdf14a1..cb887e053582826c07d856e0371c4cee9c7d91ec 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/onDBInsert.js @@ -1,8 +1,9 @@ import("system.vars"); import("Attribute_lib"); -var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); -var objectType = vars.get("$field.OBJECT_TYPE"); +var data = vars.get("$local.rowdata"); +var attributeId = data["AB_ATTRIBUTE_ID.value"]; +var objectType = data["OBJECT_TYPE.value"]; AttributeUsageUtil.insertChildrenUsages(attributeId, objectType); AttributeUsageUtil.removeDuplicates(attributeId); \ No newline at end of file diff --git a/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js b/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js index 02890f1b92c8da2fd1f5849ad7855337ba6148ed..c32017dd3c683d7cb23b3da231eda5adeb7423cd 100644 --- a/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/AttributeUsage_entity/recordcontainers/db/onDBUpdate.js @@ -1,9 +1,10 @@ import("system.vars"); import("Attribute_lib"); -var attributeId = vars.get("$field.AB_ATTRIBUTE_ID"); +var data = vars.get("$local.rowdata"); +var attributeId = data["AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID"]; var oldObjectType = vars.get("$context.originalObjectType"); -var newObjectType = vars.get("$field.OBJECT_TYPE"); +var newObjectType = data["AB_ATTRIBUTEUSAGE.OBJECT_TYPE"]; AttributeUsageUtil.updateChildrenUsages(attributeId, oldObjectType, newObjectType); AttributeUsageUtil.removeDuplicates(attributeId); \ No newline at end of file diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index 82cf2ea6d656622625aeb7db24581806a66e613b..cc99164ec880429153f2d3fda1eaf2140fb7c9c6 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -13,6 +13,14 @@ <entityFields> <entityProvider> <name>#PROVIDER</name> + <dependencies> + <entityDependency> + <name>0691a752-4e4e-47b7-a376-f39655c0aa6f</name> + <entityName>Activity_entity</entityName> + <fieldName>ActivityAtrributes</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> </entityProvider> <entityField> <name>ATTRIBUTE_NAME</name> @@ -103,6 +111,10 @@ <name>GetGroups_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>AttributeTypes_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -155,11 +167,16 @@ <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/keywordattributetypes/children/containername_param/valueProcess.js</valueProcess> <expose v="true" /> </entityParameter> + <entityParameter> + <name>WhitelistIds_param</name> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/keywordattributetypes/children/whitelistids_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityField> <name>DROPDOWNDEFINITION</name> <title>Keyword</title> + <placeholderProcess>%aditoprj%/entity/Attribute_entity/entityfields/dropdowndefinition/placeholderProcess.js</placeholderProcess> <dropDownProcess>%aditoprj%/entity/Attribute_entity/entityfields/dropdowndefinition/dropDownProcess.js</dropDownProcess> <stateProcess>%aditoprj%/entity/Attribute_entity/entityfields/dropdowndefinition/stateProcess.js</stateProcess> <titleProcess>%aditoprj%/entity/Attribute_entity/entityfields/dropdowndefinition/titleProcess.js</titleProcess> @@ -273,6 +290,10 @@ <name>ObjectType_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>AttributeTypes_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityConsumer> @@ -330,6 +351,24 @@ <iconId>VAADIN:CURLY_BRACKETS</iconId> <stateProcess>%aditoprj%/entity/Attribute_entity/entityfields/openadminview/stateProcess.js</stateProcess> </entityActionField> + <entityField> + <name>DROPDOWNFILTER</name> + <title>Filter</title> + <contentType>FILTER_TREE</contentType> + </entityField> + <entityParameter> + <name>AttributeTypes_param</name> + <expose v="true" /> + </entityParameter> + <entityActionField> + <name>openDetails</name> + <onActionProcess>%aditoprj%/entity/Attribute_entity/entityfields/opendetails/onActionProcess.js</onActionProcess> + </entityActionField> + <entityParameter> + <name>ObjectRowId_param</name> + <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/objectrowid_param/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -347,18 +386,28 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ATTRIBUTE_PARENT_ID.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ATTRIBUTE_NAME.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ATTRIBUTE_ACTIVE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>DROPDOWNDEFINITION.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>DROPDOWNFILTER.value</name> + </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>SORTING.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ATTRIBUTE_TYPE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ATTRIBUTE_TYPE.displayValue</name> @@ -366,9 +415,6 @@ <jDitoRecordFieldMapping> <name>USAGELIST.value</name> </jDitoRecordFieldMapping> - <jDitoRecordFieldMapping> - <name>ATTRIBUTE_NAME.value</name> - </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ATTRIBUTE_PARENT_ID.displayValue</name> </jDitoRecordFieldMapping> diff --git a/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js index 246c17c087fbbb4d52c421b75fd2ed3cecd21442..ddd93fef102160327fc4b5788220b010328eace2 100644 --- a/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_active/valueProcess.js @@ -2,5 +2,5 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string("1"); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js index 640e5c1e11de0afafb7076b438e0532b6f1ea64c..ec0073a5e960afa705bdec743462eefd0eb123cf 100644 --- a/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js @@ -2,5 +2,5 @@ import("system.neon"); import("system.result"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.AttrParentId_param") && vars.get("$param.AttrParentId_param") && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.AttrParentId_param") && vars.get("$param.AttrParentId_param") && vars.get("$this.value") == null) result.string(vars.get("$param.AttrParentId_param")); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_type/onValueChange.js b/entity/Attribute_entity/entityfields/attribute_type/onValueChange.js index 680e7f2e1063cd169abc39d20c8f69490eace3f4..24139923a76e9f17e29bcd16815b207660766846 100644 --- a/entity/Attribute_entity/entityfields/attribute_type/onValueChange.js +++ b/entity/Attribute_entity/entityfields/attribute_type/onValueChange.js @@ -3,6 +3,6 @@ import("system.vars"); import("Attribute_lib"); import("Entity_lib"); -var type = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.ATTRIBUTE_TYPE")) || ""; -if (type.trim() != $AttributeTypes.KEYWORD && vars.get("$field.DROPDOWNDEFINITION")) +var type = vars.get("local.value") || ""; +if (type.trim() != $AttributeTypes.KEYWORD && vars.exists("$field.DROPDOWNDEFINITION") && vars.get("$field.DROPDOWNDEFINITION")) neon.setFieldValue("$field.DROPDOWNDEFINITION", ""); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/attribute_type/stateProcess.js b/entity/Attribute_entity/entityfields/attribute_type/stateProcess.js index 96d928dedfd2f51c83d050b84b51a34584412990..8c6709ec5b1ce2236dbb00e36c756b62b7e6bae4 100644 --- a/entity/Attribute_entity/entityfields/attribute_type/stateProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_type/stateProcess.js @@ -12,18 +12,14 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.r { var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); var parentType = AttributeUtil.getAttributeType(vars.get("$field.ATTRIBUTE_PARENT_ID")); - if (parentType == $AttributeTypes.COMBO || parentType == $AttributeTypes.VOID) - { - state = neon.COMPONENTSTATE_READONLY; - } - else if (AttributeTypeUtil.isGroupType(type)) + if (AttributeTypeUtil.isGroupType(type)) { var hasSubordinate = db.cell(SqlCondition.begin() .andPrepareVars("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", "$field.UID") .buildSql( - "select count(*) = 0 from AB_ATTRIBUTE", "1=2" + "select count(*) from AB_ATTRIBUTE", "1=2" //TODO: is there a way exists could be used? ) - ) != "true"; + ) != "0"; if (hasSubordinate) state = neon.COMPONENTSTATE_READONLY; } diff --git a/entity/Attribute_entity/entityfields/attribute_type/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_type/valueProcess.js index 4578988623607a371183c603776847748b0a392d..f71767310af882089ae2d9f01355f052721e2979 100644 --- a/entity/Attribute_entity/entityfields/attribute_type/valueProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_type/valueProcess.js @@ -7,10 +7,7 @@ import("Attribute_lib"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.ATTRIBUTE_PARENT_ID") != "") { var type = AttributeUtil.getAttributeType(vars.get("$field.ATTRIBUTE_PARENT_ID")); - if (type == $AttributeTypes.COMBO) - result.string($AttributeTypes.COMBOVALUE); - else if (type == $AttributeTypes.VOID) - result.string($AttributeTypes.VOID); - else if (vars.get("$this.value") == $AttributeTypes.COMBOVALUE) - result.string(""); + var possibleTypes = AttributeTypeUtil.getPossibleChildren(type); + if (possibleTypes && possibleTypes.length === 1) + result.string(possibleTypes[0]); } \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/dropdowndefinition/dropDownProcess.js b/entity/Attribute_entity/entityfields/dropdowndefinition/dropDownProcess.js index 413cfa7747294ec669a2457c17b562b6a0877c54..2ac4fdfe746f195614b2929afe827b16af8a8609 100644 --- a/entity/Attribute_entity/entityfields/dropdowndefinition/dropDownProcess.js +++ b/entity/Attribute_entity/entityfields/dropdowndefinition/dropDownProcess.js @@ -1,21 +1,13 @@ -import("system.translate"); -import("Context_lib"); -import("system.vars"); -import("system.result"); -import("Keyword_lib"); -import("Attribute_lib"); - -var res = []; -var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); -if (type == $AttributeTypes.KEYWORD) -{ - res = KeywordUtils.getContainerNames().map(function (e) - { - return [e, e];//currently the first column is ID, second view value - which is the same because there is no ID for keyword-containers - }); -} -else if (type == $AttributeTypes.OBJECTSELECTION) -{ - res = ContextUtils.getContexts(true); -} -result.object(res); +import("system.translate"); +import("Context_lib"); +import("system.vars"); +import("system.result"); +import("Keyword_lib"); +import("Attribute_lib"); + +var res = []; +var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); +var getDropDownFn = type && $AttributeTypes[type] && $AttributeTypes[type].getDropDownDefinitions; +if (getDropDownFn instanceof Function) + res = getDropDownFn.call(); +result.object(res); diff --git a/entity/Attribute_entity/entityfields/dropdowndefinition/placeholderProcess.js b/entity/Attribute_entity/entityfields/dropdowndefinition/placeholderProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7ef97b2dfac662713a40a02d0974ef2494ae311f --- /dev/null +++ b/entity/Attribute_entity/entityfields/dropdowndefinition/placeholderProcess.js @@ -0,0 +1,11 @@ +import("system.translate"); +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); +if (type == $AttributeTypes.KEYWORD) + result.string(translate.text("Keyword")); +else if (type == $AttributeTypes.OBJECTSELECTION) + result.string(translate.text("Module")); diff --git a/entity/Attribute_entity/entityfields/dropdowndefinition/stateProcess.js b/entity/Attribute_entity/entityfields/dropdowndefinition/stateProcess.js index 8335f36cceeaf1148dfe2e88e50b9ef1d8b565ec..f4447a5915899cbbef6950be1e099aa21a791f89 100644 --- a/entity/Attribute_entity/entityfields/dropdowndefinition/stateProcess.js +++ b/entity/Attribute_entity/entityfields/dropdowndefinition/stateProcess.js @@ -4,7 +4,8 @@ import("system.result"); import("Attribute_lib"); var fieldState; -if ((vars.get("$field.ATTRIBUTE_TYPE").trim() == $AttributeTypes.KEYWORD || vars.get("$field.ATTRIBUTE_TYPE").trim() == $AttributeTypes.OBJECTSELECTION) +var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); +if (type && $AttributeTypes[type] && $AttributeTypes[type].getDropDownDefinitions && !AttributeUtil.hasRelations(vars.get("$field.UID"))) fieldState = neon.COMPONENTSTATE_EDITABLE; else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) diff --git a/entity/Attribute_entity/entityfields/dropdowndefinition/titleProcess.js b/entity/Attribute_entity/entityfields/dropdowndefinition/titleProcess.js index f00cbd82e67e091c167605b83a160416e4b83853..7ef97b2dfac662713a40a02d0974ef2494ae311f 100644 --- a/entity/Attribute_entity/entityfields/dropdowndefinition/titleProcess.js +++ b/entity/Attribute_entity/entityfields/dropdowndefinition/titleProcess.js @@ -1,11 +1,11 @@ -import("system.translate"); -import("system.neon"); -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - -var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); -if (type == $AttributeTypes.KEYWORD) - result.string(translate.text("Keyword")); -else if (type == $AttributeTypes.OBJECTSELECTION) - result.string(translate.text("Module")); +import("system.translate"); +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var type = vars.get("$field.ATTRIBUTE_TYPE").trim(); +if (type == $AttributeTypes.KEYWORD) + result.string(translate.text("Keyword")); +else if (type == $AttributeTypes.OBJECTSELECTION) + result.string(translate.text("Module")); diff --git a/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js b/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js index ef43e6922bec83c1c7711e2023fbff06f4eb34a0..8778b5d409990f03002f22809ad317d160110d4b 100644 --- a/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js +++ b/entity/Attribute_entity/entityfields/full_attribute_name/valueProcess.js @@ -1,11 +1,11 @@ -import("system.vars"); -import("system.result"); -import("Attribute_lib"); - -var name = vars.get("$field.ATTRIBUTE_NAME"); -if (!(vars.exists("$param.DisplaySimpleName_param") && vars.get("$param.DisplaySimpleName_param"))) -{ - var parentName = AttributeUtil.getFullAttributeName(vars.get("$field.ATTRIBUTE_PARENT_ID")); - name = (parentName ? parentName + " / " : "") + name; -} +import("system.vars"); +import("system.result"); +import("Attribute_lib"); + +var name = vars.get("$this.value"); +if (!(vars.exists("$param.DisplaySimpleName_param") && vars.get("$param.DisplaySimpleName_param"))) +{ + var parentName = AttributeUtil.getFullAttributeName(vars.get("$field.ATTRIBUTE_PARENT_ID")); + name = (parentName ? parentName + " / " : "") + name; +} result.string(name); \ No newline at end of file diff --git a/entity/Attribute_entity/entityfields/keywordattributetypes/children/whitelistids_param/valueProcess.js b/entity/Attribute_entity/entityfields/keywordattributetypes/children/whitelistids_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7b6ff8c9c50d32b31512f753bbbb26440fc24382 --- /dev/null +++ b/entity/Attribute_entity/entityfields/keywordattributetypes/children/whitelistids_param/valueProcess.js @@ -0,0 +1,25 @@ +import("system.logging"); +import("system.db"); +import("system.neon"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + var possibleTypes; + if (vars.get("$field.ATTRIBUTE_PARENT_ID")) + { + var type = AttributeUtil.getAttributeType(vars.get("$field.ATTRIBUTE_PARENT_ID")); + possibleTypes = AttributeTypeUtil.getPossibleChildren(type); + } + if (!possibleTypes) + { + possibleTypes = []; + for (let attrType in $AttributeTypes) + if ($AttributeTypes[attrType].toString() != $AttributeTypes.COMBOVALUE.toString()) + possibleTypes.push($AttributeTypes[attrType].toString()); + } + logging.log(JSON.stringify(possibleTypes, null, "\t")) + result.object(possibleTypes); +} \ No newline at end of file diff --git a/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js b/entity/Attribute_entity/entityfields/objectrowid_param/valueProcess.js similarity index 100% rename from entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js rename to entity/Attribute_entity/entityfields/objectrowid_param/valueProcess.js diff --git a/entity/Attribute_entity/entityfields/opendetails/onActionProcess.js b/entity/Attribute_entity/entityfields/opendetails/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..20ae8eea182052eb33f1e3bc5a6056d28e7fe2a9 --- /dev/null +++ b/entity/Attribute_entity/entityfields/opendetails/onActionProcess.js @@ -0,0 +1,12 @@ +import("Context_lib"); +import("system.vars"); +import("system.neon"); + +var selection = vars.get("$sys.selection"); +var params = { + "AttributeId_param" : selection[0], + "ObjectRowId_param" : vars.get("$param.ObjectRowId_param"), + "ObjectType_param" : vars.get("$param.ObjectType_param") +} + +neon.openContext("AttributeRelation", "AttributeRelationTreeEdit_view", null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js b/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js index 54e00eb0a624331ee8d633d904a81cfcf5acdb1a..e4fd9e63f9acbce13f072c6c5e3be46ed3285263 100644 --- a/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js @@ -15,25 +15,17 @@ var parentType = vars.exists("$param.AttrParentType_param") && vars.get("$param. var fetchUsages = true; var translateName = false; -var uidTableAlias = "UIDROW"; -var sqlSelect = "select UIDROW.AB_ATTRIBUTEID, UIDROW.ATTRIBUTE_PARENT_ID, UIDROW.ATTRIBUTE_ACTIVE, UIDROW.DROPDOWNDEFINITION, UIDROW.SORTING, UIDROW.ATTRIBUTE_TYPE, " - + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.attributeType(), "UIDROW.ATTRIBUTE_TYPE") //3 - + ", '', UIDROW.ATTRIBUTE_NAME, PARENT1.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_NAME, PARENT3.ATTRIBUTE_NAME, PARENT3.ATTRIBUTE_PARENT_ID \n\ - from AB_ATTRIBUTE UIDROW \n\ - left join AB_ATTRIBUTE PARENT1 on UIDROW.ATTRIBUTE_PARENT_ID = PARENT1.AB_ATTRIBUTEID \n\ - left join AB_ATTRIBUTE PARENT2 ON PARENT1.ATTRIBUTE_PARENT_ID = PARENT2.AB_ATTRIBUTEID \n\ - left join AB_ATTRIBUTE PARENT3 ON PARENT2.ATTRIBUTE_PARENT_ID = PARENT3.AB_ATTRIBUTEID"; +var sqlSelect = "select AB_ATTRIBUTEID, ATTRIBUTE_PARENT_ID, ATTRIBUTE_NAME, ATTRIBUTE_ACTIVE, DROPDOWNDEFINITION, DROPDOWNFILTER, SORTING, ATTRIBUTE_TYPE, " + + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.attributeType(), "ATTRIBUTE_TYPE") //3 + + ", '', '', '' from AB_ATTRIBUTE"; -/* always select the names of the next 3 parents so that less queries - are required later when buildung the full name */ - -var sqlOrder = " order by UIDROW.ATTRIBUTE_PARENT_ID asc, UIDROW.SORTING asc"; +var sqlOrder = " order by ATTRIBUTE_PARENT_ID asc, SORTING asc"; var condition = SqlCondition.begin(); if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) { - condition.and("UIDROW.AB_ATTRIBUTEID in ('" + vars.get("$local.idvalues").join("','") + "')"); + condition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", vars.get("$local.idvalues")); } else if (getGroups) //if getGroups == true, it is the lookup for selecting the superordinate attribute { @@ -43,22 +35,24 @@ else if (getGroups) //if getGroups == true, it is the lookup for selecting the s for (let type in $AttributeTypes) if ($AttributeTypes[type].isGroup) { - isGroupCondition.orPrepare(["AB_ATTRIBUTE", "ATTRIBUTE_TYPE", uidTableAlias], $AttributeTypes[type]); + isGroupCondition.orPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes[type]); } condition.andSqlCondition(SqlCondition.begin() .andSqlCondition(isGroupCondition) - .andPrepareVars(["AB_ATTRIBUTE", "AB_ATTRIBUTEID", uidTableAlias], "$param.AttrParentId_param", "# != ?") - .and("UIDROW.AB_ATTRIBUTEID not in ('" + AttributeUtil.getAllChildren(vars.getString("$param.AttrParentId_param")).join("','") + "')") + .andPrepareVars("AB_ATTRIBUTE.AB_ATTRIBUTEID", "$param.AttrParentId_param", "# != ?") + .andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", AttributeUtil.getAllChildren(vars.getString("$param.AttrParentId_param")), null, true) ); } else if (objectType) //if there's an objectType, it comes from the AttributeRelation entity (lookup for the attribute selection) { var filteredAttributes = null; - if (vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param")) { + if (vars.exists("$param.AttributeTypes_param") && vars.getString("$param.AttributeTypes_param")) + condition.andIn("AB_ATTRIBUTE.ATTRIBUTE_TYPE", JSON.parse(vars.getString("$param.AttributeTypes_param"))); + + if (vars.exists("$param.FilteredAttributeIds_param") && vars.getString("$param.FilteredAttributeIds_param")) filteredAttributes = JSON.parse(vars.getString("$param.FilteredAttributeIds_param")); - } var attributeCount; if (vars.exists("$param.AttributeCount_param") && vars.get("$param.AttributeCount_param")) @@ -66,7 +60,7 @@ else if (objectType) //if there's an objectType, it comes from the AttributeRel var ids = AttributeUtil.getPossibleAttributes(objectType, false, filteredAttributes, attributeCount); if (ids.length > 0) - condition.and("UIDROW.AB_ATTRIBUTEID in ('" + ids.join("','") + "')"); + condition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", ids); else // do not return anything, if parameter is there but an empty array condition.and("1=2"); @@ -79,7 +73,7 @@ else if (parentType) //condition for all subordinate attributes of an attribute { var parentId = vars.exists("$param.AttrParentId_param") && vars.get("$param.AttrParentId_param"); if (parentId) - condition.and("UIDROW.AB_ATTRIBUTEID in ('" + AttributeUtil.getAllChildren(vars.getString("$param.AttrParentId_param")).join("','") + "')"); + condition.andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", AttributeUtil.getAllChildren(vars.getString("$param.AttrParentId_param"))); } else condition.and("1=2"); @@ -92,14 +86,14 @@ if (vars.exists("$local.filter") && vars.get("$local.filter")) { var filter = vars.get("$local.filter"); if (filter.filter) - condition.andSqlCondition(JditoFilterUtils.getSqlCondition(filter.filter, "AB_ATTRIBUTE", uidTableAlias)); + condition.andSqlCondition(JditoFilterUtils.getSqlCondition(filter.filter, "AB_ATTRIBUTE")); } var usages; if (fetchUsages) //this query is only necessary in Attribute, not in AttributeRelation { var usagesSelect = "select AB_ATTRIBUTE_ID, OBJECT_TYPE from AB_ATTRIBUTEUSAGE \n\ - join AB_ATTRIBUTE UIDROW on AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = UIDROW.AB_ATTRIBUTEID"; + join AB_ATTRIBUTE on AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID"; var usageTbl = db.table(condition.buildSql(usagesSelect, "1=1")); usages = {}; for (let i = 0, l = usageTbl.length; i < l; i++) @@ -114,12 +108,23 @@ if (fetchUsages) //this query is only necessary in Attribute, not in AttributeRe var attributes = db.table(condition.buildSql(sqlSelect, "1=1", sqlOrder)); +var allNames = db.table("select AB_ATTRIBUTEID, ATTRIBUTE_PARENT_ID, ATTRIBUTE_NAME from AB_ATTRIBUTE"); +var attrNameData = {}; +for (let i = 0, l = allNames.length; i < l; i++) +{ + attrNameData[allNames[i][0]] = [ + allNames[i][1], + translateName + ? translate.text(allNames[i][2]) + : allNames[i][2] + ]; +} var nameCache = {}; -result.object(_buildAttributeTable(attributes, usages, translateName)); +result.object(_buildAttributeTable(attributes, usages)); //sorts the records in a way that a tree can be built and adds values -function _buildAttributeTable (pAttributes, pUsages, pTranslate) +function _buildAttributeTable (pAttributes, pUsages) { var rows = {}; var allIds = {}; @@ -149,21 +154,15 @@ function _buildAttributeTable (pAttributes, pUsages, pTranslate) for (let i in rows) { let rowData = rows[i].data; - if (pUsages && rowData[5].trim() != $AttributeTypes.COMBOVALUE && i in pUsages) + if (pUsages && rowData[7].trim() != $AttributeTypes.COMBOVALUE && i in pUsages) { - rowData[7] = pUsages[i].map(function (usage) + rowData[9] = pUsages[i].map(function (usage) { return translate.text(usage); }).join(", "); } - var fullName; - if (displaySimpleName) - fullName = pTranslate - ? translate.text(rowData[8]) - : rowData[8]; - else - fullName = _getFullName(rowData[8], rowData[9], rowData[10], rowData[11], rowData[12], pTranslate); - rowData.splice(10, 3, fullName); + rowData[10] = _getFullName(rowData[1]); //parent full name + rowData[11] = _getFullName(rowData[0], displaySimpleName); sortedArray[rows[i].index] = rowData; } @@ -174,25 +173,37 @@ function _buildAttributeTable (pAttributes, pUsages, pTranslate) * builds the full attribute name from the pre-loaded parent names and adds all parent names * if required */ - function _getFullName (pAttributeName, pParent1Name, pParent2Name, pParent3Name, pParent4Id) + function _getFullName (pAttributeId, pSimpleName) { - var parent4FullName; - if (pParent4Id && pParent4Id in nameCache) - parent4FullName = nameCache[pParent4Id]; - else - { - parent4FullName = pParent4Id ? AttributeUtil.getFullAttributeName(pParent4Id, false, pTranslate) : null; - nameCache[pParent4Id] = parent4FullName; - } - if (pTranslate) + if (!pAttributeId) + return ""; + var attrId = pAttributeId; + var fullName = []; + + while (attrId) { - pAttributeName = translate.text(pAttributeName); - pParent1Name = translate.text(pParent1Name); - pParent2Name = translate.text(pParent2Name); - pParent3Name = translate.text(pParent3Name); + let name = null; + if (attrId in nameCache) + { + name = nameCache[attrId]; + attrId = null; + } + else if (attrId in attrNameData) + { + name = attrNameData[attrId][1]; + attrId = attrNameData[attrId][0]; //next parent + } + else + attrId = null; + if (name) + fullName.unshift(name); + if (pSimpleName) + break; } - pAttributeName = ArrayUtils.joinNonEmptyFields([parent4FullName, pParent3Name, pParent2Name, pParent1Name, pAttributeName], " / "); + + fullName = fullName.join(" / "); + nameCache[pAttributeId] = fullName; - return pAttributeName; + return fullName; } } diff --git a/entity/Attribute_entity/recordcontainers/jdito/onDelete.js b/entity/Attribute_entity/recordcontainers/jdito/onDelete.js index 046b1dca18f622ac02623b1f82cb419c9d0d5d81..7368edfb0952b1e71b18ab71f9925a8a4e3df075 100644 --- a/entity/Attribute_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Attribute_entity/recordcontainers/jdito/onDelete.js @@ -14,21 +14,21 @@ var attributeId = vars.get("$field.UID"); var childIds = AttributeUtil.getAllChildren(attributeId).concat(attributeId); condition = SqlCondition.begin() - .and("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID in ('" + childIds.join("','") + "')") + .andIn("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", childIds) .build(); //delete all entries in AB_ATTRIBUTEUSAGE belonging to the attribute to avoid unrelated entries db.deleteData("AB_ATTRIBUTEUSAGE", condition); condition = SqlCondition.begin() - .and("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID in ('" + childIds.join("','") + "')") + .andIn("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", childIds) .build(); //delete all entries in AB_ATTRIBUTERELATION for the attributes db.deleteData("AB_ATTRIBUTERELATION", condition); condition = SqlCondition.begin() - .and("AB_ATTRIBUTE.AB_ATTRIBUTEID in ('" + childIds.join("','") + "')") + .andIn("AB_ATTRIBUTE.AB_ATTRIBUTEID", childIds) .build(); //delete all attribute children diff --git a/entity/Attribute_entity/recordcontainers/jdito/onInsert.js b/entity/Attribute_entity/recordcontainers/jdito/onInsert.js index 40e10e11b533fc5ccee823daad6872941beebaf7..e44ad6dacc4be5f21442e178e609cedfa32ffff8 100644 --- a/entity/Attribute_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Attribute_entity/recordcontainers/jdito/onInsert.js @@ -1,6 +1,7 @@ import("system.db"); import("system.vars"); +var rowdata = vars.get("$local.rowdata"); var columns = [ "AB_ATTRIBUTEID", "ATTRIBUTE_ACTIVE", @@ -8,16 +9,18 @@ var columns = [ "ATTRIBUTE_PARENT_ID", "ATTRIBUTE_TYPE", "DROPDOWNDEFINITION", + "DROPDOWNFILTER", "SORTING" ]; var values = [ - vars.get("$field.UID"), - vars.get("$field.ATTRIBUTE_ACTIVE"), - vars.get("$field.ATTRIBUTE_NAME"), - vars.get("$field.ATTRIBUTE_PARENT_ID"), - vars.get("$field.ATTRIBUTE_TYPE"), - vars.get("$field.DROPDOWNDEFINITION"), - vars.get("$field.SORTING") + rowdata["UID.value"], + rowdata["ATTRIBUTE_ACTIVE.value"] || "", + rowdata["ATTRIBUTE_NAME.value"] || "", + rowdata["ATTRIBUTE_PARENT_ID.value"] || "", + rowdata["ATTRIBUTE_TYPE.value"] || "", + rowdata["DROPDOWNDEFINITION.value"] || "", + rowdata["DROPDOWNFILTER.value"] || "", + rowdata["SORTING.value"] || "" ]; db.insertData("AB_ATTRIBUTE", columns, null, values); \ No newline at end of file diff --git a/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js b/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js index af114d5a96bcef11470b6da3b48910bb0b5ef555..cc709a73a6100b8a5d991061e5d1119aa18f4092 100644 --- a/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/Attribute_entity/recordcontainers/jdito/onUpdate.js @@ -1,23 +1,27 @@ -import("Sql_lib"); -import("system.db"); -import("system.vars"); - -var columns = [ - "ATTRIBUTE_ACTIVE", - "ATTRIBUTE_NAME", - "ATTRIBUTE_PARENT_ID", - "ATTRIBUTE_TYPE", - "DROPDOWNDEFINITION", - "SORTING" -]; -var values = [ - vars.get("$field.ATTRIBUTE_ACTIVE"), - vars.get("$field.ATTRIBUTE_NAME"), - vars.get("$field.ATTRIBUTE_PARENT_ID"), - vars.get("$field.ATTRIBUTE_TYPE"), - vars.get("$field.DROPDOWNDEFINITION"), - vars.get("$field.SORTING") -]; - -db.updateData("AB_ATTRIBUTE", columns, null, values, +import("system.logging"); +import("Sql_lib"); +import("system.db"); +import("system.vars"); + +var rowdata = vars.get("$local.rowdata"); +var columns = [ + "ATTRIBUTE_ACTIVE", + "ATTRIBUTE_NAME", + "ATTRIBUTE_PARENT_ID", + "ATTRIBUTE_TYPE", + "DROPDOWNDEFINITION", + "DROPDOWNFILTER", + "SORTING" +]; +var values = [ + rowdata["ATTRIBUTE_ACTIVE.value"] || "", + rowdata["ATTRIBUTE_NAME.value"] || "", + rowdata["ATTRIBUTE_PARENT_ID.value"] || "", + rowdata["ATTRIBUTE_TYPE.value"] || "", + rowdata["DROPDOWNDEFINITION.value"] || "", + rowdata["DROPDOWNFILTER.value"] || "", + rowdata["SORTING.value"] || "" +]; +logging.log(JSON.stringify(values, null, "\t")) +db.updateData("AB_ATTRIBUTE", columns, null, values, SqlCondition.equals("AB_ATTRIBUTE.AB_ATTRIBUTEID", vars.get("$field.UID"), "1=2")); \ No newline at end of file diff --git a/entity/BulkMailAddRecipients_entity/entityfields/recipientcontactids/valueProcess.js b/entity/BulkMailAddRecipients_entity/entityfields/recipientcontactids/valueProcess.js index 867801eb33a46e2945ad7759d7c48633e8217fc0..107d0af5ed33fdbed773fc5e8bbac0952a303646 100644 --- a/entity/BulkMailAddRecipients_entity/entityfields/recipientcontactids/valueProcess.js +++ b/entity/BulkMailAddRecipients_entity/entityfields/recipientcontactids/valueProcess.js @@ -1,21 +1,8 @@ -import("Contact_lib"); -import("system.result"); -import("Bulkmail_lib"); -import("KeywordRegistry_basic"); -import("system.util"); -import("system.db"); -import("Sql_lib"); -import("system.vars"); - -var contactIds = JSON.parse(vars.getString("$param.ContactIds_param")); -var bulkMailId = vars.get("$field.BULKMAIL_ID"); - -var existsQuery = "not exists(select BULKMAILRECIPIENTID from BULKMAILRECIPIENT where BULKMAILRECIPIENT.CONTACT_ID = CONTACT.CONTACTID and # = ?)"; -var query = SqlCondition.begin() - .andIn("CONTACT.CONTACTID", contactIds) - .andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", bulkMailId, existsQuery) //only add contacts that aren't already recipients - .andSqlCondition(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail(), true)) //check if there's a commrestriction - .buildSql("select CONTACTID from CONTACT"); - -contactIds = db.array(db.COLUMN, query); -result.string(JSON.stringify(contactIds)); +import("system.result"); +import("Bulkmail_lib"); +import("system.vars"); + +var contactIds = JSON.parse(vars.getString("$param.ContactIds_param")); +var bulkMailId = vars.get("$field.BULKMAIL_ID"); + +result.string(JSON.stringify(BulkMailUtils.filterNewRecipients(bulkMailId, contactIds))); \ No newline at end of file diff --git a/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js b/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js index d47a0319721d5b49a4e57fcce24ca7009dd1fc34..cce82d39abe4867c83b6b4289e6d5dfe284ace9a 100644 --- a/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js +++ b/entity/BulkMailAddRecipients_entity/recordcontainers/jdito/onInsert.js @@ -5,3 +5,4 @@ var contactIds = JSON.parse(vars.getString("$field.recipientContactIds")); var bulkMailId = vars.get("$field.BULKMAIL_ID"); BulkMailUtils.addRecipients(bulkMailId, contactIds); +BulkMailUtils.openBulkMail(bulkMailId); \ No newline at end of file diff --git a/entity/BulkMailChart_entity/recordcontainers/jdito/contentProcess.js b/entity/BulkMailChart_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0869420384ccec1e8f1d42e8c2658734e3e3df7c --- /dev/null +++ b/entity/BulkMailChart_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,16 @@ +import("system.db"); +import("system.result"); +import("Sql_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("system.vars"); + +var bulkMailId = vars.get("$param.BulkMailId_param"); + +var query = SqlBuilder.begin() + .select(["STATUS", "STATUS", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.bulkMailRecipientStatus(), "STATUS"), "count(STATUS)"]) + .from("BULKMAILRECIPIENT") + .where(SqlCondition.begin().andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", bulkMailId)) + .groupBy("STATUS"); + +result.object(db.table(query.build())); \ No newline at end of file diff --git a/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod b/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod index ee5572dfda076c1ae377155bf114b41818f3fcff..cfdc84490dd7b9e30d2622127a94c2b6bb404a0f 100644 --- a/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod +++ b/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod @@ -3,6 +3,9 @@ <name>BulkMailRecipient_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Recipient</title> + <siblings> + <element>Communication_entity</element> + </siblings> <titlePlural>Recipients</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -166,10 +169,12 @@ <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>BULKMAILRECIPIENT.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>BULKMAILRECIPIENT.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORGANISATION_ID.value</name> diff --git a/entity/BulkMailRecipient_entity/entityfields/contact_id/onValidation.js b/entity/BulkMailRecipient_entity/entityfields/contact_id/onValidation.js index 727a9813cc00efdebc9871dff07e767a8b14f6d5..174227c1873ebbe408e8fa37d1b5356b81813b06 100644 --- a/entity/BulkMailRecipient_entity/entityfields/contact_id/onValidation.js +++ b/entity/BulkMailRecipient_entity/entityfields/contact_id/onValidation.js @@ -1,8 +1,13 @@ +import("Bulkmail_lib"); +import("system.vars"); import("Contact_lib"); import("system.translate"); import("system.result"); import("KeywordRegistry_basic"); import("Entity_lib"); -if (ContactUtils.hasCommRestriction(ProcessHandlingUtils.getOnValidationValue(), $KeywordRegistry.communicationMediumCampaign$mail())) +var contactId = vars.get("local.value"); +if (BulkMailUtils.isRecipient(vars.get("$field.BULKMAIL_ID"), contactId, vars.get("$field.BULKMAILRECIPIENTID"))) + result.string(translate.text("The contact is already a recipient!")); +else if (ContactUtils.hasCommRestriction(contactId, $KeywordRegistry.communicationMediumCampaign$mail())) result.string(translate.text("The contact has an advertising ban for emails!")); \ No newline at end of file diff --git a/entity/BulkMailRecipient_entity/entityfields/statuskeyword/children/containername_param/valueProcess.js b/entity/BulkMailRecipient_entity/entityfields/statuskeyword/children/containername_param/valueProcess.js index ed3b8531d70d092278f787ddb54e289b20931b4e..06d12d80f3fab307d4bd3964b3c62928786447a2 100644 --- a/entity/BulkMailRecipient_entity/entityfields/statuskeyword/children/containername_param/valueProcess.js +++ b/entity/BulkMailRecipient_entity/entityfields/statuskeyword/children/containername_param/valueProcess.js @@ -1,3 +1,4 @@ +import("KeywordRegistry_basic"); import("system.result"); -result.string("BulkMailSentStatus"); //TODO: keyword registry \ No newline at end of file +result.string($KeywordRegistry.bulkMailRecipientStatus()); \ No newline at end of file diff --git a/entity/BulkMailStatusChart_entity/BulkMailStatusChart_entity.aod b/entity/BulkMailStatusChart_entity/BulkMailStatusChart_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..fbcdd8dd9bd296ecb6d66f763651a557a5420d72 --- /dev/null +++ b/entity/BulkMailStatusChart_entity/BulkMailStatusChart_entity.aod @@ -0,0 +1,63 @@ +<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> + <name>BulkMailStatusChart_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Recipient status</title> + <siblings> + <element>BulkMailRecipient_entity</element> + </siblings> + <titlePlural>Recipient status</titlePlural> + <recordContainer>jdito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>X</name> + <title>Recipients</title> + </entityField> + <entityField> + <name>Y</name> + </entityField> + <entityParameter> + <name>BulkMailId_param</name> + <expose v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityField> + <name>UID</name> + </entityField> + <entityProvider> + <name>RecipientStatusChart</name> + <dependencies> + <entityDependency> + <name>e2d96467-ec53-424b-b78c-c97c2db2bb8a</name> + <entityName>BulkMail_entity</entityName> + <fieldName>RecipientStatusChart</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jdito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/BulkMailStatusChart_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>X.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>X.displayValue</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>Y.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/BulkMailStatusChart_entity/recordcontainers/jdito/contentProcess.js b/entity/BulkMailStatusChart_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2057fed00fd1beb8adc1fc585970352ecff790a0 --- /dev/null +++ b/entity/BulkMailStatusChart_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,16 @@ +import("system.db"); +import("system.result"); +import("Sql_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("system.vars"); + +var bulkMailId = vars.get("$param.BulkMailId_param"); + +var query = SqlBuilder.begin() + .select(["STATUS", "STATUS", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.bulkMailRecipientStatus(), "STATUS"), "count(STATUS)"]) + .from("BULKMAILRECIPIENT") + .where(SqlCondition.begin().andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", bulkMailId)) + .groupBy("STATUS"); + +result.object(db.table(query.build())); \ No newline at end of file diff --git a/entity/BulkMailTesting_entity/BulkMailTesting_entity.aod b/entity/BulkMailTesting_entity/BulkMailTesting_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..da34a9438ea7faa052ff3b0a29f523d53aef2a46 --- /dev/null +++ b/entity/BulkMailTesting_entity/BulkMailTesting_entity.aod @@ -0,0 +1,61 @@ +<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> + <name>BulkMailTesting_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <siblings> + <element>BulkMail_entity</element> + </siblings> + <recordContainer>jdito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>TESTING_CONTACT_ID</name> + <title>Contact</title> + <consumer>Contacts</consumer> + <linkedContext>AnyContact</linkedContext> + <valueProcess>%aditoprj%/entity/BulkMailTesting_entity/entityfields/testing_contact_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/BulkMailTesting_entity/entityfields/testing_contact_id/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>TESTING_EMAIL_ADDRESS</name> + <title>Recipient address</title> + <valueProcess>%aditoprj%/entity/BulkMailTesting_entity/entityfields/testing_email_address/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>SAVESETTINGS</name> + <title>Save settings</title> + <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/BulkMailTesting_entity/entityfields/savesettings/dropDownProcess.js</dropDownProcess> + </entityField> + <entityParameter> + <name>BulkMailId_param</name> + <expose v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityConsumer> + <name>Contacts</name> + <dependency> + <name>dependency</name> + <entityName>AnyContact_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + </entityConsumer> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jdito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <onInsert>%aditoprj%/entity/BulkMailTesting_entity/recordcontainers/jdito/onInsert.js</onInsert> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/BulkMailTesting_entity/entityfields/savesettings/dropDownProcess.js b/entity/BulkMailTesting_entity/entityfields/savesettings/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ea87f0cb35f482786bbea6794140e8926fca3935 --- /dev/null +++ b/entity/BulkMailTesting_entity/entityfields/savesettings/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/BulkMailTesting_entity/entityfields/testing_contact_id/displayValueProcess.js b/entity/BulkMailTesting_entity/entityfields/testing_contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3cfd8a80f6d4914aa8636462e5fa8aaa63cb702e --- /dev/null +++ b/entity/BulkMailTesting_entity/entityfields/testing_contact_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Contact_lib"); + +result.string(ContactUtils.getTitleByContactId(vars.get("$field.TESTING_CONTACT_ID"))); \ No newline at end of file diff --git a/entity/BulkMailTesting_entity/entityfields/testing_contact_id/valueProcess.js b/entity/BulkMailTesting_entity/entityfields/testing_contact_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..49dff7de739727af391d894fa9afd4d63d0a5f0c --- /dev/null +++ b/entity/BulkMailTesting_entity/entityfields/testing_contact_id/valueProcess.js @@ -0,0 +1,15 @@ +import("Sql_lib"); +import("system.db"); +import("Employee_lib"); +import("system.vars"); +import("system.result"); + +var contactId = db.cell(SqlCondition.begin() + .andPrepareVars("BULKMAIL.BULKMAILID", "$param.BulkMailId_param") + .buildSql("select TESTING_CONTACT_ID from BULKMAIL") +); +if (!contactId) + contactId = EmployeeUtils.getCurrentContactId(); + +if (vars.get("$this.value") == null) + result.string(contactId); \ No newline at end of file diff --git a/entity/BulkMailTesting_entity/entityfields/testing_email_address/valueProcess.js b/entity/BulkMailTesting_entity/entityfields/testing_email_address/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..261b02cb666e2bdeb75a544dd1ad646dece04c1e --- /dev/null +++ b/entity/BulkMailTesting_entity/entityfields/testing_email_address/valueProcess.js @@ -0,0 +1,12 @@ +import("Sql_lib"); +import("system.db"); +import("Employee_lib"); +import("system.vars"); +import("system.result"); + +var email = db.cell(SqlCondition.begin() + .andPrepareVars("BULKMAIL.BULKMAILID", "$param.BulkMailId_param") + .buildSql("select TESTING_EMAIL_ADDRESS from BULKMAIL") +); +if (vars.get("$this.value") == null) + result.string(email); \ No newline at end of file diff --git a/entity/BulkMailTesting_entity/recordcontainers/jdito/onInsert.js b/entity/BulkMailTesting_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..a2489e0b7b3772dbf08cb0cf881774f3bc0193c4 --- /dev/null +++ b/entity/BulkMailTesting_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,16 @@ +import("Sql_lib"); +import("system.db"); +import("Bulkmail_lib"); +import("system.vars"); + +var testingContact = vars.get("$field.TESTING_CONTACT_ID"); +var testingEmail = vars.get("$field.TESTING_EMAIL_ADDRESS"); +var bulkMailId = vars.get("$param.BulkMailId_param"); + +BulkMailUtils.sendBulkMailOnServer(bulkMailId, [[testingContact, testingEmail]]); + +if (vars.get("$field.SAVESETTINGS") == "1") +{ + db.updateData("BULKMAIL", ["TESTING_CONTACT_ID", "TESTING_EMAIL_ADDRESS"], null, [testingContact, testingEmail], + SqlCondition.equals("BULKMAIL.BULKMAILID", bulkMailId)); +} \ No newline at end of file diff --git a/entity/BulkMail_entity/BulkMail_entity.aod b/entity/BulkMail_entity/BulkMail_entity.aod index 80c39a89f971724f71bfe41a31df92e7ee5fb19f..f85ae7712263ac0c501f7803c558e5ce4e6177ce 100644 --- a/entity/BulkMail_entity/BulkMail_entity.aod +++ b/entity/BulkMail_entity/BulkMail_entity.aod @@ -5,6 +5,8 @@ <icon>VAADIN:AT</icon> <title>Bulk mail</title> <contentTitleProcess>%aditoprj%/entity/BulkMail_entity/contentTitleProcess.js</contentTitleProcess> + <iconId>VAADIN:AT</iconId> + <titlePlural>Bulk mails</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -25,14 +27,17 @@ <name>NAME</name> <title>Name</title> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/name/valueProcess.js</valueProcess> </entityField> <entityField> <name>SUBJECT</name> <title>Subject</title> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/subject/valueProcess.js</valueProcess> </entityField> <entityField> <name>DESCRIPTION</name> <title>Description</title> + <contentType>LONG_TEXT</contentType> </entityField> <entityField> <name>DOCUMENTTEMPLATE_ID</name> @@ -86,24 +91,11 @@ <mandatory v="true" /> <onValidation>%aditoprj%/entity/BulkMail_entity/entityfields/sender/onValidation.js</onValidation> </entityField> - <entityActionField> - <name>sendMail</name> - <title>Send</title> - <onActionProcess>%aditoprj%/entity/BulkMail_entity/entityfields/sendmail/onActionProcess.js</onActionProcess> - <iconId>VAADIN:PAPERPLANE</iconId> - <stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/sendmail/stateProcess.js</stateProcess> - </entityActionField> <entityField> <name>ICON</name> <contentType>IMAGE</contentType> <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/icon/valueProcess.js</valueProcess> </entityField> - <entityField> - <name>preview</name> - <contentType>HTML</contentType> - <state>READONLY</state> - <displayValueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/preview/displayValueProcess.js</displayValueProcess> - </entityField> <entityConsumer> <name>StatusKeyword</name> <dependency> @@ -119,7 +111,7 @@ </children> </entityConsumer> <entityField> - <name>BINDATA</name> + <name>bindata</name> <contentType>FILE</contentType> <stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/bindata/stateProcess.js</stateProcess> </entityField> @@ -130,6 +122,88 @@ <element>SUBJECT</element> </fields> </entityFieldGroup> + <entityParameter> + <name>PresetRecipients_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>content</name> + <title>Content</title> + <contentTypeProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js</contentTypeProcess> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>LogHistories</name> + <dependency> + <name>dependency</name> + <entityName>LogHistory_entity</entityName> + <fieldName>LogHistoryProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>tablenames_param</name> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>CREATEACTIVITIES</name> + <title>Create activities</title> + <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/BulkMail_entity/entityfields/createactivities/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/createactivities/valueProcess.js</valueProcess> + </entityField> + <entityConsumer> + <name>RecipientStatusChart</name> + <dependency> + <name>dependency</name> + <entityName>BulkMailStatusChart_entity</entityName> + <fieldName>RecipientStatusChart</fieldName> + </dependency> + <children> + <entityParameter> + <name>BulkMailId_param</name> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/recipientstatuschart/children/bulkmailid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>TESTING_CONTACT_ID</name> + <title>Contact</title> + <consumer>Contacts</consumer> + <linkedContext>AnyContact</linkedContext> + </entityField> + <entityField> + <name>TESTING_EMAIL_ADDRESS</name> + <title>Recipient address</title> + </entityField> + <entityParameter> + <name>SendTestMail_param</name> + <expose v="true" /> + </entityParameter> + <entityConsumer> + <name>Contacts</name> + <dependency> + <name>dependency</name> + <entityName>AnyContact_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + </entityConsumer> + <entityActionField> + <name>sendMail</name> + <title>Send</title> + <onActionProcess>%aditoprj%/entity/BulkMail_entity/entityfields/sendmail/onActionProcess.js</onActionProcess> + <iconId>VAADIN:PAPERPLANE</iconId> + <stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/sendmail/stateProcess.js</stateProcess> + <tooltipProcess>%aditoprj%/entity/BulkMail_entity/entityfields/sendmail/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>testMail</name> + <title>Test email</title> + <onActionProcess>%aditoprj%/entity/BulkMail_entity/entityfields/testmail/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CLIPBOARD_CHECK</iconId> + </entityActionField> <entityActionField> <name>openAdminView</name> <title>Open admin view</title> @@ -170,6 +244,7 @@ <dbRecordFieldMapping> <name>DESCRIPTION.value</name> <recordfield>BULKMAIL.DESCRIPTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DOCUMENTTEMPLATE_ID.value</name> @@ -178,14 +253,17 @@ <dbRecordFieldMapping> <name>NAME.value</name> <recordfield>BULKMAIL.NAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SUBJECT.value</name> <recordfield>BULKMAIL.SUBJECT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SENDER.value</name> <recordfield>BULKMAIL.SENDER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DOCUMENTTEMPLATE_ID.displayValue</name> @@ -194,11 +272,28 @@ <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>BULKMAIL.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.displayValue</name> <expression>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CREATEACTIVITIES.value</name> + <recordfield>BULKMAIL.CREATEACTIVITIES</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TESTING_CONTACT_ID.value</name> + <recordfield>BULKMAIL.TESTING_CONTACT_ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TESTING_EMAIL_ADDRESS.value</name> + <recordfield>BULKMAIL.TESTING_EMAIL_ADDRESS</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TESTING_CONTACT_ID.displayValue</name> + <expression>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/testing_contact_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d1b6018ddd76af776cd9d21c31902a3c95ead3f6 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js @@ -0,0 +1,21 @@ +import("Bulkmail_lib"); +import("system.result"); +import("Document_lib"); +import("system.vars"); +import("DocumentTemplate_lib"); + +var upload = vars.get("$field.bindata"); +var type; +if (upload) +{ + type = DocumentUtil.getMimeTypeFromUpload(upload); + type = DocumentTemplate.types.fromMimeType(type); +} +else +{ + let template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID")); + type = template.type; +} +result.string(type == DocumentTemplate.types.TXT + ? "LONG_TEXT" + : "HTML"); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/preview/displayValueProcess.js b/entity/BulkMail_entity/entityfields/content/displayValueProcess.js similarity index 69% rename from entity/BulkMail_entity/entityfields/preview/displayValueProcess.js rename to entity/BulkMail_entity/entityfields/content/displayValueProcess.js index 9b0b01405e606c3bdc23905986abe160e2a62acc..33b1e10e22e8eb98f9041122f0f668c05200ccc5 100644 --- a/entity/BulkMail_entity/entityfields/preview/displayValueProcess.js +++ b/entity/BulkMail_entity/entityfields/content/displayValueProcess.js @@ -1,19 +1,19 @@ -import("Bulkmail_lib"); -import("system.text"); -import("Employee_lib"); -import("system.vars"); -import("system.result"); -import("system.neon"); -import("DocumentTemplate_lib"); - -//if this was done for every row, like in a lookup, the performance would be very bad -if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_MASK) -{ - var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID")); - - var contactId = EmployeeUtils.getCurrentContactId(); - var preview = template.getReplacedEmailsByContactIds([contactId]); - - result.string(preview[contactId].body); -} - +import("Bulkmail_lib"); +import("system.text"); +import("Employee_lib"); +import("system.vars"); +import("system.result"); +import("system.neon"); +import("DocumentTemplate_lib"); + +//if this was done for every row, like in a lookup, the performance would be very bad +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) +{ + var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID")); + + var contactId = EmployeeUtils.getCurrentContactId(); + var preview = template.getReplacedContentByContactId(contactId); + + result.string(preview); +} + diff --git a/entity/BulkMail_entity/entityfields/content/valueProcess.js b/entity/BulkMail_entity/entityfields/content/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..88d58ef83678d176d31d2efce461afe0cc40e7d7 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/content/valueProcess.js @@ -0,0 +1,21 @@ +import("system.neon"); +import("Document_lib"); +import("system.result"); +import("system.vars"); +import("system.db"); +import("DocumentTemplate_lib"); +import("Bulkmail_lib"); + +if (vars.get("$this.value") == null && vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) +{ + var upload = vars.get("$field.bindata"); + var template; + if (upload) + template = DocumentTemplate.fromUpload(upload); + else + template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID")); + + var content = template.getReplacedContent({}); + + result.string(content); +} \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/createactivities/dropDownProcess.js b/entity/BulkMail_entity/entityfields/createactivities/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3373b8a886df7267c9205c206442cb2e091128fb --- /dev/null +++ b/entity/BulkMail_entity/entityfields/createactivities/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/BulkMail_entity/entityfields/createactivities/valueProcess.js b/entity/BulkMail_entity/entityfields/createactivities/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..72e22f0a52f1d6439b67df5abc59a66280df8fd4 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/createactivities/valueProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string("1"); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/documenttemplate_id/onValueChange.js b/entity/BulkMail_entity/entityfields/documenttemplate_id/onValueChange.js index 6d1fe433a0ad7b27289c152edd86ce47b2c096f7..c2d0c4e5323ea1219d1f6f0085a624f996609e54 100644 --- a/entity/BulkMail_entity/entityfields/documenttemplate_id/onValueChange.js +++ b/entity/BulkMail_entity/entityfields/documenttemplate_id/onValueChange.js @@ -7,7 +7,7 @@ import("Entity_lib"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { - var templateId = ProcessHandlingUtils.getOnValidationValue(); + var templateId = vars.get("local.value"); var template = DocumentTemplate.loadTemplate(templateId); if (template.type == DocumentTemplate.types.EML) { diff --git a/entity/BulkMail_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js b/entity/BulkMail_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..aa13fc5ed2e195b362095cc74f843ab270296ce4 --- /dev/null +++ b/entity/BulkMail_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.BULKMAILID"), tableNames: ["BULKMAIL"]}); + +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/BulkMail_entity/entityfields/name/valueProcess.js b/entity/BulkMail_entity/entityfields/name/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..94a33c3fc3288465e8959ea57f74eb9b983d1787 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/name/valueProcess.js @@ -0,0 +1,14 @@ +import("system.result"); +import("Document_lib"); +import("system.neon"); +import("system.vars"); + +if (vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var upload = vars.get("$field.bindata"); + if (upload) + { + var filename = DocumentUtil.getFilenameFromUpload(upload); + result.string(filename.split(".")[0]); + } +} \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/recipientstatuschart/children/bulkmailid_param/valueProcess.js b/entity/BulkMail_entity/entityfields/recipientstatuschart/children/bulkmailid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2a12b8389ba83e397d6b9ae10eb59989a25590fe --- /dev/null +++ b/entity/BulkMail_entity/entityfields/recipientstatuschart/children/bulkmailid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.BULKMAILID")); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/sender/onValidation.js b/entity/BulkMail_entity/entityfields/sender/onValidation.js index a07daba57f94e4328ff3907479205d93e38a93db..36c5491ee5aa2ddf06932ee751e0f7740ad24547 100644 --- a/entity/BulkMail_entity/entityfields/sender/onValidation.js +++ b/entity/BulkMail_entity/entityfields/sender/onValidation.js @@ -1,11 +1,12 @@ -import("system.result"); -import("Communication_lib"); -import("Entity_lib"); - -var message; -var sender = ProcessHandlingUtils.getOnValidationValue(); -var fn = CommValidationUtil.makeValidationFn("EMAIL"); -if (fn !== null) - message = fn.call(null, sender); -if (message) +import("system.vars"); +import("system.result"); +import("Communication_lib"); +import("Entity_lib"); + +var message; +var sender = vars.get("local.value"); +var fn = CommValidationUtil.makeValidationFn("EMAIL"); +if (fn !== null) + message = fn.call(null, sender); +if (message) result.string(message); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/sendmail/onActionProcess.js b/entity/BulkMail_entity/entityfields/sendmail/onActionProcess.js index 84cc2e975ffd32302521043c2342a774b0a927cf..4a316db7db175aae1530bb366fe02086d1702f45 100644 --- a/entity/BulkMail_entity/entityfields/sendmail/onActionProcess.js +++ b/entity/BulkMail_entity/entityfields/sendmail/onActionProcess.js @@ -1,3 +1,5 @@ +import("system.translate"); +import("system.question"); import("Sql_lib"); import("system.neon"); import("system.vars"); @@ -5,7 +7,11 @@ import("Bulkmail_lib"); import("system.db"); import("KeywordRegistry_basic"); -db.updateData("BULKMAIL", ["STATUS"], null, [$KeywordRegistry.bulkMailStatus$beingSent()], - SqlCondition.equals("BULKMAIL.BULKMAILID", vars.get("$field.BULKMAILID"), "1=2")); -neon.refreshAll(); -BulkMailUtils.sendBulkMailOnServer(vars.get("$field.BULKMAILID")); \ No newline at end of file +var send = question.askYesNo(translate.text("Bulk mail"), translate.text("Should the mail be sent now?"), false); +if (send) +{ + db.updateData("BULKMAIL", ["STATUS"], null, [$KeywordRegistry.bulkMailStatus$beingSent()], + SqlCondition.equals("BULKMAIL.BULKMAILID", vars.get("$field.BULKMAILID"), "1=2")); + neon.refreshAll(); + BulkMailUtils.sendBulkMailOnServer(vars.get("$field.BULKMAILID")); +} \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/sendmail/tooltipProcess.js b/entity/BulkMail_entity/entityfields/sendmail/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..264f6bfd16f8e4e181b4088811117bf017025771 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/sendmail/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Send")); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/status/displayValueProcess.js b/entity/BulkMail_entity/entityfields/status/displayValueProcess.js index 0dd6bd59e0bb7db1bba471167d20ae5a41cb8423..e134a0c97aea832acd32fe66be3806770b33d1c7 100644 --- a/entity/BulkMail_entity/entityfields/status/displayValueProcess.js +++ b/entity/BulkMail_entity/entityfields/status/displayValueProcess.js @@ -3,4 +3,4 @@ import("KeywordRegistry_basic"); import("system.result"); import("Keyword_lib"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.bulkMailStatus(), vars.get("$this.value"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.bulkMailStatus(), vars.get("$field.STATUS"))); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/subject/valueProcess.js b/entity/BulkMail_entity/entityfields/subject/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fb6c668dc4b4fdf20757a7a5db45de16f8ed8392 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/subject/valueProcess.js @@ -0,0 +1,18 @@ +import("system.result"); +import("Email_lib"); +import("Document_lib"); +import("DocumentTemplate_lib"); +import("system.neon"); +import("system.vars"); + +if (vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var upload = vars.get("$field.bindata"); + if (upload) + { + var binData = DocumentUtil.getBindataFromUpload(upload); + var type = DocumentUtil.getMimeTypeFromUpload(upload); + if (DocumentTemplate.types.fromMimeType(type) == DocumentTemplate.types.EML) + result.string(Email.fromRFC(binData).subject); + } +} \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/testmail/onActionProcess.js b/entity/BulkMail_entity/entityfields/testmail/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3852daca44d122f7a011d6fe4559d34cf7390321 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/testmail/onActionProcess.js @@ -0,0 +1,17 @@ +import("system.neon"); +import("system.db"); +import("Employee_lib"); +import("system.vars"); +import("Bulkmail_lib"); + +var testingContact = vars.get("$field.TESTING_CONTACT_ID"); +var testingEmail = vars.get("$field.TESTING_EMAIL_ADDRESS"); + +if (testingContact && testingEmail) + BulkMailUtils.sendBulkMailOnServer(vars.get("$field.BULKMAILID"), [[testingContact, testingEmail]]); +else + neon.openContext("BulkMailTesting", "BulkMailTesting_view", null, neon.OPERATINGSTATE_NEW, { + "BulkMailId_param" : vars.get("$field.BULKMAILID") + }); + + diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js b/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js index e0185aeb92f4be0494605035cc4700bbd0901868..71625c5c712cab7e76569fb406a17ae5a47fbce8 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js @@ -1,12 +1,12 @@ -import("system.vars"); -import("Sql_lib"); -import("system.db"); - -db.deleteData("BULKMAILRECIPIENT", SqlCondition.equals("BULKMAILRECIPIENT.BULKMAIL_ID", vars.get("$local.uid"), "1=2")); -var SYSALIAS = "_____SYSTEMALIAS"; -var binaryId = db.cell(SqlCondition.begin(SYSALIAS) - .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.BULKMAILID") - .buildSql("select ID from ASYS_BINARIES"), SYSALIAS); - -if (binaryId) +import("system.vars"); +import("Sql_lib"); +import("system.db"); + +db.deleteData("BULKMAILRECIPIENT", SqlCondition.equals("BULKMAILRECIPIENT.BULKMAIL_ID", vars.get("$local.uid"), "1=2")); +var SYSALIAS = SqlUtils.getSystemAlias(); +var binaryId = db.cell(SqlCondition.begin(SYSALIAS) + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$local.uid") + .buildSql("select ID from ASYS_BINARIES"), SYSALIAS); + +if (binaryId) db.deleteBinary(binaryId, SYSALIAS); \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js index 92c78050f4f47399cbc67955957249934a206692..124d083b49c0f9e023aaa6f730b170fc427a550f 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js @@ -1,23 +1,30 @@ -import("system.result"); -import("system.vars"); -import("system.db"); -import("system.util"); -import("Document_lib"); - -//TODO - Function - -var bindataUpload = DocumentUtil.getBindataFromUpload(vars.get("$field.BINDATA")); -var filename = ""; -var bindata = ""; - -if(bindataUpload != "") -{ - filename = DocumentUtil.getFilenameFromUpload(vars.get("$field.BINDATA")); - bindata = bindataUpload; -} - -if(bindata != "" && filename != "") -{ - db.insertBinary("BULKMAIL", "DOCUMENT", vars.get("$field.BULKMAILID"), - "", bindata, filename, "", "", "_____SYSTEMALIAS"); -} \ No newline at end of file +import("Sql_lib"); +import("DocumentTemplate_lib"); +import("system.result"); +import("system.vars"); +import("system.db"); +import("system.util"); +import("Document_lib"); +import("Bulkmail_lib"); + +var content = vars.get("$field.content"); +var bindata = vars.get("$field.bindata"); +var rowdata = vars.get("$local.rowdata"); +var bulkMailId = rowdata["BULKMAIL.BULKMAILID"]; +var templateId = rowdata["BULKMAIL.DOCUMENTTEMPLATE_ID"]; +var bulkMailName = rowdata["BULKMAIL.NAME"]; + +var template = DocumentTemplate.getSelectedTemplate(templateId, bindata, content, DocumentTemplate.types.HTML); + +if (template.content) +{ + if (!template.filename) + template.filename = bulkMailName + ".html"; + db.insertBinary("BULKMAIL", "DOCUMENT", bulkMailId, + "", template.content, template.filename, "", "", SqlUtils.getSystemAlias()); +} + +var contactIds = JSON.parse(vars.getString("$param.PresetRecipients_param")); + +if (contactIds && contactIds.length > 0) + BulkMailUtils.addRecipients(bulkMailId, BulkMailUtils.filterNewRecipients(bulkMailId, contactIds)); \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js index 4b8b28c49a9c31968b3cc5b34883d746bdc50193..e6ca5e9a03194feedeba892cd5c5359deb0e9894 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js @@ -1,28 +1,29 @@ +import("system.neon"); import("Sql_lib"); +import("DocumentTemplate_lib"); import("system.result"); import("system.vars"); import("system.db"); -import("system.util"); import("Document_lib"); +import("Bulkmail_lib"); -//TODO - Function +var content = vars.get("$field.content"); +var bindata = vars.get("$field.bindata"); +var rowdata = vars.get("$local.rowdata"); +var bulkMailId = rowdata["BULKMAIL.BULKMAILID"]; +var templateId = rowdata["BULKMAIL.DOCUMENTTEMPLATE_ID"]; +var bulkMailName = rowdata["BULKMAIL.NAME"]; -var upload = vars.get("$field.BINDATA"); -var bindataUpload = DocumentUtil.getBindataFromUpload(upload); -var filename = ""; -var bindata = ""; +var template = DocumentTemplate.getSelectedTemplate(templateId, bindata, content, DocumentTemplate.types.HTML); -if(bindataUpload != "") +if (template.content) { - filename = DocumentUtil.getFilenameFromUpload(upload); - bindata = bindataUpload; -} - -if(bindata != "" && filename != "") -{ - let sysAlias = "_____SYSTEMALIAS"; + if (!template.filename) + template.filename = bulkMailName + ".html"; + let sysAlias = SqlUtils.getSystemAlias(); var binaryId = db.cell(SqlCondition.begin(sysAlias) - .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.BULKMAILID") + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$local.uid") .buildSql("select ID from ASYS_BINARIES", "1=2"), sysAlias); - db.updateBinary(binaryId, "", bindata, filename, "", "", sysAlias); + db.updateBinary(binaryId, "", template.content, template.filename, "", "", sysAlias); + neon.refresh(["$field.content"]); } \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/testing_contact_id.displayvalue/expression.js b/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/testing_contact_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..11979e350e55cd52f6940d5ded3a206a89448002 --- /dev/null +++ b/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/testing_contact_id.displayvalue/expression.js @@ -0,0 +1,4 @@ +import("Contact_lib"); +import("system.result"); + +result.string(ContactUtils.getResolvingDisplaySubSql("BULKMAIL.TESTING_CONTACT_ID")); \ No newline at end of file diff --git a/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod b/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod index 6240a4fadb82aeca8891c25c330e910821fd0c66..9c2216cde824c0f250245b40f4f63f99a4fd961f 100644 --- a/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod +++ b/entity/CampaignAddParticipants_entity/CampaignAddParticipants_entity.aod @@ -37,7 +37,6 @@ <entityField> <name>campaignParticipantMessage</name> <state>READONLY</state> - <valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js</valueProcess> <onValueChangeTypes> <element>PROCESS</element> </onValueChangeTypes> diff --git a/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValueChange.js b/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValueChange.js index 6991eccc9143e886238cfb6d745e83359814c62e..1a42050e6f2f9a6337de2b1f250623a372de1152 100644 --- a/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValueChange.js +++ b/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValueChange.js @@ -1,7 +1,7 @@ -import("system.vars"); -import("system.neon"); -import("Campaign_lib"); - -var stepId; -stepId = CampaignUtils.getDefaultCampaignStep(vars.get("$field.CAMPAIGN_ID")); +import("system.vars"); +import("system.neon"); +import("Campaign_lib"); + +var stepId; +stepId = CampaignUtils.getDefaultCampaignStep(vars.get("local.value")); neon.setFieldValue("$field.CAMPAIGNSTEP_ID", stepId); \ No newline at end of file diff --git a/entity/CampaignAddParticipants_entity/entityfields/isoperationvalid/valueProcess.js b/entity/CampaignAddParticipants_entity/entityfields/isoperationvalid/valueProcess.js index c0689ca0aa2ecf419c001d1461c673d2b5f076d7..7232e9b7806fe94ddb279962715a35820ed89a1b 100644 --- a/entity/CampaignAddParticipants_entity/entityfields/isoperationvalid/valueProcess.js +++ b/entity/CampaignAddParticipants_entity/entityfields/isoperationvalid/valueProcess.js @@ -1,118 +1,122 @@ -import("Campaign_lib"); -import("system.result"); -import("system.translate"); -import("system.vars"); -import("system.neon"); - -var campaignParticipantsAmount = 0; - -var targetTable = vars.get("$param.dataSourceTableName_param"); -var selectionRowIds = JSON.parse(vars.getString("$param.campaignParticipantsRowIds_param")); -var selectedCampaignId = vars.get("$field.CAMPAIGN_ID"); -var selectedCampaignStepId = vars.get("$field.CAMPAIGNSTEP_ID"); -var isUpdate = vars.get("$field.isUpdate"); - -var participantCondition = ""; -var messageString = ""; -var resultValue = "false"; - -if(selectedCampaignId != '') -{ - /* - * First determines how many of the selected are already in the campaign - * If there are no valid participants at all or too many in respect of the - * selected steps max number of participants, nothing will be added. - * A message describing this situation will be written. - * - * If none of those criteria match, all participants are good to be added. - */ - var countParticipantsAlreadyInCampaign = 0; - var countParticipantsToAdd = 0; - var countValidParticipantsToAdd = 0; - var whereCondition = ""; - var rowIdsComparisonField = ""; - - //if theres a selection, we have to use it, otherwise use the condition - if(selectionRowIds != null && selectionRowIds.length > 0) - { - countParticipantsToAdd = selectionRowIds.length; - - - /* - * The field against which will be checked, if the selection is already contained in the campaignStep - * depends on wether isUpdate is true or not. - * If true, the selected IDs are CampaignParticipantIds, otherwise contactIds. - * This happens because on true the action is called in the participants filterview to move participants - * between steps, on false new participants are in the process of being added to a step. - */ - if(isUpdate == "true") - { - rowIdsComparisonField = "CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID"; - whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = '" + selectedCampaignStepId + "'"; - } - else - { - rowIdsComparisonField = "CAMPAIGNPARTICIPANT.CONTACT_ID"; - whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGN_ID = '" + selectedCampaignId + "'"; - } - countParticipantsAlreadyInCampaign = CampaignUtils.GetParticipantsAlreadyAddedCountByRowId(whereCondition, rowIdsComparisonField, selectionRowIds); - } - else - { - participantCondition = JSON.parse(vars.getString("$param.campaignParticipantsCondition_param")).condition; - - let useRightJoinToGetOrgs = "false"; - if(targetTable == "ORGANISATION") - { - useRightJoinToGetOrgs = "true"; - - //Necessary because organisations don't have a personid' - participantCondition += " and PERSON.PERSONID is NULL" - } - - countParticipantsToAdd = CampaignUtils.GetContactCountByCondition(participantCondition, isUpdate, useRightJoinToGetOrgs); - - /* - * If the update mode is active, the goal is to move participants between steps. - * therefore the check if the affected participants already are added to a particluar step has to be on the step level. - * - * If not, participants are to be added. It has to be checked if a participant is in a campaign, regardless of the particular - * step because one participant can be in a campaign just once. - */ - if(isUpdate == "true") - whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = '" + selectedCampaignStepId + "'"; - else - whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGN_ID = '" + selectedCampaignId + "'"; - - countParticipantsAlreadyInCampaign = CampaignUtils.GetParticipantsAlreadyAddedCountByCondition(whereCondition, participantCondition, useRightJoinToGetOrgs); - } - countValidParticipantsToAdd = countParticipantsToAdd - countParticipantsAlreadyInCampaign; - - if(countParticipantsToAdd <= 0) - { - messageString = translate.text("No contacts selected"); - } - else if(countValidParticipantsToAdd <= 0) - { - messageString = translate.text("All selected participants already are in the campaign"); - } - else if(hasStepEnoughSlots(countValidParticipantsToAdd)) - { - messageString = translate.withArguments("%0/%1 participant(s) will be added to the selected campaign step", [countValidParticipantsToAdd, countParticipantsToAdd]); - resultValue = "true"; - } - else - { - messageString = translate.withArguments("Not enough slots for %0/%1 participant(s)", [countValidParticipantsToAdd, countParticipantsToAdd]); - } - neon.setFieldValue("$field.campaignParticipantMessage", messageString); - result.string(resultValue); -} - -function hasStepEnoughSlots(pCountToAdd) -{ - let currentParticipants = CampaignUtils.getParticipantCountForStep(selectedCampaignStepId) - let maxParticipants = CampaignUtils.getMaxParticipantCountForStep(selectedCampaignStepId) - - return (parseInt(currentParticipants) + parseInt(pCountToAdd)) <= maxParticipants; +import("Campaign_lib"); +import("system.result"); +import("system.translate"); +import("system.vars"); +import("system.neon"); + +var campaignParticipantsAmount = 0; + +var targetTable = vars.get("$param.dataSourceTableName_param"); +var selectionRowIds = JSON.parse(vars.getString("$param.campaignParticipantsRowIds_param")); +var selectedCampaignId = vars.get("$field.CAMPAIGN_ID"); +var selectedCampaignStepId = vars.get("$field.CAMPAIGNSTEP_ID"); +var isUpdate = vars.get("$field.isUpdate"); + +var participantCondition = ""; +var messageString = ""; +var resultValue = "false"; + +if(selectedCampaignId != '') +{ + /* + * First determines how many of the selected are already in the campaign + * If there are no valid participants at all or too many in respect of the + * selected steps max number of participants, nothing will be added. + * A message describing this situation will be written. + * + * If none of those criteria match, all participants are good to be added. + */ + var countParticipantsAlreadyInCampaign = 0; + var countParticipantsToAdd = 0; + var countValidParticipantsToAdd = 0; + var whereCondition = ""; + var rowIdsComparisonField = ""; + + //if theres a selection, we have to use it, otherwise use the condition + if(selectionRowIds != null && selectionRowIds.length > 0) + { + countParticipantsToAdd = selectionRowIds.length; + + + /* + * The field against which will be checked, if the selection is already contained in the campaignStep + * depends on wether isUpdate is true or not. + * If true, the selected IDs are CampaignParticipantIds, otherwise contactIds. + * This happens because on true the action is called in the participants filterview to move participants + * between steps, on false new participants are in the process of being added to a step. + */ + if(isUpdate == "true") + { + rowIdsComparisonField = "CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID"; + whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = '" + selectedCampaignStepId + "'"; + } + else + { + rowIdsComparisonField = "CAMPAIGNPARTICIPANT.CONTACT_ID"; + whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGN_ID = '" + selectedCampaignId + "'"; + } + countParticipantsAlreadyInCampaign = CampaignUtils.GetParticipantsAlreadyAddedCountByRowId(whereCondition, rowIdsComparisonField, selectionRowIds); + } + else + { + participantCondition = JSON.parse(vars.getString("$param.campaignParticipantsCondition_param")).condition; + + let useRightJoinToGetOrgs = "false"; + if(targetTable == "ORGANISATION") + { + useRightJoinToGetOrgs = "true"; + + //Necessary because organisations don't have a personid' + participantCondition += " and PERSON.PERSONID is NULL" + } + + countParticipantsToAdd = CampaignUtils.GetContactCountByCondition(participantCondition, isUpdate, useRightJoinToGetOrgs); + + /* + * If the update mode is active, the goal is to move participants between steps. + * therefore the check if the affected participants already are added to a particluar step has to be on the step level. + * + * If not, participants are to be added. It has to be checked if a participant is in a campaign, regardless of the particular + * step because one participant can be in a campaign just once. + */ + if(isUpdate == "true") + whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = '" + selectedCampaignStepId + "'"; + else + whereCondition = "CAMPAIGNPARTICIPANT.CAMPAIGN_ID = '" + selectedCampaignId + "'"; + + countParticipantsAlreadyInCampaign = CampaignUtils.GetParticipantsAlreadyAddedCountByCondition(whereCondition, participantCondition, useRightJoinToGetOrgs); + } + countValidParticipantsToAdd = countParticipantsToAdd - countParticipantsAlreadyInCampaign; + + if(countParticipantsToAdd <= 0) + { + messageString = translate.text("No contacts selected"); + } + else if(countValidParticipantsToAdd <= 0) + { + messageString = translate.text("All selected participants already are in the campaign"); + } + else + { + let excess = getParticipantExcess(countValidParticipantsToAdd); + if (excess > 0) + { + messageString = translate.withArguments("Not enough slots for %0/%1 participant(s)", [excess, countParticipantsToAdd]); + } + else + { + messageString = translate.withArguments("%0/%1 participant(s) will be added to the selected campaign step", [countValidParticipantsToAdd, countParticipantsToAdd]); + resultValue = "true"; + } + } + neon.setFieldValue("$field.campaignParticipantMessage", messageString); + result.string(resultValue); +} + +function getParticipantExcess (pCountToAdd) +{ + let currentParticipants = CampaignUtils.getParticipantCountForStep(selectedCampaignStepId) + let maxParticipants = CampaignUtils.getMaxParticipantCountForStep(selectedCampaignStepId) + + return (parseInt(currentParticipants) + parseInt(pCountToAdd)) - maxParticipants; } \ No newline at end of file diff --git a/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js b/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js index c471c8a13c8c91ffa5916745d7e8c6080f5c92ef..81aeb47b23e5a0d9fe087f701064397826b41c3a 100644 --- a/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js +++ b/entity/CampaignAddParticipants_entity/recordcontainers/jdito/onInsert.js @@ -1,3 +1,5 @@ +import("system.neon"); +import("Sql_lib"); import("system.vars"); import("system.db"); import("system.util"); @@ -30,7 +32,8 @@ else _handleCondition(campaignId, conditionSourceTableName, participantCondition); } - +if (!vars.exists("$param.currentCampaignId_param") || !vars.get("$param.currentCampaignId_param")) + neon.openContext("Campaign", "CampaignMain_view", [campaignId], neon.OPERATINGSTATE_VIEW, null); function _handleCondition(pCampaignId, pTargetTableName, pCondition) { @@ -62,12 +65,22 @@ function _handleCondition(pCampaignId, pTargetTableName, pCondition) function _handleRowIds(pParticipantRowIds) { + var oldStepIds = {}; if(isUpdate == "true") { cols = [ "CAMPAIGNSTEP_ID", - "USER_EDIT", - "DATE_EDIT" + "USER_EDIT", + "DATE_EDIT" ]; + + let oldSteps = db.table(SqlCondition.begin() + .orIn("CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID", pParticipantRowIds) + .buildSql("select CAMPAIGNPARTICIPANTID, CAMPAIGNSTEP_ID from CAMPAIGNPARTICIPANT", "1=2") + ); + oldSteps.forEach(function (step) + { + this[step[0]] = step[1]; + }, oldStepIds); } else { @@ -89,12 +102,21 @@ function _handleRowIds(pParticipantRowIds) if(isUpdate == "true") { + let oldCampaignStepId = oldStepIds[pParticipantRowIds[participant]] || ""; let updatedValues = [newCampaignStepId, vars.get("$sys.user"), vars.get("$sys.date")]; let condition = "CONTACT_ID = '" + pParticipantRowIds[participant] + "' OR CAMPAIGNPARTICIPANTID = '" + pParticipantRowIds[participant] + "'"; - let valsCampaignParticipantLog = new Array(pParticipantRowIds[participant], campaignId, newCampaignStepId, campaignParticipantLogId, vars.get("$sys.user"), vars.get("$sys.date")); + let valsCampaignParticipantLog = [ + pParticipantRowIds[participant], + campaignId, + newCampaignStepId, + campaignParticipantLogId, + vars.get("$sys.user"), + vars.get("$sys.date"), + oldCampaignStepId + ]; statementArray.push(["CAMPAIGNPARTICIPANT", cols, null, updatedValues, condition]); logArray.push(["CAMPAIGNPARTICIPANTLOG", colNamesCampaignParticipantLog, null, valsCampaignParticipantLog]); @@ -122,7 +144,6 @@ function _handleRowIds(pParticipantRowIds) } else db.inserts(statementArray); - if(logArray.length > 0) db.inserts(logArray); } diff --git a/entity/CampaignAnalysis_entity/CampaignAnalysis_entity.aod b/entity/CampaignAnalysis_entity/CampaignAnalysis_entity.aod index e590ec8804c0bff64723a9fdfb29fdd968a72b3e..1c36b1046e43d1a63d85676b70e12380e5bd0413 100644 --- a/entity/CampaignAnalysis_entity/CampaignAnalysis_entity.aod +++ b/entity/CampaignAnalysis_entity/CampaignAnalysis_entity.aod @@ -49,6 +49,7 @@ <contentType>NUMBER</contentType> <outputFormat>#,##0.00</outputFormat> <valueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/variablecosts/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/variablecosts/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>FixCosts</name> @@ -56,6 +57,7 @@ <contentType>NUMBER</contentType> <outputFormat>#,##0.00</outputFormat> <valueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/fixcosts/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/fixcosts/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>TotalCosts</name> @@ -63,6 +65,7 @@ <contentType>NUMBER</contentType> <outputFormat>#,##0.00</outputFormat> <valueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/totalcosts/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/totalcosts/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>CostsPerParticipant</name> @@ -70,6 +73,7 @@ <contentType>NUMBER</contentType> <outputFormat>#,##0.00</outputFormat> <valueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>UID</name> @@ -99,6 +103,10 @@ <expose v="true" /> <description>PARAMETER</description> </entityParameter> + <entityField> + <name>Currency</name> + <valueProcess>%aditoprj%/entity/CampaignAnalysis_entity/entityfields/currency/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/displayValueProcess.js b/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fe9d9c02cb11f5f70ecd4c00e41b251ed5f1a789 --- /dev/null +++ b/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.CostsPerParticipant"), translate.text("#,##0.00"), vars.get("$field.Currency"))); \ No newline at end of file diff --git a/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/valueProcess.js b/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/valueProcess.js index ccd043074d5d151f5226b40cc450c4e510e13657..ec3ccc758e613aec6dd8eb10b071f0f9ed777854 100644 --- a/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/valueProcess.js +++ b/entity/CampaignAnalysis_entity/entityfields/costsperparticipant/valueProcess.js @@ -1,4 +1,5 @@ import("system.result"); import("system.vars"); -result.string(parseFloat(vars.getString("$field.TotalCosts")) / parseInt(vars.get("$field.ParticipantCount"))); \ No newline at end of file +var cost = parseFloat(vars.getString("$field.TotalCosts")) / parseInt(vars.get("$field.ParticipantCount")); +result.string(isFinite(cost) ? cost : 0); //if there is no participant, it would cause a division by zero and the result would be infinity \ No newline at end of file diff --git a/entity/CampaignAnalysis_entity/entityfields/currency/valueProcess.js b/entity/CampaignAnalysis_entity/entityfields/currency/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0707325468559c403e49b8cb1410dcfda71b81e5 --- /dev/null +++ b/entity/CampaignAnalysis_entity/entityfields/currency/valueProcess.js @@ -0,0 +1,7 @@ +import("system.db"); +import("system.result"); +import("Sql_lib"); + +result.string(db.cell(SqlCondition.begin() + .andPrepareVars("CAMPAIGN.CAMPAIGNID", "$param.CampaignId_param") + .buildSql("select CURRENCY from CAMPAIGN", "1=2"))); \ No newline at end of file diff --git a/entity/CampaignAnalysis_entity/entityfields/fixcosts/displayValueProcess.js b/entity/CampaignAnalysis_entity/entityfields/fixcosts/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0ef6b1164e2c8b3c15111fe3174f75f74412d558 --- /dev/null +++ b/entity/CampaignAnalysis_entity/entityfields/fixcosts/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.FixCosts"), translate.text("#,##0.00"), vars.get("$field.Currency"))); \ No newline at end of file diff --git a/entity/CampaignAnalysis_entity/entityfields/totalcosts/displayValueProcess.js b/entity/CampaignAnalysis_entity/entityfields/totalcosts/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1446e4d3b304a06f21325dc360dc5f01b5f0c605 --- /dev/null +++ b/entity/CampaignAnalysis_entity/entityfields/totalcosts/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.TotalCosts"), translate.text("#,##0.00"), vars.get("$field.Currency"))); \ No newline at end of file diff --git a/entity/CampaignAnalysis_entity/entityfields/variablecosts/displayValueProcess.js b/entity/CampaignAnalysis_entity/entityfields/variablecosts/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..58579e46183839ab4fb7634bfdd2ccdf3713a1e4 --- /dev/null +++ b/entity/CampaignAnalysis_entity/entityfields/variablecosts/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.VariableCosts"), translate.text("#,##0.00"), vars.get("$field.Currency"))); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/CampaignCost_entitiy.aod b/entity/CampaignCost_entitiy/CampaignCost_entitiy.aod deleted file mode 100644 index 2103f13185bda6145df3b068a0d86cc1998505f2..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/CampaignCost_entitiy.aod +++ /dev/null @@ -1,299 +0,0 @@ -<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> - <name>CampaignCost_entitiy</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <afterOperatingState>%aditoprj%/entity/CampaignCost_entitiy/afterOperatingState.js</afterOperatingState> - <recordContainer>db</recordContainer> - <entityFields> - <entityProvider> - <name>#PROVIDER</name> - </entityProvider> - <entityField> - <name>CAMPAIGNCOSTID</name> - <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaigncostid/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>CAMPAIGN_ID</name> - <title>Campaign</title> - <consumer>Campaigns</consumer> - <groupable v="true" /> - <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaign_id/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaign_id/displayValueProcess.js</displayValueProcess> - </entityField> - <entityField> - <name>CAMPAIGNSTEP_ID</name> - <title>Campaign Step</title> - <consumer>CampaignSteps</consumer> - <groupable v="true" /> - <mandatoryProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignstep_id/mandatoryProcess.js</mandatoryProcess> - <stateProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignstep_id/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignstep_id/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignstep_id/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignstep_id/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - </onValueChangeTypes> - </entityField> - <entityField> - <name>CATEGORY</name> - <title>Category</title> - <consumer>KeywordCampaignManagementCostCategory</consumer> - <groupable v="true" /> - <mandatory v="true" /> - <displayValueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/category/displayValueProcess.js</displayValueProcess> - </entityField> - <entityField> - <name>NET</name> - <title>Cost</title> - <contentType>NUMBER</contentType> - <outputFormat>#,##0.00</outputFormat> - <inputFormat>#,##0.00</inputFormat> - <mandatory v="true" /> - </entityField> - <entityField> - <name>USER_NEW</name> - <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/user_new/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>DATE_NEW</name> - <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/date_new/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>USER_EDIT</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/user_edit/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>DATE_EDIT</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/date_edit/valueProcess.js</valueProcess> - </entityField> - <entityProvider> - <name>CampaignCosts</name> - <dependencies> - <entityDependency> - <name>7131288b-af5c-4914-96f5-c5d70217fc23</name> - <entityName>Campaign_entity</entityName> - <fieldName>CampaignCosts</fieldName> - <isConsumer v="false" /> - </entityDependency> - </dependencies> - <children> - <entityParameter> - <name>CampaignStepId_param</name> - <expose v="false" /> - </entityParameter> - <entityParameter> - <name>Uid_param</name> - <expose v="false" /> - </entityParameter> - <entityParameter> - <name>CampaignId_param</name> - <expose v="true" /> - </entityParameter> - <entityParameter> - <name>CampaignSteps_param</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaigncosts/children/campaignsteps_param/valueProcess.js</valueProcess> - <expose v="false" /> - </entityParameter> - </children> - </entityProvider> - <entityProvider> - <name>StepCosts</name> - <dependencies> - <entityDependency> - <name>af147f3e-a1bd-4eb0-9ac8-325dbdaba17d</name> - <entityName>CampaignStep_entity</entityName> - <fieldName>CampaignStepCosts</fieldName> - <isConsumer v="false" /> - </entityDependency> - <entityDependency> - <name>2a92b738-c0bb-4c14-9915-aff9e18effaf</name> - <entityName>Campaign_entity</entityName> - <fieldName>CampaignStepCosts</fieldName> - <isConsumer v="false" /> - </entityDependency> - </dependencies> - <children> - <entityParameter> - <name>CampaignStepId_param</name> - <expose v="true" /> - </entityParameter> - <entityParameter> - <name>Uid_param</name> - <expose v="false" /> - </entityParameter> - <entityParameter> - <name>CampaignId_param</name> - <expose v="true" /> - </entityParameter> - <entityParameter> - <name>CampaignSteps_param</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/stepcosts/children/campaignsteps_param/valueProcess.js</valueProcess> - <expose v="false" /> - </entityParameter> - </children> - </entityProvider> - <entityConsumer> - <name>Campaigns</name> - <dependency> - <name>dependency</name> - <entityName>Campaign_entity</entityName> - <fieldName>Campaigns</fieldName> - </dependency> - </entityConsumer> - <entityConsumer> - <name>CampaignSteps</name> - <dependency> - <name>dependency</name> - <entityName>CampaignStep_entity</entityName> - <fieldName>CampaignSteps</fieldName> - </dependency> - <children> - <entityParameter> - <name>campaignId_param</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignsteps/children/campaignid_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> - <entityConsumer> - <name>KeywordCampaignManagementCostCategory</name> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> - <children> - <entityParameter> - <name>ContainerName_param</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js</valueProcess> - </entityParameter> - <entityParameter> - <name>ExcludedKeyIdsSubquery_param</name> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> - <entityActionGroup> - <name>alter</name> - <children> - <entityActionField> - <name>edit</name> - <onActionProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/alter/children/edit/onActionProcess.js</onActionProcess> - <isSelectionAction v="true" /> - <iconId>NEON:PENCIL</iconId> - </entityActionField> - </children> - </entityActionGroup> - <entityParameter> - <name>CampaignId_param</name> - <expose v="true" /> - <mandatory v="true" /> - <description>PARAMETER</description> - </entityParameter> - <entityParameter> - <name>CampaignStepId_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> - <entityParameter> - <name>Uid_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> - <entityField> - <name>netPerParticipant</name> - <contentType>NUMBER</contentType> - <outputFormat>#,##0.00</outputFormat> - <inputFormat>#,##0.00</inputFormat> - <state>READONLY</state> - <titleProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/netperparticipant/titleProcess.js</titleProcess> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/netperparticipant/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>countParticipants</name> - <title>Participants</title> - <contentType>NUMBER</contentType> - <outputFormat>#0</outputFormat> - <inputFormat>#0</inputFormat> - <state>READONLY</state> - <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/countparticipants/valueProcess.js</valueProcess> - </entityField> - <entityParameter> - <name>CampaignSteps_param</name> - <title></title> - <expose v="true" /> - <documentation>%aditoprj%/entity/CampaignCost_entitiy/entityfields/campaignsteps_param/documentation.adoc</documentation> - <description>PARAMETER</description> - </entityParameter> - </entityFields> - <recordContainers> - <dbRecordContainer> - <name>db</name> - <alias>Data_alias</alias> - <fromClauseProcess>%aditoprj%/entity/CampaignCost_entitiy/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> - <conditionProcess>%aditoprj%/entity/CampaignCost_entitiy/recordcontainers/db/conditionProcess.js</conditionProcess> - <orderClauseProcess>%aditoprj%/entity/CampaignCost_entitiy/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> - <linkInformation> - <linkInformation> - <name>70c2db20-0695-4189-92cb-7da585bff401</name> - <tableName>CAMPAIGNCOST</tableName> - <primaryKey>CAMPAIGNCOSTID</primaryKey> - <isUIDTable v="true" /> - <readonly v="false" /> - </linkInformation> - <linkInformation> - <name>b97b7f67-86ea-4d0a-8303-abc05863ed66</name> - <tableName>CAMPAIGNSTEP</tableName> - <primaryKey>CAMPAIGNSTEPID</primaryKey> - <isUIDTable v="false" /> - <readonly v="true" /> - </linkInformation> - </linkInformation> - <recordFieldMappings> - <dbRecordFieldMapping> - <name>CAMPAIGN_ID.value</name> - <recordfield>CAMPAIGNCOST.CAMPAIGN_ID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>CAMPAIGNCOSTID.value</name> - <recordfield>CAMPAIGNCOST.CAMPAIGNCOSTID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>CAMPAIGNSTEP_ID.value</name> - <recordfield>CAMPAIGNCOST.CAMPAIGNSTEP_ID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>CATEGORY.value</name> - <recordfield>CAMPAIGNCOST.CATEGORY</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DATE_EDIT.value</name> - <recordfield>CAMPAIGNCOST.DATE_EDIT</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DATE_NEW.value</name> - <recordfield>CAMPAIGNCOST.DATE_NEW</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>NET.value</name> - <recordfield>CAMPAIGNCOST.NET</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>USER_EDIT.value</name> - <recordfield>CAMPAIGNCOST.USER_EDIT</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>USER_NEW.value</name> - <recordfield>CAMPAIGNCOST.USER_NEW</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>CATEGORY.displayValue</name> - <expression>%aditoprj%/entity/CampaignCost_entitiy/recordcontainers/db/recordfieldmappings/category.displayvalue/expression.js</expression> - </dbRecordFieldMapping> - </recordFieldMappings> - </dbRecordContainer> - </recordContainers> -</entity> diff --git a/entity/CampaignCost_entitiy/afterOperatingState.js b/entity/CampaignCost_entitiy/afterOperatingState.js deleted file mode 100644 index aadf712515f2c07c00aac89451d56b6cd77bdf39..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/afterOperatingState.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) -{ - neon.refreshAll(); -} \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/alter/children/edit/onActionProcess.js b/entity/CampaignCost_entitiy/entityfields/alter/children/edit/onActionProcess.js deleted file mode 100644 index 5808a7a781c569c67472b7a91f7892363330b39a..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/alter/children/edit/onActionProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.neon"); -import("system.vars"); - -var params = { - "Uid_param" : vars.get("$sys.uid") -} -neon.openContext("CampaignCost", "CampaignCostEdit_view", null, neon.OPERATINGSTATE_EDIT, params); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaign_id/displayValueProcess.js b/entity/CampaignCost_entitiy/entityfields/campaign_id/displayValueProcess.js deleted file mode 100644 index 2e2d6acf76ae6b1ea51cbcc77db98483695bcbf8..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaign_id/displayValueProcess.js +++ /dev/null @@ -1,9 +0,0 @@ -import("system.result"); -import("system.db"); -import("system.vars"); -import("Campaign_lib"); - -var campaignId = vars.get("$field.CAMPAIGN_ID"); -var campaignName = CampaignUtils.getCampaignNameById(campaignId); - -result.string(campaignName); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaign_id/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/campaign_id/valueProcess.js deleted file mode 100644 index 4037fcb024927b70e5a6ca6f7753c70c0cea0728..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaign_id/valueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.CampaignId_param") && vars.get("$param.CampaignId_param")) -{ - result.string(vars.get("$param.CampaignId_param")); -} \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/displayValueProcess.js b/entity/CampaignCost_entitiy/entityfields/campaignstep_id/displayValueProcess.js deleted file mode 100644 index f05a19497e25fe0dc5771521a787dbac10fb5489..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/displayValueProcess.js +++ /dev/null @@ -1,20 +0,0 @@ -import("system.neon"); -import("system.translate"); -import("system.result"); -import("system.db"); -import("system.vars"); -import("Campaign_lib"); - -if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) -{ - var campaignStepId = vars.get("$field.CAMPAIGNSTEP_ID"); - if (campaignStepId) - { - var campaignStepName = CampaignUtils.getCampaignStepNameById(campaignStepId); - result.string(translate.text("Step") + ": " + campaignStepName); - } - else - { - result.string(translate.text("Fix cost")); - } -} \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/mandatoryProcess.js b/entity/CampaignCost_entitiy/entityfields/campaignstep_id/mandatoryProcess.js deleted file mode 100644 index 32de11947a0d476bc467050c0a740461be22b2f7..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/mandatoryProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); - -result.object((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && - vars.exists("$param.CampaignSteps_param") && vars.get("$param.CampaignSteps_param") == "1" && - vars.exists("$param.CampaignStepId_param") && !vars.get("$param.CampaignStepId_param"))); diff --git a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/onValueChange.js b/entity/CampaignCost_entitiy/entityfields/campaignstep_id/onValueChange.js deleted file mode 100644 index 6483cdd91c7941e5997f3405fffbddcf3893f23a..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/onValueChange.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.neon"); - -neon.setFieldValue("$field.CATEGORY", ""); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/stateProcess.js b/entity/CampaignCost_entitiy/entityfields/campaignstep_id/stateProcess.js deleted file mode 100644 index a3d6f4f4d26c42171f5dfaf152074f7039f95afd..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/stateProcess.js +++ /dev/null @@ -1,13 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && - vars.exists("$param.CampaignSteps_param") && vars.get("$param.CampaignSteps_param") == "1" && - vars.exists("$param.CampaignStepId_param") && !vars.get("$param.CampaignStepId_param")) -{ - result.string(neon.COMPONENTSTATE_AUTO); -} -else -{ - result.string(neon.COMPONENTSTATE_INVISIBLE); -} \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/campaignstep_id/valueProcess.js deleted file mode 100644 index 30896ea50e4ae6bbc69bb7baaca294418004cb84..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignstep_id/valueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.CampaignStepId_param") && vars.get("$param.CampaignStepId_param")) -{ - result.string(vars.get("$param.CampaignStepId_param")); -} \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaignsteps/children/campaignid_param/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/campaignsteps/children/campaignid_param/valueProcess.js deleted file mode 100644 index dc855dd051409b0f79372cc2e34d294a1a57c72d..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignsteps/children/campaignid_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$param.CampaignId_param")) \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaignsteps_param/documentation.adoc b/entity/CampaignCost_entitiy/entityfields/campaignsteps_param/documentation.adoc deleted file mode 100644 index d74c862542faa32b0e558fa69c33edc0000980f6..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/campaignsteps_param/documentation.adoc +++ /dev/null @@ -1,2 +0,0 @@ -if 0: show only fix costs -if 1: show only campaign steps \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/category/displayValueProcess.js b/entity/CampaignCost_entitiy/entityfields/category/displayValueProcess.js deleted file mode 100644 index c8d7303fadeec6339bcd9065205606caa49e415c..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/category/displayValueProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignStepCostCategory(), vars.get("$this.value"))); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/countparticipants/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/countparticipants/valueProcess.js deleted file mode 100644 index c8cec9a46f4ad458f2dfb3f8525644fb1a1d5244..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/countparticipants/valueProcess.js +++ /dev/null @@ -1,12 +0,0 @@ -import("system.result"); -import("system.vars"); -import("Campaign_lib"); - -if (vars.get("$field.CAMPAIGNSTEP_ID")) -{ - result.string(CampaignUtils.getParticipantCountForStep(vars.get("$field.CAMPAIGNSTEP_ID"))); -} -else -{ - result.string(CampaignUtils.getParticipantCount(vars.get("$field.CAMPAIGN_ID"))); -} \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/date_edit/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/date_edit/valueProcess.js deleted file mode 100644 index 96630036eca528560c85d9a237044931e7a9197b..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/date_edit/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.util"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) - result.string(vars.get("$sys.date")); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/date_new/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/date_new/valueProcess.js deleted file mode 100644 index 1b1ea7c082a78ebd6e793a5dc644d8920f9522c2..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/date_new/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.util"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string(vars.get("$sys.date")); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js deleted file mode 100644 index 621fdd82097282d2e949cb0402cf1edcbf5610ce..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("KeywordRegistry_basic"); - -result.string($KeywordRegistry.campaignStepCostCategory()); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/excludedkeyidssubquery_param/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/excludedkeyidssubquery_param/valueProcess.js deleted file mode 100644 index 7bf0f39ed06188503867bd1ecca206fece100bc0..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/excludedkeyidssubquery_param/valueProcess.js +++ /dev/null @@ -1,18 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.db"); -import("Sql_lib"); -import("system.result"); - -var cond = SqlCondition.begin() - .andPrepareVars("CAMPAIGNCOST.CAMPAIGN_ID", "$field.CAMPAIGN_ID"); - -if (vars.get("$field.CAMPAIGNSTEP_ID")) - cond.andPrepareVars("CAMPAIGNCOST.CAMPAIGNSTEP_ID", "$field.CAMPAIGNSTEP_ID"); -else - cond.and("CAMPAIGNCOST.CAMPAIGNSTEP_ID is null") - -if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) - cond.andPrepareVars("CAMPAIGNCOST.CAMPAIGNCOSTID", "$field.CAMPAIGNCOSTID", "# <> ?"); - -result.string(db.translateStatement(cond.buildSql("select CATEGORY from CAMPAIGNCOST", "1=2", "group by CATEGORY"))); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/netperparticipant/titleProcess.js b/entity/CampaignCost_entitiy/entityfields/netperparticipant/titleProcess.js deleted file mode 100644 index c5ea14f73ec9a5870c7c5e3a7a58e3358107e15d..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/netperparticipant/titleProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.translate"); -import("system.result"); - -result.string(translate.text("Cost") + " " + translate.text("per") + " " + translate.text("Participant")); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/netperparticipant/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/netperparticipant/valueProcess.js deleted file mode 100644 index eea808176cb74be09b41f29a60bb1105115c5af4..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/netperparticipant/valueProcess.js +++ /dev/null @@ -1,11 +0,0 @@ -import("system.vars"); -import("system.result"); -import("system.eMath"); - -var netto = parseFloat(vars.get("$field.NET")); -var countParticipants = parseFloat(vars.get("$field.countParticipants")); - -if (netto && countParticipants &&countParticipants > 0) - result.string(eMath.roundDec(netto / countParticipants, 2, eMath.ROUND_HALF_UP)); -else - result.string(0); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/user_edit/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/user_edit/valueProcess.js deleted file mode 100644 index 8a93ff7e16a82fb332cf1f6f30c95bec0c74d929..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/user_edit/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.util"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) - result.string(vars.get("$sys.user")); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/user_new/valueProcess.js b/entity/CampaignCost_entitiy/entityfields/user_new/valueProcess.js deleted file mode 100644 index 2615c2bbe71788eb05f1ff93ea8afaa05b40f6fb..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/entityfields/user_new/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.util"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string(vars.get("$sys.user")); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/recordcontainers/db/conditionProcess.js b/entity/CampaignCost_entitiy/recordcontainers/db/conditionProcess.js deleted file mode 100644 index f553af6bac573d4226067d0bf246eada7d0d1dc5..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/recordcontainers/db/conditionProcess.js +++ /dev/null @@ -1,22 +0,0 @@ -import("system.vars"); -import("system.db"); -import("system.result"); -import("Sql_lib"); - -var cond = SqlCondition.begin() - .andPrepareVars("CAMPAIGNCOST.CAMPAIGNCOSTID", "$param.Uid_param") - .andPrepareVars("CAMPAIGNCOST.CAMPAIGN_ID", "$param.CampaignId_param") - .andPrepareVars("CAMPAIGNCOST.CAMPAIGNSTEP_ID", "$param.CampaignStepId_param"); - -if (vars.exists("$param.CampaignSteps_param") && vars.get("$param.CampaignSteps_param") == "1") -{ - // only step costs - cond.and("CAMPAIGNCOST.CAMPAIGNSTEP_ID is not null"); -} -else -{ - // only fix costs - cond.and("CAMPAIGNCOST.CAMPAIGNSTEP_ID is null"); -} - -result.string(db.translateCondition(cond.build("1=2"))); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/recordcontainers/db/fromClauseProcess.js b/entity/CampaignCost_entitiy/recordcontainers/db/fromClauseProcess.js deleted file mode 100644 index e075c4e894903b135e4bd4281da91bdb84c90538..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/recordcontainers/db/fromClauseProcess.js +++ /dev/null @@ -1,3 +0,0 @@ -import("system.result"); - -result.string("CAMPAIGNCOST left join CAMPAIGNSTEP on CAMPAIGNCOST.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID") \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/recordcontainers/db/orderClauseProcess.js b/entity/CampaignCost_entitiy/recordcontainers/db/orderClauseProcess.js deleted file mode 100644 index e8abc388f8ef2e8b95dcb0d800030fcfc52701d0..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entitiy/recordcontainers/db/orderClauseProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("system.db"); - -result.object({"CAMPAIGNSTEP.SORTING": db.ASCENDING}); \ No newline at end of file diff --git a/entity/CampaignCost_entity/CampaignCost_entity.aod b/entity/CampaignCost_entity/CampaignCost_entity.aod index 2c584cd215139c6a8631c2e525b6c372f21891fe..54ea032fe2337da9be23f221dd7bd64371540d1b 100644 --- a/entity/CampaignCost_entity/CampaignCost_entity.aod +++ b/entity/CampaignCost_entity/CampaignCost_entity.aod @@ -6,7 +6,7 @@ <element>CampaignAnalysis_entity</element> <element>CampaignCostChart_entity</element> </siblings> - <afterOperatingState>%aditoprj%/entity/CampaignCost_entity/afterOperatingState.js</afterOperatingState> + <titlePlural>Cost entries</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -55,6 +55,7 @@ <outputFormat>#,##0.00</outputFormat> <inputFormat>#,##0.00</inputFormat> <mandatory v="true" /> + <displayValueProcess>%aditoprj%/entity/CampaignCost_entity/entityfields/net/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>USER_NEW</name> @@ -215,6 +216,7 @@ <state>READONLY</state> <titleProcess>%aditoprj%/entity/CampaignCost_entity/entityfields/netperparticipant/titleProcess.js</titleProcess> <valueProcess>%aditoprj%/entity/CampaignCost_entity/entityfields/netperparticipant/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/CampaignCost_entity/entityfields/netperparticipant/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>countParticipants</name> @@ -232,6 +234,9 @@ <documentation>%aditoprj%/entity/CampaignCost_entity/entityfields/campaignsteps_param/documentation.adoc</documentation> <description>PARAMETER</description> </entityParameter> + <entityField> + <name>CURRENCY</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -242,19 +247,26 @@ <orderClauseProcess>%aditoprj%/entity/CampaignCost_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <linkInformation> <linkInformation> - <name>70c2db20-0695-4189-92cb-7da585bff401</name> + <name>6010c581-04c5-4578-b07b-5ab5ce27093b</name> <tableName>CAMPAIGNCOST</tableName> <primaryKey>CAMPAIGNCOSTID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> <linkInformation> - <name>b97b7f67-86ea-4d0a-8303-abc05863ed66</name> + <name>e5fcdb82-a4f4-4bf8-a7e5-81b94d6377bb</name> <tableName>CAMPAIGNSTEP</tableName> <primaryKey>CAMPAIGNSTEPID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> + <linkInformation> + <name>22980b1e-ea89-4dc6-a648-bddb77401c6a</name> + <tableName>CAMPAIGN</tableName> + <primaryKey>CAMPAIGNID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> </linkInformation> <recordFieldMappings> <dbRecordFieldMapping> @@ -297,6 +309,10 @@ <name>CATEGORY.displayValue</name> <expression>%aditoprj%/entity/CampaignCost_entity/recordcontainers/db/recordfieldmappings/category.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CURRENCY.value</name> + <recordfield>CAMPAIGN.CURRENCY</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/CampaignCost_entity/afterOperatingState.js b/entity/CampaignCost_entity/afterOperatingState.js deleted file mode 100644 index d39336402371a7d3f5db536a2e8ca261fa4e7fe3..0000000000000000000000000000000000000000 --- a/entity/CampaignCost_entity/afterOperatingState.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) -{ - neon.refreshAll(); -} \ No newline at end of file diff --git a/entity/CampaignCost_entity/entityfields/category/displayValueProcess.js b/entity/CampaignCost_entity/entityfields/category/displayValueProcess.js index 96536279ef0b858b99687c397622da45f831fa14..ea066328168d83b9c725e0628005f160d86d9d21 100644 --- a/entity/CampaignCost_entity/entityfields/category/displayValueProcess.js +++ b/entity/CampaignCost_entity/entityfields/category/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignStepCostCategory(), vars.get("$this.value"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignStepCostCategory(), vars.get("$field.CATEGORY"))); \ No newline at end of file diff --git a/entity/CampaignCost_entity/entityfields/net/displayValueProcess.js b/entity/CampaignCost_entity/entityfields/net/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..450ae0cfd9fa1701eeb4d4e7c049a3c8fb8fc7a0 --- /dev/null +++ b/entity/CampaignCost_entity/entityfields/net/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.NET"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/CampaignCost_entity/entityfields/netperparticipant/displayValueProcess.js b/entity/CampaignCost_entity/entityfields/netperparticipant/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d37ae85c8d479b752a505f2ad78b2fd57f6f0d16 --- /dev/null +++ b/entity/CampaignCost_entity/entityfields/netperparticipant/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.netPerParticipant"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/CampaignCost_entity/recordcontainers/db/fromClauseProcess.js b/entity/CampaignCost_entity/recordcontainers/db/fromClauseProcess.js index 4d95079d7cb044ddab9f1e475e6921ec8dcfb2f9..bfccf1c985dacc26263d113b9df88f54ec09c022 100644 --- a/entity/CampaignCost_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/CampaignCost_entity/recordcontainers/db/fromClauseProcess.js @@ -1,3 +1,4 @@ import("system.result"); -result.string("CAMPAIGNCOST left join CAMPAIGNSTEP on CAMPAIGNCOST.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID") \ No newline at end of file +result.string("CAMPAIGNCOST left join CAMPAIGNSTEP on CAMPAIGNCOST.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID \ + join CAMPAIGN on CAMPAIGNCOST.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID"); \ No newline at end of file diff --git a/entity/CampaignParticipantChart_entity/recordcontainers/jdito/contentProcess.js b/entity/CampaignParticipantChart_entity/recordcontainers/jdito/contentProcess.js index f3a905214eece4720bb4675a6e9e4febf06a57c5..c0de8da56a189d7fc6347b135c79685f7a76468d 100644 --- a/entity/CampaignParticipantChart_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/CampaignParticipantChart_entity/recordcontainers/jdito/contentProcess.js @@ -9,7 +9,10 @@ var campaignId = vars.get("$param.CampaignId_param"); var sqlSelect = "select CAMPAIGNSTEPID, CAMPAIGNSTEP.NAME, count(distinct CAMPAIGNPARTICIPANTID), MAXPARTICIPANTS, count(distinct CAMPAIGNPARTICIPANTLOG.CAMPAIGNPARTICIPANT_ID) \n\ from CAMPAIGNSTEP \n\ left join CAMPAIGNPARTICIPANT on CAMPAIGNSTEPID = CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID \n\ - left join CAMPAIGNPARTICIPANTLOG on CAMPAIGNSTEPID = CAMPAIGNPARTICIPANTLOG.CAMPAIGNSTEP_ID"; + left join CAMPAIGNPARTICIPANTLOG on CAMPAIGNSTEPID = CAMPAIGNPARTICIPANTLOG.PREVIOUS_CAMPAIGNSTEP_ID and CAMPAIGNPARTICIPANTLOG.CAMPAIGNSTEP_ID != CAMPAIGNPARTICIPANTLOG.PREVIOUS_CAMPAIGNSTEP_ID"; + //Participated: counts all distinct CAMPAIGNPARTICIPANT_IDs from logs where the PREVIOUS_CAMPAIGNSTEP_ID is the id of the campaign step. Logs where + //the new CAMPAIGNSTEP_ID is the same as the PREVIOUS_CAMPAIGNSTEP_ID are not counted. This does not check if the SORTING is correct. + var sqlGroupOrderBy = "group by CAMPAIGNSTEPID, CAMPAIGNSTEP.NAME, MAXPARTICIPANTS, CAMPAIGNSTEP.SORTING order by CAMPAIGNSTEP.SORTING"; var sqlQuery = SqlCondition.begin() @@ -19,9 +22,9 @@ var sqlQuery = SqlCondition.begin() var stepData = db.table(sqlQuery); var categories = { - CURRENT : "CURRENT", - MAX : "MAX", - LOGGED : "LOGGED" + CURRENT : "_CURRENT", + MAX : "_MAX", + LOGGED : "_LOGGED" }; var records = []; diff --git a/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod b/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod index dcc84f129403fc44af28657f4ce9cfe32b54935b..c215f745c25cf6bf3daee3d3990e3a51539adfee 100644 --- a/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod +++ b/entity/CampaignParticipant_entity/CampaignParticipant_entity.aod @@ -188,7 +188,6 @@ <name>ADVERTISINGBAN_ICON</name> <colorProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/colorProcess.js</colorProcess> <contentType>IMAGE</contentType> - <stateProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/valueProcess.js</valueProcess> </entityField> <entityConsumer> @@ -213,6 +212,16 @@ </entityParameter> </children> </entityConsumer> + <entityField> + <name>STANDARD_EMAIL_COMMUNICATION</name> + <title>E-Mail</title> + <state>READONLY</state> + </entityField> + <entityField> + <name>STANDARD_PHONE_COMMUNICATION</name> + <title>Phone</title> + <state>READONLY</state> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -230,10 +239,6 @@ </linkInformation> </linkInformation> <recordFieldMappings> - <dbRecordFieldMapping> - <name>CAMPAIGNPARTICIPANT_ID.value</name> - <recordfield>CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CAMPAIGN_ID.value</name> <recordfield>CAMPAIGNPARTICIPANT.CAMPAIGN_ID</recordfield> @@ -266,6 +271,22 @@ <name>USER_NEW.value</name> <recordfield>CAMPAIGNPARTICIPANT.USER_NEW</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CAMPAIGNPARTICIPANTID.displayValue</name> + <recordfield>CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ADVERTISINGBAN.value</name> + <expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban.value/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD_PHONE_COMMUNICATION.displayValue</name> + <expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD_EMAIL_COMMUNICATION.displayValue</name> + <expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.displayvalue/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/colorProcess.js b/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/colorProcess.js index 0c478c06f5f0d5bec38a2c6cee2135b21194077d..3eb3a718c487bffa661a1be7118944382102d9ab 100644 --- a/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/colorProcess.js +++ b/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/colorProcess.js @@ -1,7 +1,6 @@ import("system.result"); import("Sql_lib"); import("system.db"); -import("system.logging"); import("system.vars"); import("system.neon"); import("Campaign_lib"); diff --git a/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/valueProcess.js b/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/valueProcess.js index cf69811ac8cbb00ca31d0c3935cae70ddb983c86..9fdd845ab16b3d16340afe51c363673a7942f1a6 100644 --- a/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/valueProcess.js +++ b/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/valueProcess.js @@ -1,5 +1,4 @@ import("system.vars"); -import("system.logging"); import("system.result"); import("KeywordRegistry_basic"); import("Keyword_lib"); diff --git a/entity/CampaignParticipant_entity/entityfields/campaign_id/onValueChange.js b/entity/CampaignParticipant_entity/entityfields/campaign_id/onValueChange.js index ef4b32c6c5801121bfac2c42c138c3b10ee5d2d9..73033cd7e06fc00bb164ff8920be139478a10057 100644 --- a/entity/CampaignParticipant_entity/entityfields/campaign_id/onValueChange.js +++ b/entity/CampaignParticipant_entity/entityfields/campaign_id/onValueChange.js @@ -2,5 +2,5 @@ import("system.neon"); import("Campaign_lib"); import("system.vars"); -var stepId = CampaignUtils.getDefaultCampaignStep(vars.get("$field.CAMPAIGN_ID")); +var stepId = CampaignUtils.getDefaultCampaignStep(vars.get("local.value")); neon.setFieldValue("$field.CAMPAIGNSTEP_ID", stepId); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/onDBInsert.js b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/onDBInsert.js index 847118274289be3fc7b39180b3dcbe19e3b35ccb..bc3712278f25894a8721b39e3ab1ce74ecab3e00 100644 --- a/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/onDBInsert.js +++ b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/onDBInsert.js @@ -1,9 +1,11 @@ -import("system.vars"); -import("Campaign_lib"); - -var campaignId = vars.get("$field.CAMPAIGN_ID"); -var campaignStepId = vars.get("$field.CAMPAIGNSTEP_ID"); -var contactId = vars.get("$field.CONTACT_ID"); -var campaignParticipantId = vars.get("$field.CAMPAIGNPARTICIPANTID"); - -CampaignUtils.createLogEntry(campaignId, campaignStepId, contactId, campaignParticipantId); \ No newline at end of file +import("system.vars"); +import("Campaign_lib"); + +var rowdata = vars.get("$local.rowdata"); +var campaignId = rowdata["CAMPAIGNPARTICIPANT.CAMPAIGN_ID"]; +var campaignStepId = rowdata["CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID"]; +var contactId = rowdata["CAMPAIGNPARTICIPANT.CONTACT_ID"]; +var campaignParticipantId = vars.get("$local.uid"); +var previousCampaignstepId = ""; + +CampaignUtils.createLogEntry(campaignId, campaignStepId, contactId, campaignParticipantId, previousCampaignstepId); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban.value/expression.js b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban.value/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..6d7b0fbce0469fbb63c347dd3e019e50def57e25 --- /dev/null +++ b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban.value/expression.js @@ -0,0 +1,6 @@ +import("system.result"); + +result.string("(select MEDIUM from CAMPAIGNSTEP \n\ + join COMMRESTRICTION on MEDIUM = STEPMEDIUM \n\ + where COMMRESTRICTION.CONTACT_ID = CAMPAIGNPARTICIPANT.CONTACT_ID \n\ + and CAMPAIGNSTEP.CAMPAIGNSTEPID = CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID)"); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.displayvalue/expression.js b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..28967142d41b09fd97aa7991b40e836c1248ec95 --- /dev/null +++ b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("Sql_lib"); +import("system.result"); +import("Communication_lib"); + +var res = CommUtil.getStandardSubSqlMail(SqlCondition.begin().and("COMMUNICATION.CONTACT_ID = CAMPAIGNPARTICIPANT.CONTACT_ID")); +result.string(res); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.displayvalue/expression.js b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..1b654090c3c0fffd96c2eb836be6cbb10cdb4661 --- /dev/null +++ b/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.displayvalue/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Communication_lib"); + +var res = CommUtil.getStandardSubSqlPhone(SqlCondition.begin().and("COMMUNICATION.CONTACT_ID = CAMPAIGNPARTICIPANT.CONTACT_ID")); +result.string(res); \ No newline at end of file diff --git a/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod index 33320d758b60b8bb657198b0041dd7004deecfe9..f3a29a7c24402e085c1ce01cdfa5f00abd36664f 100644 --- a/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod +++ b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod @@ -2,12 +2,12 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>CampaignPlanning_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>NEON:GROUP_APPOINTMENT</icon> <title>Campaign planning</title> <siblings> <element>Campaign_entity</element> <element>CampaignStep_entity</element> </siblings> + <iconId>NEON:GROUP_APPOINTMENT</iconId> <recordContainer>jditoRecordContainer</recordContainer> <entityFields> <entityProvider> @@ -103,14 +103,17 @@ <dbRecordFieldMapping> <name>CAMPAIGN_NAME.value</name> <recordfield>CAMPAIGN.NAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DATE_END.value</name> <recordfield>CAMPAIGNSTEP.DATE_END</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DATE_START.value</name> <recordfield>CAMPAIGNSTEP.DATE_START</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PREDECESSOR_STEP_ID.value</name> diff --git a/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onUpdate.js b/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onUpdate.js index b0ba5ab3b44309370cdf78bbdf8445663fc0953a..a03a0c069fd6ecf787026d211b45d45b783d23a9 100644 --- a/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onUpdate.js +++ b/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onUpdate.js @@ -1,5 +1,4 @@ import("Campaign_lib"); -import("system.logging"); import("system.vars"); import("system.db"); diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod index c80393c1a9972029a34e3e0d75072e38e9821532..1e4b903793c15424b8f256f6af23a1df3017861f 100644 --- a/entity/CampaignStep_entity/CampaignStep_entity.aod +++ b/entity/CampaignStep_entity/CampaignStep_entity.aod @@ -6,7 +6,9 @@ <title>Campaign Step</title> <siblings> <element>CampaignPlanning_entity</element> + <element>Campaign_entity</element> </siblings> + <grantDeleteProcess>%aditoprj%/entity/CampaignStep_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/CampaignStep_entity/contentTitleProcess.js</contentTitleProcess> <onValidation>%aditoprj%/entity/CampaignStep_entity/onValidation.js</onValidation> <imageProcess>%aditoprj%/entity/CampaignStep_entity/imageProcess.js</imageProcess> @@ -38,6 +40,10 @@ <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> </entityField> <entityField> <name>EMPLOYEE_CONTACT_ID</name> @@ -73,12 +79,12 @@ <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js</valueProcess> </entityField> <entityField> - <name>STATE</name> + <name>STATUS</name> <title>Status</title> <consumer>KeywordStates</consumer> <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/state/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/state/displayValueProcess.js</displayValueProcess> + <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/status/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/status/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>SORTING</name> @@ -333,9 +339,12 @@ <entityParameter> <name>campaignId_param</name> <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/campaignid_param/valueProcess.js</valueProcess> - <expose v="true" /> <mandatory v="true" /> </entityParameter> + <entityParameter> + <name>maxSort_param</name> + <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityField> @@ -368,6 +377,16 @@ <consumer>CampaignStepMedium</consumer> <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js</displayValueProcess> </entityField> + <entityActionField> + <name>newBulkMail</name> + <title>Write bulk mail</title> + <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newbulkmail/onActionProcess.js</onActionProcess> + <iconId>VAADIN:AT</iconId> + </entityActionField> + <entityParameter> + <name>maxSort_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -418,8 +437,8 @@ <recordfield>CAMPAIGNSTEP.SORTING</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>STATE.value</name> - <recordfield>CAMPAIGNSTEP.STATE</recordfield> + <name>STATUS.value</name> + <recordfield>CAMPAIGNSTEP.STATUS</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_EDIT.value</name> @@ -430,8 +449,8 @@ <recordfield>CAMPAIGNSTEP.USER_NEW</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>STATE.displayValue</name> - <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js</expression> + <name>STATUS.displayValue</name> + <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MAXPARTICIPANTS.value</name> diff --git a/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js b/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js index c876f777295c165cd1b38cba358bfd6a8a6920a7..e97c4268951b37afbff8afad70b80a07822a1bca 100644 --- a/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js +++ b/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js @@ -1,7 +1,7 @@ -import("system.result"); -import("system.vars"); -import("Campaign_lib"); - -var campaignId = vars.get("$this.value"); -var campaignName = CampaignUtils.getCampaignNameById(campaignId) +import("system.result"); +import("system.vars"); +import("Campaign_lib"); + +var campaignId = vars.get("$field.CAMPAIGN_ID"); +var campaignName = CampaignUtils.getCampaignNameById(campaignId) result.string(campaignName); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/campaign_id/stateProcess.js b/entity/CampaignStep_entity/entityfields/campaign_id/stateProcess.js index 4d24ddc4a7d1afc5465ea27bcff3229edbc67d7d..fcfc9adff47d5aec4a5503074c7efba56b4bc507 100644 --- a/entity/CampaignStep_entity/entityfields/campaign_id/stateProcess.js +++ b/entity/CampaignStep_entity/entityfields/campaign_id/stateProcess.js @@ -1,5 +1,4 @@ import("system.result"); -import("system.logging"); import("system.neon"); import("system.vars"); diff --git a/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js b/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..00062fc76127c61b752533c1c15f0578b8e65ce0 --- /dev/null +++ b/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(parseInt(vars.get("$field.SORTING")) - 1); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js b/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js index b0c6f5d3b5240543f6fefcccee25cd50d5151524..8048460efdebae9db5983abdcf0ecda0b6b2911f 100644 --- a/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js +++ b/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js @@ -1,10 +1,10 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("system.datetime"); - -var threeWeeks = datetime.ONE_WEEK * 3; -var inThreeWeeks = datetime.date() + threeWeeks; - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +import("system.neon"); +import("system.vars"); +import("system.result"); +import("system.datetime"); + +var threeWeeks = datetime.ONE_WEEK * 3; +var inThreeWeeks = datetime.date() + threeWeeks; + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(inThreeWeeks); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js b/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js index 1a1d714cdde1413809445e51e0dd6cc841219099..5232be0ad0ad84c3ddc067506c9a9c7e6f3e4bd2 100644 --- a/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js +++ b/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js @@ -3,7 +3,7 @@ import("system.neon"); import("system.vars"); import("system.result"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(DateUtils.getTodayUTC()); } diff --git a/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js b/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js index 7363c5fb269c99197ae38d1032b278818de80d8e..fd6b6aef2f69c7be604ebcf0512609e3dfdff3cb 100644 --- a/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js +++ b/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js @@ -1,10 +1,10 @@ -import("Campaign_lib"); -import("system.result"); -import("Entity_lib"); -import("system.vars"); - -var currentParticipantsCount = parseInt(vars.get("$field.CurrentMaxParticipantsInfo")[0]); -var newMaxParticipantsCount = parseInt(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MAXPARTICIPANTS"))); - -if(newMaxParticipantsCount < currentParticipantsCount) +import("Campaign_lib"); +import("system.result"); +import("Entity_lib"); +import("system.vars"); + +var currentParticipantsCount = parseInt(vars.get("$field.CurrentMaxParticipantsInfo")[0]); +var newMaxParticipantsCount = parseInt(vars.get("local.value")); + +if(newMaxParticipantsCount < currentParticipantsCount) result.string(CampaignUtils.getMaxParticipantsValidationMessage()); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/newbulkmail/onActionProcess.js b/entity/CampaignStep_entity/entityfields/newbulkmail/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f1ed0b790f38d89d6b30d2eb7de8c8efa3d42a02 --- /dev/null +++ b/entity/CampaignStep_entity/entityfields/newbulkmail/onActionProcess.js @@ -0,0 +1,10 @@ +import("Sql_lib"); +import("system.db"); +import("Bulkmail_lib"); + +var recipients = db.array(db.COLUMN, SqlCondition.begin() + .andPrepareVars("CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID", "$field.CAMPAIGNSTEPID") + .andPrepareVars("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", "$field.CAMPAIGN_ID") + .buildSql("select CONTACT_ID from CAMPAIGNPARTICIPANT")); + +BulkMailUtils.newBulkMail(recipients); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/state/displayValueProcess.js b/entity/CampaignStep_entity/entityfields/status/displayValueProcess.js similarity index 80% rename from entity/Campaign_entity/entityfields/state/displayValueProcess.js rename to entity/CampaignStep_entity/entityfields/status/displayValueProcess.js index 686247b7356e156e1c5dc6b70d840c4da9b099e2..d0247bf23ab99895d336f6954448a7866fc855c5 100644 --- a/entity/Campaign_entity/entityfields/state/displayValueProcess.js +++ b/entity/CampaignStep_entity/entityfields/status/displayValueProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignState(), vars.get("$field.STATE"))); \ No newline at end of file +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignStepState(), vars.get("$field.STATUS"))); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/state/valueProcess.js b/entity/CampaignStep_entity/entityfields/status/valueProcess.js similarity index 63% rename from entity/CampaignStep_entity/entityfields/state/valueProcess.js rename to entity/CampaignStep_entity/entityfields/status/valueProcess.js index da244c96b11edb16fbfeb5e0a812d5315ae5b659..dc5efe1d6fe6cca00ad15ff17d26d7fe16a98a55 100644 --- a/entity/CampaignStep_entity/entityfields/state/valueProcess.js +++ b/entity/CampaignStep_entity/entityfields/status/valueProcess.js @@ -1,7 +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")) +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.campaignStepState$open()); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js b/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js index c030c5382afe5f1237d122200fc5f028a702d7fb..429287a14cde6238f380ff76c6b30c2e6ca93f05 100644 --- a/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js +++ b/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("KeywordRegistry_basic"); -import("Keyword_lib"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.communicationMediumCampaign(), vars.get("$this.value"))); +import("system.result"); +import("system.vars"); +import("KeywordRegistry_basic"); +import("Keyword_lib"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.communicationMediumCampaign(), vars.get("$field.STEPMEDIUM"))); diff --git a/entity/CampaignStep_entity/grantDeleteProcess.js b/entity/CampaignStep_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..87f22c8c68e951b1986bc106010ce589753244be --- /dev/null +++ b/entity/CampaignStep_entity/grantDeleteProcess.js @@ -0,0 +1,7 @@ +import("Context_lib"); +import("system.vars"); +import("ActivityTask_lib"); +import("system.result"); + +result.string(!TaskUtils.hasTasks(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js b/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js index 295493d78e809e8e6e55e99285ad4716cc28a105..1049e6cdec0f35e2915051b645b193f32ae8cd51 100644 --- a/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js +++ b/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js @@ -1,7 +1,12 @@ +import("system.db"); +import("Sql_lib"); import("system.vars"); import("system.result"); -if(vars.get("$param.campaignId_param")) -{ - result.string("CAMPAIGN_ID = '" + vars.getString("$param.campaignId_param") + "'"); -} +var cond = SqlCondition.begin() + .andPrepareVars("CAMPAIGNSTEP.CAMPAIGN_ID", "$param.campaignId_param"); + +cond.andPrepareIfSet("CAMPAIGNSTEP.SORTING", vars.getString("$param.maxSort_param"), "# <= ?"); + + +result.string(db.translateCondition(cond.build("1=1"))); \ No newline at end of file diff --git a/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js b/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js index bb926e234e662a174638dfcabd90a68b299db5ed..f0e8a44adee3749dafae8e5cba1b67c52701e01a 100644 --- a/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js +++ b/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js @@ -1,6 +1,6 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.campaignStepState(), "CAMPAIGNSTEP.STATE"); +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.campaignStepState(), "CAMPAIGNSTEP.STATUS"); result.string(sql); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/recordcontainers/db/recordfieldmappings/category.displayvalue/expression.js b/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js similarity index 73% rename from entity/CampaignCost_entitiy/recordcontainers/db/recordfieldmappings/category.displayvalue/expression.js rename to entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js index 4f14958aedfdf8daa195607c5b86e2e66e097ce5..f0e8a44adee3749dafae8e5cba1b67c52701e01a 100644 --- a/entity/CampaignCost_entitiy/recordcontainers/db/recordfieldmappings/category.displayvalue/expression.js +++ b/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js @@ -1,6 +1,6 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.campaignStepCostCategory(), "CAMPAIGNCOST.CATEGORY"); +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.campaignStepState(), "CAMPAIGNSTEP.STATUS"); result.string(sql); \ No newline at end of file diff --git a/entity/Campaign_entity/Campaign_entity.aod b/entity/Campaign_entity/Campaign_entity.aod index 2cdd9fdef08cd09446bb1d488e3c1694d632d9be..364f0019d3722dc74cd8a005c51f3a17e64b3c5a 100644 --- a/entity/Campaign_entity/Campaign_entity.aod +++ b/entity/Campaign_entity/Campaign_entity.aod @@ -4,6 +4,13 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <icon>VAADIN:GROUP</icon> <title>Campaign</title> + <siblings> + <element>CampaignStep_entity</element> + <element>CampaignCost_entity</element> + <element>CampaignCostChart_entity</element> + <element>CampaignStep_entity</element> + </siblings> + <grantDeleteProcess>%aditoprj%/entity/Campaign_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Campaign_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Campaign_entity/afterUiInit.js</afterUiInit> <iconId>VAADIN:GROUP</iconId> @@ -30,6 +37,7 @@ <name>NAME</name> <title>Name</title> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/name/valueProcess.js</valueProcess> </entityField> <entityField> <name>DATE_START</name> @@ -63,6 +71,7 @@ <name>DESCRIPTION</name> <title>Description</title> <contentType>LONG_TEXT</contentType> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/description/valueProcess.js</valueProcess> </entityField> <entityField> <name>USER_NEW</name> @@ -104,12 +113,12 @@ </children> </entityConsumer> <entityField> - <name>STATE</name> + <name>STATUS</name> <title>Status</title> <consumer>KeywordStates</consumer> <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/state/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/state/displayValueProcess.js</displayValueProcess> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/status/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/status/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> <name>KeywordStates</name> @@ -337,6 +346,7 @@ </entityConsumer> <entityConsumer> <name>Attributes</name> + <stateProcess>%aditoprj%/entity/Campaign_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/Campaign_entity/entityfields/attributes/onValidation.js</onValidation> <dependency> <name>dependency</name> @@ -406,6 +416,12 @@ <title>Nur eigene anzeigen</title> <expose v="true" /> </entityParameter> + <entityActionField> + <name>copyCampaign</name> + <title>Copy Campaign</title> + <onActionProcess>%aditoprj%/entity/Campaign_entity/entityfields/copycampaign/onActionProcess.js</onActionProcess> + <iconId>NEON:EXPORT</iconId> + </entityActionField> <entityActionField> <name>openAdminView</name> <title>Open admin view</title> @@ -413,6 +429,85 @@ <iconId>VAADIN:CURLY_BRACKETS</iconId> <stateProcess>%aditoprj%/entity/Campaign_entity/entityfields/openadminview/stateProcess.js</stateProcess> </entityActionField> + <entityParameter> + <name>originalCampaignIdCopy_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>description_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>emplContactId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>name_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>state_param</name> + <expose v="true" /> + </entityParameter> + <entityConsumer> + <name>Documents</name> + <dependency> + <name>dependency</name> + <entityName>Document_entity</entityName> + <fieldName>Documents</fieldName> + </dependency> + <children> + <entityParameter> + <name>AssignmentTable_param</name> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>AssignmentRowId_param</name> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>AttributeTree</name> + <stateProcess>%aditoprj%/entity/Campaign_entity/entityfields/attributetree/stateProcess.js</stateProcess> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>TreeProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>ObjectRowId_param</name> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ObjectType_param</name> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>CURRENCY</name> + <title>Currency</title> + <consumer>KeywordCurrency</consumer> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/currency/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Campaign_entity/entityfields/currency/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>KeywordCurrency</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Campaign_entity/entityfields/keywordcurrency/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> @@ -442,14 +537,17 @@ <dbRecordFieldMapping> <name>DESCRIPTION.value</name> <recordfield>CAMPAIGN.DESCRIPTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>EMPLOYEE_CONTACT_ID.value</name> <recordfield>CAMPAIGN.EMPLOYEE_CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NAME.value</name> <recordfield>CAMPAIGN.NAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_EDIT.value</name> @@ -459,14 +557,6 @@ <name>USER_NEW.value</name> <recordfield>CAMPAIGN.USER_NEW</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STATE.value</name> - <recordfield>CAMPAIGN.STATE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STATE.displayValue</name> - <expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CAMPAIGNID.value</name> <recordfield>CAMPAIGN.CAMPAIGNID</recordfield> @@ -478,12 +568,46 @@ <dbRecordFieldMapping> <name>DATE_START.value</name> <expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/date_start.value/expression.js</expression> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DATE_END.value</name> <expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/date_end.value/expression.js</expression> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> + <dbRecordFieldMapping> + <name>STATUS.value</name> + <recordfield>CAMPAIGN.STATUS</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STATUS.displayValue</name> + <expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CURRENCY.value</name> + <recordfield>CAMPAIGN.CURRENCY</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CURRENCY.displayValue</name> + <expression>%aditoprj%/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/currency.displayvalue/expression.js</expression> </dbRecordFieldMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> </recordContainers> </entity> diff --git a/entity/Campaign_entity/entityfields/attributes/onValidation.js b/entity/Campaign_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..5e74ba1b8463057afde9809c5eb8930f46519dd8 100644 --- a/entity/Campaign_entity/entityfields/attributes/onValidation.js +++ b/entity/Campaign_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/attributes/stateProcess.js b/entity/Campaign_entity/entityfields/attributes/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Campaign_entity/entityfields/attributes/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js b/entity/Campaign_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..533f8ec837ea2f9b588ddf05545ac47cdda23d18 --- /dev/null +++ b/entity/Campaign_entity/entityfields/attributetree/children/objectrowid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$sys.uid")); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js b/entity/Campaign_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e8b4e72e74a0a4696ff39e83135aa6100ef908c0 --- /dev/null +++ b/entity/Campaign_entity/entityfields/attributetree/children/objecttype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getCurrentContextId()); diff --git a/entity/Campaign_entity/entityfields/attributetree/stateProcess.js b/entity/Campaign_entity/entityfields/attributetree/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Campaign_entity/entityfields/attributetree/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/copycampaign/onActionProcess.js b/entity/Campaign_entity/entityfields/copycampaign/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d0e4f15cee96a3e7328b2b5d92067f31c8cceaef --- /dev/null +++ b/entity/Campaign_entity/entityfields/copycampaign/onActionProcess.js @@ -0,0 +1,11 @@ +import("system.vars"); +import("Campaign_lib"); + +var campaignid = vars.getString("$field.CAMPAIGNID"); +var description = vars.getString("$field.DESCRIPTION"); +var emplContactId = vars.getString("$field.EMPLOYEE_CONTACT_ID"); +var name = vars.getString("$field.NAME"); +var state = vars.getString("$field.STATUS"); + +CampaignUtils.copyCampaign(campaignid, description, emplContactId, name, state); + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/status/displayValueProcess.js b/entity/Campaign_entity/entityfields/currency/displayValueProcess.js similarity index 50% rename from entity/Order_entity/entityfields/status/displayValueProcess.js rename to entity/Campaign_entity/entityfields/currency/displayValueProcess.js index 4a9b7bcc8b2f66e295eafc8c09f796d693249001..71f6fd23918c683ebf7eecb2bfc971f603bd00fe 100644 --- a/entity/Order_entity/entityfields/status/displayValueProcess.js +++ b/entity/Campaign_entity/entityfields/currency/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.salesorderState(), vars.get("$field.STATUS"))); +result.string(KeywordUtils.getViewValue($KeywordRegistry.currency(), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/currency/valueProcess.js b/entity/Campaign_entity/entityfields/currency/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..05fa9172bc2933be5e71b17e5f7230d844d86664 --- /dev/null +++ b/entity/Campaign_entity/entityfields/currency/valueProcess.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("KeywordRegistry_basic"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string($KeywordRegistry.currency$eur()); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/description/valueProcess.js b/entity/Campaign_entity/entityfields/description/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65e38624eb4cbf930ce78521ab04ee36f367a03d --- /dev/null +++ b/entity/Campaign_entity/entityfields/description/valueProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.description_param") && vars.get("$param.description_param")) +{ + result.string(vars.get("$param.description_param")); +} \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js b/entity/Campaign_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..96338662b420b63d0107f01aec509a0d60cd6e2f --- /dev/null +++ b/entity/Campaign_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.CAMPAIGNID")); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js b/entity/Campaign_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fe27d1de73e3dd34826f531666659febc05d1087 --- /dev/null +++ b/entity/Campaign_entity/entityfields/documents/children/assignmenttable_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("CAMPAIGN"); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/employee_contact_id/valueProcess.js b/entity/Campaign_entity/entityfields/employee_contact_id/valueProcess.js index 0d83e155507cb0955f8ebc5a4ff4af836b96977e..2f4b53c92dc95c4b2e185fe4dbb4356673b1cc48 100644 --- a/entity/Campaign_entity/entityfields/employee_contact_id/valueProcess.js +++ b/entity/Campaign_entity/entityfields/employee_contact_id/valueProcess.js @@ -1,7 +1,12 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -import("Employee_lib"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) - result.string(EmployeeUtils.getCurrentContactId()); \ No newline at end of file +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Employee_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + if(vars.exists("$param.emplContactId_param") && vars.get("$param.emplContactId_param")) + result.string(vars.get("$param.emplContactId_param")); + else if(vars.get("$this.value") == null) + result.string(EmployeeUtils.getCurrentContactId()); +} \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/keywordcurrency/children/containername_param/valueProcess.js b/entity/Campaign_entity/entityfields/keywordcurrency/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6e94f823cd6267123836d5c5a4f9ed6f38da0bb6 --- /dev/null +++ b/entity/Campaign_entity/entityfields/keywordcurrency/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("KeywordRegistry_basic"); +import("system.result"); + +result.string($KeywordRegistry.currency()); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/name/valueProcess.js b/entity/Campaign_entity/entityfields/name/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..da922d4af5d21c64d4fae65c901d3479732b2b70 --- /dev/null +++ b/entity/Campaign_entity/entityfields/name/valueProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.name_param") && vars.get("$param.name_param")) +{ + result.string(vars.get("$param.name_param")); +} \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/state/valueProcess.js b/entity/Campaign_entity/entityfields/state/valueProcess.js deleted file mode 100644 index 9dff88d91d83c29412096ee051941114a92f82b1..0000000000000000000000000000000000000000 --- a/entity/Campaign_entity/entityfields/state/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); -import("KeywordRegistry_basic"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) - result.string($KeywordRegistry.campaignState$planning()); \ No newline at end of file diff --git a/entity/CampaignStep_entity/entityfields/state/displayValueProcess.js b/entity/Campaign_entity/entityfields/status/displayValueProcess.js similarity index 78% rename from entity/CampaignStep_entity/entityfields/state/displayValueProcess.js rename to entity/Campaign_entity/entityfields/status/displayValueProcess.js index 4eda9361751ab1a50266d6fb8264a35cb808a077..2b82fe77f1e59332c6adfbfa9398714a6b7b2566 100644 --- a/entity/CampaignStep_entity/entityfields/state/displayValueProcess.js +++ b/entity/Campaign_entity/entityfields/status/displayValueProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignStepState(), vars.get("$this.value"))); \ No newline at end of file +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.campaignState(), vars.get("$field.STATUS"))); \ No newline at end of file diff --git a/entity/Campaign_entity/entityfields/status/valueProcess.js b/entity/Campaign_entity/entityfields/status/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2593cb9a9879f1bbdcd91a08c5ca3ed99eea0c4a --- /dev/null +++ b/entity/Campaign_entity/entityfields/status/valueProcess.js @@ -0,0 +1,12 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("KeywordRegistry_basic"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + if(vars.exists("$param.state_param") && vars.get("$param.state_param")) + result.string(vars.get("$param.state_param")); + else if (vars.get("$this.value") == null) + result.string($KeywordRegistry.campaignState$planning()); +} \ No newline at end of file diff --git a/entity/Campaign_entity/grantDeleteProcess.js b/entity/Campaign_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8f6dbd3f5f48448ca0c78b7240fbbd715828a6bd --- /dev/null +++ b/entity/Campaign_entity/grantDeleteProcess.js @@ -0,0 +1,9 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("CAMPAIGN", null, vars.get("$field.CAMPAIGNID")) + && !TaskUtils.hasTasks(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/conditionProcess.js b/entity/Campaign_entity/recordcontainers/db/conditionProcess.js index e2736c04e6c8e8231e524311c3733b49239dd775..35564fcfc97e9cbfd34ef204697547e186e56a9f 100644 --- a/entity/Campaign_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Campaign_entity/recordcontainers/db/conditionProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("Employee_lib"); import("system.db"); import("system.result"); diff --git a/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/onDBInsert.js b/entity/Campaign_entity/recordcontainers/db/onDBInsert.js index 1c4614ea9ccf8b7adc7d532ea28deab3036f1970..817ea9b70d548acdc636dab946a5f26affc8ebb0 100644 --- a/entity/Campaign_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Campaign_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("system.neon"); import("Employee_lib"); import("system.translate"); import("KeywordRegistry_basic"); @@ -5,30 +6,39 @@ import("system.util"); import("system.vars"); import("system.db"); import("system.datetime"); +import("Campaign_lib"); -var threeWeeks = datetime.ONE_WEEK * 3; -var inThreeWeeks = datetime.date() + threeWeeks; +var rowdata = vars.get("$local.rowdata"); +var campaignId = vars.get("$local.uid"); -var campaignId = vars.get("$field.CAMPAIGNID"); -var campaignStepId = util.getNewUUID(); -var campaignStepName = translate.text("Added"); +if (vars.get("$param.originalCampaignIdCopy_param")) + CampaignUtils.copyCampaignSteps(vars.getString("$param.originalCampaignIdCopy_param"), campaignId); +else +{ + var threeWeeks = datetime.ONE_WEEK * 3; + var inThreeWeeks = datetime.date() + threeWeeks; -var dateNew = vars.get("$sys.date"); -var userNew = vars.get("$sys.user"); + + var campaignStepId = util.getNewUUID(); + var campaignStepName = translate.text("Added"); -var dateStart = dateNew; -var dateEnd = inThreeWeeks; + var dateNew = vars.get("$sys.date"); + var userNew = vars.get("$sys.user"); -var description = ""; -var maxParticipants = 100; -var state = $KeywordRegistry.campaignStepState$open(); -var sorting = 1; -var employeeContactId = vars.get("$field.EMPLOYEE_CONTACT_ID"); + var dateStart = dateNew; + var dateEnd = inThreeWeeks; + var description = ""; + var maxParticipants = 100; + var state = $KeywordRegistry.campaignStepState$open(); + var sorting = 1; + var employeeContactId = rowdata["CAMPAIGN.EMPLOYEE_CONTACT_ID"]; -var columns = ["CAMPAIGN_ID", "CAMPAIGNSTEPID", "NAME", "DATE_NEW", "USER_NEW", - "DATE_START", "DATE_END", "DESCRIPTION", "MAXPARTICIPANTS", "STATE", "SORTING", "EMPLOYEE_CONTACT_ID"]; -var values = [campaignId, campaignStepId, campaignStepName, dateNew, userNew, - dateStart, dateEnd, description, maxParticipants, state, sorting, employeeContactId]; -db.insertData("CAMPAIGNSTEP", columns, null, values); \ No newline at end of file + var columns = ["CAMPAIGN_ID", "CAMPAIGNSTEPID", "NAME", "DATE_NEW", "USER_NEW", + "DATE_START", "DATE_END", "DESCRIPTION", "MAXPARTICIPANTS", "STATUS", "SORTING", "EMPLOYEE_CONTACT_ID"]; + var values = [campaignId, campaignStepId, campaignStepName, dateNew, userNew, + dateStart, dateEnd, description, maxParticipants, state, sorting, employeeContactId]; + + db.insertData("CAMPAIGNSTEP", columns, null, values); +} \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fa780bd3a980c26cd0931459951df89c31b7d4a3 --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Campaign'"; + +result.string("CAMPAIGNID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Member_entity/recordcontainers/db/recordfieldmappings/salesproject_role.displayvalue/expression.js b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/currency.displayvalue/expression.js similarity index 82% rename from entity/Member_entity/recordcontainers/db/recordfieldmappings/salesproject_role.displayvalue/expression.js rename to entity/Campaign_entity/recordcontainers/db/recordfieldmappings/currency.displayvalue/expression.js index 4e07d5e1138b5fac8da6fedca2efe17c54727ec4..97616b9b6066153e56e577e2aef5425ae22b8da6 100644 --- a/entity/Member_entity/recordcontainers/db/recordfieldmappings/salesproject_role.displayvalue/expression.js +++ b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/currency.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.MemberRole(), "MEMBER.ROLE"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.currency(), "CAMPAIGN.CURRENCY"); result.string(sql); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js similarity index 80% rename from entity/Campaign_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js rename to entity/Campaign_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js index cf96338344da8b24effa97ed754332065023ba9a..f67e50c289fe9587d704ded87665c5abce6509b5 100644 --- a/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js +++ b/entity/Campaign_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js @@ -1,6 +1,6 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.campaignState(), "CAMPAIGN.STATE"); +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.campaignState(), "CAMPAIGN.STATUS"); result.string(sql); \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod b/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod index a9476d528f2a7a68e33c76b782bd1ca571f9c7d1..be89d052752f9821aba3165aa52fd8ad0d417a99 100644 --- a/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod +++ b/entity/ClassificationAdmin_entity/ClassificationAdmin_entity.aod @@ -6,6 +6,7 @@ <title>Classification</title> <grantDeleteProcess>%aditoprj%/entity/ClassificationAdmin_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/ClassificationAdmin_entity/contentTitleProcess.js</contentTitleProcess> + <iconId>VAADIN:LIST_OL</iconId> <titlePlural>Classifications</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> @@ -146,6 +147,7 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>CLASSIFICATIONGROUP.value</name> + <isFilterable v="false" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>CLASSIFICATIONSCORE_ID.value</name> @@ -158,15 +160,18 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>OBJECT_TYPE.value</name> + <isFilterable v="false" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>OBJECT_ROWID.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>SCORETYPE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>CLASSIFICATIONTYPE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> diff --git a/entity/ClassificationAdmin_entity/entityfields/classificationgroup/displayValueProcess.js b/entity/ClassificationAdmin_entity/entityfields/classificationgroup/displayValueProcess.js index a5717eabb76417046c488939aadcfa7beb915dcd..4fb0aeb79a76fae66af37083cc83e38fc26d051e 100644 --- a/entity/ClassificationAdmin_entity/entityfields/classificationgroup/displayValueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/classificationgroup/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(translate.text(vars.get("$this.value"))); \ No newline at end of file +result.string(translate.text(vars.get("$field.CLASSIFICATIONGROUP"))); \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/classificationgroup/onValidation.js b/entity/ClassificationAdmin_entity/entityfields/classificationgroup/onValidation.js index 54c0a302da1fbc5e4e536a7ffd0f80778cc1986c..b22708772a0282ee6afb72989395043a5a80ff50 100644 --- a/entity/ClassificationAdmin_entity/entityfields/classificationgroup/onValidation.js +++ b/entity/ClassificationAdmin_entity/entityfields/classificationgroup/onValidation.js @@ -7,7 +7,7 @@ import("Entity_lib"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { - var newGroup = ProcessHandlingUtils.getOnValidationValue(); + var newGroup = vars.get("local.value"); // use param if available or current selectionRows var classificationType = ClassificationUtils.getUsageType("$param.ClassificationType_param", "$sys.selectionRows"); diff --git a/entity/ClassificationAdmin_entity/entityfields/classificationtype/displayValueProcess.js b/entity/ClassificationAdmin_entity/entityfields/classificationtype/displayValueProcess.js index e56601c615178505648345adeb253d9b3dea9e77..9a93d9382887643fcc081de68214ba526ed930ac 100644 --- a/entity/ClassificationAdmin_entity/entityfields/classificationtype/displayValueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/classificationtype/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$this.value"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$field.CLASSIFICATIONTYPE"))); \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/classificationtype_id/valueProcess.js b/entity/ClassificationAdmin_entity/entityfields/classificationtype_id/valueProcess.js index 3886bb2dbefafdfd50c83b824fe2c1efd190f31e..aaef9be6b3921ec62b37843d0c65b43aeedd7fdf 100644 --- a/entity/ClassificationAdmin_entity/entityfields/classificationtype_id/valueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/classificationtype_id/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) && !vars.get("$this.value")) +if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) && vars.get("$this.value") == null) { result.string(vars.get("$field.CLASSIFICATIONTYPEID")); } \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/object_rowid/valueProcess.js b/entity/ClassificationAdmin_entity/entityfields/object_rowid/valueProcess.js index d15a596ff1090502ac8cd6afd63e12893ce05625..00c91dc0b75c8cb002fa9eafe58ad40ab16a0e3a 100644 --- a/entity/ClassificationAdmin_entity/entityfields/object_rowid/valueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/object_rowid/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.get("$this.value") == null) { result.string(vars.get("$param.ObjectRowid_param")); } \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/object_type/valueProcess.js b/entity/ClassificationAdmin_entity/entityfields/object_type/valueProcess.js index b532aa65a135891c68363e05f02e3420967f409a..6a340688081d8317de45c8b656f6ffcbe9520e1e 100644 --- a/entity/ClassificationAdmin_entity/entityfields/object_type/valueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/object_type/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.get("$this.value") == null) { result.string(vars.get("$param.ObjectType_param")); } \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/scoretype/displayValueProcess.js b/entity/ClassificationAdmin_entity/entityfields/scoretype/displayValueProcess.js index a5717eabb76417046c488939aadcfa7beb915dcd..87d569a0e2dc50c0ef3859fdbc0f22c3d9ac89e3 100644 --- a/entity/ClassificationAdmin_entity/entityfields/scoretype/displayValueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/scoretype/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(translate.text(vars.get("$this.value"))); \ No newline at end of file +result.string(translate.text(vars.get("$field.SCORETYPE"))); \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/entityfields/uid/displayValueProcess.js b/entity/ClassificationAdmin_entity/entityfields/uid/displayValueProcess.js index b92bfbc2e35eba18a9e8daf1ba5ab25180d8a837..62451165d8d832fb9359a2696e3f32d16a585149 100644 --- a/entity/ClassificationAdmin_entity/entityfields/uid/displayValueProcess.js +++ b/entity/ClassificationAdmin_entity/entityfields/uid/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$this.value"))) \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$field.UID"))) \ No newline at end of file diff --git a/entity/ClassificationAdmin_entity/recordcontainers/jdito/contentProcess.js b/entity/ClassificationAdmin_entity/recordcontainers/jdito/contentProcess.js index 52a61eb71abaeb31c3468bf91027f2167d1f47a1..5a78999dea25b300de3f031341e56276f932906e 100644 --- a/entity/ClassificationAdmin_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/ClassificationAdmin_entity/recordcontainers/jdito/contentProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("JditoFilter_lib"); import("Classification_lib"); import("system.vars"); @@ -12,7 +11,6 @@ var classificationTypeId; if (vars.exists("$local.idvalues") && vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) { var selected = vars.get("$local.idvalues")[0]; - logging.log(selected.toSource()) classificationTypeId = selected; } diff --git a/entity/ClassificationScore_entity/entityfields/score/onValidation.js b/entity/ClassificationScore_entity/entityfields/score/onValidation.js index be6e4157430034d74f2785dcd3c5198b8dfe6a17..83ad4d951b6ef20e15e38a4e4ad81c1ba7738e3b 100644 --- a/entity/ClassificationScore_entity/entityfields/score/onValidation.js +++ b/entity/ClassificationScore_entity/entityfields/score/onValidation.js @@ -4,5 +4,5 @@ import("system.result"); import("system.vars"); var max = parseFloat(vars.getString("$field.MaxValue")); -if (parseFloat(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.SCORE"))) > max) +if (parseFloat(vars.get("local.value")) > max) result.string(translate.withArguments("${HIGHER_THAN_MAX} max: %0", [max])); \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/classificationgroup/displayValueProcess.js b/entity/Classification_entity/entityfields/classificationgroup/displayValueProcess.js index c5738f7687d5ea12365963b822d86b9d09968bdd..6f677fee2cb374dfea6c759cd9611407428f8b89 100644 --- a/entity/Classification_entity/entityfields/classificationgroup/displayValueProcess.js +++ b/entity/Classification_entity/entityfields/classificationgroup/displayValueProcess.js @@ -6,6 +6,6 @@ import("system.vars"); if (vars.getString("$field.CLASSIFICATIONGROUP")) { var score = vars.getString("$field.GroupScore"); - result.string(translate.text(vars.get("$this.value")) + ": " + score + " " + translate.text("points") + " = " + ClassificationUtils.mapToClass(score)); + result.string(translate.text(vars.get("$field.CLASSIFICATIONGROUP")) + ": " + score + " " + translate.text("points") + " = " + ClassificationUtils.mapToClass(score)); } diff --git a/entity/Classification_entity/entityfields/classificationtype/displayValueProcess.js b/entity/Classification_entity/entityfields/classificationtype/displayValueProcess.js index e56601c615178505648345adeb253d9b3dea9e77..9a93d9382887643fcc081de68214ba526ed930ac 100644 --- a/entity/Classification_entity/entityfields/classificationtype/displayValueProcess.js +++ b/entity/Classification_entity/entityfields/classificationtype/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$this.value"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.classificationType(), vars.get("$field.CLASSIFICATIONTYPE"))); \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js b/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js index 3886bb2dbefafdfd50c83b824fe2c1efd190f31e..aaef9be6b3921ec62b37843d0c65b43aeedd7fdf 100644 --- a/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js +++ b/entity/Classification_entity/entityfields/classificationtype_id/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) && !vars.get("$this.value")) +if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) && vars.get("$this.value") == null) { result.string(vars.get("$field.CLASSIFICATIONTYPEID")); } \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/object_rowid/valueProcess.js b/entity/Classification_entity/entityfields/object_rowid/valueProcess.js index d15a596ff1090502ac8cd6afd63e12893ce05625..00c91dc0b75c8cb002fa9eafe58ad40ab16a0e3a 100644 --- a/entity/Classification_entity/entityfields/object_rowid/valueProcess.js +++ b/entity/Classification_entity/entityfields/object_rowid/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.get("$this.value") == null) { result.string(vars.get("$param.ObjectRowid_param")); } \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/object_type/valueProcess.js b/entity/Classification_entity/entityfields/object_type/valueProcess.js index b532aa65a135891c68363e05f02e3420967f409a..6a340688081d8317de45c8b656f6ffcbe9520e1e 100644 --- a/entity/Classification_entity/entityfields/object_type/valueProcess.js +++ b/entity/Classification_entity/entityfields/object_type/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT && vars.get("$this.value") == null) { result.string(vars.get("$param.ObjectType_param")); } \ No newline at end of file diff --git a/entity/Classification_entity/entityfields/scoretype/displayValueProcess.js b/entity/Classification_entity/entityfields/scoretype/displayValueProcess.js index a5717eabb76417046c488939aadcfa7beb915dcd..87d569a0e2dc50c0ef3859fdbc0f22c3d9ac89e3 100644 --- a/entity/Classification_entity/entityfields/scoretype/displayValueProcess.js +++ b/entity/Classification_entity/entityfields/scoretype/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(translate.text(vars.get("$this.value"))); \ No newline at end of file +result.string(translate.text(vars.get("$field.SCORETYPE"))); \ No newline at end of file diff --git a/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js b/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js index 0d83e155507cb0955f8ebc5a4ff4af836b96977e..4711a17716cf559c48c73cd7ea780b2ffe5e2e03 100644 --- a/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js +++ b/entity/CommRestriction_Entity/entityfields/employee_involved/valueProcess.js @@ -1,7 +1,7 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -import("Employee_lib"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Employee_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(EmployeeUtils.getCurrentContactId()); \ No newline at end of file diff --git a/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js b/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js index 3e186c747bfbb6719878872798de7bcea5ab7794..4f2202c6ae0a7cf767176ab29c830936649489dc 100644 --- a/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js +++ b/entity/CommRestriction_Entity/entityfields/startdate/valueProcess.js @@ -1,7 +1,7 @@ -import("system.datetime"); -import("system.vars"); -import("system.result"); -import("system.neon"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.getString("$this.value")) +import("system.datetime"); +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) result.string(datetime.date()); \ No newline at end of file diff --git a/entity/Communication_entity/Communication_entity.aod b/entity/Communication_entity/Communication_entity.aod index a3a202a55aa320da5844b8723e5f51cb0c18d874..c9d117fe06fd0f181bd4e136b7e4d2cba56fae64 100644 --- a/entity/Communication_entity/Communication_entity.aod +++ b/entity/Communication_entity/Communication_entity.aod @@ -13,10 +13,6 @@ <contentTypeProcess>%aditoprj%/entity/Communication_entity/entityfields/addr/contentTypeProcess.js</contentTypeProcess> <mandatory v="true" /> <valueProcess>%aditoprj%/entity/Communication_entity/entityfields/addr/valueProcess.js</valueProcess> - <onValueChange>%aditoprj%/entity/Communication_entity/entityfields/addr/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - </onValueChangeTypes> <onValidation>%aditoprj%/entity/Communication_entity/entityfields/addr/onValidation.js</onValidation> </entityField> <entityField> @@ -283,7 +279,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD.value</name> - <recordfield>COMMUNICATION.STANDARD</recordfield> + <recordfield>COMMUNICATION.ISSTANDARD</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MEDIUM_ID.displayValue</name> @@ -322,7 +318,6 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <name>ADDR.value</name> <indexFieldType>COMMUNICATION</indexFieldType> <isMultiValued v="true" /> - <dbColumn>ADDR</dbColumn> </indexRecordFieldMapping> </indexFieldMappings> </indexRecordContainer> diff --git a/entity/Communication_entity/entityfields/addr/onValidation.js b/entity/Communication_entity/entityfields/addr/onValidation.js index 54a9148c82d2064819c16312df0acd1d96e60870..2a7c905a42a446fcb30b0ba10d64d62e458c1aee 100644 --- a/entity/Communication_entity/entityfields/addr/onValidation.js +++ b/entity/Communication_entity/entityfields/addr/onValidation.js @@ -11,16 +11,16 @@ import("KeywordRegistry_basic"); var commMedium = vars.get("$field.MEDIUM_ID"); -//TODO: maybe accessible via $property - then it's not needed to load that info twice var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(commMedium, $KeywordRegistry.communicationMedium()); var commCategory = keywordAttributes.contentType || "TEXT"; var fn = CommValidationUtil.makeValidationFn(commCategory); if (fn != null) { - var commAddr = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.ADDR")); + var commAddr = vars.get("local.value"); var additional = CommValidationUtil.getExtensionsBlueprint(); additional.countryCode = vars.get("$param.ContactsMainCountry_param");//TODO: try to use users language first and then the companies + var res = fn.call(null, commAddr, additional); if (res != null) result.string(res); diff --git a/entity/Communication_entity/entityfields/addr/onValueChange.js b/entity/Communication_entity/entityfields/addr/onValueChange.js deleted file mode 100644 index 82593755b7f91a95c7d063a191d9990782a2ba8e..0000000000000000000000000000000000000000 --- a/entity/Communication_entity/entityfields/addr/onValueChange.js +++ /dev/null @@ -1,27 +0,0 @@ -import("WsValidation_lib"); -import("system.neon"); -import("KeywordRegistry_basic"); -import("Keyword_lib"); -import("system.vars"); - -var addr = vars.get("$local.value"); - -if (addr) -{ - var commMedium = vars.get("$field.MEDIUM_ID"); - var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(commMedium, $KeywordRegistry.communicationMedium()); - var commCategory = keywordAttributes.contentType || "TEXT"; - - switch (commCategory) - { - case "TELEPHONE": // Phone - if(addr.length > 5) - { - neon.setFieldValue("$field.ADDR", WsValidationUtils.validate(addr, WsValidationType.get().TYPE_PHONE, vars.get("$param.ContactsMainCountry_param"))); - } - break; - default: - - } - -} \ No newline at end of file diff --git a/entity/Communication_entity/entityfields/addr/valueProcess.js b/entity/Communication_entity/entityfields/addr/valueProcess.js index 4485a97535dcb1453202c4be8c601ec4428b5afa..64ebd499996180f558787e6a291620ef0a6f8e05 100644 --- a/entity/Communication_entity/entityfields/addr/valueProcess.js +++ b/entity/Communication_entity/entityfields/addr/valueProcess.js @@ -1,3 +1,4 @@ +import("system.cti"); import("system.result"); import("system.vars"); import("system.neon"); @@ -5,10 +6,12 @@ import("KeywordRegistry_basic"); import("Keyword_lib"); var recordstate = vars.get("$sys.recordstate"); +var addr = vars.getString("$this.value"); + if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE_EDIT) { var medium = vars.get("$field.MEDIUM_ID"); - if (vars.getString("$this.value") == "" && medium) + if (addr == null && medium) { var keywordAttrs = KeywordUtils.getAttributeRelationsByKey(medium, $KeywordRegistry.communicationMedium()); var isInternet = keywordAttrs.contentType == "LINK"; @@ -16,4 +19,25 @@ if (recordstate == neon.OPERATINGSTATE_NEW || recordstate == neon.OPERATINGSTATE if (isInternet) result.string("https://"); } + else if (addr) + { + var commMedium = vars.get("$field.MEDIUM_ID"); + var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(commMedium, $KeywordRegistry.communicationMedium()); + var commCategory = keywordAttributes.contentType || "TEXT"; + + switch (commCategory) + { + case "TELEPHONE": // Phone + if(addr.length > 5) + { + var formatted = cti.formatPhoneNumber(addr, true, vars.get("$param.ContactsMainCountry_param")) + result.string(cti.formatPhoneNumber(addr, true, vars.get("$param.ContactsMainCountry_param"))) + } + break; + default: + + } + + } + } \ No newline at end of file diff --git a/entity/Communication_entity/recordcontainers/db/conditionProcess.js b/entity/Communication_entity/recordcontainers/db/conditionProcess.js index d5630c83570b49da80815e0fe47b0a01457d3688..37c61938b1dbac04b6054ddcc63ebb26a8bed8db 100644 --- a/entity/Communication_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Communication_entity/recordcontainers/db/conditionProcess.js @@ -12,6 +12,6 @@ if (vars.exists("$param.CommMediumIds_param")) { var mediumIds = JSON.parse(vars.getString("$param.CommMediumIds_param")); if(mediumIds.length > 0) - cond.and("COMMUNICATION.MEDIUM_ID in ('" + mediumIds.join("', '") + "')"); + cond.andIn("COMMUNICATION.MEDIUM_ID", mediumIds); } -result.string(db.translateCondition([cond.toString("1 = 2"), cond.preparedValues])); \ No newline at end of file +result.string(db.translateCondition(cond.build("1 = 2"))); \ No newline at end of file diff --git a/entity/Communication_entity/recordcontainers/db/onDBInsert.js b/entity/Communication_entity/recordcontainers/db/onDBInsert.js index 064879ccf84aa1d2ec5dafc66afc5dda16eed01d..fc9980a9213e693945a6f76ab92085f5e89c7172 100644 --- a/entity/Communication_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Communication_entity/recordcontainers/db/onDBInsert.js @@ -2,7 +2,9 @@ import("DataPrivacy_lib"); import("system.vars"); import("StandardObject_lib"); -new StandardObject("Communication", vars.get("$field.COMMUNICATIONID"), "Person", vars.get("$field.CONTACT_ID")) - .onCommunicationInsert(vars.get("$field.MEDIUM_ID")); - -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$field.CONTACT_ID"), vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file +var rowdata = vars.get("$local.rowdata"); + +var standard = new StandardObject("Communication", vars.get("$local.uid"), "Person", rowdata["COMMUNICATION.CONTACT_ID"]) +standard.onCommunicationInsert(rowdata["COMMUNICATION.MEDIUM_ID"]); + +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(rowdata["COMMUNICATION.CONTACT_ID"], vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file diff --git a/entity/Communication_entity/recordcontainers/db/onDBUpdate.js b/entity/Communication_entity/recordcontainers/db/onDBUpdate.js index c6e55a7c46034dbe62bb7037c7cf3ae24c16d8d3..d3d0371cec1d21f9cb927d351939dc5beac8cb99 100644 --- a/entity/Communication_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Communication_entity/recordcontainers/db/onDBUpdate.js @@ -2,7 +2,12 @@ import("DataPrivacy_lib"); import("system.vars"); import("StandardObject_lib"); -new StandardObject("Communication", vars.get("$field.COMMUNICATIONID"), "Person", vars.get("$field.CONTACT_ID")) - .onCommunicationUpdate(vars.get("$field.MEDIUM_ID")); - -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$field.CONTACT_ID"), vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file +var rowdata = vars.get("$local.rowdata"); + +if (rowdata["COMMUNICATION.CONTACT_ID"] != null) +{ + var standard = new StandardObject("Communication", vars.get("$local.uid"), "Person", rowdata["COMMUNICATION.CONTACT_ID"]) + standard.onCommunicationUpdate(rowdata["COMMUNICATION.MEDIUM_ID"]); +} + +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(rowdata["COMMUNICATION.CONTACT_ID"], vars.get("$param.ShowDsgvoMessage_param")); \ No newline at end of file diff --git a/entity/Communication_entity/recordcontainers/db/orderClauseProcess.js b/entity/Communication_entity/recordcontainers/db/orderClauseProcess.js index 29863873d869a29f0cd3e0ada45b6681052c9217..41fb0adf1e1b6167b68c6d316cc525b6f909580c 100644 --- a/entity/Communication_entity/recordcontainers/db/orderClauseProcess.js +++ b/entity/Communication_entity/recordcontainers/db/orderClauseProcess.js @@ -3,5 +3,5 @@ import("system.db"); result.object({ "AB_KEYWORD_ENTRY.SORTING": db.ASCENDING, - "COMMUNICATION.STANDARD": db.DESCENDING + "COMMUNICATION.ISSTANDARD": db.DESCENDING }); \ No newline at end of file diff --git a/entity/Communication_entity/recordcontainers/groupextension/query.js b/entity/Communication_entity/recordcontainers/groupextension/query.js index 7faad202b023540b228df7dd410c24573ce8d755..175c25d9aa7ea3eb64603cbec5ff91a1f143ccf6 100644 --- a/entity/Communication_entity/recordcontainers/groupextension/query.js +++ b/entity/Communication_entity/recordcontainers/groupextension/query.js @@ -10,7 +10,9 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } -sqlQuery = "select COMMUNICATION.COMMUNICATIONID, COMMUNICATION.ADDR from COMMUNICATION " +sqlQuery = "select COMMUNICATION.COMMUNICATIONID" + + ", COMMUNICATION.ADDR" + + " from COMMUNICATION" + (queryCondition || "") + " order by COMMUNICATION.COMMUNICATIONID "; diff --git a/entity/Competition_entity/Competition_entity.aod b/entity/Competition_entity/Competition_entity.aod index 38d81bdadbd4fd646267d6376ffaf79c5952d32b..ff1e4363a8bf6c313c032c77c11ca071ce84fd79 100644 --- a/entity/Competition_entity/Competition_entity.aod +++ b/entity/Competition_entity/Competition_entity.aod @@ -16,6 +16,7 @@ <resolution>DAY</resolution> <outputFormat>dd.MM.yyyy</outputFormat> <inputFormat>dd.MM.yyyy</inputFormat> + <onValidation>%aditoprj%/entity/Competition_entity/entityfields/date_cancelled/onValidation.js</onValidation> </entityField> <entityField> <name>INFO</name> @@ -377,6 +378,15 @@ <recordfield>COMPETITION.COMPETITIONID</recordfield> </dbRecordFieldMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> </recordContainers> </entity> diff --git a/entity/Competition_entity/entityfields/date_cancelled/onValidation.js b/entity/Competition_entity/entityfields/date_cancelled/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..193af4e5f90b053ec40e9dd7e7d11d5bc28a5f0a --- /dev/null +++ b/entity/Competition_entity/entityfields/date_cancelled/onValidation.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.vars"); +import("system.result"); +import("Date_lib"); + +if (!DateUtils.validateNotInFuture(vars.get("$local.value"))) + result.string(translate.text("Excreted can't be in the future")); diff --git a/entity/Competition_entity/entityfields/keywordstate/children/containername_param/valueProcess.js b/entity/Competition_entity/entityfields/keywordstate/children/containername_param/valueProcess.js index 1f1bf71aaf2db72c68e3191375bc308b1425a82c..8c5b3ca3c9349b9437b2306dbb5708521e6045d4 100644 --- a/entity/Competition_entity/entityfields/keywordstate/children/containername_param/valueProcess.js +++ b/entity/Competition_entity/entityfields/keywordstate/children/containername_param/valueProcess.js @@ -2,4 +2,4 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string($KeywordRegistry.CompetitionState()); \ No newline at end of file +result.string($KeywordRegistry.competitionState()); \ No newline at end of file diff --git a/entity/Competition_entity/entityfields/keywordstates/children/containername_param/valueProcess.js b/entity/Competition_entity/entityfields/keywordstates/children/containername_param/valueProcess.js index 520831dd08dc4cfdc01ad2894afebbc10ae421bd..d51269cba947f3be966be136eb909d6a3f7847a9 100644 --- a/entity/Competition_entity/entityfields/keywordstates/children/containername_param/valueProcess.js +++ b/entity/Competition_entity/entityfields/keywordstates/children/containername_param/valueProcess.js @@ -2,4 +2,4 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string($KeywordRegistry.CompetitionState()); +result.string($KeywordRegistry.competitionState()); diff --git a/entity/Competition_entity/entityfields/status/displayValueProcess.js b/entity/Competition_entity/entityfields/status/displayValueProcess.js index fbea558b6977bded361339b3e117dca75fc0a52e..4894225c15df7381773be3dc98027fdf63562077 100644 --- a/entity/Competition_entity/entityfields/status/displayValueProcess.js +++ b/entity/Competition_entity/entityfields/status/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), vars.get("$field.STATUS"))); +result.string(KeywordUtils.getViewValue($KeywordRegistry.competitionState(), vars.get("$field.STATUS"))); diff --git a/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Competition_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Competition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/Competition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js index 9f640f09b3b4b2a0940f32b14300ab86a3b73b32..31ae168166d1ad654658db03e42030db31e6645a 100644 --- a/entity/Competition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js +++ b/entity/Competition_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.CompetitionState(), "COMPETITION.STATUS"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.competitionState(), "COMPETITION.STATUS"); result.string(sql); diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod index 85f4e81486b9f73b3ad8aa8b5a9233c87632b9f7..38b5ede02171c98390b2cee907bcf1a5b5b43dee 100644 --- a/entity/Contact_entity/Contact_entity.aod +++ b/entity/Contact_entity/Contact_entity.aod @@ -255,7 +255,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>POSITION.value</name> - <recordfield>CONTACT.POSITION</recordfield> + <recordfield>CONTACT.CONTACTPOSITION</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACTROLE.value</name> @@ -267,7 +267,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LANGUAGE.value</name> - <recordfield>CONTACT.LANGUAGE</recordfield> + <recordfield>CONTACT.ISOLANGUAGE</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.value</name> diff --git a/entity/Contact_entity/entityfields/address_id/valueProcess.js b/entity/Contact_entity/entityfields/address_id/valueProcess.js index 0ddd690f6cc1711705c2243205b1483a84da6fc8..a1fd89ea38d52b2df99d15d9a6848c68fb6ecc90 100644 --- a/entity/Contact_entity/entityfields/address_id/valueProcess.js +++ b/entity/Contact_entity/entityfields/address_id/valueProcess.js @@ -3,11 +3,14 @@ import("system.vars"); import("StandardObject_lib"); // Check if the standard address is already set. -if (vars.get("$field.ADDRESS_ID") === null || vars.get("$field.ADDRESS_ID") === "" || vars.get("$field.ADDRESS_ID") == 0) { +if (vars.get("$this.value") === null || vars.get("$this.value") === "" || vars.get("$this.value") == 0) { var possibleStandardAddressID = new StandardObject("Address", null, "Person", vars.get("$field.CONTACTID")) .onPersonValueChange(vars.get("$field.ORGANISATION_ID")); // If a possible standard addrss was found it should get applied to the field. - if (possibleStandardAddressID !== null) + // The secondary condition is specifically for a new "private" person, because + // it has placeholder address with the id "0<35 whitespaces>" (whitspaces due + // to char36 and uuid format). + if (possibleStandardAddressID !== null && possibleStandardAddressID.trim() !== "0") result.string(possibleStandardAddressID); -} \ No newline at end of file +} diff --git a/entity/Contact_entity/entityfields/organisation_id/onValidation.js b/entity/Contact_entity/entityfields/organisation_id/onValidation.js index 414972ba58306e857d7bf27cd11c1175bf96cae3..2d8449de821c3519c108f09d553f73d05a70be1a 100644 --- a/entity/Contact_entity/entityfields/organisation_id/onValidation.js +++ b/entity/Contact_entity/entityfields/organisation_id/onValidation.js @@ -7,13 +7,7 @@ import("Entity_lib"); import("Sql_lib"); var personId = vars.getString("$field.PERSON_ID"); -var organisationId = ProcessHandlingUtils.getOnValidationValue("$field.ORGANISATION_ID"); - -//workaround for organisationId: $local.value will return the name of the organisation which is not what we want -//but the field already contains the changed value; so let's load the field instead of the $local.value-variable -//this is a bug within the ADITO-kernel -//TODO: change the workaround behaviour when $local.value is retrieved correct -organisationId = vars.getString("$field.ORGANISATION_ID"); +var organisationId = vars.get("$local.value"); //a entry within the Contact_enity can never be edited only created (it's edited within the Person_entity) //so no need to provide our own CONTACTID since it does not exist in the database right now => provide null instead diff --git a/entity/Contact_entity/entityfields/person_id/valueProcess.js b/entity/Contact_entity/entityfields/person_id/valueProcess.js index 7803b90af373762f4ae921f51bdadf4386ac9469..86dc70467464d41a428886dd7830cf7432470cde 100644 --- a/entity/Contact_entity/entityfields/person_id/valueProcess.js +++ b/entity/Contact_entity/entityfields/person_id/valueProcess.js @@ -3,5 +3,5 @@ import("system.result"); import("system.neon"); var presetValue = vars.get("$param.PersonId_param"); -if (presetValue && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (presetValue && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(presetValue); \ No newline at end of file diff --git a/entity/Contact_entity/entityfields/status/valueProcess.js b/entity/Contact_entity/entityfields/status/valueProcess.js index ab590b059440372f55b8c6d73d0c47eae06ca396..13218c16514d81765c7e5dfd47c099996adfe063 100644 --- a/entity/Contact_entity/entityfields/status/valueProcess.js +++ b/entity/Contact_entity/entityfields/status/valueProcess.js @@ -3,5 +3,5 @@ import("system.result"); import("system.neon"); import("KeywordRegistry_basic"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +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/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod index 498e9c4546494880284b128f7e46a81dc57e9b34..95285692f1ee0c680ec64642e56e851d99d2d4fc 100644 --- a/entity/Context_entity/Context_entity.aod +++ b/entity/Context_entity/Context_entity.aod @@ -65,6 +65,12 @@ <fieldName>Contexts</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>98695ca8-7f46-489d-a479-f856f6d2b5ca</name> + <entityName>Order_entity</entityName> + <fieldName>Contexts</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod index d9fbb83e332e44798f9bd5d2994f747869353926..52283a9db64a6e7fb6d341afbd64cd2076ce3bf8 100644 --- a/entity/Contract_entity/Contract_entity.aod +++ b/entity/Contract_entity/Contract_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Contract_entity/documentation.adoc</documentation> <title>Contract</title> + <grantDeleteProcess>%aditoprj%/entity/Contract_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Contract_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Contract_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Contract_entity/onValidation.js</onValidation> @@ -65,6 +66,7 @@ <name>CONTRACTTYPE</name> <title>Type of contract</title> <consumer>ContractTypes</consumer> + <mandatory v="true" /> <displayValueProcess>%aditoprj%/entity/Contract_entity/entityfields/contracttype/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -277,6 +279,7 @@ </entityActionField> <entityConsumer> <name>Attributes</name> + <stateProcess>%aditoprj%/entity/Contract_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/Contract_entity/entityfields/attributes/onValidation.js</onValidation> <dependency> <name>dependency</name> @@ -298,6 +301,7 @@ </entityConsumer> <entityConsumer> <name>AttributeTree</name> + <stateProcess>%aditoprj%/entity/Contract_entity/entityfields/attributetree/stateProcess.js</stateProcess> <dependency> <name>dependency</name> <entityName>AttributeRelation_entity</entityName> @@ -344,7 +348,7 @@ <iconId>VAADIN:TASKS</iconId> </entityActionField> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -353,7 +357,7 @@ <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Contract_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Contract_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -407,14 +411,17 @@ <dbRecordFieldMapping> <name>CONTRACTCODE.value</name> <recordfield>CONTRACT.CONTRACTCODE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTRACTDUE.value</name> <recordfield>CONTRACT.CONTRACTDUE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTRACTEND.value</name> <recordfield>CONTRACT.CONTRACTEND</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTRACTID.value</name> @@ -423,22 +430,27 @@ <dbRecordFieldMapping> <name>CONTRACTSTART.value</name> <recordfield>CONTRACT.CONTRACTSTART</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTRACTSTATUS.value</name> <recordfield>CONTRACT.CONTRACTSTATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTRACTTYPE.value</name> <recordfield>CONTRACT.CONTRACTTYPE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PAYMENT.value</name> <recordfield>CONTRACT.PAYMENT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>REMARK.value</name> <recordfield>CONTRACT.REMARK</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> @@ -480,7 +492,26 @@ <name>CONTACT_PERSON_ID.displayValue</name> <expression>%aditoprj%/entity/Contract_entity/recordcontainers/db/recordfieldmappings/contact_person_id.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CONTACT_ID.displayValue</name> + <expression>%aditoprj%/entity/Contract_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> <indexRecordContainer> <name>index</name> diff --git a/entity/Contract_entity/entityfields/attributes/onValidation.js b/entity/Contract_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..8520c54ac83ad0ac651268dd730f5b9c6745e3aa 100644 --- a/entity/Contract_entity/entityfields/attributes/onValidation.js +++ b/entity/Contract_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/attributes/stateProcess.js b/entity/Contract_entity/entityfields/attributes/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Contract_entity/entityfields/attributes/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/attributetree/stateProcess.js b/entity/Contract_entity/entityfields/attributetree/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Contract_entity/entityfields/attributetree/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/contact_id/fieldIdProcess.js b/entity/Contract_entity/entityfields/contact_id/fieldIdProcess.js index c354a6b460cbecf0233c20761c02c66415c20e72..6cd3c4544e56fa57ad04b119be620aa650f4a849 100644 --- a/entity/Contract_entity/entityfields/contact_id/fieldIdProcess.js +++ b/entity/Contract_entity/entityfields/contact_id/fieldIdProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string (vars.get("$this.value")); \ No newline at end of file +result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/contact_id/linkedContextProcess.js b/entity/Contract_entity/entityfields/contact_id/linkedContextProcess.js index 2e504d63e3b5a3f71b54b072798b3ad09c50984b..666b1349748541127d2977a28e6a140ccbf800b1 100644 --- a/entity/Contract_entity/entityfields/contact_id/linkedContextProcess.js +++ b/entity/Contract_entity/entityfields/contact_id/linkedContextProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.result"); import("Contact_lib"); -result.string(ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID"))); \ No newline at end of file +result.string(ContactUtils.getContextByPersOrg(vars.get("$field.CONTACT_PERSON_ID"), vars.get("$field.CONTACT_ORG_ID"))); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/contractcode/onValidation.js b/entity/Contract_entity/entityfields/contractcode/onValidation.js index c9c46837558c4f545d61a8861b63a8a3d32dd0df..4d3cfa688f691b265b2348d492a123d2ef8f47e4 100644 --- a/entity/Contract_entity/entityfields/contractcode/onValidation.js +++ b/entity/Contract_entity/entityfields/contractcode/onValidation.js @@ -5,7 +5,7 @@ import("Contract_lib"); import("Entity_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW - && !ContractUtils.validateContractNumber(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTRACTCODE")))) + && !ContractUtils.validateContractNumber(vars.get("local.value"))) { vars.set("$field.CONTRACTCODE", ContractUtils.getNextContractNumber().toString()); } \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/contractend/onValueChange.js b/entity/Contract_entity/entityfields/contractend/onValueChange.js index 7b6446d1fea311587b24f3b353cb0f3a2ec44904..1e3c85c6ef60e8daaf57ba5c67841264b31a2c07 100644 --- a/entity/Contract_entity/entityfields/contractend/onValueChange.js +++ b/entity/Contract_entity/entityfields/contractend/onValueChange.js @@ -2,8 +2,8 @@ import("system.vars"); import("Util_lib"); import("Entity_lib"); -var cEnd = vars.get("$field.CONTRACTEND"); +var cEnd = vars.get("local.value"); var cDue = vars.get("$field.CONTRACTDUE"); -if (cDue != "" && cDue > cEnd) +if (cDue && cEnd && cDue > cEnd) vars.set("$field.CONTRACTDUE", cEnd); \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/contractstart/onValueChange.js b/entity/Contract_entity/entityfields/contractstart/onValueChange.js index f2e29fdda8f9227616cd3dc7f3879867b2bfbaa8..2039e005c8ccdb8235ffcf4ca8f465749cbff12f 100644 --- a/entity/Contract_entity/entityfields/contractstart/onValueChange.js +++ b/entity/Contract_entity/entityfields/contractstart/onValueChange.js @@ -2,7 +2,7 @@ import("system.vars"); import("Util_lib"); import("Entity_lib"); -var cStart = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTRACTSTART")); +var cStart = vars.get("local.value"); var cDue = vars.get("$field.CONTRACTDUE"); if (cDue < cStart && cDue != "") diff --git a/entity/Contract_entity/entityfields/contractstart/valueProcess.js b/entity/Contract_entity/entityfields/contractstart/valueProcess.js index fde00cab2ad74643d42064d1ae353c92972deeca..072560acb2f89d72012c5d3539c293cbf02b86a8 100644 --- a/entity/Contract_entity/entityfields/contractstart/valueProcess.js +++ b/entity/Contract_entity/entityfields/contractstart/valueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.neon"); import("Date_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(DateUtils.getTodayUTC()); } \ No newline at end of file diff --git a/entity/Contract_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Contract_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Contract_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Contract_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index 820fc8bb5dc0d79c01a18bb305926d9e643fa5a6..f3a33022dd2768fb78f05bafc713ba43d6272145 100644 --- a/entity/Contract_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Contract_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.CONTRACTID"), tableNames: ["AB_ATTRIBUTERELATION"]}); -res.push({id: vars.get("$field.CONTRACTID"), tableNames: ["CONTRACT"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.CONTRACTID"), tableNames: ["AB_ATTRIBUTERELATION"]}); +res.push({id: vars.get("$field.CONTRACTID"), tableNames: ["CONTRACT"]}); + +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/Contract_entity/grantDeleteProcess.js b/entity/Contract_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..36b39de07882145d3528ad277b799a36d79c4a6e --- /dev/null +++ b/entity/Contract_entity/grantDeleteProcess.js @@ -0,0 +1,9 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("CONTRACT", null, vars.get("$field.CONTRACTID")) + && !TaskUtils.hasTasks(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Contract_entity/onValidation.js b/entity/Contract_entity/onValidation.js index 77648d016858294bd4ed08ac0ffe845efddd9bac..c562298d1844abc47394d0d1fc31ae06dba7bf7d 100644 --- a/entity/Contract_entity/onValidation.js +++ b/entity/Contract_entity/onValidation.js @@ -9,11 +9,11 @@ var endDate = vars.get("$field.CONTRACTEND"); var errorMessage = ""; -if (!DateUtils.validateBeginnBeforeEnd(startDate, endDate)) +if (endDate && !DateUtils.validateBeginnBeforeEnd(startDate, endDate)) errorMessage = DateUtils.getValidationFailString(); // check Duedate -var cDue = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTRACTDUE")); +var cDue = vars.get("$field.CONTRACTDUE"); if (cDue && (startDate && !DateUtils.validateBeginnBeforeEnd(startDate, cDue) || endDate && !DateUtils.validateBeginnBeforeEnd(cDue, endDate))) { if (errorMessage != "") diff --git a/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Contract_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c2197272407c3509180dc90692e2edc59e2d6d7a --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Contract'"; + +result.string("CONTRACTID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js b/entity/Contract_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..2821fb702f86a860ad359c2ea089f5551743d795 --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +var contact = Contact.createWithColumnPreset() +var renderer = new ContactTitleRenderer(contact, ContactTitleRenderer.OPTIONS.IncludeOrganisation); +result.string(renderer.asSql()); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/index/query.js b/entity/Contract_entity/recordcontainers/index/query.js index 3a7783950d4c3e1f8c1222d963e3f468a4dd100d..2c01a5477fbfe24464274ba8a2294bb043cf61b0 100644 --- a/entity/Contract_entity/recordcontainers/index/query.js +++ b/entity/Contract_entity/recordcontainers/index/query.js @@ -15,12 +15,12 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select CONTRACTID as uid, " +sqlQuery = 'select CONTRACTID as "_uid_", ' + sqlHelper.concat(["CONTRACTCODE", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contractStatus(), "CONTRACTSTATUS")], " | ") - + " as title, " + + ' as "_title_", ' + sqlHelper.concat(["ORGANISATION.NAME", "'| " + translate.text("Type of contract") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contractType(), "CONTRACTTYPE")]) - + " as description" + + ' as "_description_"' + ", CONTRACTCODE " + ", CUSTOMERCODE " + ", CONTRACT.CONTACT_ID" diff --git a/entity/DSGVOInfo_entity/entityfields/datasource/displayValueProcess.js b/entity/DSGVOInfo_entity/entityfields/datasource/displayValueProcess.js index e91f2e9dc43773355e826bdaa6e5c554824054a9..c2256cb6f59e99e189b508df819ad5918c25e700 100644 --- a/entity/DSGVOInfo_entity/entityfields/datasource/displayValueProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/datasource/displayValueProcess.js @@ -4,4 +4,4 @@ import("Contact_lib"); import("system.neon"); -result.string(ContactUtils.getFullTitleByContactId(vars.getString("$this.value"))); \ No newline at end of file +result.string(ContactUtils.getFullTitleByContactId(vars.getString("$field.DATASOURCE"))); \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/datedeadline/mandatoryProcess.js b/entity/DSGVOInfo_entity/entityfields/datedeadline/mandatoryProcess.js index 0543f4ceb723c217a081276a676b12f71015c5eb..324b330151fbc1a9bd48a07869aaaeb072c39e43 100644 --- a/entity/DSGVOInfo_entity/entityfields/datedeadline/mandatoryProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/datedeadline/mandatoryProcess.js @@ -3,4 +3,4 @@ import("KeywordRegistry_basic"); import("system.vars"); import("system.result"); -result.object(vars.get("$param.ReportType_param") == DataPrivacyUtils.DisclosureReportName() && vars.get("$field.deadline") != "" && vars.get("$field.deadline") != $KeywordRegistry.DSGVODeadline$onTime()); \ No newline at end of file +result.object(vars.get("$param.ReportType_param") == DataPrivacyUtils.DisclosureReportName() && vars.get("$field.deadline") != "" && vars.get("$field.deadline") != $KeywordRegistry.dsgvoDeadline$onTime()); \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/datedeadline/stateProcess.js b/entity/DSGVOInfo_entity/entityfields/datedeadline/stateProcess.js index 3c440e90a8eddadd305813732e4b7436760889b1..9d141f7f4915fda4c7a59915152d1ecb5ac55d0d 100644 --- a/entity/DSGVOInfo_entity/entityfields/datedeadline/stateProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/datedeadline/stateProcess.js @@ -6,7 +6,7 @@ import("KeywordRegistry_basic"); if (vars.get("$param.ReportType_param") == DataPrivacyUtils.DisclosureReportName()) { - if (vars.get("$field.deadline") && vars.get("$field.deadline") != $KeywordRegistry.DSGVODeadline$onTime()) + if (vars.get("$field.deadline") && vars.get("$field.deadline") != $KeywordRegistry.dsgvoDeadline$onTime()) result.string(neon.COMPONENTSTATE_EDITABLE); else result.string(neon.COMPONENTSTATE_DISABLED); diff --git a/entity/DSGVOInfo_entity/entityfields/deadline/onValueChange.js b/entity/DSGVOInfo_entity/entityfields/deadline/onValueChange.js index 241f74778cc9673531a9d60b5ead573c7d75ec23..c263317ed2ea71d8651496cd0ae151cb95119144 100644 --- a/entity/DSGVOInfo_entity/entityfields/deadline/onValueChange.js +++ b/entity/DSGVOInfo_entity/entityfields/deadline/onValueChange.js @@ -2,7 +2,7 @@ import("KeywordRegistry_basic"); import("system.vars"); import("system.neon"); -if (vars.get("$this.value") == $KeywordRegistry.DSGVODeadline$onTime()) +if (vars.get("$local.value") == $KeywordRegistry.dsgvoDeadline$onTime()) { neon.setFieldValues({ "$field.dateDeadline": "" diff --git a/entity/DSGVOInfo_entity/entityfields/garantee/mandatoryProcess.js b/entity/DSGVOInfo_entity/entityfields/garantee/mandatoryProcess.js index 4b8d2f2f16acb0781b96a2258e13774a7ddc930e..1038e1167f0bc290e7e044ef2dbc5e145dd0c8ff 100644 --- a/entity/DSGVOInfo_entity/entityfields/garantee/mandatoryProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/garantee/mandatoryProcess.js @@ -3,5 +3,5 @@ import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); -result.object(vars.get("$field.TRANSMISSION") && vars.get("$field.TRANSMISSION") != $KeywordRegistry.DSGVOTransmission$none() - && vars.get("$field.TRANSMISSION") != $KeywordRegistry.DSGVOTransmission$inland()); \ No newline at end of file +result.object(vars.get("$field.TRANSMISSION") != "" && vars.get("$field.TRANSMISSION") != $KeywordRegistry.dsgvoTransmission$none() + && vars.get("$field.TRANSMISSION") != $KeywordRegistry.dsgvoTransmission$inland()); \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/garantee/stateProcess.js b/entity/DSGVOInfo_entity/entityfields/garantee/stateProcess.js index 8dc37099f20a895a20ec9d7defbfdd00f20308d0..455b4fa0533358440a7f68532ce82dbfe1b4b082 100644 --- a/entity/DSGVOInfo_entity/entityfields/garantee/stateProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/garantee/stateProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); -if (vars.get("$field.TRANSMISSION") && vars.get("$field.TRANSMISSION") != $KeywordRegistry.DSGVOTransmission$none() && vars.get("$field.TRANSMISSION") != $KeywordRegistry.DSGVOTransmission$inland()) +if (vars.get("$field.TRANSMISSION") && vars.get("$field.TRANSMISSION") != $KeywordRegistry.dsgvoTransmission$none() && vars.get("$field.TRANSMISSION") != $KeywordRegistry.dsgvoTransmission$inland()) { result.string(neon.COMPONENTSTATE_EDITABLE); } diff --git a/entity/DSGVOInfo_entity/entityfields/keywordguarantee/children/containername_param/valueProcess.js b/entity/DSGVOInfo_entity/entityfields/keywordguarantee/children/containername_param/valueProcess.js index cdbc336e4ae7c15b04c521b1ec0a4f2015d24490..6301513a9df9cb9e2eb6b385b800fb48a6e54659 100644 --- a/entity/DSGVOInfo_entity/entityfields/keywordguarantee/children/containername_param/valueProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/keywordguarantee/children/containername_param/valueProcess.js @@ -1,4 +1,4 @@ import("KeywordRegistry_basic"); import("system.result"); -result.string($KeywordRegistry.DSGVOGuarantee()); \ No newline at end of file +result.string($KeywordRegistry.dsgvoGuarantee()); \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/recipient/displayValueProcess.js b/entity/DSGVOInfo_entity/entityfields/recipient/displayValueProcess.js index e91f2e9dc43773355e826bdaa6e5c554824054a9..e4a926b3553d60c50e0a71d742ff99600de691a5 100644 --- a/entity/DSGVOInfo_entity/entityfields/recipient/displayValueProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/recipient/displayValueProcess.js @@ -4,4 +4,4 @@ import("Contact_lib"); import("system.neon"); -result.string(ContactUtils.getFullTitleByContactId(vars.getString("$this.value"))); \ No newline at end of file +result.string(ContactUtils.getFullTitleByContactId(vars.getString("$field.RECIPIENT"))); \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/recipient/mandatoryProcess.js b/entity/DSGVOInfo_entity/entityfields/recipient/mandatoryProcess.js index 4f7af0e1dab1d69cc1579f04f09e7e4da0bbb784..b72d41b28f12a60815129c0ba9c541b31a43f19d 100644 --- a/entity/DSGVOInfo_entity/entityfields/recipient/mandatoryProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/recipient/mandatoryProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); -result.object(vars.get("$field.TRANSMISSION") && vars.get("$field.TRANSMISSION") != $KeywordRegistry.DSGVOTransmission$none()); \ No newline at end of file +result.object(vars.get("$field.TRANSMISSION") != "" && vars.get("$field.TRANSMISSION") != $KeywordRegistry.dsgvoTransmission$none()); \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/recipient/stateProcess.js b/entity/DSGVOInfo_entity/entityfields/recipient/stateProcess.js index 6a3687894cb27fe68eac6a23e9774562a298552b..3e96a7bc47dbb2ffacabaeaa9aa42851c7c06a03 100644 --- a/entity/DSGVOInfo_entity/entityfields/recipient/stateProcess.js +++ b/entity/DSGVOInfo_entity/entityfields/recipient/stateProcess.js @@ -1,15 +1,13 @@ -import("system.logging"); import("system.result"); import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); -if (vars.get("$field.TRANSMISSION") && vars.get("$field.TRANSMISSION") != $KeywordRegistry.DSGVOTransmission$none()) +if (vars.get("$field.TRANSMISSION") && vars.get("$field.TRANSMISSION") != $KeywordRegistry.dsgvoTransmission$none()) { result.string(neon.COMPONENTSTATE_EDITABLE); } else { - logging.log("DISABLE res"); result.string(neon.COMPONENTSTATE_DISABLED); } \ No newline at end of file diff --git a/entity/DSGVOInfo_entity/entityfields/transmission/onValueChange.js b/entity/DSGVOInfo_entity/entityfields/transmission/onValueChange.js index 031834e9c654cf7f3e6ddbeb9b814dc655ceb95e..ac3985df8a878fe44c1179c4e8fc9ace5a6530f5 100644 --- a/entity/DSGVOInfo_entity/entityfields/transmission/onValueChange.js +++ b/entity/DSGVOInfo_entity/entityfields/transmission/onValueChange.js @@ -2,7 +2,7 @@ import("KeywordRegistry_basic"); import("system.vars"); import("system.neon"); -if (vars.get("$this.value") == $KeywordRegistry.DSGVOTransmission$none()) +if (vars.get("$local.value") == $KeywordRegistry.dsgvoTransmission$none()) { neon.setFieldValues({ "$field.RECIPIENT": "", diff --git a/entity/DSGVOInfo_entity/recordcontainers/db/onDBInsert.js b/entity/DSGVOInfo_entity/recordcontainers/db/onDBInsert.js index e8669f4fa41b190b0d2409d52bf653dfa1d2a9b3..ef08b6011add55be5ac2961455eb1d455f16d0c1 100644 --- a/entity/DSGVOInfo_entity/recordcontainers/db/onDBInsert.js +++ b/entity/DSGVOInfo_entity/recordcontainers/db/onDBInsert.js @@ -1,12 +1,14 @@ import("system.vars"); import("DataPrivacy_lib"); +var rowdata = vars.get("$local.rowdata"); + if (vars.get("$param.ReportType_param")) DataPrivacyUtils.openReport(vars.get("$param.ContactId_param"), vars.get("$param.ReportType_param"), { - datasource: vars.get("$field.DATASOURCE"), - transmission: vars.get("$field.TRANSMISSION"), - recipient: vars.get("$field.RECIPIENT"), - garantees: vars.get("$field.GUARANTEE"), + datasource: rowdata["DSGVOINFO.DATASOURCE"], + transmission: rowdata["DSGVOINFO.TRANSMISSION"], + recipient: rowdata["DSGVOINFO.RECIPIENT"], + garantees: rowdata["DSGVOINFO.GUARANTEE"], requestDate: vars.get("$field.dateRequest"), deadline: vars.get("$field.deadline"), deadlineDate: vars.get("$field.dateDeadline") diff --git a/entity/DSGVOInfo_entity/recordcontainers/db/onDBUpdate.js b/entity/DSGVOInfo_entity/recordcontainers/db/onDBUpdate.js index e8669f4fa41b190b0d2409d52bf653dfa1d2a9b3..ef08b6011add55be5ac2961455eb1d455f16d0c1 100644 --- a/entity/DSGVOInfo_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/DSGVOInfo_entity/recordcontainers/db/onDBUpdate.js @@ -1,12 +1,14 @@ import("system.vars"); import("DataPrivacy_lib"); +var rowdata = vars.get("$local.rowdata"); + if (vars.get("$param.ReportType_param")) DataPrivacyUtils.openReport(vars.get("$param.ContactId_param"), vars.get("$param.ReportType_param"), { - datasource: vars.get("$field.DATASOURCE"), - transmission: vars.get("$field.TRANSMISSION"), - recipient: vars.get("$field.RECIPIENT"), - garantees: vars.get("$field.GUARANTEE"), + datasource: rowdata["DSGVOINFO.DATASOURCE"], + transmission: rowdata["DSGVOINFO.TRANSMISSION"], + recipient: rowdata["DSGVOINFO.RECIPIENT"], + garantees: rowdata["DSGVOINFO.GUARANTEE"], requestDate: vars.get("$field.dateRequest"), deadline: vars.get("$field.deadline"), deadlineDate: vars.get("$field.dateDeadline") diff --git a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js index aab9432c45b93a49745bde854bfdcfada816331c..b51d9069c3f21fd773d59657203ad8d3f6bd4928 100644 --- a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js +++ b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/guarantee.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOGuarantee(), "DSGVOINFO.GUARANTEE"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.dsgvoGuarantee(), "DSGVOINFO.GUARANTEE"); result.string(sql); diff --git a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js index 7c9e6a4cde65ad274be90f7d4c76e0f12128379d..1cd3f3f3f243503eed32b959c33a61c46004d277 100644 --- a/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js +++ b/entity/DSGVOInfo_entity/recordcontainers/db/recordfieldmappings/transmission.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOTransmission(), "DSGVOINFO.TRANSMISSION"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.dsgvoTransmission(), "DSGVOINFO.TRANSMISSION"); result.string(sql); diff --git a/entity/DSGVO_entity/DSGVO_entity.aod b/entity/DSGVO_entity/DSGVO_entity.aod index 31b0890782f3fa18a7055bb94be5181aee1f207d..0d673ba4b18194ec6f895509d890ab1cf87e32f1 100644 --- a/entity/DSGVO_entity/DSGVO_entity.aod +++ b/entity/DSGVO_entity/DSGVO_entity.aod @@ -12,6 +12,7 @@ </siblings> <grantCreate v="false" /> <grantDelete v="false" /> + <titlePlural></titlePlural> <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> @@ -80,20 +81,6 @@ <name>CONTACT_ID</name> <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/contact_id/valueProcess.js</valueProcess> </entityField> - <entityConsumer> - <name>OrganisationAndContactAdresses</name> - <dependency> - <name>dependency</name> - <entityName>Address_entity</entityName> - <fieldName>OrganisationAndContactAddresses</fieldName> - </dependency> - <children> - <entityParameter> - <name>OrganisationId_param</name> - <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/organisationandcontactadresses/children/organisationid_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityConsumer> <name>KeywordDSGVOPurpose</name> <dependency> @@ -180,7 +167,6 @@ <isSelectionAction v="true" /> <iconId>VAADIN:ASTERISK</iconId> <state>INVISIBLE</state> - <stateProcess>%aditoprj%/entity/DSGVO_entity/entityfields/dsgvoactions/children/anonymperson/stateProcess.js</stateProcess> </entityActionField> </children> </entityActionGroup> diff --git a/entity/DSGVO_entity/entityfields/dsgvotype/displayValueProcess.js b/entity/DSGVO_entity/entityfields/dsgvotype/displayValueProcess.js index 952ed787e8168e45e8e294a26865f5ef569b78b7..a91ec572c02a941012ad8eb50f3a4999485c5daa 100644 --- a/entity/DSGVO_entity/entityfields/dsgvotype/displayValueProcess.js +++ b/entity/DSGVO_entity/entityfields/dsgvotype/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.result"); import("Keyword_lib"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), vars.get("$this.value"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.dsgvoType(), vars.get("$field.DSGVOTYPE"))); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/keyworddsgvopurpose/children/containername_param/valueProcess.js b/entity/DSGVO_entity/entityfields/keyworddsgvopurpose/children/containername_param/valueProcess.js index 245270971322b851dd24f308b377c949d6d9f5ec..e3137fa5ae698c33c827d9c4ccb8cc67ec9b66e9 100644 --- a/entity/DSGVO_entity/entityfields/keyworddsgvopurpose/children/containername_param/valueProcess.js +++ b/entity/DSGVO_entity/entityfields/keyworddsgvopurpose/children/containername_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.result"); import("KeywordRegistry_basic"); -result.string($KeywordRegistry.DSGVOPurpose()); \ No newline at end of file +result.string($KeywordRegistry.dsgvoPurpose()); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/keyworddsgvostatuoritysource/children/containername_param/valueProcess.js b/entity/DSGVO_entity/entityfields/keyworddsgvostatuoritysource/children/containername_param/valueProcess.js index 37e7e4c7585ce1bb27218e08d6dd94e1f7a6c94b..a777c1ebc111b9c6e9954a7fe8a6b4433d030c90 100644 --- a/entity/DSGVO_entity/entityfields/keyworddsgvostatuoritysource/children/containername_param/valueProcess.js +++ b/entity/DSGVO_entity/entityfields/keyworddsgvostatuoritysource/children/containername_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.result"); import("KeywordRegistry_basic"); -result.string($KeywordRegistry.DSGVOStatuoritysource()); \ No newline at end of file +result.string($KeywordRegistry.dsgvoStatuoritysource()); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/keyworddsgvotype/children/containername_param/valueProcess.js b/entity/DSGVO_entity/entityfields/keyworddsgvotype/children/containername_param/valueProcess.js index 55a2d94f1039eff44d908d07fb958802af38838b..6cdce1d4579b3a930a63906ca3cbee9d9fdb157e 100644 --- a/entity/DSGVO_entity/entityfields/keyworddsgvotype/children/containername_param/valueProcess.js +++ b/entity/DSGVO_entity/entityfields/keyworddsgvotype/children/containername_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.result"); import("KeywordRegistry_basic"); -result.string($KeywordRegistry.DSGVOType()); \ No newline at end of file +result.string($KeywordRegistry.dsgvoType()); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/purpose/displayValueProcess.js b/entity/DSGVO_entity/entityfields/purpose/displayValueProcess.js index 473d70c8e03baf65b05ffba822df0ac500c35ba4..ceb809e9d48aabd0515af5c96fbca913074bf6a0 100644 --- a/entity/DSGVO_entity/entityfields/purpose/displayValueProcess.js +++ b/entity/DSGVO_entity/entityfields/purpose/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("KeywordRegistry_basic"); import("Keyword_lib"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.DSGVOPurpose(), vars.get("$field.PURPOSE"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.dsgvoPurpose(), vars.get("$field.PURPOSE"))); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/statuoritysource/displayValueProcess.js b/entity/DSGVO_entity/entityfields/statuoritysource/displayValueProcess.js index 50071f1e659a6419aa90ab0ddc429b2769076fa7..e7e44596afa069231ec41a7611b9ba921731a3b9 100644 --- a/entity/DSGVO_entity/entityfields/statuoritysource/displayValueProcess.js +++ b/entity/DSGVO_entity/entityfields/statuoritysource/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("KeywordRegistry_basic"); import("Keyword_lib"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.DSGVOStatuoritysource(), vars.get("$field.STATUORITYSOURCE"))); \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.dsgvoStatuoritysource(), vars.get("$field.STATUORITYSOURCE"))); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/value/contentTypeProcess.js b/entity/DSGVO_entity/entityfields/value/contentTypeProcess.js index a96c4d2059fdbcbdb397571422b72ed8da12e7a0..f12ab2a78c8f353a32df4fa08af7411d4dae9550 100644 --- a/entity/DSGVO_entity/entityfields/value/contentTypeProcess.js +++ b/entity/DSGVO_entity/entityfields/value/contentTypeProcess.js @@ -1,14 +1,12 @@ -import("system.logging"); import("system.result"); import("KeywordRegistry_basic"); import("system.vars"); import("system.neon"); // NOTE: If there are more cases added, consider adding this to DSGVOType keyword as attribute or adding it to DataPrivacy_lib to the Types. -logging.log(vars.get("$field.DSGVOTYPE")); switch (vars.get("$field.DSGVOTYPE").trim()) { - case $KeywordRegistry.DSGVOType$birth().trim(): + case $KeywordRegistry.dsgvoType$birth().trim(): result.string("DATE"); break; default: diff --git a/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js b/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js deleted file mode 100644 index 91a2439d76a87078fe11b740c5972d3f8e5c395b..0000000000000000000000000000000000000000 --- a/entity/DSGVO_entity/recordcontainers/db/onDBInsert.js +++ /dev/null @@ -1,47 +0,0 @@ -import("KeywordRegistry_basic"); -import("Keyword_lib"); -import("system.db"); -import("system.neon"); -import("system.vars"); -import("system.util"); - -/* -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -{ - var cols = ["USER_NEW" , "USER_EDIT" , "DSGVOID" , "ROW_ID" , "DATE_NEW" , - "TABLENAME" , "DATE_EDIT" , "RIGHT" , "VALID_TO" , "CONTACT_ID" , "USE"]; - - var vals = [vars.get("$sys.user"), null, util.getNewUUID(), - vars.get("$field.ROW_ID"), vars.get("$sys.date"), vars.get("$field.TABLENAME"), - null, KeywordUtils. vars.get("$field.RIGHT").valueOf(), vars.get("$field.VALID_TO"), - vars.get("$field.CONTACT_ID"), vars.get("$field.USE").valueOf()]; - // KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOUse(), "DSGVO.USE"); - db.insertData("DSGVO", cols, null, vals); -} - - -/* - - // TODO Eintrag in DSGVO Tabelle - - /* - * - var InputMapping = { - "OFFERITEM": { - condition: "OFFER_ID = '" + pSourceOfferId + "' order by ITEMSORT", - ValueMapping: { - "OFFER_ID" : pTargetOfferId - } - } - }; - CopyModuleUtils.copyModule(InputMapping); - - var oiUtils = new OfferItemUtils(pTargetOfferId); - - //update order price - cols = ["NET", "VAT"]; - var vals = oiUtils.getNetAndVat(); - - db.updateData("OFFER", cols, null, vals, SqlCondition.equals("OFFER.OFFERID", pTargetOfferId, "1 = 2")); - * - */ \ No newline at end of file diff --git a/entity/DescriptionTranslation_entity/DescriptionTranslation_entity.aod b/entity/DescriptionTranslation_entity/DescriptionTranslation_entity.aod index 1cc4e1fccd959387620498c694c3eef4995b32c4..a363513e906fc4d0ed343a4e325d5c2b28c8ec71 100644 --- a/entity/DescriptionTranslation_entity/DescriptionTranslation_entity.aod +++ b/entity/DescriptionTranslation_entity/DescriptionTranslation_entity.aod @@ -107,7 +107,6 @@ <dbRecordFieldMapping> <name>LANG.value</name> <recordfield>DESCRIPTIONTRANSLATION.LANG</recordfield> - <expression>%aditoprj%/entity/DescriptionTranslation_entity/recordcontainers/db/recordfieldmappings/lang.value/expression.js</expression> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LANG.displayValue</name> diff --git a/entity/DescriptionTranslation_entity/entityfields/lang/displayValueProcess.js b/entity/DescriptionTranslation_entity/entityfields/lang/displayValueProcess.js index ac0f29fc259baae6d6042a83e588737d6c76fd31..471293a21aa1604884698461618f2e15e142da92 100644 --- a/entity/DescriptionTranslation_entity/entityfields/lang/displayValueProcess.js +++ b/entity/DescriptionTranslation_entity/entityfields/lang/displayValueProcess.js @@ -6,5 +6,5 @@ import("KeywordRegistry_basic"); import("Keyword_lib"); import("Sql_lib"); -result.string(translate.text(db.cell(SqlCondition.begin().andPrepareVars("AB_LANGUAGE.ISO3", "$this.value") +result.string(translate.text(db.cell(SqlCondition.begin().andPrepareVars("AB_LANGUAGE.ISO3", "$field.LANG") .buildSql("select NAME_LATIN from AB_LANGUAGE", "1=2")))); \ No newline at end of file diff --git a/entity/DocumentTemplateLink_entity/entityfields/opendocument/onActionProcess.js b/entity/DocumentTemplateLink_entity/entityfields/opendocument/onActionProcess.js index 12b4334475dd3a1eb6a42d373d13213d351414a3..c943e852369cd24ce58978071cd6917b197414e1 100644 --- a/entity/DocumentTemplateLink_entity/entityfields/opendocument/onActionProcess.js +++ b/entity/DocumentTemplateLink_entity/entityfields/opendocument/onActionProcess.js @@ -1,12 +1,15 @@ -import("system.db"); -import("system.vars"); -import("system.neon"); - -var fileInformation = db.array(db.ROW, "select ID, FILENAME from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.DOCUMENTTEMPLATE_ID_CHILD") + "'", "_____SYSTEMALIAS"); -var data = db.getBinaryContent(fileInformation[0], "_____SYSTEMALIAS"); -neon.download(data, fileInformation[1]); - - - - - +import("Sql_lib"); +import("system.db"); +import("system.vars"); +import("system.neon"); + +var fileInformation = db.array(db.ROW, SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.DOCUMENTTEMPLATE_ID_CHILD") + .buildSql("select ID, FILENAME from ASYS_BINARIES"), SqlUtils.getSystemAlias()); +var data = db.getBinaryContent(fileInformation[0], SqlUtils.getSystemAlias()); +neon.download(data, fileInformation[1]); + + + + + diff --git a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod index 35bdd8383af5752c5866840093b15b527bf19fa8..8d4b79be20e1cb9bd76b48e48bf772199977214e 100644 --- a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod +++ b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod @@ -6,6 +6,8 @@ <title>Document Template</title> <contentTitleProcess>%aditoprj%/entity/DocumentTemplate_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/DocumentTemplate_entity/afterUiInit.js</afterUiInit> + <iconId>VAADIN:FILE_FONT</iconId> + <titlePlural>Document templates</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -42,14 +44,14 @@ <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/user_new/valueProcess.js</valueProcess> </entityField> <entityField> - <name>TYPE</name> + <name>KIND</name> <title>Type</title> <consumer>KeywordDocumentTemplateType</consumer> <groupable v="true" /> <mandatory v="true" /> - <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/type/stateProcess.js</stateProcess> - <displayValueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/type/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/DocumentTemplate_entity/entityfields/type/onValueChange.js</onValueChange> + <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/kind/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/kind/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/DocumentTemplate_entity/entityfields/kind/onValueChange.js</onValueChange> </entityField> <entityField> <name>USER_EDIT</name> @@ -58,18 +60,18 @@ <name>NAME</name> <title>Name</title> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/name/valueProcess.js</valueProcess> </entityField> <entityField> - <name>LANGUAGE</name> + <name>ISOLANGUAGE</name> <title>Language</title> <consumer>Languages</consumer> <mandatory v="true" /> - <displayValueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/language/displayValueProcess.js</displayValueProcess> + <displayValueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/isolanguage/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>BINDATA</name> <contentType>FILE</contentType> - <onValueChange>%aditoprj%/entity/DocumentTemplate_entity/entityfields/bindata/onValueChange.js</onValueChange> </entityField> <entityConsumer> <name>Documents</name> @@ -113,6 +115,7 @@ </entityConsumer> <entityConsumer> <name>Attributes</name> + <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/DocumentTemplate_entity/entityfields/attributes/onValidation.js</onValidation> <dependency> <name>dependency</name> @@ -244,6 +247,18 @@ <fieldName>Templates</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>93242043-ddc2-414e-84c8-610342b0bd85</name> + <entityName>Order_entity</entityName> + <fieldName>DocumentTemplateTexHeader</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>62dc5f05-4203-40b3-9d34-cbbefc8264ae</name> + <entityName>Order_entity</entityName> + <fieldName>DocumentTemplateTexFooter</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityParameter> @@ -293,17 +308,10 @@ <name>DESCRIPTION.value</name> <recordfield>DOCUMENTTEMPLATE.DESCRIPTION</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LANGUAGE.value</name> - <recordfield>DOCUMENTTEMPLATE.LANGUAGE</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NAME.value</name> <recordfield>DOCUMENTTEMPLATE.NAME</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>TYPE.value</name> - <recordfield>DOCUMENTTEMPLATE.TYPE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_EDIT.value</name> @@ -320,6 +328,17 @@ <dbRecordFieldMapping> <name>CLASSIFICATION.value</name> <recordfield>DOCUMENTTEMPLATE.CLASSIFICATION</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>KIND.value</name> + <recordfield>DOCUMENTTEMPLATE.KIND</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ISOLANGUAGE.value</name> + <recordfield>DOCUMENTTEMPLATE.ISOLANGUAGE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/DocumentTemplate_entity/entityfields/attributes/onValidation.js b/entity/DocumentTemplate_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..37bb493f7803388fce9a592b674e4891ea56842e 100644 --- a/entity/DocumentTemplate_entity/entityfields/attributes/onValidation.js +++ b/entity/DocumentTemplate_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.DOCUMENTTEMPLATEID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/attributes/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/attributes/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/attributes/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/bindata/onValueChange.js b/entity/DocumentTemplate_entity/entityfields/bindata/onValueChange.js deleted file mode 100644 index 7ed1a7ee612295e7f22d6941fa6fd4c442a91004..0000000000000000000000000000000000000000 --- a/entity/DocumentTemplate_entity/entityfields/bindata/onValueChange.js +++ /dev/null @@ -1,17 +0,0 @@ -import("system.vars"); -import("system.neon"); -import("Entity_lib"); -import("Document_lib"); - -var uploadValue = DocumentUtil.getFilenameFromUpload(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.BINDATA"))); - -if(!(vars.get("$field.NAME") != null && vars.get("$field.NAME") != "")) -{ - if(uploadValue.length <= 40) - { - neon.setFieldValue("$field.NAME", uploadValue); - }else{ - var limit = uploadValue.length - 40; - neon.setFieldValue("$field.NAME", uploadValue.substr(0, uploadValue.length - limit)); - } -} \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/classification/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/classification/stateProcess.js index aa77e44499178abf82f427f63122eebf5bf373f6..a53a086f62b6eeb071e03166dfc52489fc02cd62 100644 --- a/entity/DocumentTemplate_entity/entityfields/classification/stateProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/classification/stateProcess.js @@ -1,8 +1,8 @@ -import("system.vars"); -import("system.result"); -import("system.neon"); - -if(vars.get("$field.TYPE") != "") -{ - result.string(neon.COMPONENTSTATE_EDITABLE); +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$field.KIND") != "") +{ + result.string(neon.COMPONENTSTATE_EDITABLE); } \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/documenttemplatetypecategory/children/usagefilter_param/valueProcess.js b/entity/DocumentTemplate_entity/entityfields/documenttemplatetypecategory/children/usagefilter_param/valueProcess.js index 64603e3e1bf02dad06aaf13f93c74f996d25ff3e..96543fbc1bc515b9392ebfdbd51aa4c9eda93568 100644 --- a/entity/DocumentTemplate_entity/entityfields/documenttemplatetypecategory/children/usagefilter_param/valueProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/documenttemplatetypecategory/children/usagefilter_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.object(vars.get("$field.TYPE")); \ No newline at end of file +result.object(vars.get("$field.KIND")); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/language/displayValueProcess.js b/entity/DocumentTemplate_entity/entityfields/isolanguage/displayValueProcess.js similarity index 88% rename from entity/Offer_entity/entityfields/language/displayValueProcess.js rename to entity/DocumentTemplate_entity/entityfields/isolanguage/displayValueProcess.js index bcbf2118161a42f079dfa6ece4df7fb4d6b6774e..0a2a0ee65d4db10c8e023e7e2849fbde9b6de533 100644 --- a/entity/Offer_entity/entityfields/language/displayValueProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/isolanguage/displayValueProcess.js @@ -4,7 +4,7 @@ import("system.result"); import("system.vars"); import("Sql_lib"); -var iso3 = vars.get("$field.LANGUAGE"); +var iso3 = vars.get("$field.ISOLANGUAGE"); var latinName = db.cell(SqlCondition.begin() .andPrepare("AB_LANGUAGE.ISO3", iso3) .buildSql("select NAME_LATIN from AB_LANGUAGE", "1=0")); diff --git a/entity/DocumentTemplate_entity/entityfields/type/displayValueProcess.js b/entity/DocumentTemplate_entity/entityfields/kind/displayValueProcess.js similarity index 77% rename from entity/DocumentTemplate_entity/entityfields/type/displayValueProcess.js rename to entity/DocumentTemplate_entity/entityfields/kind/displayValueProcess.js index 543177e2faddef74ec044962aac2969efe9b04de..257b2f7fa4faaef6abf736b7554e26f18dd4a010 100644 --- a/entity/DocumentTemplate_entity/entityfields/type/displayValueProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/kind/displayValueProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.documentTemplateType(), vars.get("$field.TYPE"))); \ No newline at end of file +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.documentTemplateType(), vars.get("$field.KIND"))); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/type/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/kind/stateProcess.js similarity index 96% rename from entity/DocumentTemplate_entity/entityfields/type/stateProcess.js rename to entity/DocumentTemplate_entity/entityfields/kind/stateProcess.js index 3735d6d4411513b42cb2148c43028f223f3e4a8c..49d3d53d991cc1a864d6db072347af1800f035cf 100644 --- a/entity/DocumentTemplate_entity/entityfields/type/stateProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/kind/stateProcess.js @@ -1,7 +1,7 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) -{ - result.string(neon.COMPONENTSTATE_READONLY); +import("system.result"); +import("system.neon"); +import("system.vars"); +if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +{ + result.string(neon.COMPONENTSTATE_READONLY); } \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/links/children/type_param/valueProcess.js b/entity/DocumentTemplate_entity/entityfields/links/children/type_param/valueProcess.js index e133265a133774e7833f803e776e6321c6ab1aac..ff40ad745a0a2d0676d08287e93bad6602a0b35b 100644 --- a/entity/DocumentTemplate_entity/entityfields/links/children/type_param/valueProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/links/children/type_param/valueProcess.js @@ -1,4 +1,4 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.TYPE")); \ No newline at end of file +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.KIND")); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js index 957a413f1d7036e74834b8f00622619178d16b15..42093844e7492876f8a41515b1de9668fd10b805 100644 --- a/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js @@ -1,9 +1,9 @@ -import("system.result"); -import("KeywordRegistry_basic"); -import("system.vars"); -import("system.neon"); - -if(vars.get("$field.TYPE") != $KeywordRegistry.documentTemplateType$mail()) -{ - result.string(neon.COMPONENTSTATE_INVISIBLE); +import("system.result"); +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.neon"); + +if(vars.get("$field.KIND") != $KeywordRegistry.documentTemplateType$mail()) +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); } \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/name/valueProcess.js b/entity/DocumentTemplate_entity/entityfields/name/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65117fc5b8e553ef7764c9957e30b236b7174229 --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/name/valueProcess.js @@ -0,0 +1,15 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); +import("Entity_lib"); +import("Document_lib"); + +if (vars.get("$this.value") == null && vars.get("$field.BINDATA")) +{ + var uploadValue = DocumentUtil.getFilenameFromUpload(vars.get("$field.BINDATA")); + + if (uploadValue.length > 40) + uploadValue = uploadValue.substr(0, 40); + + neon.setFieldValue("$field.NAME", uploadValue); +} \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/textext/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/textext/stateProcess.js index 4cf6aa010e905f13af9ba2b500bb612e9bd935e4..41188aaad45f111652458bd4548d0a195486fd72 100644 --- a/entity/DocumentTemplate_entity/entityfields/textext/stateProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/textext/stateProcess.js @@ -3,7 +3,7 @@ import("system.neon"); import("system.result"); import("system.vars"); -if(vars.get("$field.TYPE").trim() == "TEX" && vars.get("$field.BINDATA") == "") +if(vars.get("$field.KIND").trim() == "TEX" && vars.get("$field.BINDATA") == "") { var fileExtension = DocumentUtil.getFileExtensionFromUpload(vars.get("$field.NAME")); diff --git a/entity/DocumentTemplate_entity/entityfields/textext/valueProcess.js b/entity/DocumentTemplate_entity/entityfields/textext/valueProcess.js index e49e46111f558564257ee7b2ee4f58817299d77b..4723c73981af398bf75eb3cb0f4b5a440bc2ef03 100644 --- a/entity/DocumentTemplate_entity/entityfields/textext/valueProcess.js +++ b/entity/DocumentTemplate_entity/entityfields/textext/valueProcess.js @@ -1,17 +1,20 @@ -import("Document_lib"); -import("system.util"); -import("system.db"); -import("system.neon"); -import("system.result"); -import("system.vars"); - -if(vars.get("$field.TYPE").trim() == "TEX" && vars.get("$field.BINDATA") == "" && vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) -{ - var fileExtension = DocumentUtil.getFileExtensionFromUpload(vars.get("$field.NAME")); - - if(fileExtension == "txt") - { - var binaryId = db.cell("select ID from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.DOCUMENTTEMPLATEID") + "'", "_____SYSTEMALIAS"); - result.string(util.decodeBase64String(db.getBinaryContent(binaryId, "_____SYSTEMALIAS"))); - } +import("Sql_lib"); +import("Document_lib"); +import("system.util"); +import("system.db"); +import("system.neon"); +import("system.result"); +import("system.vars"); + +if(vars.get("$field.KIND").trim() == "TEX" && vars.get("$field.BINDATA") == "" && vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +{ + var fileExtension = DocumentUtil.getFileExtensionFromUpload(vars.get("$field.NAME")); + + if(fileExtension == "txt") + { + var binaryId = db.cell(SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.DOCUMENTTEMPLATEID") + .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getSystemAlias()); + result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getSystemAlias()))); + } } \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js b/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js index 8d6aafedbb0d42f6d6510d799470bc9a2bab2885..bb44f99ca8914bbd59283b8fb393c27332f3182f 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js @@ -1,10 +1,10 @@ -import("system.result"); -import("system.vars"); -import("system.db"); -import("Sql_lib"); - -var cond = SqlCondition.begin() - .andPrepareVars("DOCUMENTTEMPLATE.TYPE", "$param.DocumentTemplateType_param") - .andPrepareVars("DOCUMENTTEMPLATE.CLASSIFICATION", "$param.DocumentTemplateTypeClassification_param"); - +import("system.result"); +import("system.vars"); +import("system.db"); +import("Sql_lib"); + +var cond = SqlCondition.begin() + .andPrepareVars("DOCUMENTTEMPLATE.KIND", "$param.DocumentTemplateType_param") + .andPrepareVars("DOCUMENTTEMPLATE.CLASSIFICATION", "$param.DocumentTemplateTypeClassification_param"); + result.string(db.translateStatement(cond.build("1=1"))); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js index 4c36144ce13ea38637c86f83aa94e3a0d36c3796..95cf3f9a66491bacbe72d4968928043043d2445c 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js @@ -1,6 +1,9 @@ +import("Sql_lib"); import("system.vars"); import("system.db"); -var binaryId = db.cell("select ID from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.DOCUMENTTEMPLATEID") + "'", "_____SYSTEMALIAS"); +var binaryId = db.cell(SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.DOCUMENTTEMPLATEID") + .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getSystemAlias()); -db.deleteBinary(binaryId, "_____SYSTEMALIAS"); \ No newline at end of file +db.deleteBinary(binaryId, SqlUtils.getSystemAlias()); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js index 0d8f6fe0d4cb076ba62b68fbb9738d9c2ee77039..daf8ed24ded549d06dd867118abadbdad497eff1 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js @@ -3,8 +3,10 @@ import("system.vars"); import("system.db"); import("system.util"); import("Document_lib"); +import("Sql_lib"); //TODO - Function +var rowdata = vars.get("$local.rowdata"); var bindataUpload = DocumentUtil.getBindataFromUpload(vars.get("$field.BINDATA")); var filename = ""; @@ -15,14 +17,14 @@ if(bindataUpload != "") filename = DocumentUtil.getFilenameFromUpload(vars.get("$field.BINDATA")); bindata = bindataUpload; } -else if(vars.get("$field.TYPE").trim() == "TEX" && vars.get("$field.texText") != "") +else if(rowdata["DOCUMENTTEMPLATE.KIND"].trim() == "TEX" && vars.get("$field.texText") != "") { - filename = vars.get("$field.NAME") + ".txt"; + filename = rowdata["DOCUMENTTEMPLATE.NAME"] + ".txt"; bindata = util.encodeBase64String(vars.get("$field.texText")); } if(bindata != "" && filename != "") { - db.insertBinary("DOCUMENTTEMPLATE", "DOCUMENT", vars.get("$field.DOCUMENTTEMPLATEID"), - "", bindata, filename, "", "", "_____SYSTEMALIAS"); + db.insertBinary("DOCUMENTTEMPLATE", "DOCUMENT", vars.get("$local.uid"), + "", bindata, filename, "", "", SqlUtils.getSystemAlias()); } \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js index df234535f20d98c2ebfd7b18111fe4f7db44bc1d..58d13c2ae560227626e58c523453fa9072343102 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js @@ -1,27 +1,40 @@ -import("system.util"); -import("system.vars"); -import("system.db"); -import("Document_lib"); - -//TODO - Function - -var bindataUpload = DocumentUtil.getBindataFromUpload(vars.get("$field.BINDATA")); -var filename = ""; -var bindata = ""; - -if(bindataUpload != "") -{ - bindata = bindataUpload; - filename = DocumentUtil.getFilenameFromUpload(vars.get("$field.BINDATA")); -} -else if(vars.get("$field.TYPE").trim() == "TEX" && vars.get("$field.texText") != "") -{ - filename = vars.get("$field.NAME") + ".txt"; - bindata = util.encodeBase64String(vars.get("$field.texText")); -} - -if(bindata != "" && filename != "") -{ - var binaryId = db.cell("select ID from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.DOCUMENTTEMPLATEID") + "'", "_____SYSTEMALIAS"); - db.updateBinary(binaryId, "", bindata, filename, "", "", "_____SYSTEMALIAS"); +import("Binary_lib"); +import("system.util"); +import("system.vars"); +import("system.db"); +import("Document_lib"); +import("Sql_lib"); + +//TODO - Function + +var rowdata = vars.get("$local.rowdata"); + +var bindataUpload = DocumentUtil.getBindataFromUpload(vars.get("$field.BINDATA")); +var filename = ""; +var bindata = ""; + +if(bindataUpload != "") +{ + bindata = bindataUpload; + filename = DocumentUtil.getFilenameFromUpload(vars.get("$field.BINDATA")); + + if(filename != null && filename != "") + filename = rowdata["DOCUMENTTEMPLATE.NAME"] + ".txt"; +} +else if(rowdata["DOCUMENTTEMPLATE.KIND"].trim() == "TEX" && vars.get("$field.texText") != "") +{ + filename = rowdata["DOCUMENTTEMPLATE.NAME"] + ".txt"; + bindata = util.encodeBase64String(vars.get("$field.texText")); +} + +if(bindata != "" && filename != "") +{ + var assignmentTable = "DOCUMENTTEMPLATE"; + var assignmentName= "DOCUMENT"; + var rowId = vars.get("$local.uid"); + var binMeta = db.getBinaryMetadata(assignmentTable, assignmentName, rowId, false, SqlUtils.getSystemAlias(), "MAINDOCUMENT"); + if (binMeta.length == 0) + SingleBinaryUtils.insertMainDocument(assignmentTable, assignmentName, rowId, bindata, filename, null, SqlUtils.getSystemAlias()); + else + db.updateBinary(binMeta[0][db.BINARY_ID], "", bindata, filename, "", "MAINDOCUMENT", SqlUtils.getSystemAlias()); } \ No newline at end of file diff --git a/entity/Document_entity/Document_entity.aod b/entity/Document_entity/Document_entity.aod index e3340741944910f237823d08a1648d2d0011910e..95b5a2f31e1cf5438c32550866aa08d032e042f8 100644 --- a/entity/Document_entity/Document_entity.aod +++ b/entity/Document_entity/Document_entity.aod @@ -67,6 +67,7 @@ <children> <entityActionField> <name>downloadFilesAction</name> + <title>Download</title> <onActionProcess>%aditoprj%/entity/Document_entity/entityfields/document_actions/children/downloadfilesaction/onActionProcess.js</onActionProcess> <isObjectAction v="false" /> <isSelectionAction v="true" /> @@ -129,6 +130,7 @@ </entityParameter> <entityActionField> <name>downloadSingleFileAction</name> + <title>Download</title> <onActionProcess>%aditoprj%/entity/Document_entity/entityfields/downloadsinglefileaction/onActionProcess.js</onActionProcess> <iconId>VAADIN:DOWNLOAD</iconId> </entityActionField> @@ -196,6 +198,12 @@ <fieldName>Documents</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>7a20bd0f-9b1f-4a2b-a823-dbd4220613ca</name> + <entityName>Campaign_entity</entityName> + <fieldName>Documents</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -258,6 +266,12 @@ <fieldName>MainDocuments</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>056f943d-2ad2-4359-9825-7b445f0267ff</name> + <entityName>SupportTicket_entity</entityName> + <fieldName>MainDocuments</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Document_entity/entityfields/bindata_upload/onValueChange.js b/entity/Document_entity/entityfields/bindata_upload/onValueChange.js index bac80becd0f9e237b82c178ca5eaa60957a29662..c0b7a0db07072a7f30d5bfdd1afef3713e5a9d72 100644 --- a/entity/Document_entity/entityfields/bindata_upload/onValueChange.js +++ b/entity/Document_entity/entityfields/bindata_upload/onValueChange.js @@ -3,5 +3,5 @@ import("system.neon"); import("Entity_lib"); import("Document_lib"); -var uploadValue = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.BINDATA_UPLOAD")); +var uploadValue = vars.get("local.value"); neon.setFieldValue("$field.NAME", DocumentUtil.getFilenameFromUpload(uploadValue)); diff --git a/entity/Document_entity/entityfields/is_main_document/onValueChange.js b/entity/Document_entity/entityfields/is_main_document/onValueChange.js index 9b24b45926f8c5a61e02a09fcdfbb1a1dcb4de76..6a0b8cbb98df8907007380f60a24c2f3fde360a6 100644 --- a/entity/Document_entity/entityfields/is_main_document/onValueChange.js +++ b/entity/Document_entity/entityfields/is_main_document/onValueChange.js @@ -2,8 +2,7 @@ import("system.neon"); import("system.vars"); import("Entity_lib"); -var value = vars.exists("$field.IS_MAIN_DOCUMENT") ? vars.get("$field.IS_MAIN_DOCUMENT") : ""; -value = ProcessHandlingUtils.getOnValidationValue(value); +var value = vars.get("$local.value") ? vars.get("$local.value") : ""; if(value == "1") neon.setFieldValue("$field.KEYWORD", "MAINDOCUMENT"); diff --git a/entity/Document_entity/recordcontainers/jdito/contentProcess.js b/entity/Document_entity/recordcontainers/jdito/contentProcess.js index a4ad1b837c44901630593abd843a4467f6ca8707..ac587aa94de4b50020b99e39054ac3b3b29403ae 100644 --- a/entity/Document_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Document_entity/recordcontainers/jdito/contentProcess.js @@ -22,7 +22,7 @@ if(vars.exists("$param.AssignmentTable_param") && if(vars.exists("$local.idvalues") && vars.get("$local.idvalues")) metadata = db.getBinaryMetadataForIds(vars.get("$local.idvalues"), true, alias) else - metadata = db.getBinaryMetadata(assignmentTable, assignmentName, assignmentRowId, false, alias, keyword); + metadata = db.getBinaryMetadata(assignmentTable, assignmentName || "", assignmentRowId, false, alias, keyword); // Iterate through found binary data and populate result array for( var i = 0; i < metadata.length; i++) { diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js b/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js index 0f811becde3b650522124a8f399da0b889d6f3ab..c1041366b81d28135ca08820e00ae1c66d7c1609 100644 --- a/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js +++ b/entity/DuplicateScanConditionConfig_entity/entityfields/condition/valueProcess.js @@ -1,12 +1,9 @@ -import("system.logging"); import("system.vars"); import("system.result"); -logging.log("condition value process -> " + JSON.stringify(vars.get("$field.CONDITION"))); -if(vars.get("$field.CONDITION") == "") +if(vars.get("$this.value") == "") { let entityToScan = vars.get("$param.EntityToFilter_param"); - logging.log("condition leer neu rein schreiben -> " + entityToScan); let defaultFilterJson = JSON.stringify({entity: entityToScan, filter: {type: "group", operator: "AND", childs: []}}); result.string(defaultFilterJson); diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js b/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js index 9886fc8456dd191c7522d1db08dbc261b8c06f96..37ac7439530344dfaa6a263ec251aa5e3d13d97d 100644 --- a/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js +++ b/entity/DuplicateScanConditionConfig_entity/entityfields/duplicatescan_id/valueProcess.js @@ -1,6 +1,6 @@ import("system.result"); import("system.vars"); -if(vars.get("$field.DUPLICATESCAN_ID") == "") +if(vars.get("$this.value") == "") { result.string(vars.get("$param.DuplicateScanId_param")); } \ No newline at end of file diff --git a/entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js b/entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js index 7ac009f93f24d9697f6eea6c7d11ac93df584ceb..9eab3ae2e01d4d2eae9cd972788b3ba035e8b5f5 100644 --- a/entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js +++ b/entity/DuplicateScanConditionConfig_entity/entityfields/parameter/valueProcess.js @@ -1,6 +1,4 @@ -import("system.logging"); import("system.result"); import("system.vars"); -logging.log("EntityToFilter_param -> " + vars.get("$param.EntityToFilter_param")); result.string(vars.get("$param.EntityToFilter_param")); \ No newline at end of file diff --git a/entity/DuplicateScan_entity/DuplicateScan_entity.aod b/entity/DuplicateScan_entity/DuplicateScan_entity.aod index d1c5058f3884a01f1c63b955cef51264000640ba..f5576cc1cd0b928fb2e56efac616e10dd4f0a1b2 100644 --- a/entity/DuplicateScan_entity/DuplicateScan_entity.aod +++ b/entity/DuplicateScan_entity/DuplicateScan_entity.aod @@ -3,6 +3,7 @@ <name>DuplicateScan_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Duplicatescan</title> + <iconId>VAADIN:DATABASE</iconId> <recordContainer>DBRecordContainer</recordContainer> <entityFields> <entityProvider> diff --git a/entity/Email_entity/entityfields/recipient/displayValueProcess.js b/entity/Email_entity/entityfields/recipient/displayValueProcess.js index 465e0a9f7198021c0d439c55cbeaff0d5c566f89..8e2f689eb15234549c8e1586c5aeba949ada2d62 100644 --- a/entity/Email_entity/entityfields/recipient/displayValueProcess.js +++ b/entity/Email_entity/entityfields/recipient/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.neon"); import("system.vars"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string(vars.get("$this.value")); \ No newline at end of file + result.string(vars.get("$field.RECIPIENT")); \ No newline at end of file diff --git a/entity/Email_entity/entityfields/recipient/valueProcess.js b/entity/Email_entity/entityfields/recipient/valueProcess.js index 1115022a7a85a8c8283ab6429fa117100664a2c9..e83561d0e54fb7ff062c4157e4c6b6bd718f86b6 100644 --- a/entity/Email_entity/entityfields/recipient/valueProcess.js +++ b/entity/Email_entity/entityfields/recipient/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { if (vars.exists("$param.Recipient_param") && vars.get("$param.Recipient_param")) result.string(vars.get("$param.Recipient_param")); diff --git a/entity/Email_entity/recordcontainers/jdito/onInsert.js b/entity/Email_entity/recordcontainers/jdito/onInsert.js index 6cacfadc459568989baeae6ce715af0c7dc2104a..0d1bbaf89d697443184dda23614a52ca5bdb2cb8 100644 --- a/entity/Email_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Email_entity/recordcontainers/jdito/onInsert.js @@ -3,17 +3,12 @@ import("system.neon"); import("Employee_lib"); import("system.vars"); import("Email_lib"); +import("Contact_lib"); var contactId = vars.get("$param.ContactId_param"); -EmailUtils.openMailTemplate( +var eml = EmailWritingUtils.openMailTemplate( vars.get("$field.RECIPIENT"), EmployeeUtils.getCurrentContactId(), vars.get("$field.DOCUMENT_TEMPLATE"), contactId ); - -var links = []; -if (contactId) - links.push(["Person", contactId]); //TODO: dynamic - -ActivityUtils.createNewActivity(null, links); \ No newline at end of file diff --git a/entity/EmployeeRole_entity/entityfields/role/displayValueProcess.js b/entity/EmployeeRole_entity/entityfields/role/displayValueProcess.js index 388cdc2289d3f69159f7d2f346d983e0a338071c..3f92b2d22659c0b37d58f51750ddfcb1eda385c9 100644 --- a/entity/EmployeeRole_entity/entityfields/role/displayValueProcess.js +++ b/entity/EmployeeRole_entity/entityfields/role/displayValueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.tools"); var allRoles = tools.getAllRoles(); -var roleTitle = vars.get("$this.value"); +var roleTitle = vars.get("$field.ROLE"); if (roleTitle in allRoles) roleTitle = allRoles[roleTitle][0]; diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index 9d249029ed178090f083e95b961b87d612d16394..48596c9e3a434b7102b63019862647e6cf67b042 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -3,6 +3,7 @@ <name>Employee_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Employee</title> + <grantDeleteProcess>%aditoprj%/entity/Employee_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Employee_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Employee_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Employee_entity/onValidation.js</onValidation> @@ -250,6 +251,12 @@ <fieldName>EmployeeInvolved</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>773cd8d0-c4e2-4e2e-b910-a1f4e4b87801</name> + <entityName>UnlinkedMailMappingWrapper_entity</entityName> + <fieldName>Employees</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -300,24 +307,31 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>TITLE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ISACTIVE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>FIRSTNAME.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>LASTNAME.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>EMAIL_ADDRESS.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>EMAIL_ADDRESS.displayValue</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>DESCRIPTION.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>CONTACT_ID.value</name> @@ -327,6 +341,7 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>DEPARTMENT.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>CONFIRM_PASSWORD.value</name> diff --git a/entity/Employee_entity/entityfields/contact_id/onValueChange.js b/entity/Employee_entity/entityfields/contact_id/onValueChange.js index 26cac2df6b6b30fe19726b66e078f286f4d7400b..1d2ceda0ce1308bca68f3edef4ed47a7d0413807 100644 --- a/entity/Employee_entity/entityfields/contact_id/onValueChange.js +++ b/entity/Employee_entity/entityfields/contact_id/onValueChange.js @@ -1,28 +1,28 @@ -import("Communication_lib"); -import("Entity_lib"); -import("system.result"); -import("system.db"); -import("system.neon"); -import("system.vars"); -import("Sql_lib"); -import("Employee_lib"); - -var contactId = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID")); -if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) - && contactId) -{ - var name = db.array( - db.ROW, - SqlCondition.begin() - .andPrepare("CONTACT.CONTACTID", contactId) - .buildSql("select FIRSTNAME, LASTNAME, (" + CommUtil.getStandardSubSqlMail() + ") from PERSON join CONTACT on CONTACT.PERSON_ID = PERSON.PERSONID") - ); - var username = EmployeeUtils.generateUserName(name[0], name[1], "f.l+"); - - neon.setFieldValues({ - "$field.FIRSTNAME" : name[0] || "", - "$field.LASTNAME" : name[1] || "", - "$field.EMAIL_ADDRESS" : name[2] || "", - "$field.TITLE" : username - }); +import("Communication_lib"); +import("Entity_lib"); +import("system.result"); +import("system.db"); +import("system.neon"); +import("system.vars"); +import("Sql_lib"); +import("Employee_lib"); + +var contactId = vars.get("local.value"); +if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + && contactId) +{ + var name = db.array( + db.ROW, + SqlCondition.begin() + .andPrepare("CONTACT.CONTACTID", contactId) + .buildSql("select FIRSTNAME, LASTNAME, (" + CommUtil.getStandardSubSqlMail() + ") from PERSON join CONTACT on CONTACT.PERSON_ID = PERSON.PERSONID") + ); + var username = EmployeeUtils.generateUserName(name[0], name[1], "f.l+"); + + neon.setFieldValues({ + "$field.FIRSTNAME" : name[0] || "", + "$field.LASTNAME" : name[1] || "", + "$field.EMAIL_ADDRESS" : name[2] || "", + "$field.TITLE" : username + }); } \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/email_address/dropDownProcess.js b/entity/Employee_entity/entityfields/email_address/dropDownProcess.js index da419b6e5ea563cb1659058ed6999d65218ce082..0bcb8c5ea63dcf7a9224f05f033ad5b418997eff 100644 --- a/entity/Employee_entity/entityfields/email_address/dropDownProcess.js +++ b/entity/Employee_entity/entityfields/email_address/dropDownProcess.js @@ -1,26 +1,26 @@ -import("Communication_lib"); -import("system.neon"); -import("system.vars"); -import("system.db"); -import("system.result"); -import("Sql_lib"); - -var contactId = vars.get("$field.CONTACT_ID"); -if (contactId) -{ - var sql = SqlCondition.begin() - .andPrepare("COMMUNICATION.CONTACT_ID", contactId) - .and("COMMUNICATION.MEDIUM_ID in ('" + CommUtil.getMediumIdsByCategory("EMAIL").join("', '") + "')") - .buildSql("select ADDR, ADDR from COMMUNICATION"); - - var addresses = db.table(sql); - - //include the currently set email address - var currentAddress = vars.get("$field.EMAIL_ADDRESS"); - if (currentAddress && !addresses.some(function (row) {return row[0] == currentAddress;})) - { - addresses.push([currentAddress, currentAddress]); - } - - result.object(addresses); +import("Communication_lib"); +import("system.neon"); +import("system.vars"); +import("system.db"); +import("system.result"); +import("Sql_lib"); + +var contactId = vars.get("$field.CONTACT_ID"); +if (contactId && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)) +{ + var sql = SqlCondition.begin() + .andPrepare("COMMUNICATION.CONTACT_ID", contactId) + .andIn("COMMUNICATION.MEDIUM_ID", CommUtil.getMediumIdsByCategory("EMAIL")) + .buildSql("select ADDR, ADDR from COMMUNICATION"); + + var addresses = db.table(sql); + + //include the currently set email address + var currentAddress = vars.get("$field.EMAIL_ADDRESS"); + if (currentAddress && !addresses.some(function (row) {return row[0] == currentAddress;})) + { + addresses.push([currentAddress, currentAddress]); + } + + result.object(addresses); } \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/email_address/onValidation.js b/entity/Employee_entity/entityfields/email_address/onValidation.js index 764555dd20f91fd2aa2ffe24759cc4e9ae954a30..c9ac4ef72de7b9c1de1c4acc80300c00f671ea03 100644 --- a/entity/Employee_entity/entityfields/email_address/onValidation.js +++ b/entity/Employee_entity/entityfields/email_address/onValidation.js @@ -1,13 +1,13 @@ -import("Entity_lib"); -import("system.result"); -import("system.vars"); -import("system.tools"); -import("system.translate"); - -var email = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.EMAIL_ADDRESS")); -var isTaken = tools.getUserByAttribute(tools.EMAIL, [email]); -isTaken = isTaken - ? isTaken[tools.NAME] != vars.get("$field.UID") - : false; -if (email && isTaken) +import("Entity_lib"); +import("system.result"); +import("system.vars"); +import("system.tools"); +import("system.translate"); + +var email = vars.get("local.value"); +var isTaken = tools.getUserByAttribute(tools.EMAIL, [email]); +isTaken = isTaken + ? isTaken[tools.NAME] != vars.get("$field.UID") + : false; +if (email && isTaken) result.string(translate.text("Email must be unique!")); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/image/onValueChange.js b/entity/Employee_entity/entityfields/image/onValueChange.js index 8698d90353b719f652eec1427f0d8b881a8a8660..d6abf4f0c930633e54f411c91d96b8cc58843980 100644 --- a/entity/Employee_entity/entityfields/image/onValueChange.js +++ b/entity/Employee_entity/entityfields/image/onValueChange.js @@ -1,4 +1,5 @@ +import("system.vars"); import("Entity_lib"); // TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023 -FieldChanges.setChange("$field.IMAGE"); \ No newline at end of file +FieldChanges.setChange("$field.IMAGE", vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Employee_entity/entityfields/title/onValidation.js b/entity/Employee_entity/entityfields/title/onValidation.js index c2f5d678bf70ff8cd9f8b9ae68c94ea9eef3dfe3..90091b0551710d07ce191daaf18db8a5d88e83ca 100644 --- a/entity/Employee_entity/entityfields/title/onValidation.js +++ b/entity/Employee_entity/entityfields/title/onValidation.js @@ -1,17 +1,17 @@ -import("system.translate"); -import("system.neon"); -import("system.result"); -import("system.vars"); -import("system.tools"); -import("Entity_lib"); - -var title = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.TITLE")); -var isOldTitle = false; -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) -{ - let oldTitle = tools.getUserByAttribute(tools.NAME, [vars.get("$field.UID")], tools.PROFILE_TITLE); - oldTitle = oldTitle && oldTitle[tools.TITLE]; - isOldTitle = title == oldTitle; -} -if (!isOldTitle && title != "" && tools.existUsers(title)) +import("system.translate"); +import("system.neon"); +import("system.result"); +import("system.vars"); +import("system.tools"); +import("Entity_lib"); + +var title = vars.get("local.value"); +var isOldTitle = false; +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + let oldTitle = tools.getUserByAttribute(tools.NAME, [vars.get("$field.UID")], tools.PROFILE_TITLE); + oldTitle = oldTitle && oldTitle[tools.TITLE]; + isOldTitle = title == oldTitle; +} +if (!isOldTitle && title != "" && tools.existUsers(title)) result.string(translate.text("Username already exists!")); \ No newline at end of file diff --git a/entity/Employee_entity/grantDeleteProcess.js b/entity/Employee_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b60872d672ceaa4a6670cf90bc7c25fabc3e3fb2 --- /dev/null +++ b/entity/Employee_entity/grantDeleteProcess.js @@ -0,0 +1,6 @@ +import("Employee_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID")))); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js index 8db2fb2cb236265ad222ddf74c176a89dd8be92f..c5e53826744147cec8a91caf0c046b034a6efb23 100644 --- a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js @@ -1,66 +1,92 @@ -import("system.logging"); -import("Attribute_lib"); -import("system.vars"); -import("system.result"); -import("system.tools"); -import("Util_lib"); -import("Contact_lib"); -import("JditoFilter_lib"); -import("Employee_lib"); - -var users; -if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) - users = [tools.getUserByAttribute(tools.NAME, vars.get("$local.idvalues"), tools.PROFILE_FULL)]; -else -{ - var values = ["true", "false"]; - if (vars.exists("$param.OnlyActives_param") && vars.get("$param.OnlyActives_param") == "true") - values = ["true"]; - users = tools.getUsersByAttribute(tools.ISACTIVE, values, tools.PROFILE_FULL); -} - -users = users.map(function (user) -{ - return [ - user[tools.NAME], - user[tools.TITLE], - user[tools.PARAMS][tools.ISACTIVE], - user[tools.PARAMS][tools.FIRSTNAME], - user[tools.PARAMS][tools.LASTNAME], - user[tools.PARAMS][tools.EMAIL], - user[tools.PARAMS][tools.EMAIL], - user[tools.DESCRIPTION], - user[tools.PARAMS][tools.CONTACTID], - ContactUtils.getTitleByContactId(user[tools.PARAMS][tools.CONTACTID]), //TODO: get the names more efficiently - user[tools.PARAMS].department, - "" - ]; -}); - -var filter = vars.get("$local.filter"); - -//TODO: this is a workaround that filters the records manually, it should be possible to filter the users with a tools.* method -users = JditoFilterUtils.filterRecords(["UID", "TITLE", "ISACTIVE", "FIRSTNAME", "LASTNAME", "EMAIL_ADDRESS", "", "DESCRIPTION", "CONTACT_ID", "", "DEPARTMENT"], users, filter.filter); - -var order = vars.get("$local.order"); -var columnOrder = { - "TITLE.value" : 1, - "ISACTIVE.value" : 2, - "FIRSTNAME.value" : 3, - "LASTNAME.value" : 4 -}; -var sortOrder = []; -for (let field in order) -{ - if (field in columnOrder) - { - sortOrder.push(columnOrder[field]); - sortOrder.push(order[field] == "DOWN"); - } -} -if (!sortOrder.length) //sort by login by default - sortOrder = [1, false]; - -ArrayUtils.sortMulti(users, sortOrder); - -result.object(users); +import("Sql_lib"); +import("system.db"); +import("Attribute_lib"); +import("system.vars"); +import("system.result"); +import("system.tools"); +import("Util_lib"); +import("Contact_lib"); +import("JditoFilter_lib"); +import("Employee_lib"); + +var users; +if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) + users = [tools.getUserByAttribute(tools.NAME, vars.get("$local.idvalues"), tools.PROFILE_FULL)]; +else +{ + var values = ["true", "false"]; + if (vars.exists("$param.OnlyActives_param") && vars.get("$param.OnlyActives_param") == "true") + values = ["true"]; + users = tools.getUsersByAttribute(tools.ISACTIVE, values, tools.PROFILE_FULL); +} + +var contactIds = []; +users = users.map(function (user) +{ + contactIds.push(user[tools.PARAMS][tools.CONTACTID]); + + return [ + user[tools.NAME], + user[tools.TITLE], + user[tools.PARAMS][tools.ISACTIVE], + user[tools.PARAMS][tools.FIRSTNAME], + user[tools.PARAMS][tools.LASTNAME], + user[tools.PARAMS][tools.EMAIL], + user[tools.PARAMS][tools.EMAIL], + user[tools.DESCRIPTION], + user[tools.PARAMS][tools.CONTACTID], //8 + null, //9 + user[tools.PARAMS].department, + "" + ]; +}); + +var renderer = new ContactTitleRenderer(Contact.createWithColumnPreset(), ContactTitleRenderer.OPTIONS.NoOption); +var selectExpression = renderer.asSql(); + +var idsPerPage = 1000; +var names = []; +var select = "select CONTACTID, " + selectExpression + " from CONTACT \n\ + left join PERSON on (PERSON.PERSONID = CONTACT.PERSON_ID)"; + +for (let begin = 0, max = contactIds.length; begin < max; begin += idsPerPage) +{ + names = names.concat(db.table(SqlCondition.begin() + .andIn("CONTACT.CONTACTID", contactIds.slice(begin, begin + idsPerPage)) + .buildSql(select) + )); +} +var nameMap = {}; +for (let i = 0, l = names.length; i < l; i++) + nameMap[names[i][0]] = names[i][1]; + +for (let i = 0, l = users.length; i < l; i++) + users[i][9] = nameMap[users[i][8]] || ""; + +var filter = vars.get("$local.filter"); + +//TODO: this is a workaround that filters the records manually, it should be possible to filter the users with a tools.* method +users = JditoFilterUtils.filterRecords(["UID", "TITLE", "ISACTIVE", "FIRSTNAME", "LASTNAME", "EMAIL_ADDRESS", "", "DESCRIPTION", "CONTACT_ID", "", "DEPARTMENT"], users, filter.filter); + +var order = vars.get("$local.order"); +var columnOrder = { + "TITLE.value" : 1, + "ISACTIVE.value" : 2, + "FIRSTNAME.value" : 3, + "LASTNAME.value" : 4 +}; +var sortOrder = []; +for (let field in order) +{ + if (field in columnOrder) + { + sortOrder.push(columnOrder[field]); + sortOrder.push(order[field] == "DOWN"); + } +} +if (!sortOrder.length) //sort by login by default + sortOrder = [1, false]; + +ArrayUtils.sortMulti(users, sortOrder); + +result.object(users); diff --git a/entity/Forecast_entity/Forecast_entity.aod b/entity/Forecast_entity/Forecast_entity.aod index bef31d82cd87a337ec0d1ebd1fd70d5746cf553c..f261ba72391e70de0ffa8503885fca03c7f22c18 100644 --- a/entity/Forecast_entity/Forecast_entity.aod +++ b/entity/Forecast_entity/Forecast_entity.aod @@ -3,6 +3,7 @@ <name>Forecast_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>${FORECAST_ENGLISH}</title> + <titlePlural>Forecasts</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -15,18 +16,21 @@ <resolution>DAY</resolution> <outputFormat>dd.MM.yyyy</outputFormat> <inputFormat>dd.MM.yyyy</inputFormat> + <mandatory v="true" /> <valueProcess>%aditoprj%/entity/Forecast_entity/entityfields/date_start/valueProcess.js</valueProcess> </entityField> <entityField> <name>GROUPCODE</name> <title>Product</title> <consumer>KeywordProductGroupcodes</consumer> + <mandatory v="true" /> <displayValueProcess>%aditoprj%/entity/Forecast_entity/entityfields/groupcode/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>INFO</name> <title>Info</title> <contentType>LONG_TEXT</contentType> + <mandatory v="true" /> </entityField> <entityField> <name>FORECASTID</name> @@ -40,11 +44,10 @@ <valueProcess>%aditoprj%/entity/Forecast_entity/entityfields/object_rowid/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Forecast_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess> </entityField> - <entityField> - <name>TYPE</name> - </entityField> <entityField> <name>VOLUME</name> + <title>Volume</title> + <mandatory v="true" /> <titleProcess>%aditoprj%/entity/Forecast_entity/entityfields/volume/titleProcess.js</titleProcess> </entityField> <entityConsumer> @@ -134,22 +137,22 @@ <dbRecordFieldMapping> <name>DATE_START.value</name> <recordfield>FORECAST.DATE_START</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GROUPCODE.value</name> <recordfield>FORECAST.GROUPCODE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>FORECAST.INFO</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>TYPE.value</name> - <recordfield>FORECAST.TYPE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VOLUME.value</name> <recordfield>FORECAST.VOLUME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GROUPCODE.displayValue</name> diff --git a/entity/Forecast_entity/entityfields/date_start/valueProcess.js b/entity/Forecast_entity/entityfields/date_start/valueProcess.js index f7576b74fcf4e58d5a6e9b1098994ba76e9b3ef1..072560acb2f89d72012c5d3539c293cbf02b86a8 100644 --- a/entity/Forecast_entity/entityfields/date_start/valueProcess.js +++ b/entity/Forecast_entity/entityfields/date_start/valueProcess.js @@ -1,9 +1,9 @@ -import("system.result"); -import("system.vars"); -import("system.neon"); -import("Date_lib"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) -{ - result.string(DateUtils.getTodayUTC()); +import("system.result"); +import("system.vars"); +import("system.neon"); +import("Date_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + result.string(DateUtils.getTodayUTC()); } \ No newline at end of file diff --git a/entity/KeywordAttributeRelation_entity/KeywordAttributeRelation_entity.aod b/entity/KeywordAttributeRelation_entity/KeywordAttributeRelation_entity.aod index 1034b334f68ef2eb582b082b22f1e39ebb586e3c..03a30f447da9d5375fa959b3797814d16831f602 100644 --- a/entity/KeywordAttributeRelation_entity/KeywordAttributeRelation_entity.aod +++ b/entity/KeywordAttributeRelation_entity/KeywordAttributeRelation_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/KeywordAttributeRelation_entity/documentation.adoc</documentation> <title>Keyword Attribute Values</title> + <titlePlural>Keyword Attribute Values</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -33,6 +34,10 @@ <mandatory v="true" /> <displayValueProcess>%aditoprj%/entity/KeywordAttributeRelation_entity/entityfields/ab_keyword_attribute_id/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/KeywordAttributeRelation_entity/entityfields/ab_keyword_attribute_id/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> </entityField> <entityField> <name>AB_KEYWORD_ENTRY_ID</name> @@ -50,12 +55,6 @@ <fieldName>KeywordAttributeRelations</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>53b35858-7c81-429c-9e06-0362f567ad42</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>KeywordAttributeRelationsReadOnly</fieldName> - <isConsumer v="false" /> - </entityDependency> </dependencies> <children> <entityParameter> @@ -88,6 +87,7 @@ <name>FilterAlreadyUsedByEntryId_param</name> <valueProcess>%aditoprj%/entity/KeywordAttributeRelation_entity/entityfields/keywordattributes/children/filteralreadyusedbyentryid_param/valueProcess.js</valueProcess> <expose v="false" /> + <documentation>%aditoprj%/entity/KeywordAttributeRelation_entity/entityfields/keywordattributes/children/filteralreadyusedbyentryid_param/documentation.adoc</documentation> </entityParameter> </children> </entityConsumer> diff --git a/entity/KeywordAttributeRelation_entity/entityfields/ab_keyword_attribute_id/displayValueProcess.js b/entity/KeywordAttributeRelation_entity/entityfields/ab_keyword_attribute_id/displayValueProcess.js index 3e385da47ff516ac8f3bace0f873c9ff8694d735..2f5a5971a652b4452f302bad464d1a81c73853ec 100644 --- a/entity/KeywordAttributeRelation_entity/entityfields/ab_keyword_attribute_id/displayValueProcess.js +++ b/entity/KeywordAttributeRelation_entity/entityfields/ab_keyword_attribute_id/displayValueProcess.js @@ -9,7 +9,7 @@ if (keywordAttributeId) { var sql = SqlCondition.begin() .andPrepare("AB_KEYWORD_ATTRIBUTE.AB_KEYWORD_ATTRIBUTEID", keywordAttributeId) - .buildSql("select AB_KEYWORD_ATTRIBUTE.NAME, AB_KEYWORD_ATTRIBUTE.TYPE from AB_KEYWORD_ATTRIBUTE"); + .buildSql("select AB_KEYWORD_ATTRIBUTE.NAME, AB_KEYWORD_ATTRIBUTE.KIND from AB_KEYWORD_ATTRIBUTE"); res = db.cell(sql); } result.string(res); \ No newline at end of file diff --git a/entity/KeywordAttributeRelation_entity/entityfields/attributetype/valueProcess.js b/entity/KeywordAttributeRelation_entity/entityfields/attributetype/valueProcess.js index 17b5f6abe25d8b95f8c1bccf20b80b84b8d1bcc5..cbac8d6452c9fe3a1344d497181ddf75c4d3bfe1 100644 --- a/entity/KeywordAttributeRelation_entity/entityfields/attributetype/valueProcess.js +++ b/entity/KeywordAttributeRelation_entity/entityfields/attributetype/valueProcess.js @@ -12,7 +12,7 @@ if (id) { type = db.cell(SqlCondition.begin() .andPrepare("AB_KEYWORD_ATTRIBUTE.AB_KEYWORD_ATTRIBUTEID", id) - .buildSql("select AB_KEYWORD_ATTRIBUTE.TYPE from AB_KEYWORD_ATTRIBUTE")); + .buildSql("select AB_KEYWORD_ATTRIBUTE.KIND from AB_KEYWORD_ATTRIBUTE")); type = type.trim(); } result.string(type); \ No newline at end of file diff --git a/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/stateProcess.js b/entity/KeywordAttributeRelation_entity/entityfields/keywordattributes/children/filteralreadyusedbyentryid_param/documentation.adoc similarity index 100% rename from entity/CampaignParticipant_entity/entityfields/advertisingban_icon/stateProcess.js rename to entity/KeywordAttributeRelation_entity/entityfields/keywordattributes/children/filteralreadyusedbyentryid_param/documentation.adoc diff --git a/entity/KeywordAttributeRelation_entity/entityfields/valueproxy/onValueChange.js b/entity/KeywordAttributeRelation_entity/entityfields/valueproxy/onValueChange.js index a7be1f9f79d40b07b0c63110ff6feac8cd30d8f8..3ee601ff33d6e21bd26fcfb138ba550d96036322 100644 --- a/entity/KeywordAttributeRelation_entity/entityfields/valueproxy/onValueChange.js +++ b/entity/KeywordAttributeRelation_entity/entityfields/valueproxy/onValueChange.js @@ -3,7 +3,7 @@ import("system.vars"); import("Entity_lib"); var type = vars.get("$field.attributeType"); -var value = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.valueProxy")); +var value = vars.get("$local.value"); switch (type) { case "BOOL_VALUE": diff --git a/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod b/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod index 6cd59c0eb1d12cb500d16d66a85b990e0be808ca..51527c153e05af4fd0f766560af876d11a62d49d 100644 --- a/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod +++ b/entity/KeywordAttribute_entity/KeywordAttribute_entity.aod @@ -53,14 +53,6 @@ <isConsumer v="false" /> </entityDependency> </dependencies> - <children> - <entityParameter> - <name>ContainerName_param</name> - </entityParameter> - <entityParameter> - <name>FilterAlreadyUsedByEntryId_param</name> - </entityParameter> - </children> </entityProvider> <entityParameter> <name>ContainerName_param</name> @@ -114,14 +106,17 @@ <dbRecordFieldMapping> <name>CONTAINER.value</name> <recordfield>AB_KEYWORD_ATTRIBUTE.CONTAINER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NAME.value</name> <recordfield>AB_KEYWORD_ATTRIBUTE.NAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TYPE.value</name> - <recordfield>AB_KEYWORD_ATTRIBUTE.TYPE</recordfield> + <recordfield>AB_KEYWORD_ATTRIBUTE.KIND</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TYPE.displayValue</name> diff --git a/entity/KeywordAttribute_entity/entityfields/name/onValidation.js b/entity/KeywordAttribute_entity/entityfields/name/onValidation.js index 6a2c9b1a35a48af4deb4794848269fca517e8b50..8711e91f305852080a4d2c2b093e33b85a04c0e9 100644 --- a/entity/KeywordAttribute_entity/entityfields/name/onValidation.js +++ b/entity/KeywordAttribute_entity/entityfields/name/onValidation.js @@ -13,7 +13,7 @@ var validation = (function(){ var container = vars.get("$field.CONTAINER"); if (container == "") return null; - var name = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.NAME")); + var name = vars.get("local.value"); if (name == "") return null; diff --git a/entity/KeywordAttribute_entity/recordcontainers/db/conditionProcess.js b/entity/KeywordAttribute_entity/recordcontainers/db/conditionProcess.js index 02735856728916d8c1030268da36120a4b8c16c3..5df041cf417a065651c61f11c8296636328e2462 100644 --- a/entity/KeywordAttribute_entity/recordcontainers/db/conditionProcess.js +++ b/entity/KeywordAttribute_entity/recordcontainers/db/conditionProcess.js @@ -1,21 +1,21 @@ -import("system.vars"); -import("system.db"); -import("system.result"); -import("Sql_lib"); - -var cond = SqlCondition.begin().andPrepareVars("AB_KEYWORD_ATTRIBUTE.CONTAINER", "$param.ContainerName_param"); - -//filter for entries that are already used by entry_id -var entryIdForFilter = vars.get("$param.FilterAlreadyUsedByEntryId_param"); -if (entryIdForFilter) -{ - var exclusiveFilterCondition = SqlCondition.begin() - .andPrepare("AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ENTRY_ID", entryIdForFilter) - .buildSql("AB_KEYWORD_ATTRIBUTE.AB_KEYWORD_ATTRIBUTEID not in (\n\ - select AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ATTRIBUTE_ID \n\ - from AB_KEYWORD_ATTRIBUTERELATION ", null, ")"); - cond.andAttachPrepared(exclusiveFilterCondition); -} - -var condStr = db.translateCondition(cond.build("1 = 1")); +import("system.vars"); +import("system.db"); +import("system.result"); +import("Sql_lib"); + +var cond = SqlCondition.begin().andPrepareVars("AB_KEYWORD_ATTRIBUTE.CONTAINER", "$param.ContainerName_param"); + +//filter for entries that are already used by entry_id +var entryIdForFilter = vars.get("$param.FilterAlreadyUsedByEntryId_param"); +if (entryIdForFilter) +{ + var exclusiveFilterCondition = SqlCondition.begin() + .andPrepare("AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ENTRY_ID", entryIdForFilter) + .buildSql("AB_KEYWORD_ATTRIBUTE.AB_KEYWORD_ATTRIBUTEID not in (\n\ + select AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ATTRIBUTE_ID \n\ + from AB_KEYWORD_ATTRIBUTERELATION ", null, ")"); + cond.andAttachPrepared(exclusiveFilterCondition); +} + +var condStr = db.translateCondition(cond.build("1 = 1")); result.string(condStr); \ No newline at end of file diff --git a/entity/KeywordAttribute_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js b/entity/KeywordAttribute_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js index a08460ea208091b387b4fe5cd47dbfa78c9504fa..d1d58b99ba17815bf5be41cfd786e5d2e82aedab 100644 --- a/entity/KeywordAttribute_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js +++ b/entity/KeywordAttribute_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.keywordAttributeType(), "AB_KEYWORD_ATTRIBUTE.TYPE"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.keywordAttributeType(), "AB_KEYWORD_ATTRIBUTE.KIND"); result.string(sql); diff --git a/entity/KeywordEntry_entity/KeywordEntry_entity.aod b/entity/KeywordEntry_entity/KeywordEntry_entity.aod index 45fdb06f350760d33aaddf597e9d5e06d6645086..609c83dc2e21531d13805b6f92948158f2e0632c 100644 --- a/entity/KeywordEntry_entity/KeywordEntry_entity.aod +++ b/entity/KeywordEntry_entity/KeywordEntry_entity.aod @@ -18,6 +18,20 @@ <name>#PROVIDER</name> <lookupIdfield>KEYID</lookupIdfield> <recordContainer>db</recordContainer> + <dependencies> + <entityDependency> + <name>ce10e4d3-7799-4473-a681-a3c6d9f93b02</name> + <entityName>Notification_entity</entityName> + <fieldName>StateKeywords</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>0015f4fa-9f54-4d99-8e23-92e36a614d7a</name> + <entityName>Notification_entity</entityName> + <fieldName>PrioKeywords</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> </entityProvider> <entityField> <name>CONTAINER</name> @@ -461,6 +475,36 @@ <fieldName>KeywordGuarantee</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>2443c7e3-9e66-41dc-99c7-3283e9315000</name> + <entityName>Campaign_entity</entityName> + <fieldName>KeywordCurrency</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>2694515c-eda4-44aa-9826-d430aa8a8089</name> + <entityName>Order_entity</entityName> + <fieldName>KeywordOrderTypes</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>72ae7a5c-acc9-4e59-8110-f5b544f47f15</name> + <entityName>Order_entity</entityName> + <fieldName>KeywordDunningLevels</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>ea9260e9-b5e8-457c-ae84-45c4692348ce</name> + <entityName>Order_entity</entityName> + <fieldName>KeywordPaymentTerms</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>5d296f68-0a8f-429c-b630-e3ca88874945</name> + <entityName>Order_entity</entityName> + <fieldName>KeywordDeliveryTerms</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -486,6 +530,7 @@ </entityParameter> <entityConsumer> <name>KeywordAttributeRelations</name> + <onValidation>%aditoprj%/entity/KeywordEntry_entity/entityfields/keywordattributerelations/onValidation.js</onValidation> <dependency> <name>dependency</name> <entityName>KeywordAttributeRelation_entity</entityName> @@ -499,22 +544,6 @@ </entityParameter> </children> </entityConsumer> - <entityConsumer> - <name>KeywordAttributeRelationsReadOnly</name> - <documentation>%aditoprj%/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/documentation.adoc</documentation> - <state>READONLY</state> - <dependency> - <name>dependency</name> - <entityName>KeywordAttributeRelation_entity</entityName> - <fieldName>AttributesForKeywordEntry</fieldName> - </dependency> - <children> - <entityParameter> - <name>KeywordEntryId_param</name> - <valueProcess>%aditoprj%/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/children/keywordentryid_param/valueProcess.js</valueProcess> - </entityParameter> - </children> - </entityConsumer> <entityParameter> <name>ExcludedKeyIdsSubquery_param</name> <expose v="true" /> @@ -559,6 +588,7 @@ <dbRecordFieldMapping> <name>TITLE.value</name> <recordfield>AB_KEYWORD_ENTRY.TITLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SORTING.value</name> @@ -567,10 +597,12 @@ <dbRecordFieldMapping> <name>ISESSENTIAL.value</name> <recordfield>AB_KEYWORD_ENTRY.ISESSENTIAL</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ISACTIVE.value</name> <recordfield>AB_KEYWORD_ENTRY.ISACTIVE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>AB_KEYWORD_ENTRYID.value</name> @@ -583,6 +615,7 @@ <dbRecordFieldMapping> <name>CONTAINER.value</name> <recordfield>AB_KEYWORD_ENTRY.CONTAINER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/KeywordEntry_entity/entityfields/keyid/onValidation.js b/entity/KeywordEntry_entity/entityfields/keyid/onValidation.js index a0830f5196463702be757aa76d46e9b3d3c1c8f4..c617b930c473204ff932028051fbe2c1faccaa75 100644 --- a/entity/KeywordEntry_entity/entityfields/keyid/onValidation.js +++ b/entity/KeywordEntry_entity/entityfields/keyid/onValidation.js @@ -6,7 +6,7 @@ import("Sql_lib"); import("Entity_lib"); var container = vars.get("$field.CONTAINER"); -var keyId = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.KEYID")).trim(); +var keyId = vars.get("local.value").trim(); //a KEY has always to be unique within one container and since the user can specify the key on insert we've to ensure that it's unique if (container && keyId) diff --git a/entity/KeywordEntry_entity/entityfields/keyid/valueProcess.js b/entity/KeywordEntry_entity/entityfields/keyid/valueProcess.js index 2fc41228ab188dc70af71478adb1d1afd7c1cb77..e0c496f09541a007c74f8acb385b21ae51fb44a6 100644 --- a/entity/KeywordEntry_entity/entityfields/keyid/valueProcess.js +++ b/entity/KeywordEntry_entity/entityfields/keyid/valueProcess.js @@ -3,5 +3,5 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(util.getNewUUID()); \ No newline at end of file diff --git a/entity/KeywordEntry_entity/entityfields/keywordattributerelations/onValidation.js b/entity/KeywordEntry_entity/entityfields/keywordattributerelations/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..ff0553af7e4a904edf8807108c2c417aadd12adb --- /dev/null +++ b/entity/KeywordEntry_entity/entityfields/keywordattributerelations/onValidation.js @@ -0,0 +1,82 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Sql_lib"); +import("system.db"); + +if (!_areUnique()) + result.string(translate.text("Attributes must be unique!")); + +function _areUnique () +{ + var insertedRows = vars.get("$field.KeywordAttributeRelations.insertedRows"); + var changedRows = vars.get("$field.KeywordAttributeRelations.changedRows"); + var deletedRows = vars.get("$field.KeywordAttributeRelations.deletedRows"); + + var storedRows = db.table(SqlCondition.begin() + .andPrepare("AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ENTRY_ID", vars.get("$field.AB_KEYWORD_ENTRYID")) + .buildSql("select AB_KEYWORD_ATTRIBUTERELATIONID, AB_KEYWORD_ATTRIBUTE_ID from AB_KEYWORD_ATTRIBUTERELATION")); + + var attributeChanges = {}; + + if (deletedRows) + deletedRows.forEach(function (row) + { + this[row.AB_KEYWORD_ATTRIBUTERELATIONID] = ""; + }, attributeChanges); + + if (changedRows) + changedRows.forEach(function (row) + { + this[row.AB_KEYWORD_ATTRIBUTERELATIONID] = row.AB_KEYWORD_ATTRIBUTE_ID; + }, attributeChanges); + + var countObj = {}; + + storedRows.forEach(function ([storedAttrRelationId, storedAttributeId]) { + var currentAttributeId = storedAttributeId; + //merging the data that is stored in the DB and the provided changes + if (attributeChanges && storedAttrRelationId in attributeChanges) + currentAttributeId = attributeChanges[storedAttrRelationId]; + + // it doesn't matter if a row has been deleted or if the attribute has been set to "nothing" + if (currentAttributeId == "") + _decrCount(storedAttributeId); + else + { + _incrCount(currentAttributeId); + if (currentAttributeId != storedAttributeId) + _decrCount(storedAttributeId); + } + }); + + if (insertedRows) //append the new rows + { + insertedRows.forEach(function (row) + { + this[row.AB_KEYWORD_ATTRIBUTE_ID] = (this[row.AB_KEYWORD_ATTRIBUTE_ID] || 0) + 1; + }, countObj); + } + + for (let id in countObj) + if (countObj[id] > 1) + return false; + + return true; + + function _incrCount (pAttributeId) + { + if (countObj[pAttributeId]) + countObj[pAttributeId]++; + else + countObj[pAttributeId] = 1; + } + + function _decrCount (pAttributeId) + { + if (countObj[pAttributeId]) + countObj[pAttributeId]--; + else + countObj[pAttributeId] = 0; + } +} diff --git a/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/children/keywordentryid_param/valueProcess.js b/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/children/keywordentryid_param/valueProcess.js deleted file mode 100644 index 53afbdfbbfe9044ca0a5af0984365d6b2ee5bdba..0000000000000000000000000000000000000000 --- a/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/children/keywordentryid_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$field.AB_KEYWORD_ENTRYID")); \ No newline at end of file diff --git a/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/documentation.adoc b/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/documentation.adoc deleted file mode 100644 index 99874edc30d1b8340662c802a9b2b4ef1da0fcdd..0000000000000000000000000000000000000000 --- a/entity/KeywordEntry_entity/entityfields/keywordattributerelationsreadonly/documentation.adoc +++ /dev/null @@ -1,2 +0,0 @@ -Since it's not possible to limit the keywordAttributeRelation to a distinctive list (use a KeywordAttributeRelation "category" only once per keyowrd-entry) within the generic-multiple-template / titledList-template use this readonly consumer there. -For editing use the not-read-only consumer in a list-template. In a list-template only one row can be changed (and stored) which means we can exlucde already stored entries. \ No newline at end of file diff --git a/entity/KeywordEntry_entity/onValidation.js b/entity/KeywordEntry_entity/onValidation.js index f1f568a35c02d5f14032daa227f765538d92b5a1..f771dd784476b962438a1eafb789f0c145e5af3b 100644 --- a/entity/KeywordEntry_entity/onValidation.js +++ b/entity/KeywordEntry_entity/onValidation.js @@ -1,22 +1,22 @@ -import("system.translate"); -import("system.db"); -import("system.vars"); -import("system.text"); -import("system.neon"); -import("Sql_lib"); - -//TODO: this should no happen in onValidation; waiting for #1032668 -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -{ - var keyContainer = vars.get("$field.CONTAINER"); - if (keyContainer) - { - var cond = SqlCondition.begin().andPrepare("AB_KEYWORD_ENTRY.CONTAINER", keyContainer); - var maskingHelper = new SqlMaskingUtils(); - var newCodeNumber = db.cell(cond.buildSql("select " + maskingHelper.max("AB_KEYWORD_ENTRY.SORTING") + " from AB_KEYWORD_ENTRY", "1 = 2")); - newCodeNumber = Number(newCodeNumber);//if no number exists till no, start value will be 1 (due to: ++0) - if (isNaN(newCodeNumber)) - throw new TypeError(translate.text("The code number is not a valid number.")); - neon.setFieldValue("$field.SORTING", ++newCodeNumber); - } +import("system.translate"); +import("system.db"); +import("system.vars"); +import("system.text"); +import("system.neon"); +import("Sql_lib"); + +//TODO: this should no happen in onValidation; waiting for #1032668 +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var keyContainer = vars.get("$field.CONTAINER"); + if (keyContainer) + { + var cond = SqlCondition.begin().andPrepare("AB_KEYWORD_ENTRY.CONTAINER", keyContainer); + var maskingHelper = new SqlMaskingUtils(); + var newCodeNumber = db.cell(cond.buildSql("select " + maskingHelper.max("AB_KEYWORD_ENTRY.SORTING") + " from AB_KEYWORD_ENTRY", "1 = 2")); + newCodeNumber = Number(newCodeNumber);//if no number exists till no, start value will be 1 (due to: ++0) + if (isNaN(newCodeNumber)) + throw new TypeError(translate.text("The code number is not a valid number.")); + neon.setFieldValue("$field.SORTING", ++newCodeNumber); + } } \ No newline at end of file diff --git a/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js b/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js index 3afa5ffe149a183437c345b9fa0b501f2eddd01e..e581324d162afd72b6e3b262fc2a827a64882517 100644 --- a/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js +++ b/entity/KeywordEntry_entity/recordcontainers/db/conditionProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.db"); import("system.result"); diff --git a/entity/LetterRecipient_entity/LetterRecipient_entity.aod b/entity/LetterRecipient_entity/LetterRecipient_entity.aod index 10a2c4e4426a69c52d2b7344a08ceccf007a4b12..96b2be2d04a6c6366a4c5514a4bb81b9d6c32675 100644 --- a/entity/LetterRecipient_entity/LetterRecipient_entity.aod +++ b/entity/LetterRecipient_entity/LetterRecipient_entity.aod @@ -2,6 +2,9 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>LetterRecipient_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <siblings> + <element>Address_entity</element> + </siblings> <titlePlural>Recipients</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -78,14 +81,28 @@ <iconId>VAADIN:DOWNLOAD_ALT</iconId> <tooltipProcess>%aditoprj%/entity/LetterRecipient_entity/entityfields/recipientactions/children/downloadletterforselection/tooltipProcess.js</tooltipProcess> </entityActionField> + <entityActionField> + <name>removeWithCommRestriction</name> + <onActionProcess>%aditoprj%/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:BAN</iconId> + <tooltipProcess>%aditoprj%/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/tooltipProcess.js</tooltipProcess> + </entityActionField> </children> </entityActionGroup> + <entityField> + <name>ADDRESS_ID</name> + <title>Address</title> + <state>READONLY</state> + <displayValueProcess>%aditoprj%/entity/LetterRecipient_entity/entityfields/address_id/displayValueProcess.js</displayValueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> <fromClauseProcess>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> + <conditionProcess>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <linkInformation> <linkInformation> @@ -121,6 +138,7 @@ <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>LETTERRECIPIENT.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LETTERRECIPIENTID.value</name> @@ -150,6 +168,14 @@ <name>TARGETCONTEXT.value</name> <expression>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/recordfieldmappings/targetcontext.value/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ADDRESS_ID.displayValue</name> + <expression>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/recordfieldmappings/address_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ADDRESS_ID.value</name> + <recordfield>CONTACT.ADDRESS_ID</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/LetterRecipient_entity/entityfields/address_id/displayValueProcess.js b/entity/LetterRecipient_entity/entityfields/address_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cf523f34aa0656732d174aa48f916bae2f840313 --- /dev/null +++ b/entity/LetterRecipient_entity/entityfields/address_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("PostalAddress_lib"); +import("system.result"); + +result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$field.ADDRESS_ID"))); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/entityfields/contact_id/onValidation.js b/entity/LetterRecipient_entity/entityfields/contact_id/onValidation.js index 9c0fb39943a54c11d7c568a7f31e4534095d3d4c..c90cb8bafd51a8308c90de658d75b8027c6e9f74 100644 --- a/entity/LetterRecipient_entity/entityfields/contact_id/onValidation.js +++ b/entity/LetterRecipient_entity/entityfields/contact_id/onValidation.js @@ -1,8 +1,13 @@ +import("system.vars"); +import("Bulkmail_lib"); import("Contact_lib"); import("system.translate"); import("system.result"); import("KeywordRegistry_basic"); import("Entity_lib"); -if (ContactUtils.hasCommRestriction(ProcessHandlingUtils.getOnValidationValue(), $KeywordRegistry.communicationMediumCampaign$letter())) +var contactId = vars.get("local.value"); +if (SerialLetterUtils.isRecipient(vars.get("$field.SERIALLETTER_ID"), contactId, vars.get("$field.SERIALLETTER_ID"))) + result.string(translate.text("The contact is already a recipient!")); +if (ContactUtils.hasCommRestriction(contactId, $KeywordRegistry.communicationMediumCampaign$letter())) result.string(translate.text("The contact has an advertising ban for letters!")); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/entityfields/icon/colorProcess.js b/entity/LetterRecipient_entity/entityfields/icon/colorProcess.js index 7c74f6cb350f07fa5bd57c5825bda302d6d167a7..2284141675c76efe4d00742da5cc858c9b3b97c9 100644 --- a/entity/LetterRecipient_entity/entityfields/icon/colorProcess.js +++ b/entity/LetterRecipient_entity/entityfields/icon/colorProcess.js @@ -2,5 +2,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$field.HASCOMMRESTRICTION") == "true") +if (vars.get("$field.HASCOMMRESTRICTION") == "true" || !vars.get("$field.ADDRESS_ID.displayValue").trim()) result.string(neon.PRIORITY_HIGH_COLOR); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/onActionProcess.js b/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..80ae8387d5e95fa964747c3b538fa58927007c6b --- /dev/null +++ b/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/onActionProcess.js @@ -0,0 +1,24 @@ +import("Contact_lib"); +import("system.neon"); +import("Sql_lib"); +import("KeywordRegistry_basic"); +import("system.db"); + +var recipientIds = db.array(db.COLUMN, SqlBuilder.begin() + .select("LETTERRECIPIENTID") + .from("LETTERRECIPIENT") + .join("CONTACT", SqlCondition.begin() + .and("LETTERRECIPIENT.CONTACT_ID = CONTACT.CONTACTID") + .andSqlCondition(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$letter()))) + .where(SqlCondition.begin() + .andPrepareVars("LETTERRECIPIENT.SERIALLETTER_ID", "$param.SerialLetterId_param")) + .build()); + +if (recipientIds.length) +{ + db.deleteData("LETTERRECIPIENT", SqlCondition.begin() + .andIn("LETTERRECIPIENT.LETTERRECIPIENTID", recipientIds) + .build("1=2")); +} + +neon.refreshAll(); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/tooltipProcess.js b/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0cd89c71d0e745d4f9d5924bf3996898c62534d7 --- /dev/null +++ b/entity/LetterRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Remove recipients with advertising ban")); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/recordcontainers/db/conditionProcess.js b/entity/LetterRecipient_entity/recordcontainers/db/conditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..abe4a89cb96cd7238483d6b3fda1c2a4683ed8f7 --- /dev/null +++ b/entity/LetterRecipient_entity/recordcontainers/db/conditionProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string("SERIALLETTER_ID = '" + vars.get("$param.SerialLetterId_param") + "'"); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/recordcontainers/db/fromClauseProcess.js b/entity/LetterRecipient_entity/recordcontainers/db/fromClauseProcess.js index 7abfb0194a42a66eabe85346e22719f5e071f9c7..a1d94b7c23a149a7209785683f84aca4253e5710 100644 --- a/entity/LetterRecipient_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/LetterRecipient_entity/recordcontainers/db/fromClauseProcess.js @@ -2,4 +2,5 @@ import("system.result"); result.string("LETTERRECIPIENT join CONTACT on LETTERRECIPIENT.CONTACT_ID = CONTACT.CONTACTID \ left join PERSON on CONTACT.PERSON_ID = PERSON.PERSONID \ - left join ORGANISATION on CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID"); \ No newline at end of file + left join ORGANISATION on CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID \ + left join ADDRESS on (ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID)"); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/recordcontainers/db/recordfieldmappings/address_id.displayvalue/expression.js b/entity/LetterRecipient_entity/recordcontainers/db/recordfieldmappings/address_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..beac43f3d912a8f81208580f156bb766178124f7 --- /dev/null +++ b/entity/LetterRecipient_entity/recordcontainers/db/recordfieldmappings/address_id.displayvalue/expression.js @@ -0,0 +1,5 @@ +import("PostalAddress_lib"); +import("system.result"); + +var res = AddressUtils.formatOnelineSql(); +result.string(res); \ No newline at end of file diff --git a/entity/Letter_entity/Letter_entity.aod b/entity/Letter_entity/Letter_entity.aod index 4d953eb6ccf971c21035853c4bc88f635f5f6bd0..ac26bb0328f2c190da97535ced5c58beb728b6fe 100644 --- a/entity/Letter_entity/Letter_entity.aod +++ b/entity/Letter_entity/Letter_entity.aod @@ -34,6 +34,17 @@ <name>ContactId_param</name> <expose v="true" /> </entityParameter> + <entityField> + <name>bindata</name> + <contentType>FILE</contentType> + </entityField> + <entityActionField> + <name>downloadTemplate</name> + <title>Download template</title> + <onActionProcess>%aditoprj%/entity/Letter_entity/entityfields/downloadtemplate/onActionProcess.js</onActionProcess> + <iconId>VAADIN:DOWNLOAD_ALT</iconId> + <stateProcess>%aditoprj%/entity/Letter_entity/entityfields/downloadtemplate/stateProcess.js</stateProcess> + </entityActionField> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Letter_entity/entityfields/downloadtemplate/onActionProcess.js b/entity/Letter_entity/entityfields/downloadtemplate/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..562a486f2bb1f6946f2f1e1611c56be82d4c7392 --- /dev/null +++ b/entity/Letter_entity/entityfields/downloadtemplate/onActionProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("DocumentTemplate_lib"); +import("system.vars"); + +var templateId = vars.get("$field.DOCUMENT_TEMPLATE"); +var template = DocumentTemplate.loadTemplate(templateId); +if (template.content) + neon.download(template.content, template.filename); \ No newline at end of file diff --git a/entity/Letter_entity/entityfields/downloadtemplate/stateProcess.js b/entity/Letter_entity/entityfields/downloadtemplate/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5cae499dc5b201158bdd32aaed386af74dc8d0b2 --- /dev/null +++ b/entity/Letter_entity/entityfields/downloadtemplate/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.DOCUMENT_TEMPLATE")) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/Letter_entity/recordcontainers/jdito/onInsert.js b/entity/Letter_entity/recordcontainers/jdito/onInsert.js index 35bc3b14d02877310488934385dc9a5e7472ade0..78220375607f76d0568bba97ebbaf2cb8fd823cb 100644 --- a/entity/Letter_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Letter_entity/recordcontainers/jdito/onInsert.js @@ -1,14 +1,25 @@ +import("system.logging"); +import("system.translate"); +import("Contact_lib"); import("ActivityTask_lib"); import("system.neon"); import("system.vars"); +import("system.text"); import("DocumentTemplate_lib"); +import("KeywordRegistry_basic"); -var template = DocumentTemplate.loadTemplate(vars.get("$field.DOCUMENT_TEMPLATE")); +var template = DocumentTemplate.getSelectedTemplate(vars.get("$field.DOCUMENT_TEMPLATE"), vars.get("$field.bindata")); +logging.log(vars.get("$field.bindata").split(";").join(";\n")) var contactId = vars.get("$param.ContactId_param"); -neon.download(template.getReplacedContentByContactId(contactId), template.filename); +var content = template.getReplacedContentByContactId(contactId, true); +if (template.type) + neon.download(content, template.filename); var links = []; if (contactId) - links.push(["Person", contactId]); //TODO: dynamic +{ + let context = ContactUtils.getContextByContactId(contactId); + links.push([context, contactId]); +} -ActivityUtils.createNewActivity(null, links); +ActivityUtils.createNewActivity(null, links, null, null, translate.text("Letter"), text.parseDocument(content), $KeywordRegistry.activityDirection$outgoing(), [[template.filename, content, false]]); diff --git a/entity/LogHistory_entity/LogHistory_entity.aod b/entity/LogHistory_entity/LogHistory_entity.aod index c72b80ac6504dba552b6d4881b628edfaeee4948..c12c22eeca9d5f4ca428e09334f31568f4778b51 100644 --- a/entity/LogHistory_entity/LogHistory_entity.aod +++ b/entity/LogHistory_entity/LogHistory_entity.aod @@ -41,43 +41,43 @@ <entityDependency> <name>23dbfa51-5340-48e3-bd60-e0dcb7d44ad3</name> <entityName>Person_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> <name>093a40d9-9f20-4c2f-8b43-3eed39b6bede</name> <entityName>Organisation_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> <name>58532bc9-e789-403d-91a5-832ac40d6a6e</name> <entityName>Salesproject_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> <name>6caadcde-8fda-40cb-97e0-ae507beab9d7</name> <entityName>Offer_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> <name>f49eacab-f62c-4354-88eb-359cc92c2d44</name> <entityName>Order_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> <name>de473d92-dbd3-4300-8887-163c997fcd62</name> <entityName>Contract_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> <name>1c941565-b8ca-4805-a9d6-d49eb26a9801</name> <entityName>Product_entity</entityName> - <fieldName>LogHistoryConsumer</fieldName> + <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> <entityDependency> @@ -86,6 +86,18 @@ <fieldName>LogHistories</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>c7d97e89-6363-4ad3-8132-b5aeb7a0c98e</name> + <entityName>BulkMail_entity</entityName> + <fieldName>LogHistories</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>deef9cab-515b-423c-87df-1a57b3ee1ff2</name> + <entityName>SerialLetter_entity</entityName> + <fieldName>LogHistories</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityParameter> diff --git a/entity/Member_entity/Member_entity.aod b/entity/Member_entity/Member_entity.aod index 96caf1285df75815e0e245a3a929f4825f67a3f2..3429f3c4a57310cc7e412134e99437c6bbe8c384 100644 --- a/entity/Member_entity/Member_entity.aod +++ b/entity/Member_entity/Member_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <title>${SALESPROJECT_MEMBER}</title> <iconId>VAADIN:FILE_SOUND</iconId> + <titlePlural>${SALESPROJECT_MEMBER}</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -24,14 +25,14 @@ <displayValueProcess>%aditoprj%/entity/Member_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess> </entityField> <entityField> - <name>MEMBERID</name> - <valueProcess>%aditoprj%/entity/Member_entity/entityfields/memberid/valueProcess.js</valueProcess> + <name>OBJECTMEMBERID</name> + <valueProcess>%aditoprj%/entity/Member_entity/entityfields/objectmemberid/valueProcess.js</valueProcess> </entityField> <entityField> - <name>ROLE</name> + <name>MEMBERROLE</name> <title>Role</title> <consumer>KeywordMemberRoles</consumer> - <displayValueProcess>%aditoprj%/entity/Member_entity/entityfields/role/displayValueProcess.js</displayValueProcess> + <displayValueProcess>%aditoprj%/entity/Member_entity/entityfields/memberrole/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>ORGANISATION_NAME</name> @@ -225,7 +226,9 @@ TODO: intuitive möglichkeit, auf dend Stand aus Relation zurückzusetzen... akt <name>DECIDER</name> <title>Decision maker</title> <contentType>BOOLEAN</contentType> + <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/Member_entity/entityfields/decider/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/Member_entity/entityfields/decider/valueProcess.js</valueProcess> </entityField> <entityField> <name>IMAGE</name> @@ -241,30 +244,30 @@ TODO: intuitive möglichkeit, auf dend Stand aus Relation zurückzusetzen... akt <conditionProcess>%aditoprj%/entity/Member_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <linkInformation> <linkInformation> - <name>dc8d3e38-dd0c-49e1-8665-695e5fd61025</name> + <name>b14ff9f6-97cc-4353-b19b-8acd50d56d5c</name> <tableName>ORGANISATION</tableName> <primaryKey>ORGANISATIONID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>85c0ae33-0713-4413-aaef-6b0c39b70973</name> + <name>85599074-129e-4de8-b2b3-464bcfa8fb40</name> <tableName>PERSON</tableName> <primaryKey>PERSONID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>2ee2e445-6b7f-4d22-9a83-1b175ad0acc9</name> + <name>ae87b90e-b40d-4472-9bd0-08c080da7f7c</name> <tableName>CONTACT</tableName> <primaryKey>CONTACTID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>3d675008-56dc-4c91-90c9-7664dccddbb4</name> - <tableName>MEMBER</tableName> - <primaryKey>MEMBERID</primaryKey> + <name>1455636c-66c8-4100-892d-80e6a37ccd4d</name> + <tableName>OBJECTMEMBER</tableName> + <primaryKey>OBJECTMEMBERID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> @@ -300,55 +303,49 @@ TODO: intuitive möglichkeit, auf dend Stand aus Relation zurückzusetzen... akt </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> - <recordfield>MEMBER.CONTACT_ID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>SALESPROJECT_ROLE.value</name> - <recordfield>MEMBER.ROLE</recordfield> + <recordfield>OBJECTMEMBER.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>RELATIONSHIP.value</name> - <recordfield>MEMBER.RELATIONSHIP</recordfield> + <recordfield>OBJECTMEMBER.RELATIONSHIP</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_RELATIONSHIP.value</name> <recordfield>CONTACT.RELATIONSHIP</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.displayValue</name> <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js</expression> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>SALESPROJECT_ROLE.displayValue</name> - <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/salesproject_role.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DEPARTMENT.value</name> <recordfield>CONTACT.DEPARTMENT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACTROLE.value</name> <recordfield>CONTACT.CONTACTROLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>POSITION.value</name> - <recordfield>CONTACT.POSITION</recordfield> + <recordfield>CONTACT.CONTACTPOSITION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_ROWID.value</name> - <recordfield>MEMBER.OBJECT_ROWID</recordfield> + <recordfield>OBJECTMEMBER.OBJECT_ROWID</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_TYPE.value</name> - <recordfield>MEMBER.OBJECT_TYPE</recordfield> + <recordfield>OBJECTMEMBER.OBJECT_TYPE</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>MEMBERID.value</name> - <recordfield>MEMBER.MEMBERID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ROLE.value</name> - <recordfield>MEMBER.ROLE</recordfield> + <name>OBJECTMEMBERID.value</name> + <recordfield>OBJECTMEMBER.OBJECTMEMBERID</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_ROWID.displayValue</name> @@ -356,7 +353,17 @@ TODO: intuitive möglichkeit, auf dend Stand aus Relation zurückzusetzen... akt </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DECIDER.value</name> - <recordfield>MEMBER.DECIDER</recordfield> + <recordfield>OBJECTMEMBER.DECIDER</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>MEMBERROLE.displayValue</name> + <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/memberrole.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>MEMBERROLE.value</name> + <recordfield>OBJECTMEMBER.MEMBERROLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/Member_entity/entityfields/contacts/children/excludedcontactids_param/valueProcess.js b/entity/Member_entity/entityfields/contacts/children/excludedcontactids_param/valueProcess.js index ff7a12d77a6468fc07aae82c486c7b575391d236..f1c9cd6147c3f4a813d79339899b4a1ba520f27b 100644 --- a/entity/Member_entity/entityfields/contacts/children/excludedcontactids_param/valueProcess.js +++ b/entity/Member_entity/entityfields/contacts/children/excludedcontactids_param/valueProcess.js @@ -4,6 +4,6 @@ import("system.db"); import("Sql_lib"); result.object(db.array(db.COLUMN, SqlCondition.begin() - .andPrepare("MEMBER.OBJECT_ROWID", vars.get("$field.OBJECT_ROWID")) - .buildSql("select CONTACT_ID from MEMBER", "1=2"))); + .andPrepare("OBJECTMEMBER.OBJECT_ROWID", vars.get("$field.OBJECT_ROWID")) + .buildSql("select CONTACT_ID from OBJECTMEMBER", "1=2"))); \ No newline at end of file diff --git a/entity/Member_entity/entityfields/decider/dropDownProcess.js b/entity/Member_entity/entityfields/decider/dropDownProcess.js index 9b90ec712682ce323a43aa4bdb7a98ed4d68c2f8..7f3d9f988e894e6c32dfd414376030fb969d6ddb 100644 --- a/entity/Member_entity/entityfields/decider/dropDownProcess.js +++ b/entity/Member_entity/entityfields/decider/dropDownProcess.js @@ -1,7 +1,7 @@ -import("system.translate"); -import("system.result"); - -result.object([ - [true, translate.text("Yes")] - ,[false, translate.text("No")] -]); +import("system.translate"); +import("system.result"); + +result.object([ + ["1", translate.text("Yes")] + ,["0", translate.text("No")] +]); diff --git a/entity/Member_entity/entityfields/decider/valueProcess.js b/entity/Member_entity/entityfields/decider/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0c7813ac64d6597ae9dd37694b9c1dc8784b6284 --- /dev/null +++ b/entity/Member_entity/entityfields/decider/valueProcess.js @@ -0,0 +1,8 @@ +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/Member_entity/entityfields/icon/valueProcess.js b/entity/Member_entity/entityfields/icon/valueProcess.js index 71433b6fd1101334fd669ae6d666c248db6ec555..651348a3412866e0f61382d02cc2ba71b5804236 100644 --- a/entity/Member_entity/entityfields/icon/valueProcess.js +++ b/entity/Member_entity/entityfields/icon/valueProcess.js @@ -4,7 +4,7 @@ import("system.neon"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var role = vars.get("$field.ROLE"); +var role = vars.get("$field.MEMBERROLE"); var isIntern = false, icon; if(role) @@ -16,10 +16,4 @@ if(role) if(isIntern) result.string("VAADIN:STAR"); -else result.string("VAADIN:AIRPLANE"); - -//var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(role, $KeywordRegistry.MemberRole()); -// -//logging.log(keywordAttributes); -// -//result.string("VAADIN:AIRPLANE"); \ No newline at end of file +else result.string("VAADIN:AIRPLANE"); \ No newline at end of file diff --git a/entity/Member_entity/entityfields/role/displayValueProcess.js b/entity/Member_entity/entityfields/memberrole/displayValueProcess.js similarity index 80% rename from entity/Member_entity/entityfields/role/displayValueProcess.js rename to entity/Member_entity/entityfields/memberrole/displayValueProcess.js index bbdef4d21bb53e36e3bc3b9f9757470915f57d4c..9e896b0a5c9122b1d5b6e4e57ee0904b2c2397e9 100644 --- a/entity/Member_entity/entityfields/role/displayValueProcess.js +++ b/entity/Member_entity/entityfields/memberrole/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -result.string(KeywordUtils.getViewValue($KeywordRegistry.MemberRole(), vars.get("$field.ROLE"))); +result.string(KeywordUtils.getViewValue($KeywordRegistry.MemberRole(), vars.get("$field.MEMBERROLE"))); diff --git a/entity/Member_entity/entityfields/memberid/valueProcess.js b/entity/Member_entity/entityfields/objectmemberid/valueProcess.js similarity index 100% rename from entity/Member_entity/entityfields/memberid/valueProcess.js rename to entity/Member_entity/entityfields/objectmemberid/valueProcess.js diff --git a/entity/Member_entity/recordcontainers/db/conditionProcess.js b/entity/Member_entity/recordcontainers/db/conditionProcess.js index e0f35ab06bb292e7e57bc2b43d44d96612dcfb55..2d6f617c515d9dd928745c6ec9553e7fb042be09 100644 --- a/entity/Member_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Member_entity/recordcontainers/db/conditionProcess.js @@ -3,8 +3,8 @@ import("system.result"); import("Sql_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("MEMBER.OBJECT_ROWID", "$param.ObjectRowId_param") -cond.andPrepareVars("MEMBER.OBJECT_TYPE", "$param.ObjectType_param"); +cond.andPrepareVars("OBJECTMEMBER.OBJECT_ROWID", "$param.ObjectRowId_param") +cond.andPrepareVars("OBJECTMEMBER.OBJECT_TYPE", "$param.ObjectType_param"); //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/Member_entity/recordcontainers/db/fromClauseProcess.js b/entity/Member_entity/recordcontainers/db/fromClauseProcess.js index edff7462ed28f71c7e85a667f69468eacf1e5af9..9565a4e8b7cfcb553d9c1c1fff901365b644dd30 100644 --- a/entity/Member_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/Member_entity/recordcontainers/db/fromClauseProcess.js @@ -1,5 +1,5 @@ import("system.result"); -result.string("MEMBER join CONTACT on (CONTACT.CONTACTID = MEMBER.CONTACT_ID) " +result.string("OBJECTMEMBER join CONTACT on (CONTACT.CONTACTID = OBJECTMEMBER.CONTACT_ID) " + "left join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID) " + "left join PERSON on (PERSON.PERSONID = CONTACT.PERSON_ID)"); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js b/entity/Member_entity/recordcontainers/db/recordfieldmappings/memberrole.displayvalue/expression.js similarity index 78% rename from entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js rename to entity/Member_entity/recordcontainers/db/recordfieldmappings/memberrole.displayvalue/expression.js index fd49eda303bdc422d288bacde15a4d61683cdd3c..4d35e5b7c1bd955fa24f58328c90e9a63e72a929 100644 --- a/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js +++ b/entity/Member_entity/recordcontainers/db/recordfieldmappings/memberrole.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "SALESPROJECT.STATE"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.MemberRole(), "OBJECTMEMBER.MEMBERROLE"); result.string(sql); \ No newline at end of file diff --git a/entity/ModuleTree_entity/recordcontainers/jdito/contentProcess.js b/entity/ModuleTree_entity/recordcontainers/jdito/contentProcess.js index 73393d631a5190c32e7837fd7e4de8ec01613b1a..730e0e483ab0e04421d6fdecc95c8cf5a7e74080 100644 --- a/entity/ModuleTree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/ModuleTree_entity/recordcontainers/jdito/contentProcess.js @@ -40,7 +40,7 @@ function queryChildrenElements (pContextName, pID) { var taskResult = db.table(SqlCondition.begin() .andPrepare("TASK.PARENT_ID", pID) .andPrepare("TASK.PARENT_CONTEXT", pContextName) - .andPrepare("TASK.TYPE", $KeywordRegistry.taskType$task()) + .andPrepare("TASK.KIND", $KeywordRegistry.taskType$task()) .buildSql("select TASKID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION from TASK")); @@ -99,7 +99,9 @@ function queryChildrenElements (pContextName, pID) { function queryRootElement (pContextName, pID, pGetFirst) { var resultArray; if (pContextName === "Task") { - resultArray = db.array(db.ROW, "select TASKID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION from TASK where TASKID = '" + pID + "'"); + resultArray = db.array(db.ROW, SqlCondition.begin() + .andPrepare("TASK.TASKID", pID) + .buildSql("select TASKID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION from TASK")); if (resultArray.length === 0) { return null; } @@ -112,7 +114,9 @@ function queryRootElement (pContextName, pID, pGetFirst) { } return augmentData(resultArray, "Task"); } else if (pContextName === "Activity") { - resultArray = db.array(db.ROW, "select ACTIVITYID, PARENT_ID, PARENT_CONTEXT, SUBJECT, INFO from ACTIVITY where ACTIVITYID = '" + pID +"'"); + resultArray = db.array(db.ROW, SqlCondition.begin() + .andPrepare("ACTIVITY.ACTIVITYID", pID) + .buildSql("select ACTIVITYID, PARENT_ID, PARENT_CONTEXT, SUBJECT, INFO from ACTIVITY")); if (resultArray.length === 0) { return null; } @@ -126,7 +130,9 @@ function queryRootElement (pContextName, pID, pGetFirst) { return augmentData(resultArray, "Activity"); } else if (pContextName === "SupportTicket") { - resultArray = db.array(db.ROW, "select TICKETID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION from TICKET left join TASK on TASK_ID = TASKID where TICKETID = '" + pID +"'"); + resultArray = db.array(db.ROW, SqlCondition.begin() + .andPrepare("TICKET.TICKETID", pID) + .buildSql("select TICKETID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION from TICKET left join TASK on TASK_ID = TASKID")); if (resultArray.length === 0) { return null; } @@ -150,7 +156,7 @@ function queryRootElement (pContextName, pID, pGetFirst) { * UID, PARENT_ID, PARENT_CONTEXT, TITLE, DESCRIPTION * @param pType The type of the row which needs adjustment. * @return Returns the following format: - * UID, TYPE, PARENT_ID, PARENT_CONTEX, TITL, DESCRIPTION, ICON + * UID, KIND, PARENT_ID, PARENT_CONTEX, TITL, DESCRIPTION, ICON * */ function augmentData (pDataRow, pType) { diff --git a/entity/Notification_entity/Notification_entity.aod b/entity/Notification_entity/Notification_entity.aod index c065b509a26b8d154f68f18b3a30dcd86e361f01..264b358cf3d2917a84c2a719ec718a2bc9d96204 100644 --- a/entity/Notification_entity/Notification_entity.aod +++ b/entity/Notification_entity/Notification_entity.aod @@ -25,6 +25,7 @@ <entityField> <name>STATE</name> <title>State</title> + <consumer>StateKeywords</consumer> <displayValueProcess>%aditoprj%/entity/Notification_entity/entityfields/state/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -124,8 +125,37 @@ <entityField> <name>RESOLVEDPRIORITY</name> <title>priority</title> + <consumer>PrioKeywords</consumer> <textInputAllowed v="false" /> </entityField> + <entityConsumer> + <name>StateKeywords</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Notification_entity/entityfields/statekeywords/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>PrioKeywords</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Notification_entity/entityfields/priokeywords/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> @@ -158,6 +188,7 @@ <dbRecordFieldMapping> <name>CAPTION.value</name> <recordfield>ASYS_NOTIFICATIONCONTENTS.CAPTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTENTID.value</name> @@ -166,10 +197,12 @@ <dbRecordFieldMapping> <name>CREATIONDATE.value</name> <recordfield>ASYS_NOTIFICATIONCONTENTS.CREATIONDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DESCRIPTION.value</name> <recordfield>ASYS_NOTIFICATIONCONTENTS.DESCRIPTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>FORCEDPRIORITY.value</name> @@ -190,10 +223,12 @@ <dbRecordFieldMapping> <name>STATE.value</name> <recordfield>ASYS_NOTIFICATIONS.STATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TYPECODE.value</name> <recordfield>ASYS_NOTIFICATIONCONTENTS.TYPECODE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>UID.value</name> @@ -218,10 +253,12 @@ <dbRecordFieldMapping> <name>CALCULATEDPRIORITY.value</name> <recordfield>ASYS_NOTIFICATIONCONTENTS.FORCEDPRIORITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>RESOLVEDPRIORITY.value</name> <recordfield>ASYS_NOTIFICATIONS.RESOLVEDPRIORITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/Notification_entity/entityfields/priokeywords/children/containername_param/valueProcess.js b/entity/Notification_entity/entityfields/priokeywords/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1a1a50c90c786f687c2ed3833d696dc022b3d4d0 --- /dev/null +++ b/entity/Notification_entity/entityfields/priokeywords/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); + + +result.string("NotificationPriority"); \ No newline at end of file diff --git a/entity/Notification_entity/entityfields/state/displayValueProcess.js b/entity/Notification_entity/entityfields/state/displayValueProcess.js index 2949bf1ee7fe19f3a377bf38a6fc31c4192d3c22..29481035b2ba5db04af2462b345b16aea5e22e67 100644 --- a/entity/Notification_entity/entityfields/state/displayValueProcess.js +++ b/entity/Notification_entity/entityfields/state/displayValueProcess.js @@ -1,9 +1,8 @@ -import("system.logging"); import("system.translate"); import("system.result"); import("system.vars"); -var value = vars.get("$this.value"); +var value = vars.get("$field.STATE"); switch(value) { diff --git a/entity/Notification_entity/entityfields/statekeywords/children/containername_param/valueProcess.js b/entity/Notification_entity/entityfields/statekeywords/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a5407effb79841e7d2492e6f27f3ce81bfa33a51 --- /dev/null +++ b/entity/Notification_entity/entityfields/statekeywords/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); + + +result.string("NotificationState"); \ No newline at end of file diff --git a/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod b/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod index 2d69e2e1273a64646f70c2baa7d4b4fd6588cac4..d3cc2bdd8ba7382f32c82e32f42705152c1e210b 100644 --- a/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod +++ b/entity/ObjectRelationType_entity/ObjectRelationType_entity.aod @@ -7,6 +7,8 @@ <grantUpdateProcess>%aditoprj%/entity/ObjectRelationType_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/ObjectRelationType_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/ObjectRelationType_entity/contentTitleProcess.js</contentTitleProcess> + <iconId>VAADIN:SPLIT</iconId> + <titlePlural>Relation types</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> diff --git a/entity/ObjectRelationType_entity/entityfields/hierarchy/valueProcess.js b/entity/ObjectRelationType_entity/entityfields/hierarchy/valueProcess.js index b3028ee4f3a3271d9a6603e8d52faf656a4fa484..f85a152fd105b9b800f8ef9a352d078df76ce69b 100644 --- a/entity/ObjectRelationType_entity/entityfields/hierarchy/valueProcess.js +++ b/entity/ObjectRelationType_entity/entityfields/hierarchy/valueProcess.js @@ -2,7 +2,7 @@ import("system.neon"); import("system.vars"); import("system.result"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +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/ObjectRelationType_entity/entityfields/icon/valueProcess.js b/entity/ObjectRelationType_entity/entityfields/icon/valueProcess.js index baceaf10d4f15fd4c3ebfa98d86bb557ea630041..9719f33bf3aa06c3472cbe7572a478a27771e330 100644 --- a/entity/ObjectRelationType_entity/entityfields/icon/valueProcess.js +++ b/entity/ObjectRelationType_entity/entityfields/icon/valueProcess.js @@ -2,5 +2,5 @@ import("system.neon"); import("system.vars"); import("system.result"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string("VAADIN:CUBE"); \ No newline at end of file diff --git a/entity/ObjectRelationType_entity/entityfields/type2enabled_proxy/valueProcess.js b/entity/ObjectRelationType_entity/entityfields/type2enabled_proxy/valueProcess.js index ee7b68c6f9c712c45af6a147dc23c15d9bc7b1ec..76cd3a259e093b7308b52ea448ee3a2ed49fd69f 100644 --- a/entity/ObjectRelationType_entity/entityfields/type2enabled_proxy/valueProcess.js +++ b/entity/ObjectRelationType_entity/entityfields/type2enabled_proxy/valueProcess.js @@ -1,5 +1,5 @@ import("system.vars"); import("system.result"); -if (!vars.get("$field.Type2Enabled_proxy")) +if (vars.get("$this.value") == null || vars.get("$this.value") == "") result.string(vars.get("$field.DIRECTION") == "same" ? 0 : 1); \ No newline at end of file diff --git a/entity/ObjectTree_entity/ObjectTree_entity.aod b/entity/ObjectTree_entity/ObjectTree_entity.aod index 11f8a62fe75c89cd1b2fd8057afdd267e8119079..259bd6141a2a047250f710b49d550d13b326f1fc 100644 --- a/entity/ObjectTree_entity/ObjectTree_entity.aod +++ b/entity/ObjectTree_entity/ObjectTree_entity.aod @@ -3,7 +3,9 @@ <name>ObjectTree_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Object relation</title> + <grantUpdate v="true" /> <grantUpdateProcess>%aditoprj%/entity/ObjectTree_entity/grantUpdateProcess.js</grantUpdateProcess> + <grantDeleteProcess>%aditoprj%/entity/ObjectTree_entity/grantDeleteProcess.js</grantDeleteProcess> <titlePlural>Relations</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> @@ -127,6 +129,9 @@ <valueProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/objectrelationtypeid/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/objectrelationtypeid/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/ObjectTree_entity/entityfields/objectrelationtypeid/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityConsumer> <name>Objects</name> @@ -156,12 +161,6 @@ <iconId>VAADIN:FILE_TREE_SMALL</iconId> <stateProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/alter/children/insert/stateProcess.js</stateProcess> </entityActionField> - <entityActionField> - <name>edit</name> - <onActionProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js</onActionProcess> - <iconId>NEON:PENCIL</iconId> - <stateProcess>%aditoprj%/entity/ObjectTree_entity/entityfields/alter/children/edit/stateProcess.js</stateProcess> - </entityActionField> </children> </entityActionGroup> <entityParameter> diff --git a/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js b/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js deleted file mode 100644 index fc3ed15eaf7ab45ccc7caef5aff05ab0aa2f0e30..0000000000000000000000000000000000000000 --- a/entity/ObjectTree_entity/entityfields/alter/children/edit/onActionProcess.js +++ /dev/null @@ -1,18 +0,0 @@ -import("ObjectRelation_lib"); -import("system.neon"); -import("system.vars"); - -if (vars.exists("$sys.selection") && vars.getString("$sys.selection")) -{ - var selectedRows = vars.get("$sys.selection"); - var uid = JSON.parse(selectedRows[0]); - var isObjectRelationNode = typeof uid[2] == "string"; - - if (isObjectRelationNode) - { - var params = { - "Uid_param" : selectedRows[0] - } - neon.openContext("ObjectTree", "ObjectTreeEdit_view", null, neon.OPERATINGSTATE_EDIT, params); - } -} \ No newline at end of file diff --git a/entity/ObjectTree_entity/entityfields/objectrelationtypeid/onValueChange.js b/entity/ObjectTree_entity/entityfields/objectrelationtypeid/onValueChange.js index 9264282cd7b4f9b9dca1cdd33aff00bb63064dd5..28182c2e1cddb274b7ea6b797f903764a9a66515 100644 --- a/entity/ObjectTree_entity/entityfields/objectrelationtypeid/onValueChange.js +++ b/entity/ObjectTree_entity/entityfields/objectrelationtypeid/onValueChange.js @@ -1,38 +1,3 @@ -import("system.vars"); -import("system.db"); -import("system.result"); import("system.neon"); -import("Sql_lib"); -import("Entity_lib"); -var selectedObjectRelationTypeId = vars.exists("$field.selectedObjectRelationTypeIdProxy") ? vars.get("$field.selectedObjectRelationTypeIdProxy") : ""; -selectedObjectRelationTypeId = ProcessHandlingUtils.getOnValidationValue(selectedObjectRelationTypeId); - -var relationTypeData = db.array(db.ROW, SqlCondition.begin() - .andPrepare("AB_OBJECTRELATIONTYPE.AB_OBJECTRELATIONTYPEID", selectedObjectRelationTypeId) - .buildSql("select AB_OBJECTRELATIONTYPEID, OBJECT_TYPE, RELATION_TITLE, RELATION_TYPE, SIDE from AB_OBJECTRELATIONTYPE", "1=2")); - -if (relationTypeData[0]) -{ - var otherRelationTypeData = db.array(db.ROW, SqlCondition.begin() - .andPrepare("AB_OBJECTRELATIONTYPE.RELATION_TYPE", relationTypeData[3]) - .andPrepare("AB_OBJECTRELATIONTYPE.SIDE", (relationTypeData[4] == "1" ? "2" : "1")) - .buildSql("select AB_OBJECTRELATIONTYPEID, OBJECT_TYPE, RELATION_TITLE, RELATION_TYPE, SIDE from AB_OBJECTRELATIONTYPE", "1=2")) - if (!otherRelationTypeData[0]) - { - otherRelationTypeData = relationTypeData; - } - - if (relationTypeData[4] == "2") - { - //neon.setFieldValue("$field.AB_OBJECTRELATIONTYPE2", relationTypeData[0]); - //neon.setFieldValue("$field.AB_OBJECTRELATIONTYPE1", otherRelationTypeData[0]); - } - else if (relationTypeData[4] == "1") - { - //neon.setFieldValue("$field.AB_OBJECTRELATIONTYPE1", relationTypeData[0]); - //neon.setFieldValue("$field.AB_OBJECTRELATIONTYPE2", otherRelationTypeData[0]); - } - - // neon.setFieldValue("$field.MySide", otherRelationTypeData[4]); -} +neon.setFieldValue("$field.TARGET_ID", ""); \ No newline at end of file diff --git a/entity/ObjectTree_entity/entityfields/alter/children/edit/stateProcess.js b/entity/ObjectTree_entity/grantDeleteProcess.js similarity index 69% rename from entity/ObjectTree_entity/entityfields/alter/children/edit/stateProcess.js rename to entity/ObjectTree_entity/grantDeleteProcess.js index 7fd3c236f3e52b7fa99582842ccdf27700c54625..beae0d06f3855352b200ae3f219ac60ea2b572b6 100644 --- a/entity/ObjectTree_entity/entityfields/alter/children/edit/stateProcess.js +++ b/entity/ObjectTree_entity/grantDeleteProcess.js @@ -12,15 +12,9 @@ if (vars.exists("$sys.selection") && vars.getString("$sys.selection")) var uid = JSON.parse(selectedRows[0]); isObjectRelationNode = typeof uid[2] == "string"; } - - if (isObjectRelationNode) - { - result.string(neon.COMPONENTSTATE_EDITABLE) - } - else - { - result.string(neon.COMPONENTSTATE_DISABLED) - } + result.object(isObjectRelationNode) } else - result.string(neon.COMPONENTSTATE_DISABLED) \ No newline at end of file +{ + result.object(false) +} \ No newline at end of file diff --git a/entity/ObjectTree_entity/grantUpdateProcess.js b/entity/ObjectTree_entity/grantUpdateProcess.js index 33e0143ce68d08588f4cebe46478e398844793f2..28ab72502496d758e3c14404982780a2bd70431b 100644 --- a/entity/ObjectTree_entity/grantUpdateProcess.js +++ b/entity/ObjectTree_entity/grantUpdateProcess.js @@ -12,8 +12,10 @@ if (vars.exists("$sys.selection") && vars.getString("$sys.selection")) var uid = JSON.parse(selectedRows[0]); isObjectRelationNode = typeof uid[2] == "string"; } - result.object(isObjectRelationNode) } else - result.object(false) \ No newline at end of file +{ + result.object(false) +} + \ No newline at end of file diff --git a/entity/Object_entity/Object_entity.aod b/entity/Object_entity/Object_entity.aod index 8063f6fe9fe5ba285c523d27685406cca5d299a5..2677926bfe6d320f5c878827d407bd87ac713563 100644 --- a/entity/Object_entity/Object_entity.aod +++ b/entity/Object_entity/Object_entity.aod @@ -198,6 +198,12 @@ <fieldName>Objects</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>6a7a34e0-22ae-4bd7-b762-84a332a0a937</name> + <entityName>Order_entity</entityName> + <fieldName>Objects</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 2bb5d11d879d887999cea0bd424c1137e58c323a..62a2d841e53c3413d52cd3afba223d9f24a7b70f 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -152,13 +152,13 @@ <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/totalgross/displayValueProcess.js</displayValueProcess> </entityField> <entityField> - <name>LANGUAGE</name> + <name>ISOLANGUAGE</name> <title>Language</title> <consumer>Languages</consumer> <mandatory v="true" /> - <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/language/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/language/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/language/displayValueProcess.js</displayValueProcess> + <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/isolanguage/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/isolanguage/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js</displayValueProcess> </entityField> <entityActionField> <name>copyOffer</name> @@ -389,6 +389,12 @@ <fieldName>Offers</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>a74b02c4-bdb3-4ba8-9207-66a0af528b1b</name> + <entityName>Order_entity</entityName> + <fieldName>Offers</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -646,6 +652,11 @@ <titleProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/titleProcess.js</titleProcess> <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> </entityField> <entityField> <name>OBJECT_TYPE</name> @@ -788,7 +799,7 @@ </children> </entityConsumer> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -797,7 +808,7 @@ <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -806,6 +817,7 @@ <title>Footer text</title> <contentType>LONG_TEXT</contentType> <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/footer/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/footer/displayValueProcess.js</displayValueProcess> </entityField> <entityParameter> <name>OfferFooter_param</name> @@ -863,7 +875,6 @@ <onValueChangeTypes> <element>MASK</element> </onValueChangeTypes> - <onValidation>%aditoprj%/entity/Offer_entity/entityfields/contact_id/onValidation.js</onValidation> </entityField> <entityParameter> <name>PossibleConnectionTypes</name> @@ -882,6 +893,20 @@ <iconId>VAADIN:CURLY_BRACKETS</iconId> <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/openadminview/stateProcess.js</stateProcess> </entityActionField> + <entityProvider> + <name>SentOffers</name> + <children> + <entityParameter> + <name>OfferStatus_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/sentoffers/children/offerstatus_param/valueProcess.js</valueProcess> + <expose v="false" /> + </entityParameter> + </children> + </entityProvider> + <entityParameter> + <name>OfferStatus_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -934,26 +959,27 @@ <dbRecordFieldMapping> <name>CURRENCY.value</name> <recordfield>OFFER.CURRENCY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>HEADER.value</name> <recordfield>OFFER.HEADER</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LANGUAGE.value</name> - <recordfield>OFFER.LANGUAGE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NET.value</name> <recordfield>OFFER.NET</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OFFERCODE.value</name> <recordfield>OFFER.OFFERCODE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OFFERDATE.value</name> <recordfield>OFFER.OFFERDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OFFERID.value</name> @@ -966,14 +992,17 @@ <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>OFFER.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VAT.value</name> <recordfield>OFFER.VAT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VERSNR.value</name> <recordfield>OFFER.VERSNR</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ORG_ID.value</name> @@ -986,6 +1015,7 @@ <dbRecordFieldMapping> <name>ADDRESS.value</name> <recordfield>OFFER.ADDRESS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CURRENCY.displayValue</name> @@ -995,10 +1025,6 @@ <name>STATUS.displayValue</name> <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LANGUAGE.displayValue</name> - <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PROBABILITY.displayValue</name> <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/probability.displayvalue/expression.js</expression> @@ -1010,6 +1036,7 @@ <dbRecordFieldMapping> <name>DELIVERYTERMS.value</name> <recordfield>OFFER.DELIVERYTERMS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DELIVERYTERMS.displayValue</name> @@ -1022,6 +1049,7 @@ <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>OFFER.INFO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_NEW.value</name> @@ -1046,6 +1074,7 @@ <dbRecordFieldMapping> <name>FOOTER.value</name> <recordfield>OFFER.FOOTER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_TYPE.value</name> @@ -1058,6 +1087,7 @@ <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>OFFER.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LETTERSALUTATION.value</name> @@ -1071,7 +1101,35 @@ <name>CONTACT_PERSON_ID.displayValue</name> <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/contact_person_id.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CONTACT_ID.displayValue</name> + <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> + <dbRecordFieldMapping> + <name>ISOLANGUAGE.value</name> + <recordfield>OFFER.ISOLANGUAGE</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ISOLANGUAGE.displayValue</name> + <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> <indexRecordContainer> <name>index</name> diff --git a/entity/Offer_entity/entityfields/attributes/onValidation.js b/entity/Offer_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..8403835caf1939613052d63a7a89ef71c84d9087 100644 --- a/entity/Offer_entity/entityfields/attributes/onValidation.js +++ b/entity/Offer_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/attributes/stateProcess.js b/entity/Offer_entity/entityfields/attributes/stateProcess.js index 8225159ab271d45cf061f4e302b1eac50adada28..0a6a6c21d28963cf2bf06df2749337986db749b5 100644 --- a/entity/Offer_entity/entityfields/attributes/stateProcess.js +++ b/entity/Offer_entity/entityfields/attributes/stateProcess.js @@ -1,3 +1,5 @@ +import("Context_lib"); +import("Attribute_lib"); import("Offer_lib"); import("Sql_lib"); import("system.vars"); @@ -7,7 +9,10 @@ import("system.result"); if (OfferUtils.isEditable(vars.get("$field.STATUS"))) { - result.string(neon.COMPONENTSTATE_EDITABLE); + if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); + else + result.string(neon.COMPONENTSTATE_INVISIBLE); } else { diff --git a/entity/Offer_entity/entityfields/chosenaddress/displayValueProcess.js b/entity/Offer_entity/entityfields/chosenaddress/displayValueProcess.js index 698ddd21921ba4623f9eeae0c1a61f579da714f5..7bef71f89d75304d3bed9240efe3059ee5112dee 100644 --- a/entity/Offer_entity/entityfields/chosenaddress/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/chosenaddress/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("PostalAddress_lib"); import("system.result"); -result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$this.value"))) \ No newline at end of file +result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$field.ChosenAddress"))) \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js b/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js index e27804413bf71f873429b24b7a2865b03a23475b..c5042eb3c792dc79cbcb37089325e653139870f5 100644 --- a/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js +++ b/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js @@ -3,7 +3,7 @@ import("system.neon"); import("PostalAddress_lib"); import("Entity_lib"); -var newAddressId = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.ChosenAddress")); +var newAddressId = vars.get("local.value"); if (newAddressId) { diff --git a/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js b/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js index d8f47a34a6c795199277bc1d2930775b4b29e253..85822946ab4fe0ba7730ca93fd6fca69250a5b33 100644 --- a/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js @@ -1,7 +1,6 @@ -import("system.result"); -import("system.vars"); -import("Contact_lib"); -import("system.neon"); - - +import("system.result"); +import("system.vars"); +import("Contact_lib"); +import("system.neon"); + result.string(ContactUtils.getFullTitleByContactId(vars.getString("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/documentation.adoc b/entity/Offer_entity/entityfields/contact_id/documentation.adoc index 5812dd624daeeb2a97ec0d796bf3a3dba0fade26..26184bc759b7e073397279194e3f09fa4c64deb8 100644 --- a/entity/Offer_entity/entityfields/contact_id/documentation.adoc +++ b/entity/Offer_entity/entityfields/contact_id/documentation.adoc @@ -1,10 +1,10 @@ -= CONTACT_ID -:hardbreaks: - -Over this field the company or contact person of customer is linked. - -== onValueChange - -If set in the selected company or contact person, the following field value are taken over: - -* LANGUAGE \ No newline at end of file += CONTACT_ID +:hardbreaks: + +Over this field the company or contact person of customer is linked. + +== onValueChange + +If set in the selected company or contact person, the following field value are taken over: + +* ISOLANGUAGE \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js b/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js index c6e221c7440633d683f94fcc2505ba548d581b1b..666b1349748541127d2977a28e6a140ccbf800b1 100644 --- a/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js @@ -1,5 +1,5 @@ -import("system.vars"); -import("system.result"); -import("Contact_lib"); - -result.string(ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID"))); \ No newline at end of file +import("system.vars"); +import("system.result"); +import("Contact_lib"); + +result.string(ContactUtils.getContextByPersOrg(vars.get("$field.CONTACT_PERSON_ID"), vars.get("$field.CONTACT_ORG_ID"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/onValidation.js b/entity/Offer_entity/entityfields/contact_id/onValidation.js deleted file mode 100644 index ba0b5ac64592823f2c7ffdf581644839c9e7691c..0000000000000000000000000000000000000000 --- a/entity/Offer_entity/entityfields/contact_id/onValidation.js +++ /dev/null @@ -1,12 +0,0 @@ -//import("system.logging"); -//import("system.result"); -//import("system.translate"); -//import("system.vars"); -//import("Context_lib"); -//import("Entity_lib"); -//import("Contact_lib"); -// -//if (ContactUtils.getContactTypeByContactId(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID"))) != 2 && ContextUtils.getCountByContactId(vars.get("$field.OBJECT_TYPE"), ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID"))) == 0) { -// logging.log(ContextUtils.getCountByContactId(vars.get("$field.OBJECT_TYPE"), ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID")))); -// result.string(translate.text("This contact has no possible link.")) -//} \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/onValueChange.js b/entity/Offer_entity/entityfields/contact_id/onValueChange.js index cc8fab26f942a1a6e83f581c2e9c26bf57b72903..15006677e0cc2ec6dd0ffd120b1b14916637ec69 100644 --- a/entity/Offer_entity/entityfields/contact_id/onValueChange.js +++ b/entity/Offer_entity/entityfields/contact_id/onValueChange.js @@ -1,4 +1,4 @@ -import("system.logging"); +import("Sql_lib"); import("system.neon"); import("system.vars"); import("system.db"); @@ -6,13 +6,15 @@ import("Util_lib"); import("Entity_lib"); import("Contact_lib"); -var contactid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID")); +var contactid = vars.get("local.value"); if(contactid != "") { //Language Preset - var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); - if(relData[0] != "") - neon.setFieldValue("field.LANGUAGE", relData[0]); + var lang = db.cell(SqlCondition.begin() + .andPrepare("CONTACT.CONTACTID", contactid) + .buildSql("select ISOLANGUAGE from CONTACT")); + if(lang != "") + neon.setFieldValue("field.ISOLANGUAGE", lang); // set $field.CONTATCT_ORG_ID per contactid var orgid = ContactUtils.getPersOrgIds(contactid); @@ -21,12 +23,10 @@ if(contactid != "") else { neon.setFieldValue("$field.CONTACT_ORG_ID", ""); - neon.setFieldValue("$field.LANGUAGE", ""); + neon.setFieldValue("$field.ISOLANGUAGE", ""); } if(!vars.get("$param.ObjectRowId_param")) { - // logging.log(JSON.stringify(vars.get("$local.type"), null, "\t")) - // logging.log(JSON.stringify(vars.get("$local.typevalue"), null, "\t")) neon.setFieldValue("$field.OBJECT_ROWID", ""); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/valueProcess.js b/entity/Offer_entity/entityfields/contact_id/valueProcess.js index b863ff7acbd9288619e659d702561f52db3cafa0..ca10ffff0e5c7db64b8e1602cfc4006252747100 100644 --- a/entity/Offer_entity/entityfields/contact_id/valueProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/valueProcess.js @@ -5,7 +5,7 @@ import("system.vars"); import("Sql_lib"); import("Context_lib"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) var contactId = ""; if ((!vars.exists("$param.ContactId_param") || !vars.get("$param.ContactId_param")) && (vars.exists("$param.ObjectType_param") @@ -20,10 +20,12 @@ if ((!vars.exists("$param.ContactId_param") || !vars.get("$param.ContactId_param if (contactId) { - var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactId + "'"); + var lang = db.cell(SqlCondition.begin() + .andPrepare("CONTACT.CONTACTID", contactid) + .buildSql("select ISOLANGUAGE from CONTACT")); - if(relData[0] != "") - neon.setFieldValue("field.LANGUAGE", relData[0]); + if(lang != "") + neon.setFieldValue("field.ISOLANGUAGE", lang); result.string(contactId); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js b/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js index 4dc0b8f10aade72bb70fc84b11368e1f42993366..17cc41af8869fdfbe8de679bb2a0190d3367e51a 100644 --- a/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js +++ b/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js @@ -4,7 +4,7 @@ import("Offer_lib"); var contactId = vars.getString("$field.CONTACT_ID"); var currency = vars.getString("$field.CURRENCY"); -var language = vars.getString("$field.LANGUAGE"); +var language = vars.getString("$field.ISOLANGUAGE"); var header = vars.getString("$field.HEADER"); var footer = vars.getString("$field.FOOTER"); var offerId = vars.getString("$field.OFFERID"); diff --git a/entity/Offer_entity/entityfields/currency/valueProcess.js b/entity/Offer_entity/entityfields/currency/valueProcess.js index 2f2451289c947c75e2bba4dcdb3f224de3c01881..bd7b097a841c4b70a17700906fb733cf7d06a330 100644 --- a/entity/Offer_entity/entityfields/currency/valueProcess.js +++ b/entity/Offer_entity/entityfields/currency/valueProcess.js @@ -7,7 +7,7 @@ if (vars.exists("$param.OfferCurrency_param") && vars.get("$param.OfferCurrency_ { result.string(vars.get("$param.OfferCurrency_param")); } -else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string($KeywordRegistry.currency$eur()); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/documents/stateProcess.js b/entity/Offer_entity/entityfields/documents/stateProcess.js index 4c5360f5be4a89227e57e90bb98bdcaed69d6786..850da85b0f0d927ecf802dd889c6e32bd20060ea 100644 --- a/entity/Offer_entity/entityfields/documents/stateProcess.js +++ b/entity/Offer_entity/entityfields/documents/stateProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("Offer_lib"); import("system.result"); diff --git a/entity/DSGVO_entity/entityfields/dsgvoactions/children/anonymperson/stateProcess.js b/entity/Offer_entity/entityfields/footer/displayValueProcess.js similarity index 100% rename from entity/DSGVO_entity/entityfields/dsgvoactions/children/anonymperson/stateProcess.js rename to entity/Offer_entity/entityfields/footer/displayValueProcess.js diff --git a/entity/Offer_entity/entityfields/footer/valueProcess.js b/entity/Offer_entity/entityfields/footer/valueProcess.js index e064cf46a63fdb4be84aff8ec90abb3a711874a7..192565648a52934053446ebc48e07722713ffcb2 100644 --- a/entity/Offer_entity/entityfields/footer/valueProcess.js +++ b/entity/Offer_entity/entityfields/footer/valueProcess.js @@ -1,20 +1,23 @@ -import("system.result"); -import("system.vars"); -import("system.neon"); -import("system.db"); -import("system.util"); - -if(vars.exists("$param.OfferFooter_param") && vars.get("$param.OfferFooter_param")) - result.string(vars.get("$param.OfferFooter_param")); - -else if(vars.get("$this.value")) - result.string(vars.get("$this.value")); - -else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string("Vielen Dank!") - -if (vars.get("$field.ChoosenTEXFooter") != "") -{ - var binaryId = db.cell("select ID from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.ChoosenTEXFooter") + "'", "_____SYSTEMALIAS"); - result.string(util.decodeBase64String(db.getBinaryContent(binaryId, "_____SYSTEMALIAS"))); +import("Sql_lib"); +import("system.result"); +import("system.vars"); +import("system.neon"); +import("system.db"); +import("system.util"); + +if(vars.exists("$param.OfferFooter_param") && vars.get("$param.OfferFooter_param")) + result.string(vars.get("$param.OfferFooter_param")); + +else if(vars.get("$this.value")) + result.string(vars.get("$this.value")); + +else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string("Vielen Dank!"); //TODO: translate + +if (vars.get("$field.ChoosenTEXFooter") != "") +{ + var binaryId = db.cell(SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.ChoosenTEXFooter") + .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getSystemAlias()); + result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getSystemAlias()))); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js b/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js index d39bcd7a3c4880d06e2db9776a472e92ad9a34ac..80bc199de9497710301fa61c141c4fe62aa9dd45 100644 --- a/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js +++ b/entity/Offer_entity/entityfields/fulloffercode/valueProcess.js @@ -1,5 +1,9 @@ +import("system.translate"); import("system.result"); import("system.vars"); -//a filedGroup cannot be placed in a table (filter-view) at the moment and therefore a separate field is needed: -result.string(vars.get("$field.OFFERCODE") + "-" + vars.get("$field.VERSNR")); +//a fieldGroup cannot be placed in a table (filter-view) at the moment and therefore a separate field is needed: +if(!vars.get("$field.OFFERCODE") && !vars.get("$field.VERSNR")) + result.string(translate.text("Offer")); +else + result.string(vars.get("$field.OFFERCODE") + "-" + vars.get("$field.VERSNR")); diff --git a/entity/Offer_entity/entityfields/header/valueProcess.js b/entity/Offer_entity/entityfields/header/valueProcess.js index 7cdc3a91214e06e8563c42f3c0fb2b11469cd2e1..5ebdc79fc02cf4b23a7c4e478d2a3d6055b630f2 100644 --- a/entity/Offer_entity/entityfields/header/valueProcess.js +++ b/entity/Offer_entity/entityfields/header/valueProcess.js @@ -1,3 +1,5 @@ +import("Sql_lib"); +import("system.logging"); import("system.result"); import("system.vars"); import("system.neon"); @@ -11,10 +13,12 @@ else if(vars.get("$this.value")) result.string(vars.get("$this.value")); else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string("Gerne bieten wir Ihnen wie folgt an:") + result.string("Gerne bieten wir Ihnen wie folgt an:"); //TODO: translate if (vars.get("$field.ChoosenTEXHeader") != "") { - var binaryId = db.cell("select ID from ASYS_BINARIES where ROW_ID = '" + vars.get("$field.ChoosenTEXHeader") + "'", "_____SYSTEMALIAS"); - result.string(util.decodeBase64String(db.getBinaryContent(binaryId, "_____SYSTEMALIAS"))); + var binaryId = db.cell(SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.ChoosenTEXHeader") + .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getSystemAlias()); + result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getSystemAlias()))); } \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/language/displayValueProcess.js b/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js similarity index 86% rename from entity/DocumentTemplate_entity/entityfields/language/displayValueProcess.js rename to entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js index f4cab09b91902faee535768a00c0a618baa3ff27..0a2a0ee65d4db10c8e023e7e2849fbde9b6de533 100644 --- a/entity/DocumentTemplate_entity/entityfields/language/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/isolanguage/displayValueProcess.js @@ -1,12 +1,12 @@ -import("system.db"); -import("system.translate"); -import("system.result"); -import("system.vars"); -import("Sql_lib"); - -var iso3 = vars.get("$field.LANGUAGE"); -var latinName = db.cell(SqlCondition.begin() - .andPrepare("AB_LANGUAGE.ISO3", iso3) - .buildSql("select NAME_LATIN from AB_LANGUAGE", "1=0")); -latinName = translate.text(latinName); -result.string(latinName); +import("system.db"); +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Sql_lib"); + +var iso3 = vars.get("$field.ISOLANGUAGE"); +var latinName = db.cell(SqlCondition.begin() + .andPrepare("AB_LANGUAGE.ISO3", iso3) + .buildSql("select NAME_LATIN from AB_LANGUAGE", "1=0")); +latinName = translate.text(latinName); +result.string(latinName); diff --git a/entity/Offer_entity/entityfields/language/stateProcess.js b/entity/Offer_entity/entityfields/isolanguage/stateProcess.js similarity index 100% rename from entity/Offer_entity/entityfields/language/stateProcess.js rename to entity/Offer_entity/entityfields/isolanguage/stateProcess.js diff --git a/entity/Offer_entity/entityfields/language/valueProcess.js b/entity/Offer_entity/entityfields/isolanguage/valueProcess.js similarity index 89% rename from entity/Offer_entity/entityfields/language/valueProcess.js rename to entity/Offer_entity/entityfields/isolanguage/valueProcess.js index 826184267b67f23cecfd90a51ce0ee526800072a..07ae010d4acde2cafc0da5475aaa9f459b5db105 100644 --- a/entity/Offer_entity/entityfields/language/valueProcess.js +++ b/entity/Offer_entity/entityfields/isolanguage/valueProcess.js @@ -6,7 +6,7 @@ if (vars.exists("$param.OfferLanguage_param") && vars.get("$param.OfferLanguage_ { result.string(vars.get("$param.OfferLanguage_param")); } -else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string("deu"); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/lettersalutation/valueProcess.js b/entity/Offer_entity/entityfields/lettersalutation/valueProcess.js index 2c0266cbac1c8c8e575ade5d92b84fba9d7c474a..c3b78386885faaaf9b3dcfe18c659d6bb76d9c46 100644 --- a/entity/Offer_entity/entityfields/lettersalutation/valueProcess.js +++ b/entity/Offer_entity/entityfields/lettersalutation/valueProcess.js @@ -3,7 +3,7 @@ import("system.neon"); import("system.vars"); import("Address_lib"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { var addrobj = new AddrObject(vars.get("$field.CONTACT_ID")); var salutation = addrobj.getFormattedAddress(false, "{letter_salutation},"); diff --git a/entity/Offer_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Offer_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Offer_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Offer_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index b558bb290eb1cf9b5af5699279bf6b1917df6339..f6fdb0fbfa306482f48611c8049f39fb20a854a3 100644 --- a/entity/Offer_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Offer_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.OFFERID"), tableNames: ["AB_ATTRIBUTERELATION", "OFFERITEM"]}); -res.push({id: vars.get("$field.OFFERID"), tableNames: ["OFFER"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.OFFERID"), tableNames: ["AB_ATTRIBUTERELATION", "OFFERITEM"]}); +res.push({id: vars.get("$field.OFFERID"), tableNames: ["OFFER"]}); + +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/Offer_entity/entityfields/net/displayValueProcess.js b/entity/Offer_entity/entityfields/net/displayValueProcess.js index b1c561c1f00014cbcd0669f0d810bd9fdb5ba052..450ae0cfd9fa1701eeb4d4e7c049a3c8fb8fc7a0 100644 --- a/entity/Offer_entity/entityfields/net/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/net/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.NET"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js b/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js index 66b368d8e0178f9601c77a600619d542fa2c14ff..5a7493c41130f53a5a877ad0823f5783c8c80c02 100644 --- a/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js +++ b/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js @@ -6,7 +6,7 @@ var params = { "ContactId_param" : vars.get("$field.CONTACT_ID"), "ObjectType_param" : vars.get("$field.OBJECT_TYPE"), "ObjectRowId_param" : vars.get("$field.OBJECT_ROWID"), - "OfferLanguage_param" : vars.get("$field.LANGUAGE"), + "OfferLanguage_param" : vars.get("$field.ISOLANGUAGE"), "OfferOriginal_Id_param" : vars.get("$field.OFFERID"), "OfferCode_param" : vars.get("$field.OFFERCODE"), "OfferVersnr_param" : OfferUtils.getNextOfferVersionNumber(vars.get("$field.OFFERCODE")), diff --git a/entity/Offer_entity/entityfields/neworder/onActionProcess.js b/entity/Offer_entity/entityfields/neworder/onActionProcess.js index dce051360b6f16b9ac6d5c2e9dab793eb6f02aa8..696d171c7ef1d69bd9301c5e3c7d8ce214156a3f 100644 --- a/entity/Offer_entity/entityfields/neworder/onActionProcess.js +++ b/entity/Offer_entity/entityfields/neworder/onActionProcess.js @@ -3,12 +3,13 @@ import("system.neon"); import("Offer_lib"); var contactId = vars.getString("$field.CONTACT_ID"); -var salesprojectId = vars.getString("$field.OBJECT_ROWID"); +var pRowId = vars.getString("$field.OBJECT_ROWID"); +var pContext=vars.getString("$field.OBJECT_TYPE") var currency = vars.getString("$field.CURRENCY"); -var language = vars.getString("$field.LANGUAGE"); +var language = vars.getString("$field.ISOLANGUAGE"); var header = vars.getString("$field.HEADER"); var address = vars.getString("$field.ADDRESS"); var offerId = vars.getString("$field.OFFERID"); -OfferUtils.copyToOrder(offerId, salesprojectId, contactId, language, currency, address, header); +OfferUtils.copyToOrder(offerId, pContext, pRowId, contactId, language, currency, address, header); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js index 56d86282f48b1a4469aa61f7817b24edde6e5123..fe2b7c72502d9937add9b539ed38483e6ca4bd51 100644 --- a/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js @@ -4,7 +4,7 @@ import("system.db"); import("system.result"); import("Context_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) { +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.OBJECT_ROWID") == null) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); diff --git a/entity/Offer_entity/entityfields/object_rowid/valueProcess.js b/entity/Offer_entity/entityfields/object_rowid/valueProcess.js index 29bb85ddce909faec7a1d90bb521f3d129b4b495..8682d1f41d4023e8e347ad32eb1c0760af54f0fb 100644 --- a/entity/Offer_entity/entityfields/object_rowid/valueProcess.js +++ b/entity/Offer_entity/entityfields/object_rowid/valueProcess.js @@ -1,8 +1,6 @@ -import("system.logging"); import("system.neon"); import("system.vars"); import("system.result"); -logging.log("--- " + JSON.stringify(vars.get("$sys.recordstate"), vars.exists("$param.ObjectRowId_param"), null, "\t")) if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) result.string(vars.get("$param.ObjectRowId_param")); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/object_type/valueProcess.js b/entity/Offer_entity/entityfields/object_type/valueProcess.js index 2ef4eb50b1095a48985b177800f92eb867078128..daa858c3b8f879a069f5a131a3e0e9f433345f1f 100644 --- a/entity/Offer_entity/entityfields/object_type/valueProcess.js +++ b/entity/Offer_entity/entityfields/object_type/valueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.result"); import("Context_lib") -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) { diff --git a/entity/Offer_entity/entityfields/offercode/onValidation.js b/entity/Offer_entity/entityfields/offercode/onValidation.js index 3b9c0b76f65fa2b8ae4026d17b1e78d5197d919f..4d9d2f8a307e5bfe834ba5defbbe845b46d279fd 100644 --- a/entity/Offer_entity/entityfields/offercode/onValidation.js +++ b/entity/Offer_entity/entityfields/offercode/onValidation.js @@ -8,7 +8,7 @@ import("Entity_lib"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.exists("$param.OfferCode_param") - && !OfferUtils.validateOfferNumber(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.OFFERCODE"))) ) + && !OfferUtils.validateOfferNumber(vars.get("local.value")) ) { vars.set( "$field.OFFERCODE", OfferUtils.getNextOfferNumber().toString() ); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/offeritems/children/language_param/valueProcess.js b/entity/Offer_entity/entityfields/offeritems/children/language_param/valueProcess.js index 33d4d6d238c6273767dcb38ba121c6edd66acbea..bf7d2d68dd299037cf3c46bb153e5b7c436194b6 100644 --- a/entity/Offer_entity/entityfields/offeritems/children/language_param/valueProcess.js +++ b/entity/Offer_entity/entityfields/offeritems/children/language_param/valueProcess.js @@ -1,5 +1,4 @@ -import("system.logging"); import("system.vars"); import("system.result"); -logging.log("offer " + vars.get("$field.LANGUAGE")) -result.string(vars.get("$field.LANGUAGE")); + +result.string(vars.get("$field.ISOLANGUAGE")); diff --git a/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js b/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js index 9232f51b2e090002d80c469239ab003444411400..dd50ed1f48cd0a080b399dbe7c5eb4cd6aa579e0 100644 --- a/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js +++ b/entity/Offer_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js @@ -1,5 +1,5 @@ -import("system.vars"); -import("system.result"); -import("Entity_lib"); - -result.string(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ORG_ID"))); +import("system.vars"); +import("system.result"); +import("Entity_lib"); + +result.string(vars.get("local.value")); diff --git a/entity/Offer_entity/entityfields/sentoffers/children/offerstatus_param/valueProcess.js b/entity/Offer_entity/entityfields/sentoffers/children/offerstatus_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..54675da8f571c86ed8fcb1b757bf1dcd08ff8856 --- /dev/null +++ b/entity/Offer_entity/entityfields/sentoffers/children/offerstatus_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.offerStatus$sent()); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/status/onValueChange.js b/entity/Offer_entity/entityfields/status/onValueChange.js index 81a275dcbdee865fbd6796f60354f0a62abbb96a..d06a9e01b5af62f0a0637d6db848cb7a76f626da 100644 --- a/entity/Offer_entity/entityfields/status/onValueChange.js +++ b/entity/Offer_entity/entityfields/status/onValueChange.js @@ -2,7 +2,7 @@ import("system.vars"); import("Offer_lib"); var offerId = vars.getString("$field.OFFERID"); -if (offerId && vars.get("$field.STATUS") == 2 || vars.get("$field.STATUS") == 3 || vars.get("$field.STATUS") == 4) +if (offerId && vars.get("local.value") == 2 || vars.get("local.value") == 3 || vars.get("local.value") == 4) { OfferUtils.setSent(offerId); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/totalgross/displayValueProcess.js b/entity/Offer_entity/entityfields/totalgross/displayValueProcess.js index b1c561c1f00014cbcd0669f0d810bd9fdb5ba052..7e05663a8bc4754d820b79c99b32536c38cb3916 100644 --- a/entity/Offer_entity/entityfields/totalgross/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/totalgross/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.TotalGross"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/vat/displayValueProcess.js b/entity/Offer_entity/entityfields/vat/displayValueProcess.js index b1c561c1f00014cbcd0669f0d810bd9fdb5ba052..47ebfd7ecabcff3e202bfc72a540623de1e484fd 100644 --- a/entity/Offer_entity/entityfields/vat/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/vat/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.VAT"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Offer_entity/grantDeleteProcess.js b/entity/Offer_entity/grantDeleteProcess.js index f95c719463a913f0dfef05cfee0712e084c530ce..287fe5261292fbc1d33f3a86cd673877ff688166 100644 --- a/entity/Offer_entity/grantDeleteProcess.js +++ b/entity/Offer_entity/grantDeleteProcess.js @@ -1,5 +1,11 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); import("system.vars"); import("system.result"); import("Offer_lib"); -result.string(OfferUtils.isDeletable(vars.get("$field.STATUS"))); \ No newline at end of file +result.string(OfferUtils.isDeletable(vars.get("$field.STATUS")) + && !DocumentUtil.hasDocuments("OFFER", null, vars.get("$field.OFFERID")) + && !TaskUtils.hasTasks(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Offer_entity/onDBDelete.js b/entity/Offer_entity/onDBDelete.js index c69fde6a9281b91ef88556c006165b009a8fcb4c..5c36082b9691235f56ae00de76af5eca4d528c14 100644 --- a/entity/Offer_entity/onDBDelete.js +++ b/entity/Offer_entity/onDBDelete.js @@ -1,4 +1,5 @@ +import("Sql_lib"); import("system.vars"); import("system.db"); -db.deleteData("OFFERITEM", "OFFERITEM.OFFER_ID = '" + vars.getString("$field.OFFERID") + "'"); \ No newline at end of file +db.deleteData("OFFERITEM", SqlCondition.equals("OFFERITEM.OFFER_ID", vars.getString("$field.OFFERID"), "1=2")); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/conditionProcess.js b/entity/Offer_entity/recordcontainers/db/conditionProcess.js index 25a5d52c1d4d1808cee87b68e601d8f6bf2a346f..d06014df7b5d8a907207e3547acedbdece0084eb 100644 --- a/entity/Offer_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Offer_entity/recordcontainers/db/conditionProcess.js @@ -11,5 +11,8 @@ else { cond.andPrepareVars("OFFER.OBJECT_ROWID", "$param.ObjectRowId_param"); cond.andPrepareVars("OFFER.OBJECT_TYPE", "$param.ObjectType_param"); } + +cond.andPrepareVars("OFFER.STATUS", "$param.OfferStatus_param") + //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/onDBDelete.js b/entity/Offer_entity/recordcontainers/db/onDBDelete.js index c69fde6a9281b91ef88556c006165b009a8fcb4c..5c36082b9691235f56ae00de76af5eca4d528c14 100644 --- a/entity/Offer_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Offer_entity/recordcontainers/db/onDBDelete.js @@ -1,4 +1,5 @@ +import("Sql_lib"); import("system.vars"); import("system.db"); -db.deleteData("OFFERITEM", "OFFERITEM.OFFER_ID = '" + vars.getString("$field.OFFERID") + "'"); \ No newline at end of file +db.deleteData("OFFERITEM", SqlCondition.equals("OFFERITEM.OFFER_ID", vars.getString("$field.OFFERID"), "1=2")); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/onDBInsert.js b/entity/Offer_entity/recordcontainers/db/onDBInsert.js index c9c487029913a28d6eda69030fccfc6f6f3a3f5f..cf7eb05721dd07df50aec9a891e3bdce9a3cd49b 100644 --- a/entity/Offer_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Offer_entity/recordcontainers/db/onDBInsert.js @@ -3,4 +3,4 @@ import("system.vars"); import("Offer_lib"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.OfferOriginal_Id_param")) - OfferUtils.copyOfferItems(vars.getString("$param.OfferOriginal_Id_param"), vars.get("$field.OFFERID")); + OfferUtils.copyOfferItems(vars.getString("$param.OfferOriginal_Id_param"), vars.get("$local.uid")); diff --git a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9a3d04480545203f0da83c3f6be762e684c8883a --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Offer'"; + +result.string("OFFERID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..2821fb702f86a860ad359c2ea089f5551743d795 --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +var contact = Contact.createWithColumnPreset() +var renderer = new ContactTitleRenderer(contact, ContactTitleRenderer.OPTIONS.IncludeOrganisation); +result.string(renderer.asSql()); \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..5062035a24b0ca5f7bfafba434b9447a7f3e258b --- /dev/null +++ b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); + +var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("OFFER.ISOLANGUAGE"); +result.string(sql); diff --git a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js b/entity/Offer_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js deleted file mode 100644 index cbde79e3b0930143fccf465cb6561f871a706df2..0000000000000000000000000000000000000000 --- a/entity/Offer_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Keyword_lib"); - -var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("OFFER.LANGUAGE"); -result.string(sql); diff --git a/entity/Offer_entity/recordcontainers/index/query.js b/entity/Offer_entity/recordcontainers/index/query.js index 7aed701b0b543ac1c93e7a932efec19bac353581..73e6a530c0286b34ea9f1e27bdcb83c52b7c4b47 100644 --- a/entity/Offer_entity/recordcontainers/index/query.js +++ b/entity/Offer_entity/recordcontainers/index/query.js @@ -16,11 +16,11 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select OFFERID as uid, " +sqlQuery = 'select OFFERID as "_uid_", ' + sqlHelper.concat([sqlHelper.cast("OFFERCODE", SQLTYPES.CHAR, 10), KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.offerStatus(), "OFFER.STATUS")], " | ") - + " as title, " + + ' as "_title_", ' + sqlHelper.concat(["ORGANISATION.NAME", "'| " + translate.text("Description") + ":'", sqlHelper.castLob("OFFER.INFO", 250)]) - + " as description" + + ' as "_description_"' + ", OFFERCODE" + ", CUSTOMERCODE " + ", OFFER.CONTACT_ID " diff --git a/entity/Offeritem_entity/Offeritem_entity.aod b/entity/Offeritem_entity/Offeritem_entity.aod index ca54709d83b8857becd1b33e92e606fc551c8fd7..6739e1f48f06139913d430a3b9d7dd267d1a9b31 100644 --- a/entity/Offeritem_entity/Offeritem_entity.aod +++ b/entity/Offeritem_entity/Offeritem_entity.aod @@ -4,10 +4,12 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Offeritem_entity/documentation.adoc</documentation> <title>Offeritem</title> + <siblings> + <element>Offer_entity</element> + </siblings> <grantCreateProcess>%aditoprj%/entity/Offeritem_entity/grantCreateProcess.js</grantCreateProcess> <grantUpdateProcess>%aditoprj%/entity/Offeritem_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/Offeritem_entity/grantDeleteProcess.js</grantDeleteProcess> - <afterOperatingState>%aditoprj%/entity/Offeritem_entity/afterOperatingState.js</afterOperatingState> <titlePlural>Offeritems</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -40,9 +42,11 @@ <name>ITEMPOSITION</name> <title>Position</title> <state>READONLY</state> + <valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/itemposition/valueProcess.js</valueProcess> </entityField> <entityField> <name>ITEMSORT</name> + <valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/itemsort/valueProcess.js</valueProcess> </entityField> <entityField> <name>OFFERITEMID</name> @@ -267,18 +271,22 @@ <dbRecordFieldMapping> <name>DISCOUNT.value</name> <recordfield>OFFERITEM.DISCOUNT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GROUPCODEID.value</name> <recordfield>OFFERITEM.GROUPCODEID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ITEMNAME.value</name> <recordfield>OFFERITEM.ITEMNAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ITEMPOSITION.value</name> <recordfield>OFFERITEM.ITEMPOSITION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ITEMSORT.value</name> @@ -295,30 +303,37 @@ <dbRecordFieldMapping> <name>OPTIONAL.value</name> <recordfield>OFFERITEM.OPTIONAL</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRICE.value</name> <recordfield>OFFERITEM.PRICE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRODUCT_ID.value</name> <recordfield>OFFERITEM.PRODUCT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>QUANTITY.value</name> <recordfield>OFFERITEM.QUANTITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>UNIT.value</name> <recordfield>OFFERITEM.UNIT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VAT.value</name> <recordfield>OFFERITEM.VAT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>OFFERITEM.INFO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GROUPCODEID.displayValue</name> diff --git a/entity/Offeritem_entity/afterOperatingState.js b/entity/Offeritem_entity/afterOperatingState.js deleted file mode 100644 index 7366887b469255e7b30f07d7e8cd87781ab5b51d..0000000000000000000000000000000000000000 --- a/entity/Offeritem_entity/afterOperatingState.js +++ /dev/null @@ -1,17 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("Offer_lib"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -{ - var offerId = vars.get("$field.OFFER_ID"); - var oiUtils = new OfferItemUtils(offerId); - - vars.set("$field.ITEMSORT", oiUtils.getNextItemSort()); - vars.set("$field.ITEMPOSITION", oiUtils.getNextItemPosition(vars.get("$field.ASSIGNEDTO"))); -} - -if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) -{ - neon.refresh(); -} \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/discount/onValidation.js b/entity/Offeritem_entity/entityfields/discount/onValidation.js index 2864ac016f3a9b00e8cc491bcf3fac9204e2ec90..595a5d9aae549242aaa2246e2e4b6e6d602249a0 100644 --- a/entity/Offeritem_entity/entityfields/discount/onValidation.js +++ b/entity/Offeritem_entity/entityfields/discount/onValidation.js @@ -3,7 +3,7 @@ import("system.vars"); import("Util_lib"); import("Entity_lib"); -var value = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.DISCOUNT")); +var value = vars.get("local.value"); var validationResult = NumberUtils.validateIsBetweenFloat("Discount", value, 0, 100); if (validationResult) diff --git a/entity/Offeritem_entity/entityfields/itemposition/valueProcess.js b/entity/Offeritem_entity/entityfields/itemposition/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ce2043d7397269f3b2860fdc1c90bedc45956f59 --- /dev/null +++ b/entity/Offeritem_entity/entityfields/itemposition/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Offer_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var oiUtils = new OfferItemUtils(vars.get("$field.OFFER_ID")); + result.string(oiUtils.getNextItemPosition(vars.get("$field.ASSIGNEDTO"))); +} \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/itemsort/valueProcess.js b/entity/Offeritem_entity/entityfields/itemsort/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..822bd91ae0d7ea41713660ef05c058bdf365f5f1 --- /dev/null +++ b/entity/Offeritem_entity/entityfields/itemsort/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Offer_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var oiUtils = new OfferItemUtils(vars.get("$field.OFFER_ID")); + result.string(oiUtils.getNextItemSort()); +} \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/optional/valueProcess.js b/entity/Offeritem_entity/entityfields/optional/valueProcess.js index 31b2531af1ad332b9ab67942d5a89d742c9ab368..12b932905d245ce1716f5334f4d4e5fd12d8e66c 100644 --- a/entity/Offeritem_entity/entityfields/optional/valueProcess.js +++ b/entity/Offeritem_entity/entityfields/optional/valueProcess.js @@ -2,5 +2,6 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string("0"); \ No newline at end of file +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/Offeritem_entity/entityfields/price/displayValueProcess.js b/entity/Offeritem_entity/entityfields/price/displayValueProcess.js index f9efef77b57bed78b2a0f2694905aed7cf5957f0..7937b0dc6cf9ab0750c43be49a0accec6fb27e56 100644 --- a/entity/Offeritem_entity/entityfields/price/displayValueProcess.js +++ b/entity/Offeritem_entity/entityfields/price/displayValueProcess.js @@ -1,6 +1,21 @@ +import("Sql_lib"); +import("system.db"); import("Util_lib"); import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$param.Currency_param"))); \ No newline at end of file + if (vars.get("$param.Currency_param")) + { +var curr = vars.get("$param.Currency_param") + + +} + +else { + curr = db.cell(SqlCondition.begin() + .andPrepareVars("OFFER.OFFERID", "$field.OFFER_ID") + .buildSql("select CURRENCY from OFFER", "1=2")); +} + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.PRICE"), translate.text("#,##0.00"), curr)); \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js index b3cc01ab49bbd4ddc910037d3319e4ebb11ce25b..2c2dc40460231b4e6cf5f081f48894856bb4cafc 100644 --- a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js +++ b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js @@ -8,7 +8,7 @@ import("Util_lib"); import("Entity_lib"); import("Attribute_lib"); -var pid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCT_ID")); +var pid = vars.get("local.value"); if(pid != "") { var currency = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; @@ -20,7 +20,7 @@ if(pid != "") //TODO: loading from db until loading from Consumer is possible. var ProductDetails = ProductUtils.getProductDetails(pid, PriceListFilter, [["info", db.translateStatement(SqlCondition.begin() - .andPrepareVars("DESCRIPTIONTRANSLATION.OBJECT_ROWID", "$field.PRODUCT_ID") + .andPrepareVars("DESCRIPTIONTRANSLATION.OBJECT_ROWID", "local.value") .and("DESCRIPTIONTRANSLATION.OBJECT_TYPE = 'Product'") .andPrepareVars("DESCRIPTIONTRANSLATION.LANG", "$param.Language_param") .buildSql("(select DESCRIPTION from DESCRIPTIONTRANSLATION", "1=2", ")"))] diff --git a/entity/Offeritem_entity/entityfields/quantity/onValidation.js b/entity/Offeritem_entity/entityfields/quantity/onValidation.js index a7fe04aaf506c2edfba1e2d74b644c3da785a6d1..0e56a1cc6269ecd23927fb2ef9746b2cc41b0c03 100644 --- a/entity/Offeritem_entity/entityfields/quantity/onValidation.js +++ b/entity/Offeritem_entity/entityfields/quantity/onValidation.js @@ -3,8 +3,7 @@ import("system.result"); import("system.vars"); import("Entity_lib"); -var quatity = vars.exists("$field.QUANTITY") ? vars.get("$field.QUANTITY") : ""; -quatity = ProcessHandlingUtils.getOnValidationValue(quatity); +var quatity = vars.get("$local.value") ? vars.get("$local.value") : ""; if (parseInt(quatity) <= 0) { diff --git a/entity/Offeritem_entity/entityfields/quantity/onValueChange.js b/entity/Offeritem_entity/entityfields/quantity/onValueChange.js index 7b7bf4c94ca3639b0f3e6acf5c5950eaf5c9fc3b..5098743ffb034230fa82e48dac7a1849814e7a93 100644 --- a/entity/Offeritem_entity/entityfields/quantity/onValueChange.js +++ b/entity/Offeritem_entity/entityfields/quantity/onValueChange.js @@ -1,4 +1,3 @@ -import("system.logging"); import("AttributeRegistry_basic"); import("system.vars"); import("system.neon"); @@ -8,7 +7,7 @@ import("Entity_lib"); import("Attribute_lib"); var pid = vars.get("$field.PRODUCT_ID"); -var newQuantity = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.QUANTITY")); +var newQuantity = vars.get("local.value"); if(pid != "" && newQuantity != "") { var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; @@ -28,11 +27,10 @@ if(pid != "" && newQuantity != "") //checks if the value is <= 0, if so fallback to 1 -var quatity = vars.exists("$field.QUANTITY") ? vars.get("$field.QUANTITY") : ""; -quatity = ProcessHandlingUtils.getOnValidationValue(quatity); +var quatity = vars.get("$local.value") ? vars.get("$local.value") : ""; if (parseInt(quatity) <= 0) { - neon.setFieldValue("$field.QUANTITY", "1"); + neon.setFieldValue("local.value", "1"); } \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/quantity/valueProcess.js b/entity/Offeritem_entity/entityfields/quantity/valueProcess.js index ebd4664e6124e2b62ca40d0d0e97e43003cf22f0..72e8e990dec55f1e9efab9d25b53672c5b6a6d7e 100644 --- a/entity/Offeritem_entity/entityfields/quantity/valueProcess.js +++ b/entity/Offeritem_entity/entityfields/quantity/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string("1"); } \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js b/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js index f9efef77b57bed78b2a0f2694905aed7cf5957f0..106a609bee58eae9b4557c2bf76288b70fa96f0d 100644 --- a/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js +++ b/entity/Offeritem_entity/entityfields/totalprice/displayValueProcess.js @@ -1,6 +1,21 @@ +import("Sql_lib"); +import("system.db"); import("Util_lib"); import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$param.Currency_param"))); \ No newline at end of file + if (vars.get("$param.Currency_param")) + { +var curr = vars.get("$param.Currency_param") + + +} + +else { + curr = db.cell(SqlCondition.begin() + .andPrepareVars("OFFER.OFFERID", "$field.OFFER_ID") + .buildSql("select CURRENCY from OFFER", "1=2")); +} + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.TotalPrice"), translate.text("#,##0.00"), curr)); \ No newline at end of file diff --git a/entity/Offeritem_entity/grantCreateProcess.js b/entity/Offeritem_entity/grantCreateProcess.js index b8e2e7b1a844d2c2449e44ce4249f0d0f9531167..658fcf03ff413844ff78cd652d86cbe62a0113bf 100644 --- a/entity/Offeritem_entity/grantCreateProcess.js +++ b/entity/Offeritem_entity/grantCreateProcess.js @@ -1,5 +1,6 @@ import("system.vars"); import("system.result"); import("Offer_lib"); +import("system.logging"); result.string(OfferUtils.isEditable(vars.get("$param.OfferStatus_param"))); \ No newline at end of file diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js index 1e4dc46b09b8d369f24c76194c2eb16774ab8bea..317fce086c92e7e36cb070594c3fb2a756b386d0 100644 --- a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js @@ -7,13 +7,15 @@ import("Offer_lib"); import("Product_lib"); import("Sql_lib"); -var oid = vars.get("$field.OFFER_ID"); +var rowdata = vars.get("$local.rowdata"); + +var oid = rowdata["OFFERITEM.OFFER_ID"]; if(oid != "") { var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; var contactid = vars.exists("$param.ContactId_param") ? vars.get("$param.ContactId_param") : ""; - var oiUtils = new OfferItemUtils(vars.get("$field.OFFER_ID")); - oiUtils.insertPartsList(vars.get("$field.PRODUCT_ID"), vars.get("$field.OFFERITEMID"), curr, contactid, vars.get("$param.Language_param")); + var oiUtils = new OfferItemUtils(rowdata["OFFERITEM.OFFER_ID"]); + oiUtils.insertPartsList(rowdata["OFFERITEM.PRODUCT_ID"], vars.get("$local.uid"), curr, contactid, vars.get("$param.Language_param")); oiUtils.reOrgItems(); //update offer price diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index e5be3cda345f1727d06a514b706390792605aeec..e05c1f0edbef1dec24b8dbffb1399aa09732ba17 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Order_entity/documentation.adoc</documentation> <title>Receipt</title> + <grantDeleteProcess>%aditoprj%/entity/Order_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Order_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Order_entity/afterUiInit.js</afterUiInit> <iconId>VAADIN:DOLLAR</iconId> @@ -38,13 +39,15 @@ </entityField> <entityField> <name>SALESORDERDATE</name> - <title>Date</title> + <title>Order date</title> <contentType>DATE</contentType> <resolution>DAY</resolution> <outputFormat>dd.MM.yyyy</outputFormat> <inputFormat>dd.MM.yyyy</inputFormat> <mandatory v="true" /> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/salesorderdate/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/salesorderdate/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/salesorderdate/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>SALESORDERID</name> @@ -65,24 +68,6 @@ <element>MASK</element> </onValueChangeTypes> </entityField> - <entityField> - <name>SALESPROJECT_ID</name> - <title>Salesproject</title> - <consumer>Salesprojects</consumer> - <linkedContext>Salesproject</linkedContext> - <mandatory v="true" /> - <state>INVISIBLE</state> - <stateProcess>%aditoprj%/entity/Order_entity/entityfields/salesproject_id/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/salesproject_id/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js</displayValueProcess> - </entityField> - <entityField> - <name>STATUS</name> - <title>Status</title> - <consumer>KeywordStates</consumer> - <state>EDITABLE</state> - <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/status/displayValueProcess.js</displayValueProcess> - </entityField> <entityField> <name>VAT</name> <title>Total VAT</title> @@ -98,11 +83,14 @@ <entityField> <name>HEADER</name> <title>Header text</title> + <contentType>LONG_TEXT</contentType> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/header/valueProcess.js</valueProcess> </entityField> <entityField> <name>FOOTER</name> <title>Footer text</title> + <contentType>LONG_TEXT</contentType> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/footer/valueProcess.js</valueProcess> </entityField> <entityConsumer> <name>Orderitems</name> @@ -140,8 +128,10 @@ </entityConsumer> <entityActionField> <name>newOrderVersion</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/neworderversion/documentation.adoc</documentation> <title>New receipt version</title> <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/neworderversion/onActionProcess.js</onActionProcess> + <isObjectAction v="true" /> <iconId>VAADIN:DOLLAR</iconId> </entityActionField> <entityField> @@ -161,22 +151,17 @@ <valueProcess>%aditoprj%/entity/Order_entity/entityfields/totalgross/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/totalgross/displayValueProcess.js</displayValueProcess> </entityField> - <entityParameter> - <name>SalesprojectId_param</name> - <expose v="true" /> - <mandatory v="false" /> - <description>PARAMETER</description> - </entityParameter> <entityField> - <name>LANGUAGE</name> + <name>ISOLANGUAGE</name> <title>Language</title> <consumer>Languages</consumer> <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/language/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/language/displayValueProcess.js</displayValueProcess> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/isolanguage/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/isolanguage/displayValueProcess.js</displayValueProcess> </entityField> <entityActionField> <name>newOrder</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/neworder/documentation.adoc</documentation> <title>Copy receipt</title> <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/neworder/onActionProcess.js</onActionProcess> <iconId>VAADIN:COPY</iconId> @@ -207,7 +192,8 @@ <entityParameter> <name>ContactId_param</name> <expose v="true" /> - <mandatory v="false" /> + <mandatory v="true" /> + <documentation>%aditoprj%/entity/Order_entity/entityfields/contactid_param/documentation.adoc</documentation> <description>PARAMETER</description> </entityParameter> <entityField> @@ -273,13 +259,15 @@ <dependency> <name>dependency</name> <entityName>Salesproject_entity</entityName> - <fieldName>#PROVIDER</fieldName> + <fieldName>Salesprojects</fieldName> </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> - <entityField> - <name>ADDRESS</name> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/address/valueProcess.js</valueProcess> - </entityField> <entityConsumer> <name>KeywordCurrencies</name> <dependency> @@ -312,6 +300,7 @@ </entityConsumer> <entityParameter> <name>OrderCurrency_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/ordercurrency_param/valueProcess.js</valueProcess> <expose v="true" /> <mandatory v="false" /> <description>PARAMETER</description> @@ -328,12 +317,6 @@ <mandatory v="false" /> <description>PARAMETER</description> </entityParameter> - <entityParameter> - <name>OrderAddress_param</name> - <expose v="true" /> - <mandatory v="false" /> - <description>PARAMETER</description> - </entityParameter> <entityConsumer> <name>Languages</name> <dependency> @@ -372,6 +355,7 @@ </entityConsumer> <entityActionField> <name>newActivity</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/newactivity/documentation.adoc</documentation> <title>New activity</title> <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/newactivity/onActionProcess.js</onActionProcess> <iconId>VAADIN:HOURGLASS_END</iconId> @@ -381,13 +365,15 @@ <entityField> <name>OFFER_ID</name> <title>Offer</title> + <consumer>Offers</consumer> <linkedContext>Offer</linkedContext> - <state>READONLY</state> + <state>AUTO</state> <valueProcess>%aditoprj%/entity/Order_entity/entityfields/offer_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/offer_id/displayValueProcess.js</displayValueProcess> </entityField> <entityActionField> <name>newTask</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/newtask/documentation.adoc</documentation> <title>New task</title> <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/newtask/onActionProcess.js</onActionProcess> <iconId>VAADIN:TASKS</iconId> @@ -453,7 +439,7 @@ </children> </entityConsumer> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -462,7 +448,7 @@ <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -473,6 +459,465 @@ <iconId>VAADIN:CURLY_BRACKETS</iconId> <stateProcess>%aditoprj%/entity/Order_entity/entityfields/openadminview/stateProcess.js</stateProcess> </entityActionField> + <entityField> + <name>ORDERTYPE</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/ordertype/documentation.adoc</documentation> + <title>Order Type</title> + <consumer>KeywordOrderTypes</consumer> + <mandatory v="true" /> + <usePermissions v="true" /> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/ordertype/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/ordertype/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>ORDERSTATUS</name> + <title>Sent</title> + <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/Order_entity/entityfields/orderstatus/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/orderstatus/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>PAID</name> + <title>Paid</title> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/paid/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/paid/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>Unpaid</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/unpaid/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>CANCELLATION</name> + <title>Cancelled</title> + <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/Order_entity/entityfields/cancellation/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/cancellation/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>DUNNINGDATE</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/dunningdate/documentation.adoc</documentation> + <title>Dunning date</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/dunningdate/stateProcess.js</stateProcess> + </entityField> + <entityField> + <name>DUNNINGLEVEL</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/dunninglevel/documentation.adoc</documentation> + <title>Dunning level</title> + <consumer>KeywordDunningLevels</consumer> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/dunninglevel/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/dunninglevel/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>PAYDATE</name> + <title>Pay date</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/paydate/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/paydate/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>PAYDUEDATE</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/payduedate/documentation.adoc</documentation> + <title>Pay due date</title> + <contentType>DATE</contentType> + <resolution>DAY</resolution> + <mandatory v="true" /> + <state>READONLY</state> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/payduedate/valueProcess.js</valueProcess> + </entityField> + <entityConsumer> + <name>KeywordOrderTypes</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keywordordertypes/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>KeywordDunningLevels</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keyworddunninglevels/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>OBJECT_ROWID</name> + <title>Link</title> + <consumer>Objects</consumer> + <linkedContextProcess>%aditoprj%/entity/Order_entity/entityfields/object_rowid/linkedContextProcess.js</linkedContextProcess> + <mandatory v="true" /> + <mandatoryProcess>%aditoprj%/entity/Order_entity/entityfields/object_rowid/mandatoryProcess.js</mandatoryProcess> + <titleProcess>%aditoprj%/entity/Order_entity/entityfields/object_rowid/titleProcess.js</titleProcess> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/object_rowid/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> + </entityField> + <entityField> + <name>OBJECT_TYPE</name> + <title>Connection Type</title> + <consumer>Contexts</consumer> + <mandatoryProcess>%aditoprj%/entity/Order_entity/entityfields/object_type/mandatoryProcess.js</mandatoryProcess> + <state>INVISIBLE</state> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/object_type/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>Objects</name> + <dependency> + <name>dependency</name> + <entityName>Object_entity</entityName> + <fieldName>FilteredObjects</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ObjectType_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/objects/children/objecttype_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>Contexts</name> + <dependency> + <name>dependency</name> + <entityName>Context_entity</entityName> + <fieldName>Context</fieldName> + </dependency> + <children> + <entityParameter> + <name>Whitelist</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityParameter> + <name>PossibleConnectionTypes</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/possibleconnectiontypes/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectRowId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectType_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>PAYMENTTERMS</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/paymentterms/documentation.adoc</documentation> + <title>Payment term</title> + <consumer>KeywordPaymentTerms</consumer> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/paymentterms/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/paymentterms/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>DELIVERYTERMS</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/deliveryterms/documentation.adoc</documentation> + <title>Delivery specification</title> + <consumer>KeywordDeliveryTerms</consumer> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/deliveryterms/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/deliveryterms/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>DELIVERYADDRESS</name> + <title>Delivery address</title> + <contentType>LONG_TEXT</contentType> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/deliveryaddress/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>PAYMENTADDRESS</name> + <title>Payment address</title> + <contentType>LONG_TEXT</contentType> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/paymentaddress/valueProcess.js</valueProcess> + </entityField> + <entityConsumer> + <name>KeywordPaymentTerms</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keywordpaymentterms/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>KeywordDeliveryTerms</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/keyworddeliveryterms/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>PossibleAddresses</name> + <dependency> + <name>dependency</name> + <entityName>Address_entity</entityName> + <fieldName>OrganisationAndContactAddresses</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>NOTICE</name> + <title>Notice</title> + <contentType>LONG_TEXT</contentType> + </entityField> + <entityField> + <name>DUNNINGTEXT</name> + <title>Dunning text</title> + <contentType>LONG_TEXT</contentType> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/dunningtext/valueProcess.js</valueProcess> + </entityField> + <entityParameter> + <name>OrderPaymentTerm_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OrderDeliveryTerm_param</name> + <expose v="true" /> + </entityParameter> + <entityConsumer> + <name>Offers</name> + <dependency> + <name>dependency</name> + <entityName>Offer_entity</entityName> + <fieldName>ContactOffers</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/offers/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>DocumentTemplateTexHeader</name> + <dependency> + <name>dependency</name> + <entityName>DocumentTemplate_entity</entityName> + <fieldName>DocumentTemplateProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>DocumentTemplateType_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetype_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>DocumentTemplateTypeClassification_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>DocumentTemplateTexFooter</name> + <dependency> + <name>dependency</name> + <entityName>DocumentTemplate_entity</entityName> + <fieldName>DocumentTemplateProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>DocumentTemplateType_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetype_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>DocumentTemplateTypeClassification_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetypeclassification_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>ChosenTexHeader</name> + <title>Choose Header</title> + <consumer>DocumentTemplateTexHeader</consumer> + </entityField> + <entityField> + <name>ChosenTexFooter</name> + <title>Choose Footer</title> + <consumer>DocumentTemplateTexFooter</consumer> + </entityField> + <entityParameter> + <name>OrderFooter_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OrderDunningDate_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OrderDunningLevel_param</name> + <expose v="true" /> + </entityParameter> + <entityActionField> + <name>TransferDeliveryNote</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/transferdeliverynote/documentation.adoc</documentation> + <title>Transfer to delivery note</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/transferdeliverynote/onActionProcess.js</onActionProcess> + <iconId>VAADIN:NOTEBOOK</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/transferdeliverynote/stateProcess.js</stateProcess> + </entityActionField> + <entityParameter> + <name>OrderType_param</name> + <expose v="true" /> + </entityParameter> + <entityActionField> + <name>TransferInvoice</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/transferinvoice/documentation.adoc</documentation> + <title>Transfer to Invoice</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/transferinvoice/onActionProcess.js</onActionProcess> + <iconId>VAADIN:BOOK_DOLLAR</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/transferinvoice/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>setSent</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/setsent/documentation.adoc</documentation> + <title>Set to sent</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/setsent/onActionProcess.js</onActionProcess> + <iconId>VAADIN:ARROW_BACKWARD</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/setsent/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>cancel</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/cancel/documentation.adoc</documentation> + <title>Cancel</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/cancel/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CLOSE</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/cancel/stateProcess.js</stateProcess> + </entityActionField> + <entityParameter> + <name>OrderCancellation_param</name> + <expose v="true" /> + </entityParameter> + <entityActionField> + <name>setDunning</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/setdunning/documentation.adoc</documentation> + <title>Set dunning</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/setdunning/onActionProcess.js</onActionProcess> + <iconId>VAADIN:WARNING</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/setdunning/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>setPaid</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/setpaid/documentation.adoc</documentation> + <title>Set paid amount</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/setpaid/onActionProcess.js</onActionProcess> + <iconId>VAADIN:DOLLAR</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/setpaid/stateProcess.js</stateProcess> + </entityActionField> + <entityField> + <name>ChosenPaymentAddress</name> + <title>Choose payment address</title> + <consumer>PossibleAddresses</consumer> + <mandatory v="false" /> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> + </entityField> + <entityField> + <name>ChosenDeliveryAddress</name> + <title>Choose delivery address</title> + <consumer>PossibleAddresses</consumer> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> + </entityField> + <entityParameter> + <name>Countitems_param</name> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/countitems_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>OrderCode_param</name> + <expose v="true" /> + </entityParameter> + <entityActionField> + <name>printOrder</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/printorder/documentation.adoc</documentation> + <title>Print order</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/printorder/onActionProcess.js</onActionProcess> + <iconId>VAADIN:FILE</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/printorder/stateProcess.js</stateProcess> + </entityActionField> + <entityParameter> + <name>OrderStatus_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OrderVersnr_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>FullOrderCode</name> + <title>Order number</title> + <valueProcess>%aditoprj%/entity/Order_entity/entityfields/fullordercode/valueProcess.js</valueProcess> + </entityField> + <entityActionField> + <name>printReminder</name> + <documentation>%aditoprj%/entity/Order_entity/entityfields/printreminder/documentation.adoc</documentation> + <title>Print reminder</title> + <onActionProcess>%aditoprj%/entity/Order_entity/entityfields/printreminder/onActionProcess.js</onActionProcess> + <iconId>VAADIN:FILE</iconId> + <stateProcess>%aditoprj%/entity/Order_entity/entityfields/printreminder/stateProcess.js</stateProcess> + </entityActionField> + <entityParameter> + <name>OrderPaymentAddress_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OrderDeliveryAddress_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -486,35 +931,28 @@ <onDBDelete>%aditoprj%/entity/Order_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> - <name>39d6d76d-8c8f-40aa-b2ed-4684de5d0050</name> + <name>43290f18-46fb-4d1f-b653-60f39f1fe3fb</name> <tableName>SALESORDER</tableName> <primaryKey>SALESORDERID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> <linkInformation> - <name>c67be87c-ef41-4b01-bc74-95c46a101536</name> + <name>3f8c21b4-a81e-4405-8b4f-346ff724b8a5</name> <tableName>CONTACT</tableName> <primaryKey>CONTACTID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>6c333196-ff8c-4fef-a85f-0fee8e408661</name> - <tableName>SALESPROJECT</tableName> - <primaryKey>SALESPROJECTID</primaryKey> - <isUIDTable v="false" /> - <readonly v="true" /> - </linkInformation> - <linkInformation> - <name>04cf409d-daeb-41be-ba24-9b7779ac4231</name> + <name>0131be90-6232-4dda-9036-bbde951eded5</name> <tableName>PERSON</tableName> <primaryKey>PERSONID</primaryKey> <isUIDTable v="false" /> <readonly v="true" /> </linkInformation> <linkInformation> - <name>a807abec-8815-4b57-a039-d53d24b90331</name> + <name>0efeab02-efaf-4155-9312-0aee1f7f5535</name> <tableName>ORGANISATION</tableName> <primaryKey>ORGANISATIONID</primaryKey> <isUIDTable v="false" /> @@ -536,7 +974,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LANGUAGE.value</name> - <recordfield>SALESORDER.LANGUAGE</recordfield> + <recordfield>SALESORDER.ISOLANGUAGE</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NET.value</name> @@ -554,14 +992,6 @@ <name>SALESORDERID.value</name> <recordfield>SALESORDER.SALESORDERID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>SALESPROJECT_ID.value</name> - <recordfield>SALESORDER.SALESPROJECT_ID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STATUS.value</name> - <recordfield>SALESORDER.STATUS</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VAT.value</name> <recordfield>SALESORDER.VAT</recordfield> @@ -582,30 +1012,14 @@ <name>CONTACT_PERSON_ID.value</name> <recordfield>CONTACT.PERSON_ID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ADDRESS.value</name> - <recordfield>SALESORDER.ADDRESS</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CURRENCY.displayValue</name> <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/currency.displayvalue/expression.js</expression> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STATUS.displayValue</name> - <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LANGUAGE.displayValue</name> - <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OFFER_ID.value</name> <recordfield>SALESORDER.OFFER_ID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>SALESPROJECT_ID.displayValue</name> - <recordfield>SALESPROJECT.PROJECTTITLE</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ORG_ID.displayValue</name> <recordfield>ORGANISATION.NAME</recordfield> @@ -614,6 +1028,90 @@ <name>CONTACT_PERSON_ID.displayValue</name> <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/contact_person_id.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CANCELLATION.value</name> + <recordfield>SALESORDER.CANCELLATION</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DUNNINGDATE.value</name> + <recordfield>SALESORDER.DUNNINGDATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DUNNINGLEVEL.value</name> + <recordfield>SALESORDER.DUNNINGLEVEL</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ORDERSTATUS.value</name> + <recordfield>SALESORDER.ORDERSTATUS</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ORDERTYPE.value</name> + <recordfield>SALESORDER.ORDERTYPE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PAID.value</name> + <recordfield>SALESORDER.PAID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PAYDATE.value</name> + <recordfield>SALESORDER.PAYDATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PAYDUEDATE.value</name> + <recordfield>SALESORDER.PAYDUEDATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>OBJECT_ROWID.value</name> + <recordfield>SALESORDER.OBJECT_ROWID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>OBJECT_ROWID.displayValue</name> + <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>OFFER_ID.displayValue</name> + <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>OBJECT_TYPE.value</name> + <recordfield>SALESORDER.OBJECT_TYPE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PAYMENTTERMS.value</name> + <recordfield>SALESORDER.PAYMENTTERMS</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DELIVERYTERMS.value</name> + <recordfield>SALESORDER.DELIVERYTERMS</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DELIVERYADDRESS.value</name> + <recordfield>SALESORDER.DELIVERYADDRESS</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PAYMENTADDRESS.value</name> + <recordfield>SALESORDER.PAYMENTADDRESS</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>NOTICE.value</name> + <recordfield>SALESORDER.NOTICE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DUNNINGTEXT.value</name> + <recordfield>SALESORDER.DUNNINGTEXT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DELIVERYTERMS.displayValue</name> + <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/deliveryterms.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CONTACT_ID.displayValue</name> + <expression>%aditoprj%/entity/Order_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ISOLANGUAGE.value</name> + <recordfield>SALESORDER.ISOLANGUAGE</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> <indexRecordContainer> diff --git a/entity/Order_entity/documentation.adoc b/entity/Order_entity/documentation.adoc index 7e02ccf884a070b40c08d64ac47a39968e895083..a95ff974601aad590b767047d74d2bd23eb074a8 100644 --- a/entity/Order_entity/documentation.adoc +++ b/entity/Order_entity/documentation.adoc @@ -5,10 +5,21 @@ Entity contains meta data of the Order module. It provides data from database table _SALESORDER_. -== Actions +== Receipts: + +A receipt is a document that shows the details and cost of an order and proof that it has been paid for. The receipt can either be made standalone, or acquired from the offers. +The receipt type invoice also has a reminder, which will be sent to the customer if the receipt has not been paid before the due date. + +== Types of Receipts: + +Order confirmation: What the customer receives after ordering. Can be transferred to an invoice or a delivery note. +Invoice: The main receipt of the order. It can be transferred to a delivery note, and a dunning date and level as well as the paid amount can be set. Also, a reminder can be printed. +Delivery Note: What the customer receives after the item has been delivered. +Credit: Similar to the invoice, but to be paid at a later date. The paid amount can also be set. +Cancellation: What the customer receives upon the cancellation of the order. + + -* _Copy order_: All values, orderitems included, are copyed and inserted in a new order (new order code, versnr. _1_). -* _New order version_: All values, orderitems included, are copyed and inserted in a **new order version** (versnr. + _1_). == Submodules diff --git a/entity/Order_entity/entityfields/activities/children/presetlinks_param/valueProcess.js b/entity/Order_entity/entityfields/activities/children/presetlinks_param/valueProcess.js index e4c6c134df6be187331e47d8c2c4d5a9871b7c2b..9dbbef1ab163f9b9ca0f675849aef45feaf65eac 100644 --- a/entity/Order_entity/entityfields/activities/children/presetlinks_param/valueProcess.js +++ b/entity/Order_entity/entityfields/activities/children/presetlinks_param/valueProcess.js @@ -10,9 +10,9 @@ if (contactId) links.push([ContactUtils.getContextByContactId(contactId), contactId]); } -if (vars.get("$field.SALESPROJECT_ID")) +if (vars.get("$field.OBJECT_ROWID")) { - links.push(["Salesproject", vars.get("$field.SALESPROJECT_ID")]); + links.push([vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")]); } result.object(links); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/address/valueProcess.js b/entity/Order_entity/entityfields/address/valueProcess.js deleted file mode 100644 index 4e0c4c185ea4a542b6b1dea65bbdc18b467da8ec..0000000000000000000000000000000000000000 --- a/entity/Order_entity/entityfields/address/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("system.vars"); - -if (vars.exists("$param.OrderAddress_param")) -{ - result.string(vars.get("$param.OrderAddress_param")); -} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/attributes/stateProcess.js b/entity/Order_entity/entityfields/attributes/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Order_entity/entityfields/attributes/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/attributetree/stateProcess.js b/entity/Order_entity/entityfields/attributetree/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Order_entity/entityfields/attributetree/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/cancel/documentation.adoc b/entity/Order_entity/entityfields/cancel/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..e3b0f3352779b56a024ac4e10fe06d1200db2153 --- /dev/null +++ b/entity/Order_entity/entityfields/cancel/documentation.adoc @@ -0,0 +1,2 @@ +== CANCEL +* _cancel_: sets the cancel checkbox to active. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/cancel/onActionProcess.js b/entity/Order_entity/entityfields/cancel/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f138c6f5779923d74ae1b3ecb9202739a28f1ad6 --- /dev/null +++ b/entity/Order_entity/entityfields/cancel/onActionProcess.js @@ -0,0 +1,36 @@ +import("Sql_lib"); +import("system.vars"); +import("system.neon"); +import("system.db"); +import("Order_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var id = vars.get("$field.SALESORDERID"); + +db.updateData("SALESORDER", ["CANCELLATION"], null, ["1"], SqlCondition.begin() + .andPrepareVars("SALESORDER.SALESORDERID", "$field.SALESORDERID") + .build("1=2")); +neon.refreshAll(); + +var contactId = vars.getString("$field.CONTACT_ID"); +var currency = vars.getString("$field.CURRENCY"); +var language = vars.getString("$field.ISOLANGUAGE"); +var header = vars.getString("$field.HEADER"); +var footer = vars.getString("$field.FOOTER"); +var offerId = vars.getString("$field.OFFER_ID"); +var deliveryTerm = vars.getString("$field.DELIVERYTERMS"); +var paymentTerm = vars.getString("$field.PAYMENTTERMS"); +var rowId = vars.getString("$field.OBJECT_ROWID"); +var objectType = vars.getString("$field.OBJECT_TYPE"); +var dunningDate = vars.getString("$field.DUNNINGDATE"); +var dunningLevel = vars.getString("$field.DUNNINGLEVEL"); +var orderType= $KeywordRegistry.orderType$cancellation(); +var cancellation= vars.getString("$field.CANCELLATION"); +var orderStatus=vars.getString("$field.ORDERSTATUS"); + + +OrderUtils.copyOrder(offerId, contactId, orderType, language, currency, header, footer, deliveryTerm, paymentTerm, objectType, rowId, dunningDate, dunningLevel, cancellation, orderStatus); + + + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/cancel/stateProcess.js b/entity/Order_entity/entityfields/cancel/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..64b25ea3d5a2cc521c892377b25790da145d9b02 --- /dev/null +++ b/entity/Order_entity/entityfields/cancel/stateProcess.js @@ -0,0 +1,27 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if(vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$confirmation()||vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$invoice()) + + if (vars.get("$field.CANCELLATION")=="0"){ + result.string(neon.COMPONENTSTATE_EDITABLE); + } + + else + result.string(neon.COMPONENTSTATE_DISABLED); + + else + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/cancellation/dropDownProcess.js b/entity/Order_entity/entityfields/cancellation/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..eb7b41eef018d34f85906aa931250cb812ff3392 --- /dev/null +++ b/entity/Order_entity/entityfields/cancellation/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/Order_entity/entityfields/cancellation/valueProcess.js b/entity/Order_entity/entityfields/cancellation/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..396d93a9c1ca3a7ed699ff8502147ec1159efaaa --- /dev/null +++ b/entity/Order_entity/entityfields/cancellation/valueProcess.js @@ -0,0 +1,16 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + + +if (vars.get("$this.value") == null) { + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null){ + if (vars.exists("$param.OrderCancellation_param") && vars.get("$param.OrderCancellation_param")) + { + result.string(vars.get("$param.OrderCancellation_param")); + } + else + result.string("0"); +} +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js b/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0c813a182c67edfa8cad70ef3f3ce43d0b06c126 --- /dev/null +++ b/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("PostalAddress_lib"); +import("system.result"); + +result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$field.ChosenPaymentAddress"))) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js b/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..b0019362e90c9d7ad19d6124cc9dc0b05ee34ebf --- /dev/null +++ b/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js @@ -0,0 +1,12 @@ +import("system.vars"); +import("system.neon"); +import("PostalAddress_lib"); +import("Entity_lib"); + +var newAddressId = vars.get("local.value"); + +if (newAddressId) +{ + neon.setFieldValue("$field.DELIVERYADDRESS", AddressUtils.getAddressById(newAddressId)); + + } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js b/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..daa4e4fa28136844a29bb325170ac9bb6c35b80c --- /dev/null +++ b/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js @@ -0,0 +1,18 @@ +import("Contact_lib"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if (((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null)) +{ + if (vars.get("$field.DELIVERYADDRESS")) + { + result.string(null); + } + else + { + var defaultAddressId = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID")); + if (defaultAddressId) + result.string(defaultAddressId); + } +} diff --git a/entity/Order_entity/entityfields/chosenpaymentaddress/displayValueProcess.js b/entity/Order_entity/entityfields/chosenpaymentaddress/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0c813a182c67edfa8cad70ef3f3ce43d0b06c126 --- /dev/null +++ b/entity/Order_entity/entityfields/chosenpaymentaddress/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("PostalAddress_lib"); +import("system.result"); + +result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$field.ChosenPaymentAddress"))) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js b/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..77ffefc857d9611484f01814de2ec23479998d09 --- /dev/null +++ b/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js @@ -0,0 +1,13 @@ +import("system.vars"); +import("system.neon"); +import("PostalAddress_lib"); +import("Entity_lib"); + +var newAddressId = vars.get("local.value"); + +if (newAddressId) +{ + neon.setFieldValue("$field.PAYMENTADDRESS", AddressUtils.getAddressById(newAddressId)); + neon.setFieldValue("$field.ChosenDeliveryAddress", AddressUtils.getAddressById(newAddressId)); + neon.setFieldValue("$field.DELIVERYADDRESS", AddressUtils.getAddressById(newAddressId)); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js b/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..083eb6bf297264e03ee2cfa1207c3d858897dcef --- /dev/null +++ b/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js @@ -0,0 +1,18 @@ +import("Contact_lib"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if (((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null)) +{ + if (vars.get("$field.PAYMENTADDRESS")) + { + result.string(null); + } + else + { + var defaultAddressId = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID")); + if (defaultAddressId) + result.string(defaultAddressId); + } +} diff --git a/entity/Order_entity/entityfields/contact_id/documentation.adoc b/entity/Order_entity/entityfields/contact_id/documentation.adoc index f8989a2242e89dd5d4eeca7ccb59e9ca0cccedc0..26184bc759b7e073397279194e3f09fa4c64deb8 100644 --- a/entity/Order_entity/entityfields/contact_id/documentation.adoc +++ b/entity/Order_entity/entityfields/contact_id/documentation.adoc @@ -7,4 +7,4 @@ Over this field the company or contact person of customer is linked. If set in the selected company or contact person, the following field value are taken over: -* LANGUAGE \ No newline at end of file +* ISOLANGUAGE \ No newline at end of file diff --git a/entity/Order_entity/entityfields/contact_id/onValueChange.js b/entity/Order_entity/entityfields/contact_id/onValueChange.js index 5ce78e6a9056118e8368c2c2d9acf2a620cfd52a..90bde5ed09496674f5fe694338b5a25ca0bae8ca 100644 --- a/entity/Order_entity/entityfields/contact_id/onValueChange.js +++ b/entity/Order_entity/entityfields/contact_id/onValueChange.js @@ -3,10 +3,10 @@ import("system.db"); import("Util_lib"); import("Entity_lib"); -var contactid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID")); +var contactid = vars.get("local.value"); if(contactid != "") { - var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); + var relData = db.array(db.ROW, "select ISOLANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); - if(relData[0] != "") vars.set("$field.LANGUAGE", relData[0]); + if(relData[0] != "") vars.set("$field.ISOLANGUAGE", relData[0]); } \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/organisationandcontactadresses/children/organisationid_param/valueProcess.js b/entity/Order_entity/entityfields/contactid_param/documentation.adoc similarity index 100% rename from entity/DSGVO_entity/entityfields/organisationandcontactadresses/children/organisationid_param/valueProcess.js rename to entity/Order_entity/entityfields/contactid_param/documentation.adoc diff --git a/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js b/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..928bc6a94ca7787626928dc47c2262baabb82854 --- /dev/null +++ b/entity/Order_entity/entityfields/contexts/children/whitelist/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$param.PossibleConnectionTypes")) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/countitems_param/valueProcess.js b/entity/Order_entity/entityfields/countitems_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fc714e95d0903906495442940ca974d4be2b1b59 --- /dev/null +++ b/entity/Order_entity/entityfields/countitems_param/valueProcess.js @@ -0,0 +1,15 @@ +//import("system.result"); +//import("system.vars"); +//import("system.neon"); +//import("system.entities"); +// +////var loadingConfig = entities.createConfigForLoadingConsumerRows().consumer("Orderitems"); +////var count = entities.getRowCount(loadingConfig); +// +//var conf = entities.createConfigForLoadingRows() +// .entity("Orderitem_entity") +// .provider("Orderitems") +// .addParameter("ContactId_param", vars.get("$field.CONTACT_ID")); +// +//var count=entities.getRowCount(conf); +//result.string(count); diff --git a/entity/Order_entity/entityfields/currency/displayValueProcess.js b/entity/Order_entity/entityfields/currency/displayValueProcess.js index 76d0d8a1e703554cba1c6987434ff62990691e36..c82b4d748061c5e19bf3bb21588121f5178257c2 100644 --- a/entity/Order_entity/entityfields/currency/displayValueProcess.js +++ b/entity/Order_entity/entityfields/currency/displayValueProcess.js @@ -3,8 +3,4 @@ import("system.vars"); import("Keyword_lib"); import("KeywordRegistry_basic"); -if (vars.exists("$param.OrderCurrency_param")) -{ - var currency = KeywordUtils.getViewValue($KeywordRegistry.currency(), vars.get("$param.OrderCurrency_param")); - result.string(currency); -} \ No newline at end of file +result.string(KeywordUtils.getViewValue($KeywordRegistry.currency(), vars.get("$field.CURRENCY"))); diff --git a/entity/Order_entity/entityfields/currency/valueProcess.js b/entity/Order_entity/entityfields/currency/valueProcess.js index 97b32dfd7d00c4003333ba6dd6fc95af6e383cb6..428b8d7716316722c89d40e18f3eb0593361b745 100644 --- a/entity/Order_entity/entityfields/currency/valueProcess.js +++ b/entity/Order_entity/entityfields/currency/valueProcess.js @@ -1,7 +1,13 @@ -import("system.result"); -import("system.vars"); - -if (vars.exists("$param.OrderCurrency_param")) -{ - result.string(vars.get("$param.OrderCurrency_param")); -} \ No newline at end of file +import("system.neon"); +import("system.result"); +import("system.vars"); +import("KeywordRegistry_basic"); + +if (vars.exists("$param.OrderCurrency_param") && vars.get("$param.OrderCurrency_param")) +{ + result.string(vars.get("$param.OrderCurrency_param")); +} +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +{ + result.string($KeywordRegistry.currency$eur()); +} diff --git a/entity/Order_entity/entityfields/deliveryaddress/valueProcess.js b/entity/Order_entity/entityfields/deliveryaddress/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..10da985c56a171302f7837c593e9e4cf7f21b80a --- /dev/null +++ b/entity/Order_entity/entityfields/deliveryaddress/valueProcess.js @@ -0,0 +1,10 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null)){ +if (vars.get("$param.OrderDeliveryAddress_param")) +{ + result.string(vars.get("$param.OrderDeliveryAddress_param")); +} +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/deliveryterms/displayValueProcess.js b/entity/Order_entity/entityfields/deliveryterms/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cfacf44952d5160f99c153af98a96d2a434c7432 --- /dev/null +++ b/entity/Order_entity/entityfields/deliveryterms/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.deliveryTerm(), vars.get("$field.DELIVERYTERMS"))); diff --git a/entity/Order_entity/entityfields/deliveryterms/documentation.adoc b/entity/Order_entity/entityfields/deliveryterms/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..25f97e5e351e8f2f6f867dc7a5907e429c37f59f --- /dev/null +++ b/entity/Order_entity/entityfields/deliveryterms/documentation.adoc @@ -0,0 +1,4 @@ + +== Delivery terms + +Contains the delivery terms as keywords to choose from. (frei Haus, CIF, ab werk) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/deliveryterms/valueProcess.js b/entity/Order_entity/entityfields/deliveryterms/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..35c2c1c5d5d22158f534b0022173bdaa4a225abb --- /dev/null +++ b/entity/Order_entity/entityfields/deliveryterms/valueProcess.js @@ -0,0 +1,33 @@ +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("AttributeRegistry_basic"); +import("system.neon"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); +import("Contact_lib"); + + + +if (vars.get("$param.OrderDeliveryTerm_param")) +{ + result.string(vars.get("$param.OrderDeliveryTerm_param")); +} +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var presetValue = ""; + var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")) + if (contactIds.length >= 3 && contactIds[2]) + { + var orgContactId = ContactUtils.getOrgContactId(contactIds[2]); + if (orgContactId) + { + presetValue = AttributeRelationUtils.getAttribute($AttributeRegistry.deliveryTerm(), orgContactId); + } + } + + if (presetValue) + result.string(presetValue); + else + result.string(KeywordUtils.getFirst($KeywordRegistry.deliveryTerm())); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetype_param/valueProcess.js b/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..90d0786d0d58c1664a2c481e5583a260dd7da783 --- /dev/null +++ b/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetype_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("TEX"); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaigncosts/children/campaignsteps_param/valueProcess.js b/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetypeclassification_param/valueProcess.js similarity index 59% rename from entity/CampaignCost_entitiy/entityfields/campaigncosts/children/campaignsteps_param/valueProcess.js rename to entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetypeclassification_param/valueProcess.js index 4f08839a6a4d79cdb90175f7b7f194a9902ec27f..d41d91fd2b945318cc85efb3bfeb69181d952bbd 100644 --- a/entity/CampaignCost_entitiy/entityfields/campaigncosts/children/campaignsteps_param/valueProcess.js +++ b/entity/Order_entity/entityfields/documenttemplatetexfooter/children/documenttemplatetypeclassification_param/valueProcess.js @@ -1,2 +1,2 @@ -import("system.result"); -result.string(0) \ No newline at end of file +import("system.result"); +result.string(6); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetype_param/valueProcess.js b/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..90d0786d0d58c1664a2c481e5583a260dd7da783 --- /dev/null +++ b/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetype_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("TEX"); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetypeclassification_param/valueProcess.js b/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetypeclassification_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3d6da693a6097d19172ad816dc6465e126fec9a9 --- /dev/null +++ b/entity/Order_entity/entityfields/documenttemplatetexheader/children/documenttemplatetypeclassification_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string(5) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/dunningdate/documentation.adoc b/entity/Order_entity/entityfields/dunningdate/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..2f60d8622ac08aca1aa6abcc9afd5ea258230aba --- /dev/null +++ b/entity/Order_entity/entityfields/dunningdate/documentation.adoc @@ -0,0 +1,5 @@ + + +== Dunning date + +Contains the dunning date. Field only visible when the order type is invoice, or when a new order is being created. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/dunningdate/stateProcess.js b/entity/Order_entity/entityfields/dunningdate/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bd8b298328ee30fe9401afd20691b51f7034dcd0 --- /dev/null +++ b/entity/Order_entity/entityfields/dunningdate/stateProcess.js @@ -0,0 +1,13 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); +import("KeywordRegistry_basic") + +if((vars.get("$field.ORDERTYPE") == $KeywordRegistry.orderType$invoice()) || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + { + result.string(neon.COMPONENTSTATE_AUTO); + } +else + { + result.string(neon.COMPONENTSTATE_INVISIBLE); + } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/dunninglevel/displayValueProcess.js b/entity/Order_entity/entityfields/dunninglevel/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..01280b0e5f235bf992f3f1cb255319a98197f0a5 --- /dev/null +++ b/entity/Order_entity/entityfields/dunninglevel/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.dunningLevel(), vars.get("$field.DUNNINGLEVEL"))); diff --git a/entity/Order_entity/entityfields/dunninglevel/documentation.adoc b/entity/Order_entity/entityfields/dunninglevel/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..bfe71ad24411752cdee9e659a99ef7ecd7adb597 --- /dev/null +++ b/entity/Order_entity/entityfields/dunninglevel/documentation.adoc @@ -0,0 +1,6 @@ + + + +== Dunning level + +Contains the dunning level 1 or 2. Field only visible when the order type is invoice, or when a new order is being created. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/dunninglevel/stateProcess.js b/entity/Order_entity/entityfields/dunninglevel/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bd8b298328ee30fe9401afd20691b51f7034dcd0 --- /dev/null +++ b/entity/Order_entity/entityfields/dunninglevel/stateProcess.js @@ -0,0 +1,13 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); +import("KeywordRegistry_basic") + +if((vars.get("$field.ORDERTYPE") == $KeywordRegistry.orderType$invoice()) || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + { + result.string(neon.COMPONENTSTATE_AUTO); + } +else + { + result.string(neon.COMPONENTSTATE_INVISIBLE); + } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/dunningtext/valueProcess.js b/entity/Order_entity/entityfields/dunningtext/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..09aaffb4130def69b9f334577425015ae6a5d326 --- /dev/null +++ b/entity/Order_entity/entityfields/dunningtext/valueProcess.js @@ -0,0 +1,14 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); +import("Date_lib"); + + +if (vars.get("$this.value") == null){ + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")|| neon.OPERATINGSTATE_NEW ){ + + result.string("Bitte zahlen Sie den ausstehenden Betrag, dies ist die erste/zweite Mahnung.") +} + +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/footer/valueProcess.js b/entity/Order_entity/entityfields/footer/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..da93ce5f2efc0488c2259f82b3b5c783337a7375 --- /dev/null +++ b/entity/Order_entity/entityfields/footer/valueProcess.js @@ -0,0 +1,28 @@ +import("Sql_lib"); +import("system.result"); +import("system.vars"); +import("system.neon"); +import("system.db"); +import("system.util"); + +if (vars.get("$this.value") == null) +{ + if (vars.exists("$param.OrderFooter_param")) + { + result.string(vars.get("$param.OrderFooter_param")); + } + + else if(vars.get("$this.value")) + result.string(vars.get("$this.value")); + + else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string("Danke sehr:"); //TODO: translate + + if (vars.get("$field.ChosenTexFooter") != "") + { + var binaryId = db.cell(SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.ChosenTexFooter") + .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getSystemAlias()); + result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getSystemAlias()))); + } +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/fullordercode/valueProcess.js b/entity/Order_entity/entityfields/fullordercode/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5a188eb0a4498a62bf5f10cb2991eb148579ea1f --- /dev/null +++ b/entity/Order_entity/entityfields/fullordercode/valueProcess.js @@ -0,0 +1,9 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +//a fieldGroup cannot be placed in a table (filter-view) at the moment and therefore a separate field is needed: +if(!vars.get("$field.SALESORDERCODE") && !vars.get("$field.VERSNR")) + result.string(translate.text("Order")); +else + result.string(vars.get("$field.SALESORDERCODE") + "-" + vars.get("$field.VERSNR")); diff --git a/entity/Order_entity/entityfields/header/valueProcess.js b/entity/Order_entity/entityfields/header/valueProcess.js index 5339918ba7cc5cf540ca69af540d8e26fe3c6d90..038bf931e38f6a3ea50e99194e5da823d96a9fd6 100644 --- a/entity/Order_entity/entityfields/header/valueProcess.js +++ b/entity/Order_entity/entityfields/header/valueProcess.js @@ -1,7 +1,26 @@ -import("system.result"); -import("system.vars"); - -if (vars.exists("$param.OrderHeader_param")) -{ - result.string(vars.get("$param.OrderHeader_param")); +import("Sql_lib"); +import("system.result"); +import("system.vars"); +import("system.neon"); +import("system.db"); +import("system.util"); + +if (vars.get("$this.value") == null) +{ + if(vars.exists("$param.OrderHeader_param") && vars.get("$param.OrderHeader_param")) + result.string(vars.get("$param.OrderHeader_param")); + + else if(vars.get("$this.value")) + result.string(vars.get("$this.value")); + + else if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string("Gerne bieten wir Ihnen wie folgt an:"); //TODO: translation + + if (vars.get("$field.ChosenTexHeader") != "") + { + var binaryId = db.cell(SqlCondition.begin() + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$field.ChosenTexHeader") + .buildSql("select ID from ASYS_BINARIES"), SqlUtils.getSystemAlias()); + result.string(util.decodeBase64String(db.getBinaryContent(binaryId, SqlUtils.getSystemAlias()))); + } } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/image/valueProcess.js b/entity/Order_entity/entityfields/image/valueProcess.js index 17507224aefcb223da7f2e3edca6b79ea9281930..81da551b8c512afb8e53ea1a4acd9c46934a663e 100644 --- a/entity/Order_entity/entityfields/image/valueProcess.js +++ b/entity/Order_entity/entityfields/image/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string("TEXT:" + vars.getString("$field.STATUS.displayValue")); +result.string("TEXT:" + vars.getString("$field.ORDERTYPE.displayValue")); diff --git a/entity/Order_entity/entityfields/language/displayValueProcess.js b/entity/Order_entity/entityfields/isolanguage/displayValueProcess.js similarity index 100% rename from entity/Order_entity/entityfields/language/displayValueProcess.js rename to entity/Order_entity/entityfields/isolanguage/displayValueProcess.js diff --git a/entity/Order_entity/entityfields/language/valueProcess.js b/entity/Order_entity/entityfields/isolanguage/valueProcess.js similarity index 96% rename from entity/Order_entity/entityfields/language/valueProcess.js rename to entity/Order_entity/entityfields/isolanguage/valueProcess.js index d2dcc59e62dc1405050410cdda80cb7be6740cdb..b1684b313cd013775775c1711f7b80b88cc13071 100644 --- a/entity/Order_entity/entityfields/language/valueProcess.js +++ b/entity/Order_entity/entityfields/isolanguage/valueProcess.js @@ -1,7 +1,7 @@ -import("system.result"); -import("system.vars"); - -if (vars.exists("$param.OrderLanguage_param")) -{ - result.string(vars.get("$param.OrderLanguage_param")); +import("system.result"); +import("system.vars"); + +if (vars.exists("$param.OrderLanguage_param")) +{ + result.string(vars.get("$param.OrderLanguage_param")); } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/keyworddeliveryterms/children/containername_param/valueProcess.js b/entity/Order_entity/entityfields/keyworddeliveryterms/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..25f473302308508a77047bc599cfaaae3b8339d1 --- /dev/null +++ b/entity/Order_entity/entityfields/keyworddeliveryterms/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.deliveryTerm()); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/keyworddunninglevels/children/containername_param/valueProcess.js b/entity/Order_entity/entityfields/keyworddunninglevels/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..00fd383bd950dc0282404b55e6b84ef608fb6729 --- /dev/null +++ b/entity/Order_entity/entityfields/keyworddunninglevels/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +result.string($KeywordRegistry.dunningLevel()); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/keywordordertypes/children/containername_param/valueProcess.js b/entity/Order_entity/entityfields/keywordordertypes/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e04adaf628833a255b6442e9e0469423719ac8eb --- /dev/null +++ b/entity/Order_entity/entityfields/keywordordertypes/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +result.string($KeywordRegistry.orderType()); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/keywordpaymentterms/children/containername_param/valueProcess.js b/entity/Order_entity/entityfields/keywordpaymentterms/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f56caab574a4a81ef3ad1cce2c466198062cef06 --- /dev/null +++ b/entity/Order_entity/entityfields/keywordpaymentterms/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.paymentTerm()); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Order_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Order_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Order_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index 330f295e531bcbfcc893cb021d313a15a279abfb..b5acc0e5c7cd1d3b12b79af369bdeb74e5b2fce2 100644 --- a/entity/Order_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Order_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.SALESORDERID"), tableNames: ["AB_ATTRIBUTERELATION", "SALESORDERITEM", "PRODUCT"]}); -res.push({id: vars.get("$field.SALESORDERID"), tableNames: ["SALESORDER"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.SALESORDERID"), tableNames: ["AB_ATTRIBUTERELATION", "SALESORDERITEM", "PRODUCT"]}); +res.push({id: vars.get("$field.SALESORDERID"), tableNames: ["SALESORDER"]}); + +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/Order_entity/entityfields/net/displayValueProcess.js b/entity/Order_entity/entityfields/net/displayValueProcess.js index b1c561c1f00014cbcd0669f0d810bd9fdb5ba052..450ae0cfd9fa1701eeb4d4e7c049a3c8fb8fc7a0 100644 --- a/entity/Order_entity/entityfields/net/displayValueProcess.js +++ b/entity/Order_entity/entityfields/net/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.NET"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/newactivity/documentation.adoc b/entity/Order_entity/entityfields/newactivity/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..a7173e3d3ee541dd2afb6c48779106fba0c60f97 --- /dev/null +++ b/entity/Order_entity/entityfields/newactivity/documentation.adoc @@ -0,0 +1,2 @@ +== New Activity +* _New activity_: All values are copied and inserted in a new activity (new activity code, versnr. _1_). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/newactivity/onActionProcess.js b/entity/Order_entity/entityfields/newactivity/onActionProcess.js index 1a27d3d454d20447d05ec6064c1852a7d9e49d01..d56c51af47ff83966ed6b36b0eec6b14de1706ed 100644 --- a/entity/Order_entity/entityfields/newactivity/onActionProcess.js +++ b/entity/Order_entity/entityfields/newactivity/onActionProcess.js @@ -10,9 +10,10 @@ if (contactId) links.push([ContactUtils.getContextByContactId(contactId), contactId]); } -if (vars.get("$field.SALESPROJECT_ID")) +if (vars.get("$field.OBJECT_ROWID")) { - links.push(["Salesproject", vars.get("$field.SALESPROJECT_ID")]); + links.push([vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")]); } + ActivityUtils.createNewActivity(vars.get("$field.SALESORDERID"), links); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/neworder/documentation.adoc b/entity/Order_entity/entityfields/neworder/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..4c9ee527fbffcb9873e60d3e07742bcca80c7cd5 --- /dev/null +++ b/entity/Order_entity/entityfields/neworder/documentation.adoc @@ -0,0 +1,2 @@ +== COPY ORDER +* _Copy order_: All values, orderitems included, are copied and inserted in a new order (new order code, versnr. _1_). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/neworder/onActionProcess.js b/entity/Order_entity/entityfields/neworder/onActionProcess.js index 040f89358e13a4c422ecc072f2ddde0b1d0e291b..d84e79a2958d057aca8b66fc2e61c51ce6635283 100644 --- a/entity/Order_entity/entityfields/neworder/onActionProcess.js +++ b/entity/Order_entity/entityfields/neworder/onActionProcess.js @@ -1,26 +1,28 @@ import("system.vars"); import("system.neon"); -import("Util_lib"); -import("Neon_lib"); import("Order_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); -var InputMapping = { - - "SALESORDER": { - condition: "SALESORDERID = '" + vars.get("$field.SALESORDERID") + "'" - , ValueMapping: { - "SALESORDER_ID": "" - , "SALESORDERCODE": OrderUtils.getNextOrderNumber() - , "VERSNR": "1" - } - , SubModules:{ - "SALESORDERITEM": { - condition: "SALESORDER_ID = '" + vars.get("$field.SALESORDERID") + "' order by ITEMSORT" - } - } - } -} +var contactId = vars.getString("$field.CONTACT_ID"); +var currency = vars.getString("$field.CURRENCY"); +var language = vars.getString("$field.ISOLANGUAGE"); +var header = vars.getString("$field.HEADER"); +var footer = vars.getString("$field.FOOTER"); +var offerId = vars.getString("$field.OFFER_ID"); +var deliveryTerm = vars.getString("$field.DELIVERYTERMS"); +var paymentTerm = vars.getString("$field.PAYMENTTERMS"); +var paymentAddress = vars.getString("$field.PAYMENTADDRESS"); +var deliveryAddress = vars.getString("$field.DELIVERYADDRESS"); +var rowId = vars.getString("$field.OBJECT_ROWID"); +var objectType = vars.getString("$field.OBJECT_TYPE"); +var dunningDate = vars.getString("$field.DUNNINGDATE"); +var dunningLevel = vars.getString("$field.DUNNINGLEVEL"); +var orderType= vars.getString("$field.ORDERTYPE"); +var cancellation= vars.getString("$field.CANCELLATION"); +var orderStatus=vars.getString("$field.ORDERSTATUS"); -var ModulesMapping = CopyModuleUtils.copyModule(InputMapping); -CopyModuleUtils.openNewModules("Order", ModulesMapping); \ No newline at end of file + +OrderUtils.copyOrder(offerId, contactId, orderType, language, currency, header, footer, deliveryTerm, paymentTerm, paymentAddress, deliveryAddress, objectType, rowId, dunningDate, dunningLevel, cancellation, orderStatus); + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/neworderversion/documentation.adoc b/entity/Order_entity/entityfields/neworderversion/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..6bbf8c93b4fab59181e46a92743a1eddd3ac0ab7 --- /dev/null +++ b/entity/Order_entity/entityfields/neworderversion/documentation.adoc @@ -0,0 +1,2 @@ +== NEW ORDER VERSION +* _New order version_: All values, orderitems included, are copied and inserted in a **new order version** (versnr. + _1_). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/neworderversion/onActionProcess.js b/entity/Order_entity/entityfields/neworderversion/onActionProcess.js index fdeec67b436c90312e53cecca701505c35368158..7c40ce8cdba15306b3d8fcee7d73dc1aa11ae3b9 100644 --- a/entity/Order_entity/entityfields/neworderversion/onActionProcess.js +++ b/entity/Order_entity/entityfields/neworderversion/onActionProcess.js @@ -1,26 +1,26 @@ import("system.vars"); import("system.neon"); -import("Util_lib"); -import("Neon_lib"); import("Order_lib"); -var InputMapping = { - - "SALESORDER": { - condition: "SALESORDERID = '" + vars.get("$field.SALESORDERID") + "'" - , ValueMapping: { - "SALESORDER_ID": vars.get("$field.SALESORDERID") - , "SALESORDERCODE": vars.get("$field.SALESORDERCODE") - , "VERSNR": OrderUtils.getNextOrderVersionNumber(vars.get("$field.SALESORDERCODE")) - } - , SubModules:{ - "SALESORDERITEM": { - condition: "SALESORDER_ID = '" + vars.get("$field.SALESORDERID") + "' order by ITEMSORT" - } - } - } +var params = { + "ContactId_param" : vars.get("$field.CONTACT_ID"), + "ObjectType_param" : vars.get("$field.OBJECT_TYPE"), + "ObjectRowId_param" : vars.get("$field.OBJECT_ROWID"), + "OrderLanguage_param" : vars.get("$field.ISOLANGUAGE"), + "OfferId_param" : vars.get("$field.OFFER_ID"), + "OrderCode_param" : vars.get("$field.SALESORDERCODE"), + "OrderVersnr_param" : OrderUtils.getNextOrderVersionNumber(vars.get("$field.SALESORDERCODE")), + "OrderCurrency_param" : vars.get("$field.CURRENCY"), + "OrderPaymentAddress_param" : vars.get("$field.PAYMENTADDRESS"), + "OrderDeliveryAddress_param" : vars.get("$field.DELIVERYADDRESS"), + "OrderHeader_param" : vars.get("$field.HEADER"), + "OrderFooter_param" : vars.get("$field.FOOTER"), + "OrderDeliveryTerm_param" : vars.get("$field.DELIVERYTERMS"), + "OrderPaymentTerm_param" : vars.get("$field.PAYMENTTERMS"), + "OrderDunningDate_param" : vars.get("$field.DUNNINGDATE"), + "OrderDunningLevel_param" : vars.get("$field.DUNNINGLEVEL"), + "OrderType_param" : vars.get("$field.ORDERTYPE"), + "OrderCancellation_param" : vars.get("$field.CANCELLATION"), + "OrderStatus_param" : vars.get("$field.ORDERSTATUS") } - -var ModulesMapping = CopyModuleUtils.copyModule(InputMapping); - -CopyModuleUtils.openNewModules("Order", ModulesMapping); \ No newline at end of file +neon.openContext("Order", null, null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/newtask/documentation.adoc b/entity/Order_entity/entityfields/newtask/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..b1f9a15db8de26020cfc53e496f6098960a8f8f5 --- /dev/null +++ b/entity/Order_entity/entityfields/newtask/documentation.adoc @@ -0,0 +1,2 @@ +== NEW TASK +* _New task_: All values are copied and inserted in a new task (new task code, versnr. _1_). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/newtask/onActionProcess.js b/entity/Order_entity/entityfields/newtask/onActionProcess.js index 3d0aeaf0beab976054701f3a58a709df8e67de92..8420e8850a094efad475ada78e9527cc3f89bbe7 100644 --- a/entity/Order_entity/entityfields/newtask/onActionProcess.js +++ b/entity/Order_entity/entityfields/newtask/onActionProcess.js @@ -10,9 +10,9 @@ if (contactId) links.push([ContactUtils.getContextByContactId(contactId), contactId]); } -if (vars.get("$field.SALESPROJECT_ID")) +if (vars.get("$field.OBJECT_ROWID")) { - links.push(["Salesproject", vars.get("$field.SALESPROJECT_ID")]); + links.push([vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")]); } TaskUtils.createNewTask(vars.get("$field.SALESORDERID"), links); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8b080bceea92c146a676b0f33cc7cb87d4e86b9d --- /dev/null +++ b/entity/Order_entity/entityfields/object_rowid/displayValueProcess.js @@ -0,0 +1,11 @@ +import("system.neon"); +import("system.vars"); +import("system.db"); +import("system.result"); +import("Context_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { + result.string(""); +} else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { + result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/object_rowid/linkedContextProcess.js b/entity/Order_entity/entityfields/object_rowid/linkedContextProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0d20a44e4ae74665b6b607aef5513cc742508221 --- /dev/null +++ b/entity/Order_entity/entityfields/object_rowid/linkedContextProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getContextName(vars.get("$field.OBJECT_TYPE"))) diff --git a/entity/Order_entity/entityfields/object_rowid/mandatoryProcess.js b/entity/Order_entity/entityfields/object_rowid/mandatoryProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4736fe4bfc8bfa641c18710e9b5a5303e967b9a6 --- /dev/null +++ b/entity/Order_entity/entityfields/object_rowid/mandatoryProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("Contact_lib"); + +var type = ContactUtils.getContactType(vars.get("$field.CONTACT_ID"), vars.get("$field.CONTACT_PERSON_ID"), vars.get("$field.CONTACT_ORG_ID")); + +result.string(type != 2); diff --git a/entity/Order_entity/entityfields/object_rowid/titleProcess.js b/entity/Order_entity/entityfields/object_rowid/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cf72d33d2860670c7b42bf809006b499c9f49432 --- /dev/null +++ b/entity/Order_entity/entityfields/object_rowid/titleProcess.js @@ -0,0 +1,21 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Context_lib"); + +var possibleTypes = vars.getString("$param.PossibleConnectionTypes"); +var title = translate.text("Link"); + +if (possibleTypes) +{ + possibleTypes = JSON.parse(possibleTypes); + if (possibleTypes.length == 1) + { + var contextTitle = ContextUtils.getTitle(possibleTypes[0]); + if (contextTitle) + title = contextTitle; + } +} + +result.string(title); + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/object_rowid/valueProcess.js b/entity/Order_entity/entityfields/object_rowid/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..947890744e193277b6c6e8495a241848c85dd084 --- /dev/null +++ b/entity/Order_entity/entityfields/object_rowid/valueProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) + result.string(vars.get("$param.ObjectRowId_param")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/object_type/displayValueProcess.js b/entity/Order_entity/entityfields/object_type/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d7b4dedc2e4402d6ce48c1acd8eb730acc2601d2 --- /dev/null +++ b/entity/Order_entity/entityfields/object_type/displayValueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); +import("system.project"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_TYPE")) { + result.string(""); +} else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { + result.string(project.getDataModel(project.DATAMODEL_KIND_CONTEXT, vars.get("$field.OBJECT_TYPE"))[1]); +} diff --git a/entity/Order_entity/entityfields/object_type/mandatoryProcess.js b/entity/Order_entity/entityfields/object_type/mandatoryProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4736fe4bfc8bfa641c18710e9b5a5303e967b9a6 --- /dev/null +++ b/entity/Order_entity/entityfields/object_type/mandatoryProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("Contact_lib"); + +var type = ContactUtils.getContactType(vars.get("$field.CONTACT_ID"), vars.get("$field.CONTACT_PERSON_ID"), vars.get("$field.CONTACT_ORG_ID")); + +result.string(type != 2); diff --git a/entity/Order_entity/entityfields/object_type/valueProcess.js b/entity/Order_entity/entityfields/object_type/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..55bd8cc69a8e1aaf581a117bfa22becd8581c312 --- /dev/null +++ b/entity/Order_entity/entityfields/object_type/valueProcess.js @@ -0,0 +1,19 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Context_lib") + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +{ + if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) + { + result.string(vars.get("$param.ObjectType_param")); + } + else if (vars.exists("$param.PossibleConnectionTypes") && vars.get("$param.PossibleConnectionTypes")) + { + var possible = JSON.parse(vars.getString("$param.PossibleConnectionTypes")); + if (possible.length > 0) + result.string(possible[0]); + } +} + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js b/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c5efd0f6d8a6d05a0f2f5e4585dfbc47fbbfdeb2 --- /dev/null +++ b/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +if (vars.get("$field.CONTACT_ID")) +{ + var ids = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); + if (ids.length >= 3 && ids[2]) + result.string(ids[2]); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/objects/children/objecttype_param/valueProcess.js b/entity/Order_entity/entityfields/objects/children/objecttype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4238ef7d3313d43079cfa870caa675f766839cf6 --- /dev/null +++ b/entity/Order_entity/entityfields/objects/children/objecttype_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.OBJECT_TYPE")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/offers/children/contactid_param/valueProcess.js b/entity/Order_entity/entityfields/offers/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7b92c1bb14aa08001b7d5738111337ab7e81f4cc --- /dev/null +++ b/entity/Order_entity/entityfields/offers/children/contactid_param/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +if (vars.get("$field.CONTACT_ID")) +{ + var ids = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); + if (ids.length >= 3 && ids[2]) + result.string(ids[2]); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/openadminview/onActionProcess.js b/entity/Order_entity/entityfields/openadminview/onActionProcess.js index a253442813b4782139e4af275015c1fffc7f2e14..79f53cbdde3097ca224b83afaac2a8945c983785 100644 --- a/entity/Order_entity/entityfields/openadminview/onActionProcess.js +++ b/entity/Order_entity/entityfields/openadminview/onActionProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("Context_lib"); AdminViewUtils.open("SALESORDERID", [ - ["SALESPROJECT_ID", vars.get("$field.SALESPROJECT_ID")], + ["SALESPROJECT_ID", vars.get("$field.OBJECT_ROWID")], ["OFFER_ID", vars.get("$field.OFFER_ID")], ["CONTACT_ID", vars.get("$field.CONTACT_ID")], ["CONTACT_ORG_ID", vars.get("$field.CONTACT_ORG_ID")], diff --git a/entity/Order_entity/entityfields/ordercode_versnr_fieldgroup/valueProcess.js b/entity/Order_entity/entityfields/ordercode_versnr_fieldgroup/valueProcess.js index dc74779ab731a8898e922e446340164b5a1cc791..e63d77e5efd06bcf3bf3e63254ae41fbf574e49b 100644 --- a/entity/Order_entity/entityfields/ordercode_versnr_fieldgroup/valueProcess.js +++ b/entity/Order_entity/entityfields/ordercode_versnr_fieldgroup/valueProcess.js @@ -1,4 +1,8 @@ +import("system.translate"); import("system.result"); import("system.vars"); -result.string(vars.get("$field.SALESORDERCODE") + "-" + vars.get("$field.VERSNR")); +if(!vars.get("$field.SALESORDERCODE") && !vars.get("$field.VERSNR")) + result.string(translate.text("Receipt")); +else + result.string(vars.get("$field.SALESORDERCODE") + "-" + vars.get("$field.VERSNR")); diff --git a/entity/DescriptionTranslation_entity/recordcontainers/db/recordfieldmappings/lang.value/expression.js b/entity/Order_entity/entityfields/ordercurrency_param/valueProcess.js similarity index 100% rename from entity/DescriptionTranslation_entity/recordcontainers/db/recordfieldmappings/lang.value/expression.js rename to entity/Order_entity/entityfields/ordercurrency_param/valueProcess.js diff --git a/entity/Order_entity/entityfields/orderitems/children/orderstatus_param/valueProcess.js b/entity/Order_entity/entityfields/orderitems/children/orderstatus_param/valueProcess.js index c077bf5964a863059f2629603660d7d7eda02492..7f21ae8769d3a3f72ff9f8bbe422a90c3afd1edd 100644 --- a/entity/Order_entity/entityfields/orderitems/children/orderstatus_param/valueProcess.js +++ b/entity/Order_entity/entityfields/orderitems/children/orderstatus_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$field.STATUS")); \ No newline at end of file +result.string(vars.get("$field.ORDERSTATUS")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/orderstatus/dropDownProcess.js b/entity/Order_entity/entityfields/orderstatus/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..eb7b41eef018d34f85906aa931250cb812ff3392 --- /dev/null +++ b/entity/Order_entity/entityfields/orderstatus/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/Order_entity/entityfields/orderstatus/valueProcess.js b/entity/Order_entity/entityfields/orderstatus/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f5ecd3b2f061a50dc0f1dd155c269806ad5b6d90 --- /dev/null +++ b/entity/Order_entity/entityfields/orderstatus/valueProcess.js @@ -0,0 +1,16 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + + +if (vars.get("$this.value") == null) { + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null){ + if (vars.exists("$param.OrderStatus_param") && vars.get("$param.OrderStatus_param")) + { + result.string(vars.get("$param.OrderStatus_param")); + } + else + result.string("0"); +} +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/ordertype/displayValueProcess.js b/entity/Order_entity/entityfields/ordertype/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..645ec2dfed45f33bf8783a208c0da8aca32f088e --- /dev/null +++ b/entity/Order_entity/entityfields/ordertype/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.orderType(), vars.get("$field.ORDERTYPE"))); diff --git a/entity/Order_entity/entityfields/ordertype/documentation.adoc b/entity/Order_entity/entityfields/ordertype/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..07da62f7c355e4ca2e01041c2496f240e2a2a33c --- /dev/null +++ b/entity/Order_entity/entityfields/ordertype/documentation.adoc @@ -0,0 +1,4 @@ + +== Order type + +Contains the order type as keywords to choose from. (Order confirmation, delivery note, invoice, credit, cancellation). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/ordertype/valueProcess.js b/entity/Order_entity/entityfields/ordertype/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1a8c788d8297f9560d2707bd9795989748352d18 --- /dev/null +++ b/entity/Order_entity/entityfields/ordertype/valueProcess.js @@ -0,0 +1,23 @@ +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("AttributeRegistry_basic"); +import("system.neon"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); +import("Contact_lib"); + + +if (vars.get("$this.value") == null) { + if (vars.exists("$param.OrderType_param") && vars.get("$param.OrderType_param")) + { + result.string(vars.get("$param.OrderType_param")); + } + + + else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + { + result.string(KeywordUtils.getFirst($KeywordRegistry.orderType())); + } + +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paid/displayValueProcess.js b/entity/Order_entity/entityfields/paid/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..41eb0973521153ec8af5545fd8105202745e7a43 --- /dev/null +++ b/entity/Order_entity/entityfields/paid/displayValueProcess.js @@ -0,0 +1,6 @@ +import("Util_lib"); +import("system.vars"); +import("system.translate"); +import("system.result"); + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.PAID"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paid/stateProcess.js b/entity/Order_entity/entityfields/paid/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bd8b298328ee30fe9401afd20691b51f7034dcd0 --- /dev/null +++ b/entity/Order_entity/entityfields/paid/stateProcess.js @@ -0,0 +1,13 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); +import("KeywordRegistry_basic") + +if((vars.get("$field.ORDERTYPE") == $KeywordRegistry.orderType$invoice()) || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + { + result.string(neon.COMPONENTSTATE_AUTO); + } +else + { + result.string(neon.COMPONENTSTATE_INVISIBLE); + } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paydate/stateProcess.js b/entity/Order_entity/entityfields/paydate/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..08bc5d1caf244373130abbf6cc954a83fe914020 --- /dev/null +++ b/entity/Order_entity/entityfields/paydate/stateProcess.js @@ -0,0 +1,13 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); +import("KeywordRegistry_basic") + +if(vars.get("$field.ORDERTYPE") != $KeywordRegistry.orderType$confirmation()|| vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + { + result.string(neon.COMPONENTSTATE_AUTO); + } +else + { + result.string(neon.COMPONENTSTATE_INVISIBLE); + } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paydate/valueProcess.js b/entity/Order_entity/entityfields/paydate/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/Order_entity/entityfields/payduedate/documentation.adoc b/entity/Order_entity/entityfields/payduedate/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..4e6d8e6314d63ff3794447d4b263951518d69a14 --- /dev/null +++ b/entity/Order_entity/entityfields/payduedate/documentation.adoc @@ -0,0 +1,4 @@ +== PAYDUEDATE + +This field indicates when the payment is due. It is dependent on the PAYMENTTTERMS field, whether to be 7 days, 30 days or 38 days after the order +creation date. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/payduedate/valueProcess.js b/entity/Order_entity/entityfields/payduedate/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ff67ec6a8bc2a68698f0ae7f8cba5be3c6b697ef --- /dev/null +++ b/entity/Order_entity/entityfields/payduedate/valueProcess.js @@ -0,0 +1,7 @@ +import("system.datetime"); +import("system.result"); +import("system.vars"); +import("Keyword_lib"); + +var days= KeywordUtils.getAttributeRelation(vars.get("$field.PAYMENTTERMS"), "PaymentTerm", "dayNumber", "0"); +result.string(parseInt(vars.get("$field.SALESORDERDATE")) + datetime.ONE_DAY * parseInt(days)); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paymentaddress/valueProcess.js b/entity/Order_entity/entityfields/paymentaddress/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8bdbd2e1e87d26be0e3ae0eacfa0585c0fef0018 --- /dev/null +++ b/entity/Order_entity/entityfields/paymentaddress/valueProcess.js @@ -0,0 +1,10 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null)){ +if (vars.get("$param.OrderPaymentAddress_param")) +{ + result.string(vars.get("$param.OrderPaymentAddress_param")); +} +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paymentterms/displayValueProcess.js b/entity/Order_entity/entityfields/paymentterms/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..720b4205ef659c382c2a5f891f3d7b1d51424fae --- /dev/null +++ b/entity/Order_entity/entityfields/paymentterms/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.paymentTerm(), vars.get("$field.PAYMENTTERMS"))); diff --git a/entity/Order_entity/entityfields/paymentterms/documentation.adoc b/entity/Order_entity/entityfields/paymentterms/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..f008318b80c172dfcf151baac9cc9e9bb5177b50 --- /dev/null +++ b/entity/Order_entity/entityfields/paymentterms/documentation.adoc @@ -0,0 +1,4 @@ + +== Payment terms + +Contains the delivery terms to choose from. Saved as keywords. (7 days netto, 30 days netto, 8 days 2% skotto 30 days netto) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/paymentterms/valueProcess.js b/entity/Order_entity/entityfields/paymentterms/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8e1009ab59b81a1239a3aabab00bae72f0399aea --- /dev/null +++ b/entity/Order_entity/entityfields/paymentterms/valueProcess.js @@ -0,0 +1,33 @@ +import("Keyword_lib"); +import("Contact_lib"); +import("AttributeRegistry_basic"); +import("KeywordRegistry_basic"); +import("system.neon"); +import("system.result"); +import("system.vars"); +import("Attribute_lib"); + +if (vars.get("$this.value") == null) { + if (vars.get("$param.OrderPaymentTerm_param")) + { + result.string(vars.get("$param.OrderPaymentTerm_param")); + } + else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + { + var presetValue = ""; + var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")) + if (contactIds.length >= 3 && contactIds[2]) + { + var orgContactId = ContactUtils.getOrgContactId(contactIds[2]); + if (orgContactId) + { + presetValue = AttributeRelationUtils.getAttribute($AttributeRegistry.paymentTerm(), orgContactId); + } + } + + if (presetValue) + result.string(presetValue); + else + result.string(KeywordUtils.getFirst($KeywordRegistry.paymentTerm())); + } +} diff --git a/entity/Order_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js b/entity/Order_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7e0951d02b7c26bc9ff0a84ad34eb2b47aa0ced8 --- /dev/null +++ b/entity/Order_entity/entityfields/possibleaddresses/children/contactid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.CONTACT_ID")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/possibleconnectiontypes/valueProcess.js b/entity/Order_entity/entityfields/possibleconnectiontypes/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e4878ba3eaca6d7a3944c9e2b9e100142f47c298 --- /dev/null +++ b/entity/Order_entity/entityfields/possibleconnectiontypes/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.object(["Salesproject"]); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/printorder/documentation.adoc b/entity/Order_entity/entityfields/printorder/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..3bdfbaa9751493395871b18027d0fad5b627b37e --- /dev/null +++ b/entity/Order_entity/entityfields/printorder/documentation.adoc @@ -0,0 +1,2 @@ +== PRINT ORDER +* _print order_: opens the order report for the current order. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/printorder/onActionProcess.js b/entity/Order_entity/entityfields/printorder/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6ff14c0d176409681ca79af8d9cc1897f37fed3e --- /dev/null +++ b/entity/Order_entity/entityfields/printorder/onActionProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Order_lib"); + +if(vars.get("$field.SALESORDERID")) + OrderUtils.openOrderReport(vars.get("$field.SALESORDERID")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/printorder/stateProcess.js b/entity/Order_entity/entityfields/printorder/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c4b677743bb6551495c672855030a7d3d651cc15 --- /dev/null +++ b/entity/Order_entity/entityfields/printorder/stateProcess.js @@ -0,0 +1,15 @@ +import("system.neon"); +import("system.result"); +import("Sql_lib"); +import("system.db"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); +else +{ + result.string(neon.COMPONENTSTATE_EDITABLE); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/printreminder/documentation.adoc b/entity/Order_entity/entityfields/printreminder/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..992913a2af64b4e43a069d52963faf3a5f6a0b99 --- /dev/null +++ b/entity/Order_entity/entityfields/printreminder/documentation.adoc @@ -0,0 +1,2 @@ +== PRINT REMINDER +* _print reminder_: opens the reminder report for the current order. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/printreminder/onActionProcess.js b/entity/Order_entity/entityfields/printreminder/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0f02e4e06098ea4d84aa201f32488564a6413c81 --- /dev/null +++ b/entity/Order_entity/entityfields/printreminder/onActionProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Order_lib"); + +if(vars.get("$field.SALESORDERID")) + OrderUtils.openReminderReport(vars.get("$field.SALESORDERID")); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/printreminder/stateProcess.js b/entity/Order_entity/entityfields/printreminder/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..50ba51671b5c75f055d93f88dd5e8cfbd4e15b3b --- /dev/null +++ b/entity/Order_entity/entityfields/printreminder/stateProcess.js @@ -0,0 +1,28 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if (vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$invoice()) +{ + + if (vars.get("$field.ORDERSTATUS")=="1" && vars.get("$field.CANCELLATION")=="0") + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + result.string(neon.COMPONENTSTATE_DISABLED); +} +else + result.string(neon.COMPONENTSTATE_DISABLED); diff --git a/entity/Order_entity/entityfields/salesordercode/onValidation.js b/entity/Order_entity/entityfields/salesordercode/onValidation.js index 7913eec27eac7305ad380c20034691581d7fd08e..77e97cc10241ebf2a9cc22b62524870a95f98fee 100644 --- a/entity/Order_entity/entityfields/salesordercode/onValidation.js +++ b/entity/Order_entity/entityfields/salesordercode/onValidation.js @@ -2,10 +2,14 @@ import("system.vars"); import("system.result"); import("system.neon"); import("Order_lib"); +import("Salesproject_lib"); +import("Util_lib"); import("Entity_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW - && !OrderUtils.validateOrderNumber(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.SALESORDERCODE")))) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW + && !vars.exists("$param.OrderCode_param") + && !OrderUtils.validateOrderNumber(vars.get("local.value")) ) { - vars.set("$field.SALESORDERCODE", OrderUtils.getNextOrderNumber().toString()); -} \ No newline at end of file + vars.set( "$field.SALESORDERCODE", OrderUtils.getNextOrderNumber().toString() ); +} + diff --git a/entity/Order_entity/entityfields/salesordercode/valueProcess.js b/entity/Order_entity/entityfields/salesordercode/valueProcess.js index fe577ec3f242189e1173071d4abb85a46f75f5be..ccfc41b24a693aa2c8f66d86a17c544d9ff15b86 100644 --- a/entity/Order_entity/entityfields/salesordercode/valueProcess.js +++ b/entity/Order_entity/entityfields/salesordercode/valueProcess.js @@ -4,6 +4,9 @@ import("system.neon"); import("Order_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -{ - result.string(OrderUtils.getNextOrderNumber()); +{ + if (vars.exists("$param.OrderCode_param") && vars.get("$param.OrderCode_param")) + result.string(vars.get("$param.OrderCode_param")); + else + result.string(OrderUtils.getNextOrderNumber()); } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/salesorderdate/displayValueProcess.js b/entity/Order_entity/entityfields/salesorderdate/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/Order_entity/entityfields/salesorderdate/stateProcess.js b/entity/Order_entity/entityfields/salesorderdate/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/Order_entity/entityfields/salesorderdate/valueProcess.js b/entity/Order_entity/entityfields/salesorderdate/valueProcess.js index ca8dba6244410a798f6b9b014cec006703259d9a..1465808073ee4285b374c77ff5ff13e793a0ce18 100644 --- a/entity/Order_entity/entityfields/salesorderdate/valueProcess.js +++ b/entity/Order_entity/entityfields/salesorderdate/valueProcess.js @@ -1,11 +1,14 @@ -import("system.vars"); -import("system.result"); -import("system.neon"); -import("Date_lib"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) -{ - result.string(DateUtils.getTodayUTC()); -} -else - result.string(vars.get("$this.value")); \ No newline at end of file +import("system.vars"); +import("system.result"); +import("system.neon"); +import("Date_lib"); + + +if (vars.get("$this.value") == null){ +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")|| neon.OPERATINGSTATE_NEW ) +{ + result.string(DateUtils.getTodayUTC()); +} +else + result.string(vars.get("$this.value")); +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js b/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js deleted file mode 100644 index 65afbf6e950eebef0268138074bc97f00869eb0a..0000000000000000000000000000000000000000 --- a/entity/Order_entity/entityfields/salesproject_id/displayValueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); -import("system.result"); -import("Salesproject_lib"); - -result.string(Salesproject.getSalesProjectTitleById(vars.getString("$field.SALESPROJECT_ID"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/salesproject_id/stateProcess.js b/entity/Order_entity/entityfields/salesproject_id/stateProcess.js deleted file mode 100644 index a88395a1cc7e5206b5396eba14e7dcf6c927214a..0000000000000000000000000000000000000000 --- a/entity/Order_entity/entityfields/salesproject_id/stateProcess.js +++ /dev/null @@ -1,13 +0,0 @@ -import("system.neon"); -import("system.result"); -import("system.vars"); - - -switch (vars.get("$sys.recordstate")) -{ - case neon.OPERATINGSTATE_NEW: - result.object(neon.COMPONENTSTATE_EDITABLE); - break; - default: - result.object(neon.COMPONENTSTATE_READONLY); -} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/salesproject_id/valueProcess.js b/entity/Order_entity/entityfields/salesproject_id/valueProcess.js deleted file mode 100644 index 2bc1715fbb0c785208505ce16d09447aa660a160..0000000000000000000000000000000000000000 --- a/entity/Order_entity/entityfields/salesproject_id/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("system.vars"); - -if (vars.exists("$param.SalesprojectId_param")) -{ - result.string(vars.get("$param.SalesprojectId_param")); -} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js b/entity/Order_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9232f51b2e090002d80c469239ab003444411400 --- /dev/null +++ b/entity/Order_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Entity_lib"); + +result.string(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ORG_ID"))); diff --git a/entity/Order_entity/entityfields/setdunning/documentation.adoc b/entity/Order_entity/entityfields/setdunning/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..5ac4e02565deb829a1cbda26b1cd9274bce7ea60 --- /dev/null +++ b/entity/Order_entity/entityfields/setdunning/documentation.adoc @@ -0,0 +1,2 @@ +== SET DUNNING +* _set dunning_: opens a new edit context but only with the dunning date and dunning level fields for the user to enter the dunning date and levels. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/setdunning/onActionProcess.js b/entity/Order_entity/entityfields/setdunning/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b105ff8dff23e2633bd9e529262c3f6d6f06d650 --- /dev/null +++ b/entity/Order_entity/entityfields/setdunning/onActionProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.neon"); + +neon.openContext("Order", "OrderDunning_view", [vars.get("$field.SALESORDERID")], neon.OPERATINGSTATE_EDIT, null); diff --git a/entity/Order_entity/entityfields/setdunning/stateProcess.js b/entity/Order_entity/entityfields/setdunning/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..50ba51671b5c75f055d93f88dd5e8cfbd4e15b3b --- /dev/null +++ b/entity/Order_entity/entityfields/setdunning/stateProcess.js @@ -0,0 +1,28 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if (vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$invoice()) +{ + + if (vars.get("$field.ORDERSTATUS")=="1" && vars.get("$field.CANCELLATION")=="0") + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + result.string(neon.COMPONENTSTATE_DISABLED); +} +else + result.string(neon.COMPONENTSTATE_DISABLED); diff --git a/entity/Order_entity/entityfields/setpaid/documentation.adoc b/entity/Order_entity/entityfields/setpaid/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..61dc104164cd584581f3ed2660cb641928b5084a --- /dev/null +++ b/entity/Order_entity/entityfields/setpaid/documentation.adoc @@ -0,0 +1,2 @@ +== SET PAID +* _set paid_: opens a new edit context but only with the pay date and paid fields for the user to enter the pay date and paid amount. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/setpaid/onActionProcess.js b/entity/Order_entity/entityfields/setpaid/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0c8acb980e727787e348ed099785198288ecbcbb --- /dev/null +++ b/entity/Order_entity/entityfields/setpaid/onActionProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.neon"); + +neon.openContext("Order", "OrderPaid_view", [vars.get("$field.SALESORDERID")], neon.OPERATINGSTATE_EDIT, null); diff --git a/entity/Order_entity/entityfields/setpaid/stateProcess.js b/entity/Order_entity/entityfields/setpaid/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5f9a54534115990966c267b702d1aeff3ce3f415 --- /dev/null +++ b/entity/Order_entity/entityfields/setpaid/stateProcess.js @@ -0,0 +1,28 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if (vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$invoice()|| vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$credit()) +{ + + if (vars.get("$field.ORDERSTATUS")=="1") + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + result.string(neon.COMPONENTSTATE_DISABLED); +} +else + result.string(neon.COMPONENTSTATE_DISABLED); diff --git a/entity/Order_entity/entityfields/setsent/documentation.adoc b/entity/Order_entity/entityfields/setsent/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..0d89607fe24836f3030b017b0478f4f3baceb84e --- /dev/null +++ b/entity/Order_entity/entityfields/setsent/documentation.adoc @@ -0,0 +1,2 @@ +== Set sent +* _Set sent_: Sets the sent checkbox to active. \ No newline at end of file diff --git a/entity/Order_entity/entityfields/setsent/onActionProcess.js b/entity/Order_entity/entityfields/setsent/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..00f7dfa911a15c3884f3361c025d2c318dca0de6 --- /dev/null +++ b/entity/Order_entity/entityfields/setsent/onActionProcess.js @@ -0,0 +1,11 @@ +import("Sql_lib"); +import("system.vars"); +import("system.neon"); +import("system.db"); + +var id = vars.get("$field.SALESORDERID"); + +db.updateData("SALESORDER", ["ORDERSTATUS"], null, ["1"], SqlCondition.begin() + .andPrepareVars("SALESORDER.SALESORDERID", "$field.SALESORDERID") + .build("1=2")); +neon.refreshAll(); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/setsent/stateProcess.js b/entity/Order_entity/entityfields/setsent/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..58fd03d38334ab142b7449b62e3ca49bbc6f333f --- /dev/null +++ b/entity/Order_entity/entityfields/setsent/stateProcess.js @@ -0,0 +1,18 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if(vars.get("$field.ORDERSTATUS")=="0") + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/tasks/children/presetlinks_param/valueProcess.js b/entity/Order_entity/entityfields/tasks/children/presetlinks_param/valueProcess.js index e4c6c134df6be187331e47d8c2c4d5a9871b7c2b..5750b425e97be5e115ea40e3940f3ca4c7083ad0 100644 --- a/entity/Order_entity/entityfields/tasks/children/presetlinks_param/valueProcess.js +++ b/entity/Order_entity/entityfields/tasks/children/presetlinks_param/valueProcess.js @@ -10,9 +10,10 @@ if (contactId) links.push([ContactUtils.getContextByContactId(contactId), contactId]); } -if (vars.get("$field.SALESPROJECT_ID")) +if (vars.get("$field.OBJECT_ROWID")) { - links.push(["Salesproject", vars.get("$field.SALESPROJECT_ID")]); + links.push([vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")]); } + result.object(links); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/totalgross/displayValueProcess.js b/entity/Order_entity/entityfields/totalgross/displayValueProcess.js index b1c561c1f00014cbcd0669f0d810bd9fdb5ba052..7e05663a8bc4754d820b79c99b32536c38cb3916 100644 --- a/entity/Order_entity/entityfields/totalgross/displayValueProcess.js +++ b/entity/Order_entity/entityfields/totalgross/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.TotalGross"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/transferdeliverynote/documentation.adoc b/entity/Order_entity/entityfields/transferdeliverynote/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..49d4604e42354b63a3f03232e936c08ff2053d2e --- /dev/null +++ b/entity/Order_entity/entityfields/transferdeliverynote/documentation.adoc @@ -0,0 +1,2 @@ +== TRANSFER DELIVERY NOTE +* _Transfer delivery note_: All values are copied and inserted in a new order with OrderType Delivery note (new order code, versnr. _1_). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/transferdeliverynote/onActionProcess.js b/entity/Order_entity/entityfields/transferdeliverynote/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7df2878f7159380f8d034109c9d7637dbc9b1a18 --- /dev/null +++ b/entity/Order_entity/entityfields/transferdeliverynote/onActionProcess.js @@ -0,0 +1,26 @@ +import("system.vars"); +import("system.neon"); +import("Order_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var contactId = vars.getString("$field.CONTACT_ID"); +var currency = vars.getString("$field.CURRENCY"); +var language = vars.getString("$field.ISOLANGUAGE"); +var header = vars.getString("$field.HEADER"); +var footer = vars.getString("$field.FOOTER"); +var offerId = vars.getString("$field.OFFER_ID"); +var deliveryTerm = vars.getString("$field.DELIVERYTERMS"); +var paymentTerm = vars.getString("$field.PAYMENTTERMS"); +var rowId = vars.getString("$field.OBJECT_ROWID"); +var objectType = vars.getString("$field.OBJECT_TYPE"); +var dunningDate = vars.getString("$field.DUNNINGDATE"); +var dunningLevel = vars.getString("$field.DUNNINGLEVEL"); +var orderType= $KeywordRegistry.orderType$deliverynote(); +var cancellation= vars.getString("$field.CANCELLATION"); +var orderStatus=vars.getString("$field.ORDERSTATUS"); + + + +OrderUtils.copyOrder(offerId, contactId, orderType, language, currency, header, footer, deliveryTerm, paymentTerm, objectType, rowId, dunningDate, dunningLevel, cancellation, orderStatus); + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/transferdeliverynote/stateProcess.js b/entity/Order_entity/entityfields/transferdeliverynote/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..70dcb91387b497cf5b6d275f9bb4c4b73ff17f12 --- /dev/null +++ b/entity/Order_entity/entityfields/transferdeliverynote/stateProcess.js @@ -0,0 +1,31 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if(vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$confirmation()) + result.string(neon.COMPONENTSTATE_EDITABLE); +else if (vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$invoice()) +{ + + if (vars.get("$field.ORDERSTATUS") == "0" && vars.get("$field.CANCELLATION") == "1") + { + result.string(neon.COMPONENTSTATE_DISABLED); + } + + else + result.string(neon.COMPONENTSTATE_EDITABLE); +} +else + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/transferinvoice/documentation.adoc b/entity/Order_entity/entityfields/transferinvoice/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..d493af2c348ba4e024ddd6c74e3d148c02bb2c39 --- /dev/null +++ b/entity/Order_entity/entityfields/transferinvoice/documentation.adoc @@ -0,0 +1,2 @@ +== TRANSFER INVOICE +* _Transfer invoice_: All values are copied and inserted in a new order with OrderType invoice (new order code, versnr. _1_). \ No newline at end of file diff --git a/entity/Order_entity/entityfields/transferinvoice/onActionProcess.js b/entity/Order_entity/entityfields/transferinvoice/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ee940353c0be659e4b49c56515b2bee5b67eba2f --- /dev/null +++ b/entity/Order_entity/entityfields/transferinvoice/onActionProcess.js @@ -0,0 +1,26 @@ +import("system.vars"); +import("system.neon"); +import("Order_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var contactId = vars.getString("$field.CONTACT_ID"); +var currency = vars.getString("$field.CURRENCY"); +var language = vars.getString("$field.ISOLANGUAGE"); +var header = vars.getString("$field.HEADER"); +var footer = vars.getString("$field.FOOTER"); +var offerId = vars.getString("$field.OFFER_ID"); +var deliveryTerm = vars.getString("$field.DELIVERYTERMS"); +var paymentTerm = vars.getString("$field.PAYMENTTERMS"); +var rowId = vars.getString("$field.OBJECT_ROWID"); +var objectType = vars.getString("$field.OBJECT_TYPE"); +var dunningDate = vars.getString("$field.DUNNINGDATE"); +var dunningLevel = vars.getString("$field.DUNNINGLEVEL"); +var orderType= $KeywordRegistry.orderType$invoice(); +var cancellation= vars.getString("$field.CANCELLATION"); +var orderStatus=vars.getString("$field.ORDERSTATUS"); + + + +OrderUtils.copyOrder(offerId, contactId, orderType, language, currency, header, footer, deliveryTerm, paymentTerm, objectType, rowId, dunningDate, dunningLevel, cancellation, orderStatus); + \ No newline at end of file diff --git a/entity/Order_entity/entityfields/transferinvoice/stateProcess.js b/entity/Order_entity/entityfields/transferinvoice/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bf1ec7bf9d805b22bd5a4f7b0afa3273fae78c55 --- /dev/null +++ b/entity/Order_entity/entityfields/transferinvoice/stateProcess.js @@ -0,0 +1,20 @@ +import("system.vars"); +import("system.result"); +import("system.db"); +import("Sql_lib"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if(itemcount == "0") + result.string(neon.COMPONENTSTATE_DISABLED); + + +else if(vars.get("$field.ORDERTYPE")==$KeywordRegistry.orderType$confirmation()) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/unpaid/valueProcess.js b/entity/Order_entity/entityfields/unpaid/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1439939a0c2a0926465ff2792b803ac15eadfb3b --- /dev/null +++ b/entity/Order_entity/entityfields/unpaid/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); +import("system.eMath"); + +result.string(eMath.subDec( + vars.get("$field.TotalGross"), + vars.get("$field.PAID"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/vat/displayValueProcess.js b/entity/Order_entity/entityfields/vat/displayValueProcess.js index b1c561c1f00014cbcd0669f0d810bd9fdb5ba052..47ebfd7ecabcff3e202bfc72a540623de1e484fd 100644 --- a/entity/Order_entity/entityfields/vat/displayValueProcess.js +++ b/entity/Order_entity/entityfields/vat/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.VAT"), translate.text("#,##0.00"), vars.get("$field.CURRENCY"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/versnr/valueProcess.js b/entity/Order_entity/entityfields/versnr/valueProcess.js index 4f0b6e1b535c8f921b8d35bd7a1ee3fd9569d288..6c5f491570d2a8e1a2541beb711d11b1d6753d95 100644 --- a/entity/Order_entity/entityfields/versnr/valueProcess.js +++ b/entity/Order_entity/entityfields/versnr/valueProcess.js @@ -1,8 +1,12 @@ import("system.vars"); import("system.result"); import("system.neon"); +import("Offer_lib"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { - result.string( "1" ); + if (vars.exists("$param.OrderVersnr_param") && vars.get("$param.OrderVersnr_param")) + result.string(vars.get("$param.OrderVersnr_param")); + else + result.string( "1" ); } \ No newline at end of file diff --git a/entity/Order_entity/grantUpdateProcess.js b/entity/Order_entity/grantDeleteProcess.js similarity index 50% rename from entity/Order_entity/grantUpdateProcess.js rename to entity/Order_entity/grantDeleteProcess.js index 256cfafaec02f72bb10d183bad96956d2f3d6733..5d5b84c34c7f2260c26d853289c8bca1be72f479 100644 --- a/entity/Order_entity/grantUpdateProcess.js +++ b/entity/Order_entity/grantDeleteProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.result"); import("Order_lib"); -result.string(OrderUtils.isEditable(vars.get("$field.STATUS"))); \ No newline at end of file +result.string(OrderUtils.isDeletable(vars.get("$field.ORDERSTATUS"))); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/conditionProcess.js b/entity/Order_entity/recordcontainers/db/conditionProcess.js index 11dd858114ebf04db6ef1e00f817003e5a0c2b7b..708518b4c62e378292e1b48f777ae508941ae9c1 100644 --- a/entity/Order_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Order_entity/recordcontainers/db/conditionProcess.js @@ -1,9 +1,15 @@ +import("system.vars"); import("system.db"); import("system.result"); import("Sql_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("SALESORDER.SALESPROJECT_ID", "$param.SalesprojectId_param"); +if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) + cond.andPrepareVars("SALESORDER.CONTACT_ID", "$param.ContactId_param"); +else { + cond.andPrepareVars("SALESORDER.OBJECT_ROWID", "$param.ObjectRowId_param"); + cond.andPrepareVars("SALESORDEER.OBJECT_TYPE", "$param.ObjectType_param"); +} //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/fromClauseProcess.js b/entity/Order_entity/recordcontainers/db/fromClauseProcess.js index 4b856fef61de20128e1110bf14de27b0fa400d97..923c8a9a9ec21dd5d6351f162e1c2dc16c316a91 100644 --- a/entity/Order_entity/recordcontainers/db/fromClauseProcess.js +++ b/entity/Order_entity/recordcontainers/db/fromClauseProcess.js @@ -3,5 +3,4 @@ import("system.result"); result.string("SALESORDER \n\ left join CONTACT on CONTACT.CONTACTID = SALESORDER.CONTACT_ID \n\ left join ORGANISATION on ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID \n\ - left join PERSON on PERSON.PERSONID = CONTACT.PERSON_ID \n\ - left join SALESPROJECT on SALESPROJECTID = SALESPROJECT_ID"); \ No newline at end of file + left join PERSON on PERSON.PERSONID = CONTACT.PERSON_ID"); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/onDBInsert.js b/entity/Order_entity/recordcontainers/db/onDBInsert.js index 940a4ff0f9a833f00b45814bab915e9ed2014fb6..0e8805fd5a43b0613e7014d49deac71e88da3ab7 100644 --- a/entity/Order_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Order_entity/recordcontainers/db/onDBInsert.js @@ -1,12 +1,6 @@ import("system.neon"); import("system.vars"); -import("Sql_lib"); -import("Order_lib"); +import("Offer_lib"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.OfferId_param")) -{ - var orderId = vars.getString("$field.SALESORDERID"); - var offerId = vars.getString("$param.OfferId_param"); - - OrderUtils.copyOfferItemsToOrder(offerId, orderId); //copy all offerItems -} +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.OfferOriginal_Id_param")) + OfferUtils.copyOfferItems(vars.getString("$param.OfferOriginal_Id_param"), vars.get("$local.rowdata")["SALESORDER.OFFER_ID"]); diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..33c36a352b21b0f4dfc9c54c1a490ea4826a610a --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Order'"; + +result.string("SALESORDERID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..2821fb702f86a860ad359c2ea089f5551743d795 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +var contact = Contact.createWithColumnPreset() +var renderer = new ContactTitleRenderer(contact, ContactTitleRenderer.OPTIONS.IncludeOrganisation); +result.string(renderer.asSql()); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/deliveryterms.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/deliveryterms.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..31f363c19a7a5f03fec90b86634b0898612cef41 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/deliveryterms.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.deliveryTerm(), "SALESORDER.DELIVERYTERMS"); +result.string(sql); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js similarity index 88% rename from entity/Order_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js rename to entity/Order_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js index a7cb288ef1c84b6168498dd245497bd6712f5610..1eec134c1cab5198e13973fb32f22d44eb20ba99 100644 --- a/entity/Order_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js @@ -1,5 +1,5 @@ import("system.result"); import("Keyword_lib"); -var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("SALESORDER.LANGUAGE"); +var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("SALESORDER.ISOLANGUAGE"); result.string(sql); diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..bbe883a82964ab9693ce6c4fca792a9c27e01363 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getNameSubselectSql("SALESORDER.OBJECT_TYPE", "SALESORDER.OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..a86ac585f271d61227c89ec425d97d7c43e2a73d --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/recordfieldmappings/offer_id.displayvalue/expression.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getNameSubselectSql("'Offer'", "SALESORDER.OFFER_ID")); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/Order_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js deleted file mode 100644 index aa54f4f9efa30b7b8af672c9c43e70ed29d54b6c..0000000000000000000000000000000000000000 --- a/entity/Order_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesorderState(), "SALESORDER.STATUS")); diff --git a/entity/Order_entity/recordcontainers/index/query.js b/entity/Order_entity/recordcontainers/index/query.js index 57bca0642de68d859f09012c034d5edc33139485..08e86cb7a0765cc9bfd3ff0b59086f184c63a439 100644 --- a/entity/Order_entity/recordcontainers/index/query.js +++ b/entity/Order_entity/recordcontainers/index/query.js @@ -15,11 +15,11 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select SALESORDERID as uid, " - + sqlHelper.concat([sqlHelper.cast("SALESORDERCODE", SQLTYPES.CHAR, 10), KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesorderState(), "SALESORDER.STATUS")], " | ") - + " as title, " +sqlQuery = 'select SALESORDERID as "_uid_", ' + + sqlHelper.concat([sqlHelper.cast("SALESORDERCODE", SQLTYPES.CHAR, 10)], " | ") + + ' as "_title_", ' + sqlHelper.concat(["ORGANISATION.NAME"], " | ") - + " as description" + + ' as "_description_" ' + ", SALESORDERCODE" + ", CUSTOMERCODE" + ", SALESORDER.CONTACT_ID" diff --git a/entity/Orderitem_entity/Orderitem_entity.aod b/entity/Orderitem_entity/Orderitem_entity.aod index eb1e45d9a587a3e3d456298cacfce3bad135a729..5113afa1cef9245d6b4641858bc0ccdd653e9d5f 100644 --- a/entity/Orderitem_entity/Orderitem_entity.aod +++ b/entity/Orderitem_entity/Orderitem_entity.aod @@ -4,7 +4,12 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Orderitem_entity/documentation.adoc</documentation> <title>Orderitem</title> - <afterOperatingState>%aditoprj%/entity/Orderitem_entity/afterOperatingState.js</afterOperatingState> + <siblings> + <element>Order_entity</element> + </siblings> + <grantCreateProcess>%aditoprj%/entity/Orderitem_entity/grantCreateProcess.js</grantCreateProcess> + <grantUpdateProcess>%aditoprj%/entity/Orderitem_entity/grantUpdateProcess.js</grantUpdateProcess> + <grantDeleteProcess>%aditoprj%/entity/Orderitem_entity/grantDeleteProcess.js</grantDeleteProcess> <titlePlural>Orderitems</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -39,6 +44,7 @@ </entityField> <entityField> <name>ITEMSORT</name> + <valueProcess>%aditoprj%/entity/Orderitem_entity/entityfields/itemsort/valueProcess.js</valueProcess> </entityField> <entityField> <name>SALESORDERITEMID</name> @@ -97,10 +103,9 @@ <name>VAT</name> <title>VAT</title> <contentType>NUMBER</contentType> - <outputFormat>0.00 %</outputFormat> + <outputFormat>0.00'%'</outputFormat> <inputFormat>0.00</inputFormat> <state>AUTO</state> - <displayValueProcess>%aditoprj%/entity/Orderitem_entity/entityfields/vat/displayValueProcess.js</displayValueProcess> </entityField> <entityParameter> <name>OrderId_param</name> @@ -135,11 +140,6 @@ <contentType>IMAGE</contentType> <valueProcess>%aditoprj%/entity/Orderitem_entity/entityfields/image/valueProcess.js</valueProcess> </entityField> - <entityParameter> - <name>OrderStatus_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> <entityProvider> <name>Orderitems</name> <recordContainer>db</recordContainer> @@ -174,11 +174,16 @@ <name>OrderStatus_param</name> <expose v="true" /> </entityParameter> + <entityParameter> + <name>Language_param</name> + <expose v="true" /> + </entityParameter> </children> </entityProvider> <entityField> <name>INFO</name> <title>Description</title> + <contentType>LONG_TEXT</contentType> </entityField> <entityConsumer> <name>KeywordProductGroupcodes</name> @@ -218,6 +223,19 @@ <fieldName>#PROVIDER</fieldName> </dependency> </entityConsumer> + <entityField> + <name>OrderStatus</name> + <documentation>%aditoprj%/entity/Orderitem_entity/entityfields/orderstatus/documentation.adoc</documentation> + <valueProcess>%aditoprj%/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js</valueProcess> + </entityField> + <entityParameter> + <name>OrderStatus_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>Language_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Orderitem_entity/afterOperatingState.js b/entity/Orderitem_entity/afterOperatingState.js deleted file mode 100644 index 2fae7948cdde0ce1358c7791d3d77ce767058aca..0000000000000000000000000000000000000000 --- a/entity/Orderitem_entity/afterOperatingState.js +++ /dev/null @@ -1,19 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("Order_lib"); - -var opState = vars.get("$sys.recordstate"); - -if(opState == neon.OPERATINGSTATE_NEW) -{ - var orderId = vars.get("$field.SALESORDER_ID"); - var oiUtils = new OrderItemUtils(orderId); - - vars.set("$field.ITEMSORT", oiUtils.getNextItemSort()); - vars.set("$field.ITEMPOSITION", oiUtils.getNextItemPosition(vars.get("$field.ASSIGNEDTO"))); -} - -if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) -{ - neon.refresh(); -} \ No newline at end of file diff --git a/entity/Orderitem_entity/documentation.adoc b/entity/Orderitem_entity/documentation.adoc index 98fbb2d09396ff2022af687684d47c8f61467153..145ceb970e81bd16471d4ea22117b5049a40cbf5 100644 --- a/entity/Orderitem_entity/documentation.adoc +++ b/entity/Orderitem_entity/documentation.adoc @@ -4,6 +4,26 @@ Entity contains products that belong to the linked order. It provides data from database table _SALESORDERITEM_ by a JDito record container. +== Orderitems + +The order items are the are the items or item groups contained in the order. These can either be standalone or acquired from offers. If they are acquired from offers, the order items are +received exactly as they are from the offer items. + + +== grantCreateProcess + +A new order item can only be added if the order associated with it is sent. If there are no order item, there is also no salesorderid, therefore +exceptions have been made if there are no order items or if the orderstatus parameter is undefined. + +== grantUpdateProcess + +An existing order item can only be modified if the order associated with it is sent. If there are no order item, there is also no salesorderid, therefore +exceptions have been made if there are no order items or if the orderstatus parameter is undefined. + +== grantDeleteProcess + +An existing order item can only be deleted if the order associated with it is sent. + == onDBInsert If a new order item is to be added, the parts list of the corresponding product diff --git a/entity/Orderitem_entity/entityfields/date_new/valueProcess.js b/entity/Orderitem_entity/entityfields/date_new/valueProcess.js index 3a0d59096cd2de39b6098f1ed95af580dcebfce0..f0ba30f6e144b316b4c1280648564aedeeb209ee 100644 --- a/entity/Orderitem_entity/entityfields/date_new/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/date_new/valueProcess.js @@ -2,5 +2,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(vars.getString("$sys.date")); \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/itemposition/valueProcess.js b/entity/Orderitem_entity/entityfields/itemposition/valueProcess.js index 92951e02d31b812798f9b29c2e53fae90655c6a9..194dca2907a267b6a2898998204a9ce920c49902 100644 --- a/entity/Orderitem_entity/entityfields/itemposition/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/itemposition/valueProcess.js @@ -1,2 +1,10 @@ import("system.result"); -result.string("") \ No newline at end of file +import("system.vars"); +import("system.neon"); +import("Order_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var oiUtils = new OrderItemUtils(vars.get("$field.SALESORDER_ID")); + result.string(oiUtils.getNextItemPosition(vars.get("$field.ASSIGNEDTO"))); +} \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/itemsort/valueProcess.js b/entity/Orderitem_entity/entityfields/itemsort/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..eb179702c0d000cde9da35bf3ca8208500eadf02 --- /dev/null +++ b/entity/Orderitem_entity/entityfields/itemsort/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); +import("Order_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var oiUtils = new OrderItemUtils(vars.get("$field.SALESORDER_ID")); + result.string(oiUtils.getNextItemSort()); +} \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/optional/valueProcess.js b/entity/Orderitem_entity/entityfields/optional/valueProcess.js index 31b2531af1ad332b9ab67942d5a89d742c9ab368..d7871520525122be1a8680a7e579397a16cb03b3 100644 --- a/entity/Orderitem_entity/entityfields/optional/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/optional/valueProcess.js @@ -2,5 +2,9 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) - result.string("0"); \ No newline at end of file + + + +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/Orderitem_entity/entityfields/orderstatus/documentation.adoc b/entity/Orderitem_entity/entityfields/orderstatus/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..3628f8e24dbf12f7da84f4338fd1edd7d8a6e4ab --- /dev/null +++ b/entity/Orderitem_entity/entityfields/orderstatus/documentation.adoc @@ -0,0 +1,4 @@ +== OrderStatus + +This field indicates if the order with which the current order item is associated is sent or not. If the item is sent, order items in that order cannot be +created or modified. \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js b/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f82efce3832aafb8d89642e4a0da072a6b2be110 --- /dev/null +++ b/entity/Orderitem_entity/entityfields/orderstatus/valueProcess.js @@ -0,0 +1,14 @@ +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null) { + if (vars.get("$param.OrderId_param")) + { +var status = vars.get("$param.OrderStatus_param") + +result.string(status); +} + else { + result.string("0"); + } +} diff --git a/entity/Orderitem_entity/entityfields/price/displayValueProcess.js b/entity/Orderitem_entity/entityfields/price/displayValueProcess.js index f9efef77b57bed78b2a0f2694905aed7cf5957f0..bc27c4c4e48d7b46cd353afb1a3220e7fb1ba2da 100644 --- a/entity/Orderitem_entity/entityfields/price/displayValueProcess.js +++ b/entity/Orderitem_entity/entityfields/price/displayValueProcess.js @@ -1,6 +1,21 @@ +import("Sql_lib"); +import("system.db"); import("Util_lib"); import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$param.Currency_param"))); \ No newline at end of file + if (vars.get("$param.Currency_param")) + { +var curr = vars.get("$param.Currency_param") + + +} + +else { + curr = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDER.SALESORDERID", "$field.SALESORDER_ID") + .buildSql("select CURRENCY from SALESORDER", "1=2")); +} + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.PRICE"), translate.text("#,##0.00"), curr)); \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/product_id/onValueChange.js b/entity/Orderitem_entity/entityfields/product_id/onValueChange.js index b7739bae3a139c87c5804d78580226529f26c66a..a4607b977dda36678b0975d1b7091055d63a080a 100644 --- a/entity/Orderitem_entity/entityfields/product_id/onValueChange.js +++ b/entity/Orderitem_entity/entityfields/product_id/onValueChange.js @@ -4,7 +4,7 @@ import("Product_lib"); import("Util_lib"); import("Entity_lib"); -var pid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCT_ID")); +var pid = vars.get("local.value"); if(pid != "") { var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; diff --git a/entity/Orderitem_entity/entityfields/quantity/onValueChange.js b/entity/Orderitem_entity/entityfields/quantity/onValueChange.js index f6cb10a4585c3152a0d78ab4bed989186d609b63..5fbe3952a65b6081c9a845b0ec03e4092303c315 100644 --- a/entity/Orderitem_entity/entityfields/quantity/onValueChange.js +++ b/entity/Orderitem_entity/entityfields/quantity/onValueChange.js @@ -5,7 +5,7 @@ import("Util_lib"); import("Entity_lib"); var pid = vars.get("$field.PRODUCT_ID"); -var newQuantity = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.QUANTITY")); +var newQuantity = vars.get("local.value"); if(pid != "" && newQuantity != "") { var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; diff --git a/entity/Orderitem_entity/entityfields/quantity/valueProcess.js b/entity/Orderitem_entity/entityfields/quantity/valueProcess.js index 1eb874ba4469528a091ef6adf85705a74c464546..72e8e990dec55f1e9efab9d25b53672c5b6a6d7e 100644 --- a/entity/Orderitem_entity/entityfields/quantity/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/quantity/valueProcess.js @@ -1,10 +1,8 @@ -import("system.vars"); -import("system.result"); -import("system.neon"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) -{ - result.string("1"); -} -else - result.string(vars.get("$this.value")); \ No newline at end of file +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + result.string("1"); +} \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/salesorder_id/valueProcess.js b/entity/Orderitem_entity/entityfields/salesorder_id/valueProcess.js index c03d980a0c1f041d6d492fd08e7593a88ce93479..59fc8495b8c4e6fd5eee0c05a8d6d9251c83f382 100644 --- a/entity/Orderitem_entity/entityfields/salesorder_id/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/salesorder_id/valueProcess.js @@ -2,9 +2,9 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { if(vars.exists("$param.OrderId_param") && vars.get("$param.OrderId_param") != null && vars.get("$param.OrderId_param") != "") - result.string(vars.getString("$param.OrderId_param")); + result.string(vars.get("$param.OrderId_param")); } diff --git a/entity/Orderitem_entity/entityfields/salesorderitemid/valueProcess.js b/entity/Orderitem_entity/entityfields/salesorderitemid/valueProcess.js index 86ef789e064a4016f2d12c432498dc23474807aa..4faa129377b11ba84a25dbfb11fb6fa18201c011 100644 --- a/entity/Orderitem_entity/entityfields/salesorderitemid/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/salesorderitemid/valueProcess.js @@ -3,5 +3,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(util.getNewUUID()); \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/totalprice/displayValueProcess.js b/entity/Orderitem_entity/entityfields/totalprice/displayValueProcess.js index f9efef77b57bed78b2a0f2694905aed7cf5957f0..5adc43216c1936a1f9f87edca3ec1eeec5b81a32 100644 --- a/entity/Orderitem_entity/entityfields/totalprice/displayValueProcess.js +++ b/entity/Orderitem_entity/entityfields/totalprice/displayValueProcess.js @@ -1,6 +1,21 @@ +import("Sql_lib"); +import("system.db"); import("Util_lib"); import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#,##0.00"), vars.get("$param.Currency_param"))); \ No newline at end of file + if (vars.get("$param.Currency_param")) + { +var curr = vars.get("$param.Currency_param") + + +} + +else { + curr = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDER.SALESORDERID", "$field.SALESORDER_ID") + .buildSql("select CURRENCY from SALESORDER", "1=2")); +} + +result.string(NumberUtils.formatWithCurrency(vars.get("$field.TotalPrice"), translate.text("#,##0.00"), curr)); \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/user_new/valueProcess.js b/entity/Orderitem_entity/entityfields/user_new/valueProcess.js index 7c566863b493d778b72dea7d8822f6a59333e77d..71110834d7d401e78c24401e044211bfb0b4ef55 100644 --- a/entity/Orderitem_entity/entityfields/user_new/valueProcess.js +++ b/entity/Orderitem_entity/entityfields/user_new/valueProcess.js @@ -2,5 +2,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(vars.getString("$sys.user")); \ No newline at end of file diff --git a/entity/Orderitem_entity/entityfields/vat/displayValueProcess.js b/entity/Orderitem_entity/entityfields/vat/displayValueProcess.js deleted file mode 100644 index 4991d571f2dca899a63b77eb17141e6f3072c719..0000000000000000000000000000000000000000 --- a/entity/Orderitem_entity/entityfields/vat/displayValueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.text"); -import("system.vars"); -import("system.translate"); -import("system.result"); - -if (vars.get("$this.value")) - result.string(text.formatDouble(vars.get("$this.value"), "0.00") + "%"); \ No newline at end of file diff --git a/entity/Orderitem_entity/grantCreateProcess.js b/entity/Orderitem_entity/grantCreateProcess.js index c4319e559cc4c4489dc863b46cd80d1647cf2ab6..afb8faec00e4b1522d7f664e6061b4e8596d7136 100644 --- a/entity/Orderitem_entity/grantCreateProcess.js +++ b/entity/Orderitem_entity/grantCreateProcess.js @@ -1,5 +1,25 @@ +import("Sql_lib"); +import("system.db"); import("system.vars"); import("system.result"); import("Order_lib"); -result.string(OrderUtils.isEditable(vars.get("$param.OrderStatus_param"))); \ No newline at end of file + + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDER_ID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if (vars.get("$field.OrderStatus") == undefined){ + result.string(false); +} +else if (itemcount == "0" && vars.get("$field.OrderStatus") == "1" ) { + result.string(false); +} + +else if (itemcount == "0" && vars.get("$field.OrderStatus") == "0"){ + result.string(true); +} + +else +result.string(OrderUtils.isEditable(vars.get("$field.OrderStatus"))); \ No newline at end of file diff --git a/entity/Orderitem_entity/grantDeleteProcess.js b/entity/Orderitem_entity/grantDeleteProcess.js index c4319e559cc4c4489dc863b46cd80d1647cf2ab6..a1d172b731764b0ab83a31d79a3fbf430f742eb4 100644 --- a/entity/Orderitem_entity/grantDeleteProcess.js +++ b/entity/Orderitem_entity/grantDeleteProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("system.result"); import("Order_lib"); -result.string(OrderUtils.isEditable(vars.get("$param.OrderStatus_param"))); \ No newline at end of file +result.string(OrderUtils.isDeletable(vars.get("$field.OrderStatus"))); \ No newline at end of file diff --git a/entity/Orderitem_entity/grantUpdateProcess.js b/entity/Orderitem_entity/grantUpdateProcess.js index c4319e559cc4c4489dc863b46cd80d1647cf2ab6..afb8faec00e4b1522d7f664e6061b4e8596d7136 100644 --- a/entity/Orderitem_entity/grantUpdateProcess.js +++ b/entity/Orderitem_entity/grantUpdateProcess.js @@ -1,5 +1,25 @@ +import("Sql_lib"); +import("system.db"); import("system.vars"); import("system.result"); import("Order_lib"); -result.string(OrderUtils.isEditable(vars.get("$param.OrderStatus_param"))); \ No newline at end of file + + +var itemcount = db.cell(SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDER_ID") + .buildSql("select count(*) from SALESORDERITEM", "1=2")); + +if (vars.get("$field.OrderStatus") == undefined){ + result.string(false); +} +else if (itemcount == "0" && vars.get("$field.OrderStatus") == "1" ) { + result.string(false); +} + +else if (itemcount == "0" && vars.get("$field.OrderStatus") == "0"){ + result.string(true); +} + +else +result.string(OrderUtils.isEditable(vars.get("$field.OrderStatus"))); \ No newline at end of file diff --git a/entity/Orderitem_entity/recordcontainers/db/conditionProcess.js b/entity/Orderitem_entity/recordcontainers/db/conditionProcess.js index 54497c9522a1c9ee37289e2de596da7f9a1fd328..de93a4387fe88a8273f84a6d45f1f335d9b00f14 100644 --- a/entity/Orderitem_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Orderitem_entity/recordcontainers/db/conditionProcess.js @@ -1,7 +1,9 @@ +import("system.db"); +import("Sql_lib"); import("system.result"); import("system.vars"); -if(vars.exists("$param.OrderId_param") && vars.get("$param.OrderId_param") != "") - result.string("SALESORDERITEM.SALESORDER_ID = ('" + vars.get("$param.OrderId_param") + "')"); -else - result.string(""); \ No newline at end of file +var cond = SqlCondition.begin() + .andPrepareVars("SALESORDERITEM.SALESORDER_ID", "$param.OrderId_param") + +result.string(db.translateCondition(cond.build("1=1"))); \ No newline at end of file diff --git a/entity/Orderitem_entity/recordcontainers/db/onDBInsert.js b/entity/Orderitem_entity/recordcontainers/db/onDBInsert.js index 8c2e990bec42ec877008bd9215d01ced748c4631..f640c4a569c268911c75a31eeb4456703d71a78a 100644 --- a/entity/Orderitem_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Orderitem_entity/recordcontainers/db/onDBInsert.js @@ -7,14 +7,16 @@ import("Order_lib"); import("Product_lib"); import("Sql_lib"); -var oid = vars.get("$field.SALESORDER_ID"); + +var rowdata = vars.get("$local.rowdata"); + +var oid = rowdata["SALESORDERITEM.SALESORDER_ID"]; if(oid != "") { var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; var contactid = vars.exists("$param.ContactId_param") ? vars.get("$param.ContactId_param") : ""; - - var oiUtils = new OrderItemUtils(vars.get("$field.SALESORDER_ID")); - oiUtils.insertPartsList(vars.get("$field.PRODUCT_ID"), vars.get("$field.SALESORDERITEMID"), curr, contactid); + var oiUtils = new OrderItemUtils(rowdata["SALESORDERITEM.SALESORDER_ID"]); + oiUtils.insertPartsList(rowdata["SALESORDERITEM.PRODUCT_ID"], vars.get("$local.uid"), curr, contactid, vars.get("$param.Language_param")); oiUtils.reOrgItems(); //update order price @@ -23,5 +25,4 @@ if(oid != "") db.updateData("SALESORDER", cols, null, vals, SqlCondition.equals("SALESORDER.SALESORDERID", oid, "1 = 2")); - neon.refresh(); -} \ No newline at end of file +} diff --git a/entity/Orderitem_entity/recordcontainers/db/onDBUpdate.js b/entity/Orderitem_entity/recordcontainers/db/onDBUpdate.js index 355f0cc560abeb3929160f3c10733bd2b3540dd6..0dfdf166457f26bc6d39a9250cb5043ffe157ce2 100644 --- a/entity/Orderitem_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Orderitem_entity/recordcontainers/db/onDBUpdate.js @@ -4,7 +4,7 @@ import("system.neon"); import("Order_lib"); import("Sql_lib"); -var oid = vars.get("$field.SALESORDER_ID"); +var oid = vars.get("$local.rowdata")["SALESORDERITEM.SALESORDER_ID"]; if(oid != "") { var cols = ["NET", "VAT"]; diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index b300ad6674da703cde209d0c75336a1ac363484c..4954f2de93633f5a68ea88e6546de837853aff6e 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -5,6 +5,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Organisation_entity/documentation.adoc</documentation> <title>Company</title> + <grantDeleteProcess>%aditoprj%/entity/Organisation_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Organisation_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Organisation_entity/afterUiInit.js</afterUiInit> <iconId>VAADIN:BUILDING</iconId> @@ -290,8 +291,8 @@ <onValueChangeTypes> <element>MASK</element> <element>PROCESS</element> - <element>RECORD</element> <element>PROCESS_SETVALUE</element> + <element>RECORD</element> </onValueChangeTypes> </entityField> <entityField> @@ -547,7 +548,7 @@ <tooltip>New Appointment</tooltip> </entityActionField> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -556,7 +557,7 @@ <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> <expose v="true" /> <mandatory v="true" /> </entityParameter> @@ -767,11 +768,15 @@ <isObjectAction v="false" /> <isSelectionAction v="true" /> <iconId>VAADIN:AT</iconId> + <tooltipProcess>%aditoprj%/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js</tooltipProcess> </entityActionField> <entityActionField> <name>addToSerialLetter</name> <onActionProcess>%aditoprj%/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtoserialletter/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <isSelectionAction v="true" /> <iconId>VAADIN:ENVELOPES</iconId> + <tooltipProcess>%aditoprj%/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js</tooltipProcess> </entityActionField> </children> </entityActionGroup> @@ -852,6 +857,47 @@ <onActionProcess>%aditoprj%/entity/Organisation_entity/entityfields/newletter/onActionProcess.js</onActionProcess> <iconId>VAADIN:ENVELOPE</iconId> </entityActionField> + <entityConsumer> + <name>Product_consumer</name> + <description>Needed for search via Offer</description> + <dependency> + <name>dependency</name> + <entityName>Product_entity</entityName> + <fieldName>Products</fieldName> + </dependency> + </entityConsumer> + <entityField> + <name>TurnoverCurrentYear</name> + <title>Turnover Current Year</title> + <contentType>NUMBER</contentType> + <outputFormat>#,##0.00€</outputFormat> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/turnovercurrentyear/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>TurnoverLastYear</name> + <title>Turnover Last Year</title> + <contentType>NUMBER</contentType> + <outputFormat>#,##0.00€</outputFormat> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/turnoverlastyear/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>TurnoverPercentDiff</name> + <title>Turnover change</title> + <colorProcess>%aditoprj%/entity/Organisation_entity/entityfields/turnoverpercentdiff/colorProcess.js</colorProcess> + <contentType>TEXT</contentType> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/turnoverpercentdiff/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>CountActivity</name> + <title>Number of activities</title> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/countactivity/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>LastActivity</name> + <title>Days inactive</title> + <colorProcess>%aditoprj%/entity/Organisation_entity/entityfields/lastactivity/colorProcess.js</colorProcess> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/lastactivity/valueProcess.js</valueProcess> + </entityField> <entityConsumer> <name>OrganisationDuplicates</name> <dependency> @@ -926,22 +972,27 @@ <dbRecordFieldMapping> <name>ADDRESS_ID.value</name> <recordfield>CONTACT.ADDRESS_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CUSTOMERCODE.value</name> <recordfield>ORGANISATION.CUSTOMERCODE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>ORGANISATION.INFO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LANGUAGE.value</name> - <recordfield>CONTACT.LANGUAGE</recordfield> + <recordfield>CONTACT.ISOLANGUAGE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NAME.value</name> <recordfield>ORGANISATION.NAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORGANISATIONID.value</name> @@ -958,20 +1009,24 @@ <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>CONTACT.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TYPE.value</name> - <recordfield>ORGANISATION.TYPE</recordfield> + <recordfield>ORGANISATION.KIND</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.displayValue</name> <recordfield></recordfield> <expression>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/standard_email_communication.displayvalue/expression.js</expression> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.displayValue</name> <recordfield></recordfield> <expression>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/standard_phone_communication.displayvalue/expression.js</expression> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.displayValue</name> @@ -1017,7 +1072,36 @@ <name>PICTURE.value</name> <recordfield>ORGANISATION.PICTURE</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD_EMAIL_COMMUNICATION.value</name> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD_PHONE_COMMUNICATION.value</name> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> + <consumerMapping> + <name>Product_consumer</name> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/product_consumer/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> <indexRecordContainer> <name>index</name> @@ -1048,7 +1132,7 @@ </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.value</name> - <indexFieldType>COMMUNICATION</indexFieldType> + <indexFieldType>EMAIL</indexFieldType> <additionalFieldNameAliases> <element>addr</element> </additionalFieldNameAliases> @@ -1056,7 +1140,7 @@ </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.value</name> - <indexFieldType>COMMUNICATION</indexFieldType> + <indexFieldType>TELEPHONE</indexFieldType> <additionalFieldNameAliases> <element>addr</element> </additionalFieldNameAliases> @@ -1067,7 +1151,7 @@ </indexRecordFieldMapping> <indexRecordFieldMapping> <name>CUSTOMERCODE.value</name> - <indexFieldType>TEXT_NO_STOPWORDS</indexFieldType> + <indexFieldType>TEXT_PLAIN</indexFieldType> <additionalFieldNameAliases /> </indexRecordFieldMapping> </indexFieldMappings> diff --git a/entity/Organisation_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js b/entity/Organisation_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js index 533f8ec837ea2f9b588ddf05545ac47cdda23d18..7b6137b4d105e9ba592cf8ef6e796fb838a32b09 100644 --- a/entity/Organisation_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/attributes/children/objectrowid_param/valueProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string(vars.get("$sys.uid")); \ No newline at end of file +result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/attributes/onValidation.js b/entity/Organisation_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..7fd206a2b41c15ada50e1cee5d0468e6e8f4607f 100644 --- a/entity/Organisation_entity/entityfields/attributes/onValidation.js +++ b/entity/Organisation_entity/entityfields/attributes/onValidation.js @@ -3,4 +3,4 @@ import("system.vars"); import("Attribute_lib"); import("system.result"); -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..76c0ea1a0d6fa4b8dadbd4eca545c544935d477b --- /dev/null +++ b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Add the selection to a bulk mail")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js index 9d2caf19d33cc0a8be852883401ff256e06fe5b9..35dcb1420a14ba006cfc657b2ac1208bc2b46d2e 100644 --- a/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js +++ b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js @@ -3,8 +3,7 @@ import("system.vars"); import("system.neon"); import("system.result"); -var query = "select count(*) from ORGANISATION where ORGANISATIONID != '0'" -var contactCount = db.cell(query); +var contactCount = vars.get("$sys.datarowcount"); if(contactCount > 0) { diff --git a/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d00822c123e56419934a9e98a623e3863e7a83ed --- /dev/null +++ b/entity/Organisation_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Add the selection to a serial letter")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/countactivity/valueProcess.js b/entity/Organisation_entity/entityfields/countactivity/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d3606bbab63de69eb4ed3b2e3748368af23f1d30 --- /dev/null +++ b/entity/Organisation_entity/entityfields/countactivity/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); +import("system.db"); +var amount = db.cell("select count(ACTIVITYID) from ACTIVITY join ACTIVITYLINK on ACTIVITYLINK.ACTIVITY_ID = ACTIVITY.ACTIVITYID \n\ + where ACTIVITYLINK.OBJECT_ROWID = '" + vars.get("$field.CONTACTID") + "' and ACTIVITYLINK.OBJECT_TYPE = 'Organisation'"); + +result.string(amount); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/lastactivity/colorProcess.js b/entity/Organisation_entity/entityfields/lastactivity/colorProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..078b0ce70cdb0c96db40f203c06a7b04e6bb7f2b --- /dev/null +++ b/entity/Organisation_entity/entityfields/lastactivity/colorProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(parseInt(vars.get("$field.LastActivity")) > 50) +{ + result.string(neon.PRIORITY_HIGH_COLOR); +} \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/lastactivity/valueProcess.js b/entity/Organisation_entity/entityfields/lastactivity/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..29dba86a02476bea8576752deae74731c0f168c6 --- /dev/null +++ b/entity/Organisation_entity/entityfields/lastactivity/valueProcess.js @@ -0,0 +1,15 @@ +import("system.datetime"); +import("system.translate"); +import("system.result"); +import("system.vars"); +import("ActivityTask_lib"); +import("Date_lib"); + +var entryDate = ActivityUtils.getLastActivityDate(vars.get("$field.CONTACTID")); +if (!entryDate) + entryDate = vars.get("$field.DATE_NEW"); + +daysPassed = DateUtils.getDayDifference(entryDate); + +if (daysPassed != null) + result.string(daysPassed); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Organisation_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Organisation_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Organisation_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index 1d6e1ab67bba4c79cec93ef491eba9b948e766c8..17ba5b0226b9dfea75bf805ada3e957ad6da28eb 100644 --- a/entity/Organisation_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.CONTACTID"), tableNames: ["CONTACT", "COMMUNICATION", "ADDRESS", "AB_ATTRIBUTERELATION"]}); -res.push({id: vars.get("$field.ORGANISATIONID"), tableNames: ["ORGANISATION"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.CONTACTID"), tableNames: ["CONTACT", "COMMUNICATION", "ADDRESS", "AB_ATTRIBUTERELATION"]}); +res.push({id: vars.get("$field.ORGANISATIONID"), tableNames: ["ORGANISATION"]}); + +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/Organisation_entity/entityfields/newemail/onActionProcess.js b/entity/Organisation_entity/entityfields/newemail/onActionProcess.js index 1da710e798dadf34a91770a741d4fa6dd837936f..cd7548548702791f8f81ec290a532fd19feaeafa 100644 --- a/entity/Organisation_entity/entityfields/newemail/onActionProcess.js +++ b/entity/Organisation_entity/entityfields/newemail/onActionProcess.js @@ -1,4 +1,4 @@ -import("system.vars"); -import("Email_lib"); - -EmailUtils.openNewMail(vars.getString("$field.CONTACTID")); \ No newline at end of file +import("system.vars"); +import("Email_lib"); + +EmailWritingUtils.openNewMail(vars.getString("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/standard_email_communication/onValueChange.js b/entity/Organisation_entity/entityfields/standard_email_communication/onValueChange.js index 972cb181d553b480c039c0d77fca8da35a528c71..b6ca79693c7baa2c3d294f57c25967f8df7db53e 100644 --- a/entity/Organisation_entity/entityfields/standard_email_communication/onValueChange.js +++ b/entity/Organisation_entity/entityfields/standard_email_communication/onValueChange.js @@ -1,4 +1,5 @@ +import("system.vars"); import("Entity_lib"); // TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023 -FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION"); \ No newline at end of file +FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION", vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/standard_phone_communication/onValueChange.js b/entity/Organisation_entity/entityfields/standard_phone_communication/onValueChange.js index 991c92d38d0731524a8de4eb6d0adabb661a71c3..d814a8e65ad4dff521e6a9c7bae9b28d8763838e 100644 --- a/entity/Organisation_entity/entityfields/standard_phone_communication/onValueChange.js +++ b/entity/Organisation_entity/entityfields/standard_phone_communication/onValueChange.js @@ -1,4 +1,5 @@ +import("system.vars"); import("Entity_lib"); // TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023 -FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION"); \ No newline at end of file +FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION", vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/status/valueProcess.js b/entity/Organisation_entity/entityfields/status/valueProcess.js index ae552040e295ab248c1b09dfffe818f5b4d26612..13218c16514d81765c7e5dfd47c099996adfe063 100644 --- a/entity/Organisation_entity/entityfields/status/valueProcess.js +++ b/entity/Organisation_entity/entityfields/status/valueProcess.js @@ -1,7 +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")) +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/Organisation_entity/entityfields/turnovercurrentyear/valueProcess.js b/entity/Organisation_entity/entityfields/turnovercurrentyear/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1f8ee1ceff032c2caab8194406bdc69ad585f039 --- /dev/null +++ b/entity/Organisation_entity/entityfields/turnovercurrentyear/valueProcess.js @@ -0,0 +1,17 @@ +import("system.translate"); +import("Util_lib"); +import("system.datetime"); +import("system.vars"); +import("system.db"); +import("system.result"); +import("system.date"); + +var currentYear = datetime.toDate(vars.get("$sys.date"), "yyyy"); + +var salesCurrentYear = db.cell("select SUM(NET) from salesorder where SALESORDERDATE >= '" + currentYear + "-01-01 00:00:00.000' \n\ + and CONTACT_ID = '" + vars.get("$field.CONTACTID") + "'"); + +if(salesCurrentYear == "") + salesCurrentYear = 0; + +result.string(salesCurrentYear); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/turnoverlastyear/valueProcess.js b/entity/Organisation_entity/entityfields/turnoverlastyear/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fcf33532b8f486b562bf3731ea6cb24a50ef2e59 --- /dev/null +++ b/entity/Organisation_entity/entityfields/turnoverlastyear/valueProcess.js @@ -0,0 +1,17 @@ +import("system.logging"); +import("system.datetime"); +import("system.vars"); +import("system.db"); +import("system.result"); +import("system.date"); + +var lastYear = parseInt(datetime.toDate(vars.get("$sys.date"), "yyyy")) - 1; + +var salesLastYear = db.cell("select SUM(NET) from salesorder where SALESORDERDATE < '" + (lastYear+1) + "-01-01 00:00:00.000' \n\ + and SALESORDERDATE >= '" + lastYear + "-01-01 00:00:00.000' \n\ + and CONTACT_ID = '" + vars.get("$field.CONTACTID") + "'"); + +if(salesLastYear == "") + salesLastYear = 0; + +result.string(salesLastYear); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/turnoverpercentdiff/colorProcess.js b/entity/Organisation_entity/entityfields/turnoverpercentdiff/colorProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9f881847a2d9a55bd025ca9b44d47b176d6bac24 --- /dev/null +++ b/entity/Organisation_entity/entityfields/turnoverpercentdiff/colorProcess.js @@ -0,0 +1,12 @@ +import("system.result"); +import("system.logging"); +import("system.vars"); +import("system.neon"); + +var ret; +var turnoverPercentDiff = parseInt(vars.get("$field.TurnoverPercentDiff")); + +if(turnoverPercentDiff > 0) + result.string(neon.PRIORITY_LOW_COLOR); +else if (turnoverPercentDiff < 0) + result.string(neon.PRIORITY_HIGH_COLOR); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/turnoverpercentdiff/valueProcess.js b/entity/Organisation_entity/entityfields/turnoverpercentdiff/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4d60d87f534d8811ae2fc0aba508d419610b102f --- /dev/null +++ b/entity/Organisation_entity/entityfields/turnoverpercentdiff/valueProcess.js @@ -0,0 +1,21 @@ +import("system.logging"); +import("system.result"); +import("system.vars"); + +var ret = 0; + +var turnoverCurrentYear = parseInt(vars.get("$field.TurnoverCurrentYear")); +var turnoverLastYear = parseInt(vars.get("$field.TurnoverLastYear")); + +if(turnoverLastYear != 0 && turnoverCurrentYear != 0) + ret = parseInt(100 / turnoverLastYear * turnoverCurrentYear) - 100; +else if(turnoverLastYear == 0 && turnoverCurrentYear != 0) + ret = 100; +else if(turnoverLastYear != 0 && turnoverCurrentYear == 0 ) + ret = -100; +else + ret = 0; + +ret += "%"; + +result.string(ret); \ No newline at end of file diff --git a/entity/Organisation_entity/grantDeleteProcess.js b/entity/Organisation_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c4ebf40c41f7ba44d1ff79e91b77b0487c59475f --- /dev/null +++ b/entity/Organisation_entity/grantDeleteProcess.js @@ -0,0 +1,9 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID")) + && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/conditionProcess.js b/entity/Organisation_entity/recordcontainers/db/conditionProcess.js index 5257861cd295a909fab10e36e938a66a6374c70b..ddde730d661f84a87f6f22d2445542f3c16d4183 100644 --- a/entity/Organisation_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Organisation_entity/recordcontainers/db/conditionProcess.js @@ -39,7 +39,7 @@ if (vars.exists("$param.ExcludedContactIds_param") && vars.get("$param.ExcludedC cond.andSqlCondition(excludedCond, "1=1"); } -cond.andPrepareVars("ORGANISATION.TYPE", "$param.OrganisationType_param"); +cond.andPrepareVars("ORGANISATION.KIND", "$param.OrganisationType_param"); //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js index b2c37a2cc9c1428bba4d856394a6bc48df8ddcd3..fa1b2d68c5d36898130c439b475ba651fcb4950c 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js @@ -1,10 +1,12 @@ +import("system.logging"); import("system.vars"); import("Organisation_lib"); import("Communication_lib"); import("Entity_lib"); // TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023 -var uid = vars.get("$sys.uid"); +var rowdata = vars.get("$local.rowdata"); +var uid = rowdata["CONTACT.CONTACTID"]; FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", function(state, value){ CommUtil.setStandardMail(uid, value); }); diff --git a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..89386c61b094587fe5fe712a52eee3847c4bc9e3 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "CONTACT join ACTIVITYLINK on ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID and ACTIVITYLINK.OBJECT_TYPE = 'Organisation' join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID"; + +result.string("ORGANISATIONID in (select CONTACT.ORGANISATION_ID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js index 9b7d38b00dc1722f6e6fcc13b7a2b7ffbf0b92fd..e127913f21feea946eb9006f1616fd8ac40548bf 100644 --- a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js +++ b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js @@ -1,5 +1,5 @@ import("system.result"); import("Keyword_lib"); -var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("CONTACT.LANGUAGE"); +var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("CONTACT.ISOLANGUAGE"); result.string(sql); diff --git a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/product_consumer/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/product_consumer/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f3dd5f5ecac3d804dd4e2868f04e0609dd2b4c34 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/product_consumer/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); + +var from = "CONTACT join OFFER on OFFER.CONTACT_ID = CONTACT.CONTACTID \n\ + join OFFERITEM on OFFERITEM.OFFER_ID = OFFER.OFFERID \n\ + join PRODUCT on PRODUCT.PRODUCTID = OFFERITEM.PRODUCT_ID"; + +result.string("ORGANISATIONID in (select CONTACT.ORGANISATION_ID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js index 2265271d80a155d2600e0f2fc2e423ed391d985c..7ab8eb06526a4f6be6502246408fe7891c4dc46d 100644 --- a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js +++ b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/type.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.organisationType(), "ORGANISATION.TYPE"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.organisationType(), "ORGANISATION.KIND"); result.string(sql); diff --git a/entity/Organisation_entity/recordcontainers/index/affectedConsumerIds.js b/entity/Organisation_entity/recordcontainers/index/affectedConsumerIds.js index e0298d25cc993a3e89df07f184ce16f2316a7ca6..15fbab7d0cc5673e1dab8c71303196c3277d7069 100644 --- a/entity/Organisation_entity/recordcontainers/index/affectedConsumerIds.js +++ b/entity/Organisation_entity/recordcontainers/index/affectedConsumerIds.js @@ -40,7 +40,7 @@ function addIds(pRes, pConsumerName, pIds) function addAddressIds(pRes, pCurrId) { var sql, ids; - sql = "select ADDRESS.ADDRESSID from ADDRESS left join CONTACT on CONTACT.CONTACTID = ADDRESS.CONTACT_ID where CONTACT.ORGANISATION_ID = '" + pCurrId + "'"; + sql = "select ADDRESS.ADDRESSID from ADDRESS where ADDRESS.CONTACT_ID = '" + pCurrId + "'"; ids = db.array(db.COLUMN, sql, alias, 0 , 1 * datetime.ONE_MINUTE); addIds(pRes, "Addresses", ids); @@ -49,7 +49,7 @@ function addAddressIds(pRes, pCurrId) function addCommunicationIds(pRes, pCurrId) { var sql, ids; - sql = "select COMMUNICATION.COMMUNICATIONID from COMMUNICATION left join CONTACT on CONTACT.CONTACTID = COMMUNICATION.CONTACT_ID where CONTACT.ORGANISATION_ID = '" + pCurrId + "'"; + sql = "select COMMUNICATION.COMMUNICATIONID from COMMUNICATION where COMMUNICATION.CONTACT_ID = '" + pCurrId + "'"; ids = db.array(db.COLUMN, sql, alias, 0 , 1 * datetime.ONE_MINUTE); addIds(pRes, "Communications", ids); diff --git a/entity/Organisation_entity/recordcontainers/index/affectedIds.js b/entity/Organisation_entity/recordcontainers/index/affectedIds.js index 7d50c9deb4813ce649ff34eb5c38d65d0d996280..6d58b69c120ee724d12c18c89eabdbc20412a5ff 100644 --- a/entity/Organisation_entity/recordcontainers/index/affectedIds.js +++ b/entity/Organisation_entity/recordcontainers/index/affectedIds.js @@ -15,22 +15,22 @@ infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, var switch (tableName) { - case "ORGANISATION": + case "CONTACT": res = [idValue]; break; - case "CONTACT": - res = db.array(db.COLUMN, "select CONTACT.ORGANISATION_ID from CONTACT where CONTACT.PERSON_ID is null and CONTACT.CONTACTID = '" + idValue + "'"); + case "ORGANISATION": + res = db.array(db.COLUMN, "select CONTACT.CONTACTID from CONTACT where CONTACT.PERSON_ID is null and CONTACT.ORGANISATION_ID = '" + idValue + "'"); break; case "ADDRESS": - res = IndexsearchUtils.getAffectedIdValues("ORGANISATION_ID", infoContainer, function (id){ - return db.array(db.COLUMN, ["select CONTACT.ORGANISATION_ID from ADDRESS left join CONTACT on CONTACT.CONTACTID = ADDRESS.CONTACT_ID where CONTACT.PERSON_ID is null and ADDRESS.ADDRESSID = ?", [ + res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){ + return db.array(db.COLUMN, ["select ADDRESS.CONTACT_ID from ADDRESS where ADDRESS.ADDRESSID = ?", [ [id, SqlUtils.getSingleColumnType("ADDRESS", "ADDRESSID")] ]]); }); break; case "COMMUNICATION": - res = IndexsearchUtils.getAffectedIdValues("ORGANISATION_ID", infoContainer, function (id){ - return db.array(db.COLUMN, ["select CONTACT.ORGANISATION_ID from COMMUNICATION left join CONTACT on CONTACT.CONTACTID = COMMUNICATION.CONTACT_ID where CONTACT.PERSON_ID is null and where COMMUNICATIONID = ?", [ + res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){ + return db.array(db.COLUMN, ["select COMMUNICATION.CONTACT_ID from COMMUNICATION where COMMUNICATIONID = ?", [ [id, SqlUtils.getSingleColumnType("COMMUNICATION", "COMMUNICATIONID")] ]]); }); diff --git a/entity/Organisation_entity/recordcontainers/index/query.js b/entity/Organisation_entity/recordcontainers/index/query.js index 68a86d5b62dff07b04696c412c3d273ca412ec76..8962918927f06fbbe77111d3bb1f37ef05169179 100644 --- a/entity/Organisation_entity/recordcontainers/index/query.js +++ b/entity/Organisation_entity/recordcontainers/index/query.js @@ -13,22 +13,22 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select ORGANISATION.ORGANISATIONID as uid" +sqlQuery = 'select CONTACT.CONTACTID as "_uid_" ' + ", " + sqlHelper.concat(["ORGANISATION.NAME", "'|'", "ORGANISATION.CUSTOMERCODE"]) - + " as title " + + ' as "_title_" ' + ", " + sqlHelper.concat([ sqlHelper.concat(["defaultAddress.ADDRESS", "defaultAddress.BUILDINGNO", "'-'" ,"defaultAddress.COUNTRY", "defaultAddress.ZIP", "defaultAddress.CITY"]) ,sqlHelper.concat(["'" + translate.text("Phone") + ":'", "(" + CommUtil.getStandardSubSqlPhone() + ")"]) ,sqlHelper.concat(["'" + translate.text("Email") + ":'", "(" + CommUtil.getStandardSubSqlMail() + ")"]) - ], " | ") + " as description " + ], " | ") + ' as "_description_"' //additional indexed fields + ", ORGANISATION.ORGANISATIONID" + ", ORGANISATION.NAME" + ", ORGANISATION.CUSTOMERCODE" + ", CONTACT.CONTACTID" - + ", (" + CommUtil.getStandardSubSqlPhone() + ') as "STANDARD_PHONE_COMMUNICATION.value"' - + ", (" + CommUtil.getStandardSubSqlMail() + ') as "STANDARD_EMAIL_COMMUNICATION.value"' + + ", (" + CommUtil.getStandardSubSqlPhone() + ") as STANDARD_PHONE_COMMUNICATION" + + ", (" + CommUtil.getStandardSubSqlMail() + ") as STANDARD_EMAIL_COMMUNICATION" + " from ORGANISATION " + " join CONTACT on CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID and CONTACT.PERSON_ID is null " + " left join ADDRESS defaultAddress on defaultAddress.ADDRESSID = CONTACT.ADDRESS_ID " diff --git a/entity/PermissionAction_entity/PermissionAction_entity.aod b/entity/PermissionAction_entity/PermissionAction_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..b79ba7a62cda9b68c901884c4b9d74b49c750411 --- /dev/null +++ b/entity/PermissionAction_entity/PermissionAction_entity.aod @@ -0,0 +1,78 @@ +<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> + <name>PermissionAction_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Action</title> + <onValidation>%aditoprj%/entity/PermissionAction_entity/onValidation.js</onValidation> + <titlePlural>Actions</titlePlural> + <recordContainer>jDito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>ACTION</name> + <title>Action</title> + <dropDownProcess>%aditoprj%/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js</dropDownProcess> + <stateProcess>%aditoprj%/entity/PermissionAction_entity/entityfields/action/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/PermissionAction_entity/entityfields/action/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>UID</name> + </entityField> + <entityProvider> + <name>PermissionActions</name> + <recordContainer>jDito</recordContainer> + <dependencies> + <entityDependency> + <name>c92e552c-6d88-4fe1-918f-1a9a71ea28ad</name> + <entityName>PermissionDetail_entity</entityName> + <fieldName>PermissionActions</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityConsumer> + <name>PermissionDetails</name> + <onValidation>%aditoprj%/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js</onValidation> + <dependency> + <name>dependency</name> + <entityName>PermissionDetail_entity</entityName> + <fieldName>Permissions</fieldName> + </dependency> + </entityConsumer> + <entityParameter> + <name>PermissionId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>AccessType_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>PermissionCondition_param</name> + <expose v="true" /> + </entityParameter> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jDito</name> + <jDitoRecordAlias>_____SYSTEMALIAS</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <onInsert>%aditoprj%/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js</onInsert> + <onUpdate>%aditoprj%/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js</onUpdate> + <onDelete>%aditoprj%/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js</onDelete> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ACTION.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ACTION.displayValue</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/PermissionAction_entity/entityfields/action/displayValueProcess.js b/entity/PermissionAction_entity/entityfields/action/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65a3ad0b2b9e511648cf581003a9061e05a1c8ad --- /dev/null +++ b/entity/PermissionAction_entity/entityfields/action/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); + +var action = vars.get("$field.ACTION"); + +result.string(action); \ No newline at end of file diff --git a/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js b/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6da1b8813f6e8ecff62b82479153d7c2e4606b68 --- /dev/null +++ b/entity/PermissionAction_entity/entityfields/action/dropDownProcess.js @@ -0,0 +1,28 @@ +import("system.vars"); +import("system.result"); + +var accesstype = vars.get("$param.AccessType_param"); +var actions = []; + +switch (accesstype) { + case "E": + actions = [ + ["view", "view"], + ["create", "create"] + ] + break; + case "R": + actions = [ + ["read", "read"], + ["update", "update"], + ["delete", "delete"] + ] + break; + case "F": + actions = [ + ["view", "view"], + ["update", "update"] + ] +} + +result.object(actions); \ No newline at end of file diff --git a/entity/PermissionAction_entity/entityfields/action/stateProcess.js b/entity/PermissionAction_entity/entityfields/action/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b4084caba76a70eeb1b82b8f65a214904cb98d16 --- /dev/null +++ b/entity/PermissionAction_entity/entityfields/action/stateProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { + result.string(neon.COMPONENTSTATE_EDITABLE); +} else { + result.string(neon.COMPONENTSTATE_READONLY); +} diff --git a/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js b/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..5acbe1fae9747b958253205861b77d6146f730c4 --- /dev/null +++ b/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js @@ -0,0 +1,33 @@ +import("Sql_lib"); +import("system.db"); +import("system.vars"); +import("system.translate"); +import("system.result"); +import("Permission_lib"); + +var alias = SqlUtils.getSystemAlias(); +var actionTitle = vars.get("$field.ACTION"); +var permissionId = vars.get("$param.PermissionId_param"); +var permCondInput = vars.get("$param.PermissionCondition_param"); + +//var deletedRows = vars.get("$field." + pConsumerField + ".deletedRows"); +var deletedRows = vars.get("$field.PermissionDetails.deletedRows"); + +if (actionTitle == "null" || actionTitle == undefined || actionTitle == null || actionTitle == "") { + result.string(translate.text("Empty actions are not allowed!")); +} else if (PermissionUtil.permissionExists(permissionId)) { + // existing permission + // check if action is already in DB + var actionsInDb = PermissionUtil.getActions([permissionId]); + var sqlStr = "select COND from ASYS_PERMISSION where ASYS_PERMISSIONID='" + permissionId + "'"; + var permCondDb = db.cell(sqlStr, alias); + + for each (var action in actionsInDb) { + if (PermissionUtil.resolveActionId(action) == actionTitle && permCondInput == permCondDb) { + result.string(translate.text("Action '" + actionTitle + "' already linked to this permission!")); + break; + } + } +} else { + result.string(true); +} \ No newline at end of file diff --git a/entity/PermissionAction_entity/onValidation.js b/entity/PermissionAction_entity/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..be4d539d44a1e2492d85480020e1b3fdba5968ac --- /dev/null +++ b/entity/PermissionAction_entity/onValidation.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.translate"); +import("system.result"); + +var actionTitle = vars.get("$field.ACTION"); + +if (actionTitle == "null" || actionTitle == undefined || actionTitle == null || actionTitle == "") { + result.string(translate.text("Empty actions are not allowed!")); +} \ No newline at end of file diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4640329c9c4f930466ccc0daffec2680d21c17a3 --- /dev/null +++ b/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,17 @@ +import("system.result"); +import("system.vars"); +import("system.tools"); +import("Permission_lib"); + +var actions = []; +var permissionId = vars.exists("$param.PermissionId_param") && vars.get("$param.PermissionId_param"); + +if (permissionId && PermissionUtil.permissionExists(permissionId)) +{ + var permActions = PermissionUtil.getActions([permissionId]); + for each (var permActionId in permActions) { + actions.push([permActionId[0], PermissionUtil.resolveActionId(permActionId), PermissionUtil.resolveActionId(permActionId)]); + } + + result.object(actions); +} \ No newline at end of file diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js b/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js new file mode 100644 index 0000000000000000000000000000000000000000..3dc7236e2952b0b90e261cce5b615bfc64045a5d --- /dev/null +++ b/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Permission_lib"); + +var action = vars.get("$local.uid"); +PermissionUtil.deleteAction(action); \ No newline at end of file diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js b/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..ba4a44784604153dc6ae0675b919766fd6d47508 --- /dev/null +++ b/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,16 @@ +import("Sql_lib"); +import("system.db"); +import("system.tools"); +import("system.result"); +import("system.vars"); +import("Permission_lib"); + +var alias = SqlUtils.getSystemAlias(); +var permissionId = vars.exists("$param.PermissionId_param") && vars.get("$param.PermissionId_param"); + +if (permissionId) { + var newAction = vars.get("$local.rowdata")["ACTION.value"]; + PermissionUtil.insertAction(permissionId, newAction, vars.get("$field.UID")); +} + +tools.clearPermissionCache(); \ No newline at end of file diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js b/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..2ca5d8944019c687e073fa926bf3211c0c1e7ea1 --- /dev/null +++ b/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js @@ -0,0 +1,13 @@ +import("system.tools"); +import("system.result"); +import("system.vars"); +import("Permission_lib"); + +var col = "ACTION"; +var table = "ASYS_PERMISSIONACTION"; +var permissionId = vars.exists("$param.PermissionId_param") && vars.get("$param.PermissionId_param"); + +if (permissionId && PermissionUtil.permissionExists(permissionId)) { + var newAction = vars.get("$local.rowdata")["ACTION.value"]; + PermissionUtil.updateIfDiff(vars.get("$field.UID"), newAction, col, table); +} \ No newline at end of file diff --git a/entity/PermissionDetail_entity/PermissionDetail_entity.aod b/entity/PermissionDetail_entity/PermissionDetail_entity.aod index 0bd38cb6c821142e651e86eda23fc88385812df0..4905d05f3b0a5357a66bba2e5848a2897daa4be7 100644 --- a/entity/PermissionDetail_entity/PermissionDetail_entity.aod +++ b/entity/PermissionDetail_entity/PermissionDetail_entity.aod @@ -8,6 +8,7 @@ </siblings> <contentTitleProcess>%aditoprj%/entity/PermissionDetail_entity/contentTitleProcess.js</contentTitleProcess> <iconIdProcess>%aditoprj%/entity/PermissionDetail_entity/iconIdProcess.js</iconIdProcess> + <titlePlural>Permission Details</titlePlural> <recordContainer>jDito</recordContainer> <entityFields> <entityProvider> @@ -16,12 +17,15 @@ <entityField> <name>CONDITION</name> <title>Condition</title> + <contentType>FILTER_TREE</contentType> <stateProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/condition/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/condition/valueProcess.js</valueProcess> </entityField> <entityField> <name>ACTION</name> <title>Action</title> - <mandatory v="true" /> + <mandatory v="false" /> + <state>INVISIBLE</state> </entityField> <entityField> <name>ROLE</name> @@ -44,6 +48,7 @@ <stateProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/onValueChange.js</onValueChange> </entityField> <entityField> <name>FIELD</name> @@ -98,6 +103,12 @@ <fieldName>PermissionDetails</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>62a56e76-d049-4c53-a439-79261a8058e1</name> + <entityName>PermissionAction_entity</entityName> + <fieldName>PermissionDetails</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityParameter> @@ -162,6 +173,29 @@ </entityParameter> </children> </entityConsumer> + <entityConsumer> + <name>PermissionActions</name> + <onValidation>%aditoprj%/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js</onValidation> + <dependency> + <name>dependency</name> + <entityName>PermissionAction_entity</entityName> + <fieldName>PermissionActions</fieldName> + </dependency> + <children> + <entityParameter> + <name>PermissionId_param</name> + <valueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>AccessType_param</name> + <valueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/permissionactions/children/accesstype_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>PermissionCondition_param</name> + <valueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissioncondition_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/PermissionDetail_entity/contentTitleProcess.js b/entity/PermissionDetail_entity/contentTitleProcess.js index 28deb444c318b28bd734b722ef718b7537b24ade..937f96a1d91d81edeced428071f1acce83dcc344 100644 --- a/entity/PermissionDetail_entity/contentTitleProcess.js +++ b/entity/PermissionDetail_entity/contentTitleProcess.js @@ -3,6 +3,8 @@ import("system.vars"); import("system.result"); var res = ""; +var entityName = vars.get("$field.ENTITY"); +var noCond = "{\"entity\":\"" + entityName + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; switch (vars.get("$field.ACCESSTYPE")) { case "E": @@ -25,10 +27,12 @@ switch (vars.get("$field.ACCESSTYPE")) { break; } -if (vars.get("$field.CONDITION") != "") { - res += " - conditional"; -} else { - res += " - default"; +if (vars.get("$field.ACCESSTYPE") != "E") { + if (vars.get("$field.CONDITION") != noCond && vars.get("$field.CONDITION") != "") { + res += " - conditional"; + } else { + res += " - default"; + } } result.string(res); \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js b/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js index 834f79bd2a754a3fb66944f5629e2a46de1ce41a..64d2e3dbafd4e842abc03c05b85b260aaf72e727 100644 --- a/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js +++ b/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js @@ -8,7 +8,7 @@ var field = vars.get("$field.FIELD"); var role = vars.get("$field.ROLE"); var entity = vars.get("$field.ENTITY"); var accesstype = vars.get("$field.ACCESSTYPE"); -var rootPermSet = PermissionUtil.getRootPermissionSet(role, entity); +var rootPermSet = PermissionUtil.getSetRoot(role, entity); if (operatingState == neon.OPERATINGSTATE_SEARCH || neon.OPERATINGSTATE_VIEW) { switch (accesstype) { diff --git a/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js b/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js index 82036f5ff916194d760c728c88286323362d31c4..77b31c523511833ae46b2844d6d8c72271298148 100644 --- a/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js +++ b/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.result"); import("Permission_lib"); @@ -7,8 +6,8 @@ var field = vars.get("$field.FIELD"); var role = vars.get("$field.ROLE"); var entity = vars.get("$field.ENTITY"); var permId = vars.get("$field.UID"); -var rootPermSet = PermissionUtil.getRootPermissionSet(role, entity); -var rootPerm = PermissionUtil.getDefaultPermission(rootPermSet); +var rootPermSet = PermissionUtil.getSetRoot(role, entity); +var rootPerm = PermissionUtil.getPermissionWithoutCond(rootPermSet); if (PermissionUtil.getCondType(rootPerm) == "false") { // condtype="false" is used to display that this entity has the usePermissions flag set but has no permissions linked -> no access on any level diff --git a/entity/PermissionDetail_entity/entityfields/condition/stateProcess.js b/entity/PermissionDetail_entity/entityfields/condition/stateProcess.js index ad116179661d269a520ee40204edef68ddb22c6c..419962f904c9cd0a047f5c53832be8154b966e77 100644 --- a/entity/PermissionDetail_entity/entityfields/condition/stateProcess.js +++ b/entity/PermissionDetail_entity/entityfields/condition/stateProcess.js @@ -3,7 +3,9 @@ import("system.result"); import("system.neon"); if(vars.get("$field.ACCESSTYPE") == "E") { - result.string(neon.COMPONENTSTATE_DISABLED); + result.string(neon.COMPONENTSTATE_INVISIBLE); } else { - result.string(neon.COMPONENTSTATE_EDITABLE); + if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { + result.string(neon.COMPONENTSTATE_EDITABLE); + } } \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/condition/valueProcess.js b/entity/PermissionDetail_entity/entityfields/condition/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c8e452efeaa3197fa0919a27a7607a57f600f27e --- /dev/null +++ b/entity/PermissionDetail_entity/entityfields/condition/valueProcess.js @@ -0,0 +1,11 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +var thisValueNotValid = "{\"entity\":\"\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == thisValueNotValid)) { + var entity = vars.get("$field.ENTITY"); + var condJson = JSON.stringify({entity: "" + entity + "", filter: {type: "group", operator: "AND", childs: []}}); + result.string(condJson); +} \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/entity/onValueChange.js b/entity/PermissionDetail_entity/entityfields/entity/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..11440115d21a7626a41c66c47e40a9eef5044612 --- /dev/null +++ b/entity/PermissionDetail_entity/entityfields/entity/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.refresh(); \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/field/stateProcess.js b/entity/PermissionDetail_entity/entityfields/field/stateProcess.js index 2a3f639a77b08b9c6b6bcfe08a44a1260d27ba64..a28f5c86f9be5e45e9d693571091ce4a7fd1d03a 100644 --- a/entity/PermissionDetail_entity/entityfields/field/stateProcess.js +++ b/entity/PermissionDetail_entity/entityfields/field/stateProcess.js @@ -7,7 +7,7 @@ import("Permission_lib"); var role = vars.get("$field.ROLE"); var entity = vars.get("$field.ENTITY"); -rootPermSet = PermissionUtil.getRootPermissionSet(role, entity); +rootPermSet = PermissionUtil.getSetRoot(role, entity); if (rootPermSet == "") { result.string(neon.COMPONENTSTATE_DISABLED); diff --git a/entity/PermissionDetail_entity/entityfields/permissionactions/children/accesstype_param/valueProcess.js b/entity/PermissionDetail_entity/entityfields/permissionactions/children/accesstype_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..530d2556d48deea69763a157ea7713b4dc0b233f --- /dev/null +++ b/entity/PermissionDetail_entity/entityfields/permissionactions/children/accesstype_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$field.ACCESSTYPE")); \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissioncondition_param/valueProcess.js b/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissioncondition_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..13699cb90d170236ada6231abba8ab035aaf7bfe --- /dev/null +++ b/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissioncondition_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$field.CONDITION")); \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js b/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8380b4e449705c93f42a6b3eae4736708622094a --- /dev/null +++ b/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js @@ -0,0 +1,17 @@ +import("system.vars"); +import("system.result"); +import("Permission_lib"); + +var entity = vars.get("$field.ENTITY"); +var cond = vars.get("$field.CONDITION"); +var noCond = "{\"entity\":\"" + entity + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; +var permSetId = PermissionUtil.getSet(vars.get("$field.ROLE"), vars.get("$field.ENTITY"), vars.get("$field.ACCESSTYPE")); + +if (permSetId != "" && (cond == "" || cond == noCond)) { + var rootPermId = PermissionUtil.getPermissionWithoutCond(permSetId); + if (rootPermId != "") { + result.string(rootPermId); + } +} else { + result.string(vars.get("$field.UID")); +} \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js b/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..2da1099bbc36332519d87a91ed9da6a9a7ed105e --- /dev/null +++ b/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js @@ -0,0 +1,106 @@ +import("Sql_lib"); +import("system.db"); +import("system.vars"); +import("system.translate"); +import("system.result"); +import("Permission_lib"); + +var allowedNumberOfActionsForRecordPermission = 3; +var allowedNumberOfActionsForEntityPermissions = 2; +var allowedNumberOfActionsForFieldPermissions = 2; + +var entityTitle = vars.get("$field.ENTITY"); +var roleTitle = vars.get("$field.ROLE"); +var fieldTitle = vars.get("$field.FIELD"); +var accesstype = vars.get("$field.ACCESSTYPE"); +var permCondInput = vars.get("$field.CONDITION"); +var permCondType = vars.get("$field.CONDTYPE"); +var permId = PermissionUtil.getPermission(roleTitle, entityTitle, fieldTitle, accesstype, permCondInput, permCondType); +var actionsInDb = PermissionUtil.getActions([permId]); +var actionsAsStringArray = vars.get("$field.ACTION").split(","); // only useful while working with already existing permissions +var noCond = "{\"entity\":\"" + entityTitle + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; + +var deletedRows = vars.get("$field.PermissionActions.deletedRows"); +var changedRows = vars.get("$field.PermissionActions.changedRows"); +var insertedRows = vars.get("$field.PermissionActions.insertedRows"); + +for each (let row in insertedRows) { + if (row.ACTION == "") { + result.string(translate.text("Empty actions are not allowed!")); + break; + } +} + +if (deletedRows.length == actionsAsStringArray.length && changedRows.length == 0 && insertedRows.length == 0) { + result.string(translate.text("Permissions without actions are not allowed!")); +} + +if (PermissionUtil.permissionExists(permId)) { + // old permission + // insert only possible, if the same action is not already linked to the permission + for each (let row in insertedRows) { + var actionHasJustBeenDeleted = false; + if (PermissionUtil.actionExists(row.ACTION, permId)) { + for each (let delRow in deletedRows) { + if (row.ACTION == delRow.ACTION) { + actionHasJustBeenDeleted = true; + } + } + if (!actionHasJustBeenDeleted) { + result.string(translate.text("Action '" + row.ACTION + "' already linked to this permission.")); + } + } + } + + for each (let row in changedRows) { + if (PermissionUtil.actionExists(row.ACTION, permId) && actionsAsStringArray.indexOf(row.ACTION) == -1) { + result.string(translate.text("Action '" + row.ACTION + "' already linked to this permission.")); + } + } +} else { + // new permission + if (insertedRows.length > 0) { + var defaultPerm = PermissionUtil.getPermission(roleTitle, entityTitle, fieldTitle, accesstype, noCond); + if (PermissionUtil.permissionExists(defaultPerm)) { + var defaultActions = PermissionUtil.getActions([defaultPerm]); + for each (let entry in insertedRows) { + for each (let action in defaultActions) { + if (entry.ACTION == PermissionUtil.resolveActionId(action)) { + result.string(translate.text("Action '" + entry.ACTION + "' is already linked to a permission with this role-entity-field-combination")); + } + } + } + } + + for (let i = 0; i < insertedRows.length-1; i++) { + for (let j = i + 1; j < insertedRows.length; j++) { + if (insertedRows[i].ACTION == insertedRows[j].ACTION) { + result.string(translate.text("No duplicates allowed: action '" + insertedRows[i].ACTION + "'")); + } + } + } + } + +} + +if (insertedRows.length > 0) { + switch (accesstype) { + case "E": + if (actionsInDb.length >= allowedNumberOfActionsForEntityPermissions && !actionHasJustBeenDeleted) { + result.string(translate.text("Only " + allowedNumberOfActionsForEntityPermissions + " actions allowed for this type of permission.")); + } + break; + case "R": + if (actionsInDb.length >= allowedNumberOfActionsForRecordPermission && !actionHasJustBeenDeleted) { + result.string(translate.text("Only " + allowedNumberOfActionsForRecordPermission + " actions allowed for this type of permission.")); + } + break; + case "F": + if (actionsInDb.length >= allowedNumberOfActionsForFieldPermissions && !actionHasJustBeenDeleted) { + result.string(translate.text("Only " + allowedNumberOfActionsForFieldPermissions + " actions allowed for this type of permission.")); + } + break; + default: + result.string(translate.text("This error should never appear - contact administrator (PermissionDetail_entity.PermissionAction.onValidation).")); + } +} \ No newline at end of file diff --git a/entity/PermissionDetail_entity/entityfields/role/valueProcess.js b/entity/PermissionDetail_entity/entityfields/role/valueProcess.js index 0f3e4521b074db52928320220a301a82f1720abd..d67b588f692d980b2940bdb21283d13909bc7a90 100644 --- a/entity/PermissionDetail_entity/entityfields/role/valueProcess.js +++ b/entity/PermissionDetail_entity/entityfields/role/valueProcess.js @@ -8,7 +8,7 @@ var role = ""; if(vars.exists("$param.RoleTitle_param") && (recordstate == neon.OPERATINGSTATE_NEW)) { role = vars.get("$param.RoleTitle_param"); } else { - role = vars.get("$field.ROLE"); + role = vars.get("$this.value"); } result.string(role); \ No newline at end of file diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js index 44edb699f0c0827f4ce776f34e4f3875a478b061..b0aa5ab5592d45f36b45bdab7dbe30b66b166293 100644 --- a/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js @@ -1,146 +1,198 @@ -import("system.util"); -import("system.vars"); -import("system.db"); -import("system.result"); -import("Permission_lib"); -import("system.project"); - -var selectedPermission = vars.get("$local.idvalues"); -var sqlStr; -var whereCond = " where"; -var alias = "_____SYSTEMALIAS"; -var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY); -var entityStructure; -var entitiesUsePermFlagSet = []; -var fieldsUsePermFlagSet = []; - -// gets all names of the entites which have the 'usePermission'-flag set (positive list) -// gets all names of the fields which have the 'usePermission'-flag set (positive list) -for each (let entityMetaData in entitiesMetaData) { - if (entityMetaData[6] == "true") { - entitiesUsePermFlagSet.push(entityMetaData[0]) - entityStructure = project.getEntityStructure(entityMetaData[0]); - for (fieldname in entityStructure.fields) { - field = entityStructure.fields[fieldname]; - if (field.usePermissions == true) { - fieldsUsePermFlagSet.push(field.name); - } - } - } -} - -whereCond += " ENTITY_ID in ('" + entitiesUsePermFlagSet.join("','") + "')"; -whereCond += " and (FIELD_ID in ('" + fieldsUsePermFlagSet.join("','") + "') or FIELD_ID is NULL)"; - -if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) { - whereCond += " and ASYS_PERMISSIONSET.ROLE_ID = '" + vars.getString("$param.RoleTitle_param") + "'"; -} else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) { - whereCond += " and ASYS_PERMISSIONSET.ENTITY_ID = '" + vars.getString("$param.EntityTitle_param") + "'"; -} - -sqlStr = - "select ASYS_PERMISSION.ASYS_PERMISSIONID, ASYS_PERMISSIONSET.ENTITY_ID, ASYS_PERMISSIONSET.ROLE_ID," - + " ASYS_PERMISSIONSET.FIELD_ID, ASYS_PERMISSION.COND, ASYS_PERMISSIONACTION.ACTION, ASYS_PERMISSIONSET.ACCESSTYPE, ASYS_PERMISSION.CONDTYPE from ASYS_PERMISSIONSET" - + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID" - + " join ASYS_PERMISSIONACTION on ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID = ASYS_PERMISSION.ASYS_PERMISSIONID" - + whereCond - + " order by ASYS_PERMISSION.ASYS_PERMISSIONID"; - -var sqlRes = db.table(sqlStr, alias); -var permissionTable = PermissionUtil.convertArrToObj(sqlRes); - -// group all permissions by permissionid and condition, concat actions -var groupedPermissionTable = [], concatAction; -for (let i = 0; i < permissionTable.length - 1; i++) { - for (let j = i + 1; j < permissionTable.length; j++) { - if (permissionTable[i].permissionid == permissionTable[j].permissionid && permissionTable[i].cond == permissionTable[j].cond) { - var currPermId = permissionTable[i].permissionid; - var indexCurrPermGrouped = PermissionUtil.indexOfPermId(groupedPermissionTable, currPermId); - if (indexCurrPermGrouped > -1) { - // permissionset got already grouped before - // concat current action with the actions which got already grouped - concatAction = groupedPermissionTable[indexCurrPermGrouped].action + "," + permissionTable[j].action; - groupedPermissionTable[indexCurrPermGrouped].action = concatAction; - break; - } else { - concatAction = permissionTable[i].action + "," + permissionTable[j].action; - groupedPermissionTable.push(permissionTable[i]); - groupedPermissionTable[groupedPermissionTable.length-1].action = concatAction; - break; - } - } - } -} - -var res = []; -var permissionTableOrigin = PermissionUtil.convertArrToObj(sqlRes); - -// no permission selected, return all permission entrys -if (selectedPermission == null) { - for each (let entry in groupedPermissionTable) { - res = prepareResultArray(entry, res); - } - - for each (let entry in permissionTableOrigin) { - if (PermissionUtil.indexOfPermId(PermissionUtil.convertArrToObj(res), entry.permissionid) == -1) { - res = prepareResultArray(entry, res); - } - } -} else { // permission selected, return only the selected permission entry - for each (let entry in groupedPermissionTable) { - if (selectedPermission == entry.permissionid) { - res = prepareResultArray(entry, res); - break; - } - } - - for each (let entry in permissionTableOrigin) { - if (selectedPermission == entry.permissionid) { - if (PermissionUtil.indexOfPermId(PermissionUtil.convertArrToObj(res), entry.permissionid) == -1) { - res = prepareResultArray(entry, res); - break; - } - } - } -} - -result.object(res.sort(sortFunction)); - -function prepareResultArray(pEntry, pRes) { - var rootPermission = ""; - if (pEntry.accesstype != "E") { - if (pEntry.accesstype == "F" && pEntry.cond != "") { - rootPermission = PermissionUtil.getRootFieldPermission(pEntry.permissionid); - if (rootPermission == "") { - rootPermission = PermissionUtil.getRootPermission(pEntry.permissionid); - } - } else - rootPermission = PermissionUtil.getRootPermission(pEntry.permissionid); - } - pRes.push([pEntry.permissionid, pEntry.entity, pEntry.role, pEntry.field, pEntry.cond, pEntry.action, pEntry.accesstype, pEntry.condtype, rootPermission]); - return pRes; -} - -// used to sort result array: Entity -> Records -> Fields -function sortFunction(a, b) { - if (a[6] == b[6] && a[6] != "F" && a[6] != "R") - return 0; - else if (a[6] == "E") - return -1; - else if (b[6] == "E") - return 1; - else if (a[6] == "R" && b[6] == "F") - return -1; - else if (a[6] == "F" && b[6] == "R") - return 1; - else if (a[6] == "R" && b[6] == "R" && a[4] == "") - return -1; - else if (a[6] == "R" && b[6] == "R" && b[4] == "") - return 1; - else if (a[6] == "F" && b[6] == "F" && a[4] == "") - return -1; - else if (a[6] == "F" && b[6] == "F" && b[4] == "") - return 1; - else - return 0; +import("Sql_lib"); +import("system.util"); +import("system.vars"); +import("system.db"); +import("system.result"); +import("Permission_lib"); +import("system.project"); + +var selectedPermission = vars.get("$local.idvalues"); +var sqlStr; +var whereCond = " where"; +var alias = SqlUtils.getSystemAlias(); +var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY); +var entityStructure; +var entitiesUsePermFlagSet = []; +var fieldsUsePermFlagSet = []; +var noCond = "{\"entity\":\"" + vars.get("$field.ENTITY") + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; + +// gets all names of the entites which have the 'usePermission'-flag set (positive list) +// gets all names of the fields which have the 'usePermission'-flag set (positive list) +for each (let entityMetaData in entitiesMetaData) { + if (entityMetaData[6] == "true") { + entitiesUsePermFlagSet.push(entityMetaData[0]) + entityStructure = project.getEntityStructure(entityMetaData[0]); + for (fieldname in entityStructure.fields) { + field = entityStructure.fields[fieldname]; + if (field.usePermissions == true) { + fieldsUsePermFlagSet.push(field.name); + } + } + } +} + +whereCond += " ENTITY_ID in ('" + entitiesUsePermFlagSet.join("','") + "')"; +whereCond += " and (FIELD_ID in ('" + fieldsUsePermFlagSet.join("','") + "') or FIELD_ID is NULL)"; + +if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) { + whereCond += " and ASYS_PERMISSIONSET.ROLE_ID = '" + vars.getString("$param.RoleTitle_param") + "'"; +} else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) { + whereCond += " and ASYS_PERMISSIONSET.ENTITY_ID = '" + vars.getString("$param.EntityTitle_param") + "'"; +} + +sqlStr = + "select ASYS_PERMISSION.ASYS_PERMISSIONID, ASYS_PERMISSIONSET.ENTITY_ID, ASYS_PERMISSIONSET.ROLE_ID," + + " ASYS_PERMISSIONSET.FIELD_ID, ASYS_PERMISSION.COND, ASYS_PERMISSIONACTION.ACTION, ASYS_PERMISSIONSET.ACCESSTYPE, ASYS_PERMISSION.CONDTYPE from ASYS_PERMISSIONSET" + + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID" + + " join ASYS_PERMISSIONACTION on ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID = ASYS_PERMISSION.ASYS_PERMISSIONID" + + whereCond + + " order by ASYS_PERMISSION.ASYS_PERMISSIONID"; + +var sqlRes = db.table(sqlStr, alias); +var permissionTable = PermissionUtil.convertArrToObj(sqlRes); + +// group all permissions by permissionid and condition, concat actions +var groupedPermissionTable = [], concatAction; +for (let i = 0; i < permissionTable.length - 1; i++) { + for (let j = i + 1; j < permissionTable.length; j++) { + if (permissionTable[i].permissionid == permissionTable[j].permissionid && permissionTable[i].cond == permissionTable[j].cond) { + var currPermId = permissionTable[i].permissionid; + var indexCurrPermGrouped = PermissionUtil.indexOfPermId(groupedPermissionTable, currPermId); + if (indexCurrPermGrouped > -1) { + // permissionset got already grouped before + // concat current action with the actions which got already grouped + concatAction = groupedPermissionTable[indexCurrPermGrouped].action + "," + permissionTable[j].action; + groupedPermissionTable[indexCurrPermGrouped].action = concatAction; + break; + } else { + concatAction = permissionTable[i].action + "," + permissionTable[j].action; + groupedPermissionTable.push(permissionTable[i]); + groupedPermissionTable[groupedPermissionTable.length-1].action = concatAction; + break; + } + } + } +} + +var res = []; +var permissionTableOrigin = PermissionUtil.convertArrToObj(sqlRes); + +// no permission selected, return all permission entrys +if (selectedPermission == null) { + for each (let entry in groupedPermissionTable) { + res = prepareResultArray(entry, res); + } + + for each (let entry in permissionTableOrigin) { + if (PermissionUtil.indexOfPermId(PermissionUtil.convertArrToObj(res), entry.permissionid) == -1) { + res = prepareResultArray(entry, res); + } + } +} else { // permission selected, return only the selected permission entry + for each (let entry in groupedPermissionTable) { + if (selectedPermission == entry.permissionid) { + res = prepareResultArray(entry, res); + break; + } + } + + for each (let entry in permissionTableOrigin) { + if (selectedPermission == entry.permissionid) { + if (PermissionUtil.indexOfPermId(PermissionUtil.convertArrToObj(res), entry.permissionid) == -1) { + res = prepareResultArray(entry, res); + break; + } + } + } +} + +result.object(res.sort(sortResultsAfterCondition).sort(sortResultsAfterAccessTypes)); + +function prepareResultArray(pEntry, pRes) { + var rootPermission = ""; + if (pEntry.accesstype != "E") { + if (pEntry.accesstype == "F" && pEntry.cond != "" && pEntry.cond != noCond) { + rootPermission = PermissionUtil.getPermissionWithoutCond(PermissionUtil.getParentSet(pEntry.permissionid)); + if (rootPermission == "") { + rootPermission = PermissionUtil.getPermissionRoot(pEntry.permissionid); + } + } else + rootPermission = PermissionUtil.getPermissionRoot(pEntry.permissionid); + } + pRes.push([pEntry.permissionid, pEntry.entity, pEntry.role, pEntry.field, pEntry.cond, + sortActions(pEntry.action.split(","), pEntry.accesstype).join(","), pEntry.accesstype, pEntry.condtype, rootPermission]); + return pRes; +} + +// sorts action csv string +// Entity: view -> create +// Record: read -> update -> delete +// Field: view -> update +function sortActions(actions, accesstype) { + return actions.sort(function(a, b) { + switch (accesstype) { + case "E": + if (a == "view") { + return -1; + } else { + return 1; + } + break; + case "R": + if (a == "read") { + return -1; + } else if (a == "update" && b == "delete") { + return 0; + } else { + return 1; + } + break; + case "F": + if (a == "view") { + return -1; + } else { + return 1; + } + break; + default: + return 0; + break; + } + }) +} + +// sorts result array: Entity -> Records -> Fields +function sortResultsAfterAccessTypes(a, b) { + if (a[6] == b[6] && a[6] != "F" && a[6] != "R") + return 0; + else if (a[6] == "E") + return -1; + else if (b[6] == "E") + return 1; + else if (a[6] == "R" && b[6] == "F") + return -1; + else if (a[6] == "F" && b[6] == "R") + return 1; + else if (a[6] == "R" && b[6] == "R" && a[4] == "") + return -1; + else if (a[6] == "R" && b[6] == "R" && b[4] == "") + return 1; + else if (a[6] == "F" && b[6] == "F" && a[4] == "") + return -1; + else if (a[6] == "F" && b[6] == "F" && b[4] == "") + return 1; + else + return 0; +} + +// sorts result array: default permission -> conditional permission +function sortResultsAfterCondition(a, b) { + var noCond = "{\"entity\":\"" + vars.get("$field.ENTITY") + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; + if (a[4] == "" || a[4] == noCond) { + return -1; + } else if (b[4] == "" || b[4] == noCond) { + return 1; + } else { + return 0; + } } \ No newline at end of file diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js b/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js index a53b540b0027aaf55679b569d9433362fb35c4d2..54100375b14cef0becd2fabc1ca5fc5a5ab15f9f 100644 --- a/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js +++ b/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js @@ -5,11 +5,11 @@ import("system.db"); import("system.vars"); import("Permission_lib"); +var alias = SqlUtils.getSystemAlias(); var permId = vars.get("$field.UID"); var accessType = vars.get("$field.ACCESSTYPE"); -var parentPermSetId = PermissionUtil.getParentPermissionSet(permId); -var linkedActions = PermissionUtil.getAllChildPermissionActions(permId); -var alias = "_____SYSTEMALIAS"; +var parentPermSetId = PermissionUtil.getParentSet(permId); +var linkedActions = PermissionUtil.getActions([permId]); var sqlCondDelAction = SqlCondition.begin() .and("ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID in ('" + linkedActions.join("','") + "')") @@ -23,20 +23,20 @@ var sqlCondDelPermSet = SqlCondition.begin() switch (accessType) { case "E": - var allPermSets = PermissionUtil.getAllChildPermissionSets(parentPermSetId); + var allPermSets = PermissionUtil.getChildSetsOfSet(parentPermSetId); allPermSets.push(parentPermSetId); - var allPerms = PermissionUtil.getAllPermissions(allPermSets); - var allPermActions = PermissionUtil.getAllPermissionActions(allPerms); + var allPerms = PermissionUtil.getPermissions(allPermSets); + var allPermActions = PermissionUtil.getActions(allPerms); sqlCondDelAction = SqlCondition.begin() - .and("ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID in ('" + allPermActions.join("','") + "')") - .build(); + .and("ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID in ('" + allPermActions.join("','") + "')") + .build(); sqlCondDelPerm = SqlCondition.begin() - .and("ASYS_PERMISSION.ASYS_PERMISSIONID in ('" + allPerms.join("','") + "')") - .build(); + .and("ASYS_PERMISSION.ASYS_PERMISSIONID in ('" + allPerms.join("','") + "')") + .build(); sqlCondDelPermSet = SqlCondition.begin() - .and("ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID in ('" + allPermSets.join("','") + "')") - .build(); + .and("ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID in ('" + allPermSets.join("','") + "')") + .build(); db.deleteData("ASYS_PERMISSIONACTION", sqlCondDelAction, alias); // delete all actions db.deleteData("ASYS_PERMISSION", sqlCondDelPerm, alias); // delete all permissions @@ -48,7 +48,7 @@ switch (accessType) { break; } -if (PermissionUtil.permSetIsEmpty(parentPermSetId)) { +if (PermissionUtil.setIsEmpty(parentPermSetId)) { db.deleteData("ASYS_PERMISSIONSET", sqlCondDelPermSet, alias); // delete empty permissionset } diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js b/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js index 3a8117c2036e0fd0b85fe1172c271059bb518746..25b19a3327de2ca40aa83018dfd22d69ce2bc42e 100644 --- a/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js +++ b/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js @@ -1,3 +1,4 @@ +import("Sql_lib"); import("Permission_lib"); import("system.neon"); import("system.util"); @@ -7,28 +8,21 @@ import("system.tools"); import("Permission_lib"); import("Entity_lib"); -var table, cols, vals; -var alias = "_____SYSTEMALIAS"; +var alias = SqlUtils.getSystemAlias(); +var tablename = "ASYS_PERMISSION"; var sqlExt = ""; -var permissionid = util.getNewUUID(); +var permissionid = vars.get("$field.UID"); var role = vars.get("$field.ROLE"); var entity = vars.get("$field.ENTITY"); var field = vars.get("$field.FIELD"); var accesstype = vars.get("$field.ACCESSTYPE").trim(); var condtype = vars.get("$field.CONDTYPE").trim(); var condition = vars.get("$field.CONDITION"); -var action = vars.get("$field.ACTION"); -if (checkInput([role, entity, accesstype, condtype, action])) { - if (checkInput([field])) - sqlExt += " and FIELD_ID = '" + field + "'"; - else if (action.includes("view") || action.includes("create")) - sqlExt += " and ACCESSTYPE = 'E'"; - else - sqlExt += " and ACCESSTYPE = 'R'"; - - var sqlStr = "select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET where ENTITY_ID = '" + entity + "' and ROLE_ID = '" + role + "'" + sqlExt; - var permissionsetid = db.cell(sqlStr, alias); +if (checkInput([role, entity, accesstype, condtype])) { + + // permission set + var permissionsetid = PermissionUtil.getSet(role, entity, accesstype, field); if (permissionsetid == "") { // no fitting permissionset found - insert new permissionset @@ -36,35 +30,24 @@ if (checkInput([role, entity, accesstype, condtype, action])) { if (accesstype == "E") { rootpermissionset = ""; } else { - rootpermissionset = PermissionUtil.getRootPermissionSet(role, entity); - } - permissionsetid = PermissionUtil.insertNewPermissionSet(rootpermissionset, entity, role, field, accesstype) - } - - // deletes permissions with CONDTYPE = 'false' - condtype=false if a permission is used to display that a entity has no permissions - var childPermissions = PermissionUtil.getAllChildPermissions(permissionsetid); - for each (var permid in childPermissions) { - if (PermissionUtil.getCondType(permid) == "false") { - PermissionUtil.deletePermission(permid); + rootpermissionset = PermissionUtil.getSetRoot(role, entity); } + permissionsetid = PermissionUtil.insertSet(rootpermissionset, entity, role, field, accesstype); } - - // check if a new permissions is needed or an existing one can be used - var existingPermId = permExists(role, entity, field, accesstype, condtype, condition); - if (existingPermId != "") { - // update - permissionid = existingPermId; + + // permission + var existingPerm = PermissionUtil.getPermission(role, entity, field, accesstype, condition); + if (existingPerm == "") { + // no existing perm found -> insert + PermissionUtil.insertPermission(permissionsetid, condition, condtype, permissionid); } else { - // permission doesnt exist -> insert new permission - // new permissionid is needed to link actions to the permission in the next step - permissionid = PermissionUtil.insertNewPermission(permissionsetid, condition, condtype) + // existing perm found -> update + PermissionUtil.updateIfDiff(existingPerm, permissionsetid, "ASYS_PERMISSIONSET_ID", tablename); + PermissionUtil.updateIfDiff(existingPerm, condition, "COND", tablename); + PermissionUtil.updateIfDiff(existingPerm, "true", "CONDTYPE", tablename); } - // insert new permissionaction - var actionNew = action.split(","); - for each (let permaction in actionNew) { - PermissionUtil.insertNewPermissionAction(permissionid, permaction); - } + // permission action gets created in PermissionAction_entity tools.clearPermissionCache(); } @@ -76,25 +59,4 @@ function checkInput(pInputArr) { return false; } return true; -} - -// returns permissionid of the permission with fitting parameters, otherwise returns empty string -function permExists(pRole, pEntity, pField, pAccesstype, pCondtype, pCondition) { - var sqlStr = ""; - var sqlExt = ""; - - if (checkInput([pCondition])) { - sqlExt += " and COND = '" + pCondition + "'"; - } - - if (checkInput([pField])) { - sqlExt += " and FIELD_ID = '" + pField + "'"; - } - - sqlStr = "select ASYS_PERMISSION.ASYS_PERMISSIONID from ASYS_PERMISSIONSET" - + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID" - + " where ENTITY_ID = '" + pEntity + "' and ROLE_ID = '" + pRole + "'" - + " and ACCESSTYPE = '" + pAccesstype + "' and CONDTYPE = '" + pCondtype + "'" + sqlExt; - var permId = db.cell(sqlStr, alias); - return permId; } \ No newline at end of file diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js b/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js index 0bac6c05f928b15b692f05e9d7d286da7979301e..cacdde1e352e2d9859d8f39f20fb9e2f3af4378c 100644 --- a/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js @@ -8,7 +8,7 @@ import("Permission_lib"); var table, cols, vals, cond; -var alias = "_____SYSTEMALIAS"; +var alias = SqlUtils.getSystemAlias(); var permissionid = vars.get("$field.UID"); var actionNew = vars.get("$field.ACTION").split(","); var entityNew = vars.get("$field.ENTITY"); @@ -25,14 +25,12 @@ if (diff.length > 0) { // insert the different actions cols = db.getColumns(table, alias); for each (var action in actionNew) { - PermissionUtil.insertNewPermissionAction(permissionid, action); + PermissionUtil.insertAction(permissionid, action); } } PermissionUtil.updateIfDiff(permissionid, permCond, "COND", "ASYS_PERMISSION"); // updates COND if the new cond is different to COND in DB PermissionUtil.updateIfDiff(permissionid, permCondType, "CONDTYPE", "ASYS_PERMISSION"); // updates CONDTYPE if the new condtype is different to CONDTYPE in DB -// entity of children has to be changed/deleted/ignored? -// PermissionUtil.updateIfDiff(PermissionUtil.getParentPermissionSet(permissionid), entityNew, "ENTITY_ID", "ASYS_PERMISSIONSET"); neon.refreshAll(); tools.clearPermissionCache(); \ No newline at end of file diff --git a/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod b/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod index 512e6e17bcfc3db474ee3d8997634a2ff5265348..30d3eb0280aa68d88e5767095c7682c7dc95ac8f 100644 --- a/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod +++ b/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod @@ -95,12 +95,15 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>TITLE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>DESCRIPTION.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>USEPERMISSION.value</name> + <isFilterable v="false" /> </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> diff --git a/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js index 97a97d450fec1e92a8284e8788a923e895d0870f..3e15f2cfb644d46d4d4177578c9542d5614fb3ab 100644 --- a/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js @@ -1,127 +1,129 @@ -import("system.logging"); -import("system.project"); -import("system.vars"); -import("system.result"); -import("system.db"); -import("Permission_lib"); - -var res = []; -var roleTitle = ""; -var entityTitle = ""; -var sqlCond = ""; -var sqlStr = ""; -var roleInternalEveryone = "INTERNAL_EVERYONE"; - -var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY); -var entitiesUsePermFlagSet = []; // array, which contains ids of entities with usePermission flag set - -// gets all names of the entites which have the 'usePermission'-flag set (positive list) -for each (let entityMetaData in entitiesMetaData) { - if (entityMetaData[6] == "true") { - entitiesUsePermFlagSet.push(entityMetaData[0]) - if (PermissionUtil.getNumberOfPermissions(entityMetaData[0]) == 0) { - // no permissions found for the given entity -> create permissionset for role INTERNAL_EVERYONE with five X's for view, create, read, edit, delete - var noAccessPermissionSetIdEntity = PermissionUtil.insertNewPermissionSet("", entityMetaData[0], roleInternalEveryone, "", "E"); - PermissionUtil.insertNewPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E" - } - } -} - -var sqlCondEntityUsePermFlagSet = " and ENTITY_ID in ('" + entitiesUsePermFlagSet.join("','") + "')"; - -if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) { - roleTitle = vars.getString("$param.RoleTitle_param"); - sqlCond = " where ROLE_ID = '" + roleTitle + "'"; - sqlStr = "select distinct ENTITY_ID from ASYS_PERMISSIONSET" + sqlCond + sqlCondEntityUsePermFlagSet; -} else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) { - entityTitle = vars.getString("$param.EntityTitle_param"); - sqlCond = " where ENTITY_ID = '" + entityTitle + "'"; - sqlStr = "select distinct ROLE_ID from ASYS_PERMISSIONSET" + sqlCond + sqlCondEntityUsePermFlagSet; -} - -var rolesOrEntities = db.array(db.COLUMN, sqlStr); -var entityPermSetId = ""; -for each (var entry in rolesOrEntities) { // entry contains either a role or an entity, depending on which param exists - if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) { - entityPermSetId = PermissionUtil.getRootPermissionSet(roleTitle, entry); - } else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) { - entityPermSetId = PermissionUtil.getRootPermissionSet(entry, entityTitle); - } - var recordPermSetId = PermissionUtil.getChildRecordPermissionSet(entityPermSetId); - var currOverview = [entityPermSetId, entry, "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE"]; - - // default entity permissions - currOverview = prepareOverview(entityPermSetId, currOverview, "default"); - - // conditional record permissions - currOverview = prepareOverview(recordPermSetId, currOverview, "conditional"); - - // default record permissions - currOverview = prepareOverview(recordPermSetId, currOverview, "default"); - - res.push(currOverview); -} -result.object(res); - -function prepareOverview(pPermSetId, pCurrOverview, pMode) { - var permId, defaultPermActionId, conditionalPermActionId = [], currOverview; - switch (pMode) { - case "default": - permId = PermissionUtil.getDefaultPermission(pPermSetId); - defaultPermActionId = PermissionUtil.getPermissionAction(permId); - currOverview = pCurrOverview; - - if (PermissionUtil.getPermissionCondType(permId) == "true") { - for each (let actionSets in defaultPermActionId) { - switch (PermissionUtil.resolvePermissionActionId(actionSets)) { - case "view": - currOverview[2] = "VAADIN:CIRCLE"; - break; - case "create": - currOverview[3] = "VAADIN:CIRCLE"; - break; - case "read": - currOverview[4] = "VAADIN:CIRCLE"; - break; - case "update": - currOverview[5] = "VAADIN:CIRCLE"; - break; - case "delete": - currOverview[6] = "VAADIN:CIRCLE"; - break; - } - } - } - break; - case "conditional": - permId = PermissionUtil.getConditionalPermission(pPermSetId); - for each (let perm in permId) { - conditionalPermActionId.push(PermissionUtil.getPermissionAction(perm)); - } - currOverview = pCurrOverview; - - for each (let actionSets in conditionalPermActionId) { - for each (let action in actionSets) { - switch (PermissionUtil.resolvePermissionActionId(action)) { - case "view": - currOverview[2] = "VAADIN:CIRCLE_THIN"; - break; - case "create": - currOverview[3] = "VAADIN:CIRCLE_THIN"; - break; - case "read": - currOverview[4] = "VAADIN:CIRCLE_THIN"; - break; - case "update": - currOverview[5] = "VAADIN:CIRCLE_THIN"; - break; - case "delete": - currOverview[6] = "VAADIN:CIRCLE_THIN"; - break; - } - } - } - break; - } - return currOverview; +import("Sql_lib"); +import("system.project"); +import("system.vars"); +import("system.result"); +import("system.db"); +import("Permission_lib"); + +var res = []; +var roleTitle = ""; +var entityTitle = ""; +var sqlCond = ""; +var sqlStr = ""; +let alias = SqlUtils.getSystemAlias(); +var roleInternalEveryone = "INTERNAL_EVERYONE"; + +var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY); +var entitiesUsePermFlagSet = []; // array, which contains ids of entities with usePermission flag set + +// gets all names of the entites which have the 'usePermission'-flag set (positive list) +for each (let entityMetaData in entitiesMetaData) { + if (entityMetaData[6] == "true") { + entitiesUsePermFlagSet.push(entityMetaData[0]) + if (PermissionUtil.getNumberOfPermissions(entityMetaData[0]) == 0) { + // no permissions found for the given entity -> create permissionset for role INTERNAL_EVERYONE with five X's for view, create, read, edit, delete + var noAccessPermissionSetIdEntity = PermissionUtil.insertSet("", entityMetaData[0], roleInternalEveryone, "", "E"); + PermissionUtil.insertPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E" + } + } +} + +var sqlCondEntityUsePermFlagSet = " and ENTITY_ID in ('" + entitiesUsePermFlagSet.join("','") + "')"; + +if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) { + roleTitle = vars.getString("$param.RoleTitle_param"); + sqlCond = " where ROLE_ID = '" + roleTitle + "'"; + sqlStr = "select distinct ENTITY_ID from ASYS_PERMISSIONSET" + sqlCond + sqlCondEntityUsePermFlagSet; +} else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) { + entityTitle = vars.getString("$param.EntityTitle_param"); + sqlCond = " where ENTITY_ID = '" + entityTitle + "'"; + sqlStr = "select distinct ROLE_ID from ASYS_PERMISSIONSET" + sqlCond + sqlCondEntityUsePermFlagSet; +} + +var rolesOrEntities = db.array(db.COLUMN, sqlStr); +var entityPermSetId = ""; +for each (var entry in rolesOrEntities) { // entry contains either a role or an entity, depending on which param exists + if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) { + entityPermSetId = PermissionUtil.getSetRoot(roleTitle, entry); + } else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) { + entityPermSetId = PermissionUtil.getSetRoot(entry, entityTitle); + } + var recordPermSetId = db.array(db.COLUMN, SqlCondition.begin().and("ASYS_PERMISSIONSET_ID = '" + entityPermSetId + "'").and("ACCESSTYPE = 'R'") + .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET"), alias); + var currOverview = [entityPermSetId, entry, "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE"]; + + // default entity permissions + currOverview = prepareOverview(entityPermSetId, currOverview, "default"); + + // conditional record permissions + currOverview = prepareOverview(recordPermSetId, currOverview, "conditional"); + + // default record permissions + currOverview = prepareOverview(recordPermSetId, currOverview, "default"); + + res.push(currOverview); +} +result.object(res); + +function prepareOverview(pPermSetId, pCurrOverview, pMode) { + var conditionalPermActionId = [], currOverview; + switch (pMode) { + case "default": + var permId = PermissionUtil.getPermissionWithoutCond(pPermSetId); + var defaultPermActionId = PermissionUtil.getActions([permId]); + currOverview = pCurrOverview; + + if (PermissionUtil.getPermissionCondType(permId) == "true") { + for each (let actionSets in defaultPermActionId) { + switch (PermissionUtil.resolveActionId(actionSets)) { + case "view": + currOverview[2] = "VAADIN:CIRCLE"; + break; + case "create": + currOverview[3] = "VAADIN:CIRCLE"; + break; + case "read": + currOverview[4] = "VAADIN:CIRCLE"; + break; + case "update": + currOverview[5] = "VAADIN:CIRCLE"; + break; + case "delete": + currOverview[6] = "VAADIN:CIRCLE"; + break; + } + } + } + break; + case "conditional": + var permIds = PermissionUtil.getPermissionWithCond(pPermSetId); + for each (let permId in permIds) { + conditionalPermActionId.push(PermissionUtil.getActions([permId])); + } + currOverview = pCurrOverview; + + for each (let actionSets in conditionalPermActionId) { + for each (let action in actionSets) { + switch (PermissionUtil.resolveActionId(action)) { + case "view": + currOverview[2] = "VAADIN:CIRCLE_THIN"; + break; + case "create": + currOverview[3] = "VAADIN:CIRCLE_THIN"; + break; + case "read": + currOverview[4] = "VAADIN:CIRCLE_THIN"; + break; + case "update": + currOverview[5] = "VAADIN:CIRCLE_THIN"; + break; + case "delete": + currOverview[6] = "VAADIN:CIRCLE_THIN"; + break; + } + } + } + break; + } + return currOverview; } \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 79e3168c9d96eadd9b9224a7c71b0ee08e82a792..01df9b5d5527da847f9cbf781a4bca691c827317 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -1,10 +1,11 @@ <?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.10" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.10"> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>Person_entity</name> <description>former Pers</description> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Person_entity/documentation.adoc</documentation> <title>Contact</title> + <grantDeleteProcess>%aditoprj%/entity/Person_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Person_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Person_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Person_entity/onValidation.js</onValidation> @@ -642,7 +643,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <textInputAllowed v="true" /> </entityField> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -651,7 +652,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Person_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Person_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> <expose v="true" /> <mandatory v="true" /> </entityParameter> @@ -832,6 +833,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <isObjectAction v="false" /> <isSelectionAction v="true" /> <iconId>VAADIN:AT</iconId> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js</tooltipProcess> </entityActionField> <entityActionField> <name>addToSerialLetter</name> @@ -840,6 +842,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <isObjectAction v="false" /> <isSelectionAction v="true" /> <iconId>VAADIN:ENVELOPES</iconId> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js</tooltipProcess> </entityActionField> </children> </entityActionGroup> @@ -960,18 +963,22 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dbRecordFieldMapping> <name>DATEOFBIRTH.value</name> <recordfield>PERSON.DATEOFBIRTH</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>FIRSTNAME.value</name> <recordfield>PERSON.FIRSTNAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GENDER.value</name> <recordfield>PERSON.GENDER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LANGUAGE.value</name> - <recordfield>CONTACT.LANGUAGE</recordfield> + <recordfield>CONTACT.ISOLANGUAGE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PERSON_ID.value</name> @@ -980,10 +987,12 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dbRecordFieldMapping> <name>LASTNAME.value</name> <recordfield>PERSON.LASTNAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MIDDLENAME.value</name> <recordfield>PERSON.MIDDLENAME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACTID.value</name> @@ -992,22 +1001,27 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dbRecordFieldMapping> <name>SALUTATION.value</name> <recordfield>PERSON.SALUTATION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TITLE.value</name> <recordfield>PERSON.TITLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TITLESUFFIX.value</name> <recordfield>PERSON.TITLESUFFIX</recordfield> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORGANISATION_ID.value</name> <recordfield>CONTACT.ORGANISATION_ID</recordfield> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>REL_RELATIONSHIP.value</name> <recordfield>CONTACT.RELATIONSHIP</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.displayValue</name> @@ -1020,6 +1034,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dbRecordFieldMapping> <name>ADDRESS_ID.value</name> <recordfield>CONTACT.ADDRESS_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORGANISATION_ID.displayValue</name> @@ -1044,18 +1059,22 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>CONTACT.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>POSITION.value</name> - <recordfield>CONTACT.POSITION</recordfield> + <recordfield>CONTACT.CONTACTPOSITION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DEPARTMENT.value</name> <recordfield>CONTACT.DEPARTMENT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACTROLE.value</name> <recordfield>CONTACT.CONTACTROLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORGANISATION_NAME.value</name> @@ -1088,17 +1107,46 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <dbRecordFieldMapping> <name>ADDRESS_ID.displayValue</name> <expression>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/address_id.displayvalue/expression.js</expression> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PICTURE.value</name> <recordfield>PERSON.PICTURE</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD_EMAIL_COMMUNICATION.value</name> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STANDARD_PHONE_COMMUNICATION.value</name> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <consumerMapping> + <name>Organisations</name> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>BASIC</filtertype> + </consumerMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> <indexRecordContainer> <name>index</name> <configMode>INDEXGROUP_DEFINITION</configMode> - <patternExtensionProcess>%aditoprj%/entity/Person_entity/recordcontainers/index/patternExtensionProcess.js</patternExtensionProcess> <indexRecordAlias>Data_alias</indexRecordAlias> <query>%aditoprj%/entity/Person_entity/recordcontainers/index/query.js</query> <affectedTables> @@ -1118,21 +1166,21 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact <indexFieldMappings> <indexRecordFieldMapping> <name>FIRSTNAME.value</name> - <indexFieldType>PERS_NAME</indexFieldType> - <isKeyword v="true" /> + <indexFieldType>PHONETIC_NAME</indexFieldType> + <isBoosted v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>LASTNAME.value</name> - <indexFieldType>PERS_NAME</indexFieldType> - <isKeyword v="true" /> + <indexFieldType>PHONETIC_NAME</indexFieldType> + <isBoosted v="true" /> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>SALUTATION.value</name> - <indexFieldType>PERS_NAME</indexFieldType> + <indexFieldType>PHONETIC_NAME</indexFieldType> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>TITLE.value</name> - <indexFieldType>PERS_NAME</indexFieldType> + <indexFieldType>PHONETIC_NAME</indexFieldType> </indexRecordFieldMapping> <indexRecordFieldMapping> <name>ORGANISATION_ID.value</name> @@ -1152,7 +1200,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.value</name> - <indexFieldType>COMM</indexFieldType> + <indexFieldType>EMAIL</indexFieldType> <additionalFieldNameAliases> <element>addr</element> </additionalFieldNameAliases> @@ -1160,7 +1208,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact </indexRecordFieldMapping> <indexRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.value</name> - <indexFieldType>COMM</indexFieldType> + <indexFieldType>TELEPHONE</indexFieldType> <additionalFieldNameAliases> <element>addr</element> </additionalFieldNameAliases> diff --git a/entity/Person_entity/entityfields/address_id/valueProcess.js b/entity/Person_entity/entityfields/address_id/valueProcess.js index b889cabd69681fb9ce8c0e756e68eb1833d4eeb0..6d1c222dd7e2939f92af5c0f21e9377205bc60e0 100644 --- a/entity/Person_entity/entityfields/address_id/valueProcess.js +++ b/entity/Person_entity/entityfields/address_id/valueProcess.js @@ -1,14 +1,14 @@ -import("system.result"); -import("system.vars"); -import("StandardObject_lib"); - -// Check if the standard address is already set. -if (!vars.get("$field.ADDRESS_ID")) -{ - var possibleStandardAddressID = new StandardObject("Address", null, "Person", vars.get("$field.PERSONID")) - .onPersonValueChange(vars.get("$field.ORGANISATION_ID")); - - // If a possible standard addrss was found it should get applied to the field. - if (possibleStandardAddressID) - result.string(possibleStandardAddressID); +import("system.result"); +import("system.vars"); +import("StandardObject_lib"); + +// Check if the standard address is already set. +if (!vars.get("$this.value")) +{ + var possibleStandardAddressID = new StandardObject("Address", null, "Person", vars.get("$field.PERSONID")) + .onPersonValueChange(vars.get("$field.ORGANISATION_ID")); + + // If a possible standard addrss was found it should get applied to the field. + if (possibleStandardAddressID) + result.string(possibleStandardAddressID); } \ No newline at end of file diff --git a/entity/Person_entity/entityfields/attributes/onValidation.js b/entity/Person_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..7fd206a2b41c15ada50e1cee5d0468e6e8f4607f 100644 --- a/entity/Person_entity/entityfields/attributes/onValidation.js +++ b/entity/Person_entity/entityfields/attributes/onValidation.js @@ -3,4 +3,4 @@ import("system.vars"); import("Attribute_lib"); import("system.result"); -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js b/entity/Person_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..76c0ea1a0d6fa4b8dadbd4eca545c544935d477b --- /dev/null +++ b/entity/Person_entity/entityfields/campaignactiongroup/children/addtobulkmailfromtable/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Add the selection to a bulk mail")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js b/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js index 1d8b597ca6f299e1a9f82b72682eef6a35187449..5306ab46adf627dedf15b3c578162ed6720f8fed 100644 --- a/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js +++ b/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/onActionProcess.js @@ -1,23 +1,21 @@ -import("system.logging"); -import("system.vars"); -import("system.neon"); -import("Campaign_lib"); - -/* - * If there's a selection only those are ought to be added. - * Otherwise the filter gets checked, if a filter has beed set, the condition - * is used to determine the objects to be added. - * If no selection has been set, all objects will be added. - */ -var sysSelection = vars.get("$sys.selection"); - -if(sysSelection.length > 0) //selektierte IDs als Array -{ - CampaignUtils.addParticipantsByRowIds(JSON.stringify(sysSelection), "PERSON"); -} -else -{ - let sysFilter = vars.get("$sys.filter");//todo change name - logging.log("filter -> " + JSON.stringify(sysFilter)); - CampaignUtils.addParticipantsByCondition(JSON.stringify(sysFilter), "PERSON"); +import("system.vars"); +import("system.neon"); +import("Campaign_lib"); + +/* + * If there's a selection only those are ought to be added. + * Otherwise the filter gets checked, if a filter has beed set, the condition + * is used to determine the objects to be added. + * If no selection has been set, all objects will be added. + */ +var sysSelection = vars.get("$sys.selection"); + +if(sysSelection.length > 0) //selektierte IDs als Array +{ + CampaignUtils.addParticipantsByRowIds(JSON.stringify(sysSelection), "PERSON"); +} +else +{ + let sysFilter = vars.get("$sys.filter");//todo change name + CampaignUtils.addParticipantsByCondition(JSON.stringify(sysFilter), "PERSON"); } \ No newline at end of file diff --git a/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js b/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js index eedb470bf2e3dace60da9a626a9a910d3455675c..d7025bdf30d79dd2530c526aa2cdefe27514de17 100644 --- a/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js +++ b/entity/Person_entity/entityfields/campaignactiongroup/children/addtocampaignfromtable/stateProcess.js @@ -3,8 +3,7 @@ import("system.vars"); import("system.neon"); import("system.result"); -var query = "select count(*) from PERSON" -var contactCount = db.cell(query); +var contactCount = vars.get("$sys.datarowcount") if(contactCount > 0) { diff --git a/entity/Person_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js b/entity/Person_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d00822c123e56419934a9e98a623e3863e7a83ed --- /dev/null +++ b/entity/Person_entity/entityfields/campaignactiongroup/children/addtoserialletter/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Add the selection to a serial letter")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/dateofbirth/onValidation.js b/entity/Person_entity/entityfields/dateofbirth/onValidation.js index 9da0a7497bd26a10627d66a89a67f3b863cde608..43c36ddb3d0f82c3ac2d24246427e3baea5e02e5 100644 --- a/entity/Person_entity/entityfields/dateofbirth/onValidation.js +++ b/entity/Person_entity/entityfields/dateofbirth/onValidation.js @@ -1,9 +1,9 @@ -import("system.datetime"); +import("Date_lib"); import("system.translate"); import("system.vars"); import("system.result"); import("Entity_lib"); -var dob = ProcessHandlingUtils.getOnValidationValue(); -if (Number(datetime.clearTime(dob)) > Number(vars.get("$sys.today"))) +var dob = vars.get("local.value"); +if (!DateUtils.validateNotInFuture(dob)) result.string(translate.text("date of birth must not be in the future")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/language/valueProcess.js b/entity/Person_entity/entityfields/language/valueProcess.js index 44dcbc3f04bb4fc3788fb890bf97db622e520008..8be4c28401d63e681cbff0a6929e7d472ebf9042 100644 --- a/entity/Person_entity/entityfields/language/valueProcess.js +++ b/entity/Person_entity/entityfields/language/valueProcess.js @@ -3,5 +3,5 @@ import("system.vars"); import("system.db"); import("system.result"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.getString("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) result.string("deu"); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Person_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Person_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Person_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index 55a2ffde25da29e08fa81b0713e470531ef7a57d..4941f4e681715d0769512fba14d11801e4fc5d1f 100644 --- a/entity/Person_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Person_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.CONTACTID"), tableNames: ["CONTACT", "COMMUNICATION", "ADDRESS", "AB_ATTRIBUTERELATION"]}); -res.push({id: vars.get("$field.PERSONID"), tableNames: ["PERSON"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.CONTACTID"), tableNames: ["CONTACT", "COMMUNICATION", "ADDRESS", "AB_ATTRIBUTERELATION"]}); +res.push({id: vars.get("$field.PERSONID"), tableNames: ["PERSON"]}); + +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/Person_entity/entityfields/newemail/onActionProcess.js b/entity/Person_entity/entityfields/newemail/onActionProcess.js index cd08784b868ada5103f3dbcb0bef4d984c823074..cd7548548702791f8f81ec290a532fd19feaeafa 100644 --- a/entity/Person_entity/entityfields/newemail/onActionProcess.js +++ b/entity/Person_entity/entityfields/newemail/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Email_lib"); -EmailUtils.openNewMail(vars.getString("$field.CONTACTID")); \ No newline at end of file +EmailWritingUtils.openNewMail(vars.getString("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/organisation_id/onValidation.js b/entity/Person_entity/entityfields/organisation_id/onValidation.js index daba90e666e30baec493136b062e2f20f1f13cf4..d81b26a77cd1d51e4ab694eba2692239c65b9c2f 100644 --- a/entity/Person_entity/entityfields/organisation_id/onValidation.js +++ b/entity/Person_entity/entityfields/organisation_id/onValidation.js @@ -7,14 +7,8 @@ import("Contact_lib"); if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) { var personId = vars.getString("$field.PERSONID"); - var organisationId = ProcessHandlingUtils.getOnValidationValue("$field.ORGANISATION_ID"); + var organisationId = vars.get("$local.value"); var contactId = vars.get("$field.CONTACTID");//in EDIT we have to exclude our own CONTACTID since we do not want a message for our own contactentry - - //workaround for organisationId: $local.value will return the name of the organisation which is not what we want - //but the field already contains the changed value; so let's load the field instead of the $local.value-variable - //this is a bug within the ADITO-kernel - //TODO: change the workaround behaviour when $local.value is retrieved correct - organisationId = vars.getString("$field.ORGANISATION_ID"); var validationMsg = ContactUtils.validateIfAlreadyExists(personId, organisationId, contactId); if (validationMsg) diff --git a/entity/Person_entity/entityfields/organisation_id/valueProcess.js b/entity/Person_entity/entityfields/organisation_id/valueProcess.js index 6f44e6e6c6e93c530f1ba2446ad7cb026e04c6ce..7d921c6a57d7d9aa6d020ba2a6fe3eb3d1256be8 100644 --- a/entity/Person_entity/entityfields/organisation_id/valueProcess.js +++ b/entity/Person_entity/entityfields/organisation_id/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.vars"); import("system.neon"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { if (vars.exists("$param.OrgId_param") && vars.get("$param.OrgId_param") != null) { diff --git a/entity/Person_entity/entityfields/picture/displayValueProcess.js b/entity/Person_entity/entityfields/picture/displayValueProcess.js index d6cead6d01f7240a25145197dbead464a0f0aaf6..2ad6742677b7f0a685be75783483833b35bebfc0 100644 --- a/entity/Person_entity/entityfields/picture/displayValueProcess.js +++ b/entity/Person_entity/entityfields/picture/displayValueProcess.js @@ -3,8 +3,8 @@ import("system.result"); import("system.neon"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) { - if (vars.get("$this.value")) - result.string(vars.get("$this.value")); + if (vars.get("$field.PICTURE")) + result.string(vars.get("$field.PICTURE")); else result.string(vars.get("$param.AvatarText_param")); } diff --git a/entity/Person_entity/entityfields/standard_email_communication/onValueChange.js b/entity/Person_entity/entityfields/standard_email_communication/onValueChange.js index 972cb181d553b480c039c0d77fca8da35a528c71..b6ca79693c7baa2c3d294f57c25967f8df7db53e 100644 --- a/entity/Person_entity/entityfields/standard_email_communication/onValueChange.js +++ b/entity/Person_entity/entityfields/standard_email_communication/onValueChange.js @@ -1,4 +1,5 @@ +import("system.vars"); import("Entity_lib"); // TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023 -FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION"); \ No newline at end of file +FieldChanges.setChange("$field.STANDARD_EMAIL_COMMUNICATION", vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/standard_phone_communication/onValueChange.js b/entity/Person_entity/entityfields/standard_phone_communication/onValueChange.js index 991c92d38d0731524a8de4eb6d0adabb661a71c3..d814a8e65ad4dff521e6a9c7bae9b28d8763838e 100644 --- a/entity/Person_entity/entityfields/standard_phone_communication/onValueChange.js +++ b/entity/Person_entity/entityfields/standard_phone_communication/onValueChange.js @@ -1,4 +1,5 @@ +import("system.vars"); import("Entity_lib"); // TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023 -FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION"); \ No newline at end of file +FieldChanges.setChange("$field.STANDARD_PHONE_COMMUNICATION", vars.get("$local.value")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/status/valueProcess.js b/entity/Person_entity/entityfields/status/valueProcess.js index ab590b059440372f55b8c6d73d0c47eae06ca396..13218c16514d81765c7e5dfd47c099996adfe063 100644 --- a/entity/Person_entity/entityfields/status/valueProcess.js +++ b/entity/Person_entity/entityfields/status/valueProcess.js @@ -3,5 +3,5 @@ import("system.result"); import("system.neon"); import("KeywordRegistry_basic"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +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/Person_entity/grantDeleteProcess.js b/entity/Person_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c4ebf40c41f7ba44d1ff79e91b77b0487c59475f --- /dev/null +++ b/entity/Person_entity/grantDeleteProcess.js @@ -0,0 +1,9 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID")) + && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2625d5ed4d439e87d79d9519af1b917807fdb0b8 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("AttributeFilter_lib"); +import("system.result"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/onDBInsert.js b/entity/Person_entity/recordcontainers/db/onDBInsert.js index 157ddf8314dc0dcbcad97150a81ff52e25c50f7b..e9c6aaf6f72398df97745ae9e1ac87fd4e976392 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -1,4 +1,4 @@ import("system.vars"); import("DataPrivacy_lib"); -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$field.CONTACTID")); \ No newline at end of file +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$local.uid")); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/onDBUpdate.js b/entity/Person_entity/recordcontainers/db/onDBUpdate.js index 530c2f5d46b93d85f6ee09373a336219671aad49..e94b093bae13bbb9a87f8344ed4786ff99f5b123 100644 --- a/entity/Person_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Person_entity/recordcontainers/db/onDBUpdate.js @@ -6,8 +6,9 @@ import("Communication_lib"); import("Entity_lib"); import("StandardObject_lib"); +var rowdata = vars.get("$local.rowdata"); // TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023 -var uid = vars.get("$sys.uid"); +var uid = rowdata["CONTACT.CONTACTID"]; FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", function(state, value){ CommUtil.setStandardMail(uid, value); }); @@ -16,8 +17,8 @@ FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", f CommUtil.setStandardPhone(uid, value); }); -new StandardObject("Address", vars.get("$field.ADDRESS_ID"), "Person", vars.get("$field.CONTACTID")) - .onPersonUpdate(vars.get("$field.ORGANISATION_ID")); +new StandardObject("Address", rowdata["CONTACT.ADDRESS_ID"], "Person", uid) + .onPersonUpdate(rowdata["CONTACT.ORGANISATION_ID"]); var updates = []; @@ -26,12 +27,15 @@ vars.get("$local.changed").forEach(function(fieldName) { switch (fieldName) { case "PERSON.FIRSTNAME": case "PERSON.LASTNAME": - var user = tools.getUserByAttribute(tools.CONTACTID, [vars.get("$field.CONTACTID")], tools.PROFILE_FULL); - user[tools.PARAMS][tools.FIRSTNAME] = vars.get("$field.FIRSTNAME"); - user[tools.PARAMS][tools.LASTNAME] = vars.get("$field.LASTNAME"); - tools.updateUser(user); + var user = tools.getUserByAttribute(tools.CONTACTID, [uid], tools.PROFILE_FULL); + if (user) + { + user[tools.PARAMS][tools.FIRSTNAME] = rowdata[fieldName]; + user[tools.PARAMS][tools.LASTNAME] = rowdata[fieldName]; + tools.updateUser(user); + } break; } }) -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(vars.get("$field.CONTACTID")); \ No newline at end of file +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(uid); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e2a17f695d65b3b040e2981806e63ccbe96a2292 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "CONTACT join ACTIVITYLINK on ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID and ACTIVITYLINK.OBJECT_TYPE = 'Person' join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID"; + +result.string("PERSONID in (select CONTACT.PERSON_ID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js index 56aa5aa75de8d6101953632ede50689fd8855343..9a44c954bd1d9798c18723a372b6fadef79c7f06 100644 --- a/entity/Person_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js +++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js @@ -1,6 +1,6 @@ import("system.result"); import("Keyword_lib"); -var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("CONTACT.LANGUAGE"); +var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("CONTACT.ISOLANGUAGE"); result.string(sql); diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c1b50e3da94468e2382abbc28ab9b56a464dbe97 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "CONTACT join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID)"; + +result.string("PERSONID in (select CONTACT.PERSON_ID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/index/affectedConsumerIds.js b/entity/Person_entity/recordcontainers/index/affectedConsumerIds.js index 679911a6c882e857b87a05a199eea26a08f06d35..36a6f2b39beb3c81837c40946a645a37df075c5c 100644 --- a/entity/Person_entity/recordcontainers/index/affectedConsumerIds.js +++ b/entity/Person_entity/recordcontainers/index/affectedConsumerIds.js @@ -41,18 +41,18 @@ function addIds(pRes, pConsumerName, pIds) function addPersAddressIds(pRes, pCurrId) { var sql, ids; - sql = "select ADDRESS.ADDRESSID from ADDRESS left join CONTACT on CONTACT.CONTACTID = ADDRESS.CONTACT_ID where CONTACT.PERSON_ID = '" + pCurrId + "'"; + sql = "select ADDRESS.ADDRESSID from ADDRESS where ADDRESS.CONTACT_ID = '" + pCurrId + "'"; ids = db.array(db.COLUMN, sql, alias, 0 , 1 * datetime.ONE_MINUTE); addIds(pRes, "PersAddresses", ids); } function addOrgAddressIds(pRes, pCurrId) { - var sql, ids; + var sql, ids; sql = "select CONTACT.ADDRESS_ID from ORGANISATION " + "join CONTACT on CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID and CONTACT.PERSON_ID is null " + "where ORGANISATION.ORGANISATIONID = ( " - + "select c.ORGANISATION_ID FROM CONTACT as c where c.PERSON_ID = '" + pCurrId + + "select c.ORGANISATION_ID FROM CONTACT as c where c.CONTACTID = '" + pCurrId + "')"; ids = db.array(db.COLUMN, sql, alias, 0 , 1 * datetime.ONE_MINUTE); @@ -62,7 +62,7 @@ function addOrgAddressIds(pRes, pCurrId) function addCommunicationIds(pRes, pCurrId) { var sql, ids; - sql = "select COMMUNICATION.COMMUNICATIONID from COMMUNICATION left join CONTACT on CONTACT.CONTACTID = COMMUNICATION.CONTACT_ID where CONTACT.PERSON_ID = '" + pCurrId + "'"; + sql = "select COMMUNICATION.COMMUNICATIONID from COMMUNICATION where COMMUNICATION.CONTACT_ID = '" + pCurrId + "'"; ids = db.array(db.COLUMN, sql, alias, 0 , 1 * datetime.ONE_MINUTE); addIds(pRes, "Communications", ids); } diff --git a/entity/Person_entity/recordcontainers/index/affectedIds.js b/entity/Person_entity/recordcontainers/index/affectedIds.js index b4b39cb6399d759ad6576b68cc46e8fffdb78835..488e44a0b18fefa686a5a6640db77c4564faae81 100644 --- a/entity/Person_entity/recordcontainers/index/affectedIds.js +++ b/entity/Person_entity/recordcontainers/index/affectedIds.js @@ -15,25 +15,25 @@ infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, var switch (tableName) { - case "PERSON": + case "CONTACT": res = [idValue]; break; - case "CONTACT": - res = db.array(db.COLUMN, "select CONTACT.PERSON_ID from CONTACT where CONTACT.CONTACTID = '" + idValue + "'"); + case "PERSON": + res = db.array(db.COLUMN, "select CONTACT.CONTACTID from CONTACT where CONTACT.PERSON_ID = '" + idValue + "'"); break; case "ORGANISATION": - res = db.array(db.COLUMN, "select CONTACT.PERSON_ID from CONTACT where CONTACT.PERSON_ID is not null and CONTACT.ORGANISATION_ID = '" + idValue + "'"); + res = db.array(db.COLUMN, "select CONTACT.CONTACTID from CONTACT where CONTACT.PERSON_ID is not null and CONTACT.ORGANISATION_ID = '" + idValue + "'"); break; case "ADDRESS": - res = IndexsearchUtils.getAffectedIdValues("PERSON_ID", infoContainer, function (id){ - return db.array(db.COLUMN, ["select CONTACT.PERSON_ID from ADDRESS left join CONTACT on CONTACT.CONTACTID = ADDRESS.CONTACT_ID where CONTACT.PERSON_ID is not null and ADDRESS.ADDRESSID = ?", [ + res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){ + return db.array(db.COLUMN, ["select ADDRESS.CONTACT_ID from ADDRESS where ADDRESS.ADDRESSID = ?", [ [id, SqlUtils.getSingleColumnType("ADDRESS", "ADDRESSID")] ]]); }); break; case "COMMUNICATION": - res = IndexsearchUtils.getAffectedIdValues("PERSON_ID", infoContainer, function (id){ - return db.array(db.COLUMN, ["select CONTACT.PERSON_ID from COMMUNICATION left join CONTACT on CONTACT.CONTACTID = COMMUNICATION.CONTACT_ID where CONTACT.PERSON_ID is not null and where COMMUNICATIONID = ?", [ + res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){ + return db.array(db.COLUMN, ["select COMMUNICATION.CONTACT_ID from COMMUNICATION where COMMUNICATIONID = ?", [ [id, SqlUtils.getSingleColumnType("COMMUNICATION", "COMMUNICATIONID")] ]]); }); diff --git a/entity/Person_entity/recordcontainers/index/patternExtensionProcess.js b/entity/Person_entity/recordcontainers/index/patternExtensionProcess.js deleted file mode 100644 index e1de697d7b7cdca5d450f2061da1154906517734..0000000000000000000000000000000000000000 --- a/entity/Person_entity/recordcontainers/index/patternExtensionProcess.js +++ /dev/null @@ -1,12 +0,0 @@ -import("system.vars"); -import("system.result"); - -var pattern = vars.get("$local.pattern"); - -var extension = ""; - -if(pattern.search("AG") != -1 || pattern.search("ag") != -1){ - extension += "-firstname:anja"; -} - -result.string(extension); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/index/query.js b/entity/Person_entity/recordcontainers/index/query.js index fdf2d9995a4f18657896e2ab03544e447b011972..ece3dd3e34927fd223128e432ba24be77fdf2e04 100644 --- a/entity/Person_entity/recordcontainers/index/query.js +++ b/entity/Person_entity/recordcontainers/index/query.js @@ -13,7 +13,7 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select PERSON.PERSONID as uid " +sqlQuery = 'select CONTACT.CONTACTID as "_uid_" ' + "," + sqlHelper.concat(["PERSON.SALUTATION", "PERSON.FIRSTNAME", "PERSON.LASTNAME", "'|'", "ORGANISATION.NAME"]) + ' as "_title_" ' + "," + sqlHelper.concat([ @@ -21,7 +21,7 @@ sqlQuery = "select PERSON.PERSONID as uid " ,"defaultAddress.COUNTRY", "defaultAddress.ZIP", "defaultAddress.CITY"]) ,sqlHelper.concat(["'" + translate.text("Phone") + ":'", "(" + CommUtil.getStandardSubSqlPhone() + ")"]) ,sqlHelper.concat(["'" + translate.text("Email") + ":'", "(" + CommUtil.getStandardSubSqlMail() + ")"]) - ], " | ") + " as description " + ], " | ") + ' as "_description_" ' //additional indexed fields + ", PERSON.PERSONID " + ", PERSON.FIRSTNAME " @@ -31,8 +31,8 @@ sqlQuery = "select PERSON.PERSONID as uid " + ", CONTACT.CONTACTID " + ", CONTACT.ORGANISATION_ID " + ", ORGANISATION.NAME " - + ", (" + CommUtil.getStandardSubSqlPhone() + ') as "STANDARD_PHONE_COMMUNICATION.value"' - + ", (" + CommUtil.getStandardSubSqlMail() + ') as "STANDARD_EMAIL_COMMUNICATION.value"' + + ", (" + CommUtil.getStandardSubSqlPhone() + ") as STANDARD_PHONE_COMMUNICATION" + + ", (" + CommUtil.getStandardSubSqlMail() + ") as STANDARD_EMAIL_COMMUNICATION" + " from PERSON " + " join CONTACT on CONTACT.PERSON_ID = PERSON.PERSONID " + " join ORGANISATION on CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID " diff --git a/entity/Prod2prod_entity/Prod2prod_entity.aod b/entity/Prod2prod_entity/Prod2prod_entity.aod index 939b420cae222428e1ff7a7d33fc33ade7190cea..f580faaec9590c336e26a55b0c7f43129405b0d7 100644 --- a/entity/Prod2prod_entity/Prod2prod_entity.aod +++ b/entity/Prod2prod_entity/Prod2prod_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Prod2prod_entity/documentation.adoc</documentation> <title>Parts list</title> + <titlePlural>Parts list</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> @@ -129,6 +130,7 @@ <jDitoRecordAlias>Data_alias</jDitoRecordAlias> <contentProcess>%aditoprj%/entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <onInsert>%aditoprj%/entity/Prod2prod_entity/recordcontainers/jdito/onInsert.js</onInsert> + <onUpdate>%aditoprj%/entity/Prod2prod_entity/recordcontainers/jdito/onUpdate.js</onUpdate> <onDelete>%aditoprj%/entity/Prod2prod_entity/recordcontainers/jdito/onDelete.js</onDelete> <recordFieldMappings> <jDitoRecordFieldMapping> diff --git a/entity/Prod2prod_entity/entityfields/quantity/valueProcess.js b/entity/Prod2prod_entity/entityfields/quantity/valueProcess.js index 1adf62b3fab0c83c0f9ff455506257b815098393..58ce03cbd183e612db63a4a85adbd8aa3870ee90 100644 --- a/entity/Prod2prod_entity/entityfields/quantity/valueProcess.js +++ b/entity/Prod2prod_entity/entityfields/quantity/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.QUANTITY")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string("1"); } \ No newline at end of file diff --git a/entity/Prod2prod_entity/entityfields/takeprice/valueProcess.js b/entity/Prod2prod_entity/entityfields/takeprice/valueProcess.js index a26e8321a9bc322bca5ef91f34b4d7628d796ee2..dc9a97223e617545f18ae934740a4f2c7012764a 100644 --- a/entity/Prod2prod_entity/entityfields/takeprice/valueProcess.js +++ b/entity/Prod2prod_entity/entityfields/takeprice/valueProcess.js @@ -2,5 +2,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.getString("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) result.string("0"); \ No newline at end of file diff --git a/entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js b/entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js index 549dd18c52b622b1419a23e002b166558d30623c..8bb7ef210a16a0ec02600971d745d6ce9b6db042 100644 --- a/entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Prod2prod_entity/recordcontainers/jdito/contentProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.neon"); import("system.result"); import("system.vars"); @@ -140,6 +139,5 @@ if(prodid != "") graphData.forEach(function (gd) { allData.push(gd); }) }) - logging.log(JSON.stringify(allData, null, "\t")) result.object(allData); } \ No newline at end of file diff --git a/entity/Prod2prod_entity/recordcontainers/jdito/onUpdate.js b/entity/Prod2prod_entity/recordcontainers/jdito/onUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..0dff9d0fdd1ee895b0c9a497806550dfa376e6c8 --- /dev/null +++ b/entity/Prod2prod_entity/recordcontainers/jdito/onUpdate.js @@ -0,0 +1,15 @@ +import("system.datetime"); +import("system.vars"); +import("system.db"); + +var cols = [ "SOURCE_ID" + , "QUANTITY" + , "OPTIONAL" + , "TAKEPRICE" ]; + +var vals = [ vars.get("$field.SOURCE_ID") + , vars.get("$field.QUANTITY") + , vars.get("$field.OPTIONAL") + , vars.get("$field.TAKEPRICE") ]; + +db.updateData("PROD2PROD", cols, null, vals, "PROD2PRODID = '" + vars.get("$field.PROD2PRODID") + "'"); \ No newline at end of file diff --git a/entity/Product_entity/Product_entity.aod b/entity/Product_entity/Product_entity.aod index 34d3afada9ad7a8567e44382c10e54b0b3c9f3b5..4c47769977d0edd85bf5c1e491118a45d3ccaf64 100644 --- a/entity/Product_entity/Product_entity.aod +++ b/entity/Product_entity/Product_entity.aod @@ -4,10 +4,13 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Product_entity/documentation.adoc</documentation> <title>Product</title> + <siblings> + <element>Productprice_entity</element> + </siblings> + <grantDeleteProcess>%aditoprj%/entity/Product_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Product_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Product_entity/afterUiInit.js</afterUiInit> <iconId>VAADIN:HAMMER</iconId> - <imageProcess>%aditoprj%/entity/Product_entity/imageProcess.js</imageProcess> <titlePlural>Products</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -49,9 +52,6 @@ <title>Product name</title> <mandatory v="true" /> </entityField> - <entityField> - <name>STANDARD</name> - </entityField> <entityField> <name>STATUS</name> <title>Active</title> @@ -125,13 +125,9 @@ </children> </entityConsumer> <entityField> - <name>IMAGE</name> + <name>PICTURE</name> <contentType>IMAGE</contentType> - <valueProcess>%aditoprj%/entity/Product_entity/entityfields/image/valueProcess.js</valueProcess> - <onValueChange>%aditoprj%/entity/Product_entity/entityfields/image/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - </onValueChangeTypes> + <displayValueProcess>%aditoprj%/entity/Product_entity/entityfields/picture/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> <name>StockCounts</name> @@ -296,6 +292,7 @@ </entityActionField> <entityConsumer> <name>Attributes</name> + <stateProcess>%aditoprj%/entity/Product_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/Product_entity/entityfields/attributes/onValidation.js</onValidation> <dependency> <name>dependency</name> @@ -329,6 +326,12 @@ <fieldName>Products</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>0129066d-805c-4522-b1bc-9bbbc9588629</name> + <entityName>Organisation_entity</entityName> + <fieldName>Product_consumer</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -364,6 +367,7 @@ </entityConsumer> <entityConsumer> <name>AttributeTree</name> + <stateProcess>%aditoprj%/entity/Product_entity/entityfields/attributetree/stateProcess.js</stateProcess> <dependency> <name>dependency</name> <entityName>AttributeRelation_entity</entityName> @@ -401,7 +405,7 @@ <valueProcess>%aditoprj%/entity/Product_entity/entityfields/date_edit/valueProcess.js</valueProcess> </entityField> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -410,7 +414,7 @@ <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Product_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Product_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -481,14 +485,17 @@ <dbRecordFieldMapping> <name>ADVERTISING.value</name> <recordfield>PRODUCT.ADVERTISING</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GROUPCODEID.value</name> <recordfield>PRODUCT.GROUPCODEID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MINSTOCK.value</name> <recordfield>PRODUCT.MINSTOCK</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRODUCTCODE.value</name> @@ -501,22 +508,22 @@ <dbRecordFieldMapping> <name>PRODUCTNAME.value</name> <recordfield>PRODUCT.PRODUCTNAME</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STANDARD.value</name> - <recordfield>PRODUCT.STANDARD</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>PRODUCT.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>UNIT.value</name> <recordfield>PRODUCT.UNIT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>PRODUCT.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>GROUPCODEID.displayValue</name> @@ -546,7 +553,26 @@ <name>CONTACT_ID.displayValue</name> <recordfield>ORGANISATION.NAME</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PICTURE.value</name> + <recordfield>PRODUCT.PICTURE</recordfield> + </dbRecordFieldMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> <indexRecordContainer> <name>index</name> diff --git a/entity/Product_entity/entityfields/attributes/onValidation.js b/entity/Product_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..a577c21d3a241ceb4cd9065f0b3e122cfadeba8f 100644 --- a/entity/Product_entity/entityfields/attributes/onValidation.js +++ b/entity/Product_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.PRODUCTID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Product_entity/entityfields/attributes/stateProcess.js b/entity/Product_entity/entityfields/attributes/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Product_entity/entityfields/attributes/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Product_entity/entityfields/attributetree/stateProcess.js b/entity/Product_entity/entityfields/attributetree/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Product_entity/entityfields/attributetree/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Product_entity/entityfields/image/onValueChange.js b/entity/Product_entity/entityfields/image/onValueChange.js deleted file mode 100644 index 1fc5daeeea2101848906d4ec2c0f78ebc23fd634..0000000000000000000000000000000000000000 --- a/entity/Product_entity/entityfields/image/onValueChange.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); -import("Entity_lib"); - -// TODO: also there is currently no good way to do updates with fields not connected to the record container. Workaround: imagevariable and update in onDBUpdate Process #1030023 -FieldChanges.setChange("$field.IMAGE"); \ No newline at end of file diff --git a/entity/Product_entity/entityfields/image/valueProcess.js b/entity/Product_entity/entityfields/image/valueProcess.js deleted file mode 100644 index a02ae76ca2bfe7aefcadf452c09cbbdcc11413ad..0000000000000000000000000000000000000000 --- a/entity/Product_entity/entityfields/image/valueProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -import("Product_lib"); - -result.string(ProductUtils.getImage(vars.get("$field.PRODUCTID"), vars.getString("$field.PRODUCTNAME"))); \ No newline at end of file diff --git a/entity/Product_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Product_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Product_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Product_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index 7598a4d5c3157ac172221db5e6889680dca1aa9b..7ba31ad1ef4e48a4004091b122ef98b05f98db8d 100644 --- a/entity/Product_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Product_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.PRODUCTID"), tableNames: ["AB_ATTRIBUTERELATION", "PRODUCTPRICE", "ORGANISATION"]}); // TEXTBLOCK missing -res.push({id: vars.get("$field.PRODUCTID"), tableNames: ["PRODUCT"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.PRODUCTID"), tableNames: ["AB_ATTRIBUTERELATION", "PRODUCTPRICE", "ORGANISATION"]}); // TEXTBLOCK missing +res.push({id: vars.get("$field.PRODUCTID"), tableNames: ["PRODUCT"]}); + +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/Product_entity/entityfields/picture/displayValueProcess.js b/entity/Product_entity/entityfields/picture/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..95ecf3b8e6ea13af26782fa35711a7d1f6bdfb2d --- /dev/null +++ b/entity/Product_entity/entityfields/picture/displayValueProcess.js @@ -0,0 +1,10 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) { + if (vars.get("$field.PICTURE")) + result.string(vars.get("$field.PICTURE")); + else + result.string(vars.get("$param.ProductText_param")); +} diff --git a/entity/Product_entity/entityfields/productcode/onValidation.js b/entity/Product_entity/entityfields/productcode/onValidation.js index 1dc5b4f996393023dd1f9e0f4070aad491cf515b..81b90e9b479276bb7057bfd12d6890d50fdde20b 100644 --- a/entity/Product_entity/entityfields/productcode/onValidation.js +++ b/entity/Product_entity/entityfields/productcode/onValidation.js @@ -7,7 +7,7 @@ import("Entity_lib"); var codeCount, productCode; -productCode = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCTCODE")); +productCode = vars.get("local.value"); codeCount = db.cell("select count(PRODUCTCODE) from PRODUCT where PRODUCTCODE = '" + productCode + "'" + " and PRODUCTID <> '" + vars.get("$field.PRODUCTID") + "'"); if(codeCount > 0) diff --git a/entity/Product_entity/entityfields/unit/valueProcess.js b/entity/Product_entity/entityfields/unit/valueProcess.js index 680bcb0016ceba4de1b98d2b92924a820ba2bc4d..4502026f046d1a80ea2ce3c4a2f3c6b625abc457 100644 --- a/entity/Product_entity/entityfields/unit/valueProcess.js +++ b/entity/Product_entity/entityfields/unit/valueProcess.js @@ -4,5 +4,5 @@ import("system.db"); import("system.result"); import("KeywordRegistry_basic"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.getString("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) result.string($KeywordRegistry.quantityUnit$pieces()); \ No newline at end of file diff --git a/entity/Product_entity/grantDeleteProcess.js b/entity/Product_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e60a76ed2f3b62ed97948d8cf55819dc835f59fa --- /dev/null +++ b/entity/Product_entity/grantDeleteProcess.js @@ -0,0 +1,8 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("PRODUCT", null, vars.get("$field.PRODUCTID")) + && !ActivityUtils.hasActivities(vars.get("$field.PRODUCTID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Product_entity/imageProcess.js b/entity/Product_entity/imageProcess.js deleted file mode 100644 index 73e048a22cc0459fe33d9df5747bcac6a56acbb9..0000000000000000000000000000000000000000 --- a/entity/Product_entity/imageProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.vars"); -import("system.result"); - -result.string(vars.get("$param.ProductText_param")); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Product_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/db/onDBUpdate.js b/entity/Product_entity/recordcontainers/db/onDBUpdate.js index 11c4f6b2dd52dd21b4935cdf8f9bb011d9cbc4c6..c9c792deebc2db95afcf6a4c4b16a19d750a7085 100644 --- a/entity/Product_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Product_entity/recordcontainers/db/onDBUpdate.js @@ -5,7 +5,7 @@ import("Entity_lib"); // TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023 FieldChanges.assimilateChangeAndDispose("$field.IMAGE", function(state, value){ if (state == FieldChanges.STATE_CHANGED()) - ProductUtils.setImage(vars.get("$field.PRODUCTID"), value); + ProductUtils.setImage(vars.get("$local.uid"), value); else - ProductUtils.removeImage(vars.get("$field.PRODUCTID")); + ProductUtils.removeImage(vars.get("$local.uid")); }); diff --git a/entity/Product_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Product_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b8141bc3b760b0439c6a4e6e07c99b38dda33d54 --- /dev/null +++ b/entity/Product_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Product'"; + +result.string("PRODUCTID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/index/query.js b/entity/Product_entity/recordcontainers/index/query.js index 34a9a7a3beae0a79423a22b105e737b178717dde..0510962887633d9d1b4e3bea26239aae9555a540 100644 --- a/entity/Product_entity/recordcontainers/index/query.js +++ b/entity/Product_entity/recordcontainers/index/query.js @@ -14,11 +14,11 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select PRODUCTID as uid, " +sqlQuery = 'select PRODUCTID as "_uid_", ' + sqlHelper.concat(["PRODUCTCODE", "PRODUCTNAME"], " | ") - + " as title, " + + ' as "_title_", ' + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.productGroupcode(), "GROUPCODEID") - + " as description" + + ' as "_description_" ' + ", PRODUCTCODE " + " from PRODUCT " + queryCondition + " order by PRODUCTCODE "; diff --git a/entity/Productprice_entity/Productprice_entity.aod b/entity/Productprice_entity/Productprice_entity.aod index 71ae5545ade577e165973a087469072a3dae4272..7f12819dac5c3456db46f3d21d2dbdc9e631f171 100644 --- a/entity/Productprice_entity/Productprice_entity.aod +++ b/entity/Productprice_entity/Productprice_entity.aod @@ -3,12 +3,14 @@ <name>Productprice_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Productprice_entity/documentation.adoc</documentation> + <icon>VAADIN:MONEY</icon> <title>Prices</title> <siblings> <element>Product_entity</element> </siblings> <onValidation>%aditoprj%/entity/Productprice_entity/onValidation.js</onValidation> <afterOperatingState>%aditoprj%/entity/Productprice_entity/afterOperatingState.js</afterOperatingState> + <titlePlural>Prices</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityField> @@ -16,6 +18,7 @@ <title>PP/SP</title> <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/Productprice_entity/entityfields/buysell/dropDownProcess.js</dropDownProcess> + <stateProcess>%aditoprj%/entity/Productprice_entity/entityfields/buysell/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Productprice_entity/entityfields/buysell/valueProcess.js</valueProcess> </entityField> <entityField> @@ -90,6 +93,7 @@ <outputFormat>#,##0.00</outputFormat> <inputFormat>#,##0.00</inputFormat> <mandatory v="true" /> + <stateProcess>%aditoprj%/entity/Productprice_entity/entityfields/vat/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Productprice_entity/entityfields/vat/valueProcess.js</valueProcess> <onValidation>%aditoprj%/entity/Productprice_entity/entityfields/vat/onValidation.js</onValidation> </entityField> @@ -245,22 +249,27 @@ <dbRecordFieldMapping> <name>BUYSELL.value</name> <recordfield>PRODUCTPRICE.BUYSELL</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CURRENCY.value</name> <recordfield>PRODUCTPRICE.CURRENCY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>FROMQUANTITY.value</name> <recordfield>PRODUCTPRICE.FROMQUANTITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRICE.value</name> <recordfield>PRODUCTPRICE.PRICE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRICELIST.value</name> <recordfield>PRODUCTPRICE.PRICELIST</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRODUCTPRICEID.value</name> @@ -269,22 +278,27 @@ <dbRecordFieldMapping> <name>PRODUCT_ID.value</name> <recordfield>PRODUCTPRICE.PRODUCT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>PRODUCTPRICE.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VALID_FROM.value</name> <recordfield>PRODUCTPRICE.VALID_FROM</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VALID_TO.value</name> <recordfield>PRODUCTPRICE.VALID_TO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VAT.value</name> <recordfield>PRODUCTPRICE.VAT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CURRENCY.displayValue</name> diff --git a/entity/Productprice_entity/afterOperatingState.js b/entity/Productprice_entity/afterOperatingState.js index 5541dfea336535d08d4b6e9f3cd236dd3634fb12..80a3d84eb82abf701d27d51058ce18eaeb659e5b 100644 --- a/entity/Productprice_entity/afterOperatingState.js +++ b/entity/Productprice_entity/afterOperatingState.js @@ -1,7 +1,10 @@ import("system.neon"); import("system.vars"); -if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) +if(vars.get("$sys.operatingstate") != undefined +&& vars.get("$sys.operatingstate") != null +&& vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW +&& vars.get("$local.value")) // local.value is previous operationgstate or null. This fixes not working Filter { neon.refresh(); } diff --git a/entity/Productprice_entity/entityfields/buysell/stateProcess.js b/entity/Productprice_entity/entityfields/buysell/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..980235b375c67faab9281318115fd7e31b4ec151 --- /dev/null +++ b/entity/Productprice_entity/entityfields/buysell/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.CONTACT_ID")) + result.string(neon.COMPONENTSTATE_READONLY); +else + result.string(neon.COMPONENTSTATE_EDITABLE); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/buysell/valueProcess.js b/entity/Productprice_entity/entityfields/buysell/valueProcess.js index 01ee58248bff468509662ad0996dbe1677f50c87..0da2dddbb8cd6a989dad5ff2b55f813770d0887e 100644 --- a/entity/Productprice_entity/entityfields/buysell/valueProcess.js +++ b/entity/Productprice_entity/entityfields/buysell/valueProcess.js @@ -2,5 +2,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string("SP"); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/contact_id/valueProcess.js b/entity/Productprice_entity/entityfields/contact_id/valueProcess.js index e9e20dba72e7a1820ad9d7b7b8570e58631f30dd..ebfa36528a52773185f164d4ecd96bc17b6e4a80 100644 --- a/entity/Productprice_entity/entityfields/contact_id/valueProcess.js +++ b/entity/Productprice_entity/entityfields/contact_id/valueProcess.js @@ -4,7 +4,7 @@ import("system.vars"); if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { - if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param") != "") + if(vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) result.string(vars.get("$param.ContactId_param")); } diff --git a/entity/Productprice_entity/entityfields/currency/valueProcess.js b/entity/Productprice_entity/entityfields/currency/valueProcess.js index 081cebb3e478a2c2c0b001db3ac3baab9dba0caa..f07b41ba6feeb577ba324ece8c0be4a29387d888 100644 --- a/entity/Productprice_entity/entityfields/currency/valueProcess.js +++ b/entity/Productprice_entity/entityfields/currency/valueProcess.js @@ -1,8 +1,9 @@ import("system.result"); import("system.neon"); import("system.vars"); +import("KeywordRegistry_basic"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { - result.string("EUR"); + result.string($KeywordRegistry.currency$eur()); } \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/pricelist/displayValueProcess.js b/entity/Productprice_entity/entityfields/pricelist/displayValueProcess.js index 08f788cf3daf8433d28d1780a17df2152be6d3d2..7a3a89b39d202c168a9daa1ec7cfeced91144ce3 100644 --- a/entity/Productprice_entity/entityfields/pricelist/displayValueProcess.js +++ b/entity/Productprice_entity/entityfields/pricelist/displayValueProcess.js @@ -7,8 +7,8 @@ import("Sql_lib"); import("system.text"); import("KeywordRegistry_basic"); -var pricelistname = vars.get("$field.PRICELIST").trim(); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW && !pricelistname) +var pricelistname = vars.get("$field.PRICELIST"); +if (!pricelistname) { var preparedStatement = SqlCondition.begin().andPrepare("CONTACT.CONTACTID", vars.get("$field.CONTACT_ID")); var dbresult = preparedStatement.buildSql("select ORGANISATION.NAME from CONTACT inner join ORGANISATION on CONTACT.ORGANISATION_ID=ORGANISATION.ORGANISATIONID", "1=2", "order by NAME"); diff --git a/entity/Productprice_entity/entityfields/pricelist/stateProcess.js b/entity/Productprice_entity/entityfields/pricelist/stateProcess.js index 5dee6ef7d089d4e2ddb435f2fac536d133500fb1..6f9cb1641974987d696a5dccea4428bc190d2cde 100644 --- a/entity/Productprice_entity/entityfields/pricelist/stateProcess.js +++ b/entity/Productprice_entity/entityfields/pricelist/stateProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.CONTACT_ID") != "") - result.string("READONLY"); //invisible +if (vars.get("$field.CONTACT_ID")) + result.string(neon.COMPONENTSTATE_READONLY); //invisible else - result.string("EDITABLE"); + result.string(neon.COMPONENTSTATE_EDITABLE); diff --git a/entity/Productprice_entity/entityfields/pricelist/valueProcess.js b/entity/Productprice_entity/entityfields/pricelist/valueProcess.js index f9c9524cedcd93dab192369848c72be7cfdd2329..deff487595e534b9934221494c1573b9b758980f 100644 --- a/entity/Productprice_entity/entityfields/pricelist/valueProcess.js +++ b/entity/Productprice_entity/entityfields/pricelist/valueProcess.js @@ -1,8 +1,7 @@ import("system.result"); import("system.neon"); import("system.vars"); +import("KeywordRegistry_basic"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -{ - result.string("02553fc7-4611-4914-8ff5-0b7c4e7531c9"); -} \ No newline at end of file +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.CONTACT_ID")) + result.string($KeywordRegistry.productPricelist$standardList()); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/product_id/fieldIdProcess.js b/entity/Productprice_entity/entityfields/product_id/fieldIdProcess.js index c354a6b460cbecf0233c20761c02c66415c20e72..6cd3c4544e56fa57ad04b119be620aa650f4a849 100644 --- a/entity/Productprice_entity/entityfields/product_id/fieldIdProcess.js +++ b/entity/Productprice_entity/entityfields/product_id/fieldIdProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string (vars.get("$this.value")); \ No newline at end of file +result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/product_id/stateProcess.js b/entity/Productprice_entity/entityfields/product_id/stateProcess.js index 07518244a575e451e071fc07387960724911c5e3..ced938f5f37658b7dbf70ee82013020b1e3a0328 100644 --- a/entity/Productprice_entity/entityfields/product_id/stateProcess.js +++ b/entity/Productprice_entity/entityfields/product_id/stateProcess.js @@ -2,11 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.exists("$param.ProductId_param") && vars.get("$param.ProductId_param")) -{ - result.string(neon.COMPONENTSTATE_DISABLED); -} +if (vars.exists("$param.ProductId_param") && vars.get("$param.ProductId_param")) + result.string(neon.COMPONENTSTATE_READONLY); else -{ - result.string(neon.COMPONENTSTATE_AUTO); -} \ No newline at end of file + result.string(neon.COMPONENTSTATE_AUTO); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/valid_from/valueProcess.js b/entity/Productprice_entity/entityfields/valid_from/valueProcess.js index fde00cab2ad74643d42064d1ae353c92972deeca..072560acb2f89d72012c5d3539c293cbf02b86a8 100644 --- a/entity/Productprice_entity/entityfields/valid_from/valueProcess.js +++ b/entity/Productprice_entity/entityfields/valid_from/valueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.neon"); import("Date_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(DateUtils.getTodayUTC()); } \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/vat/onValidation.js b/entity/Productprice_entity/entityfields/vat/onValidation.js index 463ab50e2073e791ddbacc028d50b9c1abc06589..e95e841a1fd4f5c5ab19e8358cca8efca492f7fe 100644 --- a/entity/Productprice_entity/entityfields/vat/onValidation.js +++ b/entity/Productprice_entity/entityfields/vat/onValidation.js @@ -3,7 +3,7 @@ import("system.vars"); import("Util_lib"); import("Entity_lib"); -var value = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.VAT")); +var value = vars.get("local.value"); var validationResult = NumberUtils.validateIsBetweenFloat("VAT", value, 0, 100); diff --git a/entity/Productprice_entity/entityfields/vat/stateProcess.js b/entity/Productprice_entity/entityfields/vat/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..980235b375c67faab9281318115fd7e31b4ec151 --- /dev/null +++ b/entity/Productprice_entity/entityfields/vat/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.CONTACT_ID")) + result.string(neon.COMPONENTSTATE_READONLY); +else + result.string(neon.COMPONENTSTATE_EDITABLE); \ No newline at end of file diff --git a/entity/Productprice_entity/entityfields/vat/valueProcess.js b/entity/Productprice_entity/entityfields/vat/valueProcess.js index d3ae757ad3cd88baacbe57711bcef341c43ea6f4..98c06869e1502756cb5749aaa1447932d3c44bff 100644 --- a/entity/Productprice_entity/entityfields/vat/valueProcess.js +++ b/entity/Productprice_entity/entityfields/vat/valueProcess.js @@ -1,6 +1,16 @@ -import("system.vars"); -import("system.result"); -import("system.neon"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) - result.string("0"); \ No newline at end of file +import("Product_lib"); +import("system.vars"); +import("system.result"); +import("system.neon"); + + // '!+' -> "0", "", 0 will result in false +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !+vars.get("$this.value")) +{ + if (vars.get("$field.PRODUCT_ID")) + { + var price = ProductUtils.getCurrentProductPrice(vars.get("$field.PRODUCT_ID"), "SP", true); + result.string(price[2] || "0"); + } + else + result.string("0"); +} \ No newline at end of file diff --git a/entity/Productprice_entity/recordcontainers/db/orderClauseProcess.js b/entity/Productprice_entity/recordcontainers/db/orderClauseProcess.js index 9fd0aad5a4bce2f8f7f5ca713d35f79bc1b9a7ec..4fd74ea4b6fff396197bed7a63ad854e7b3021b7 100644 --- a/entity/Productprice_entity/recordcontainers/db/orderClauseProcess.js +++ b/entity/Productprice_entity/recordcontainers/db/orderClauseProcess.js @@ -1,3 +1,4 @@ +import("system.db"); import("system.result"); -result.object({"PRODUCTPRICE.VALID_FROM": "down"}); \ No newline at end of file +result.object({"PRODUCTPRICE.VALID_FROM": db.DESCENDING}); \ No newline at end of file diff --git a/entity/Role_entity/Role_entity.aod b/entity/Role_entity/Role_entity.aod index f8d6a67f403f5019983468bea02fc21a13d4710d..5d325465a52a0162d7948d28a58544fd2d1b9680 100644 --- a/entity/Role_entity/Role_entity.aod +++ b/entity/Role_entity/Role_entity.aod @@ -4,8 +4,10 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <icon>VAADIN:USER_CHECK</icon> <title>Roles</title> + <grantCreate v="false" /> <contentTitleProcess>%aditoprj%/entity/Role_entity/contentTitleProcess.js</contentTitleProcess> <iconId>VAADIN:USER_CHECK</iconId> + <titlePlural>Roles</titlePlural> <recordContainer>jDito</recordContainer> <entityFields> <entityProvider> @@ -104,15 +106,19 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ROLETITLE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ROLETYPE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ROLEDESCRIPTION.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>USERCOUNT.value</name> + <isFilterable v="false" /> </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> diff --git a/entity/SalesprojectAnalyses_entity/SalesprojectAnalyses_entity.aod b/entity/SalesprojectAnalyses_entity/SalesprojectAnalyses_entity.aod index 54accff695cbd74cd359806528c9c8d3feccceeb..4b857c463d4b9a395f38fcafc633b2a717565cc6 100644 --- a/entity/SalesprojectAnalyses_entity/SalesprojectAnalyses_entity.aod +++ b/entity/SalesprojectAnalyses_entity/SalesprojectAnalyses_entity.aod @@ -53,6 +53,22 @@ <state>READONLY</state> <valueProcess>%aditoprj%/entity/SalesprojectAnalyses_entity/entityfields/open_salesprojects/valueProcess.js</valueProcess> </entityField> + <entityActionField> + <name>openSalesprojects</name> + <onActionProcess>%aditoprj%/entity/SalesprojectAnalyses_entity/entityfields/opensalesprojects/onActionProcess.js</onActionProcess> + </entityActionField> + <entityActionField> + <name>sentOffers</name> + <onActionProcess>%aditoprj%/entity/SalesprojectAnalyses_entity/entityfields/sentoffers/onActionProcess.js</onActionProcess> + </entityActionField> + <entityActionField> + <name>openForecast</name> + <onActionProcess>%aditoprj%/entity/SalesprojectAnalyses_entity/entityfields/openforecast/onActionProcess.js</onActionProcess> + </entityActionField> + <entityActionField> + <name>openTurnover</name> + <onActionProcess>%aditoprj%/entity/SalesprojectAnalyses_entity/entityfields/openturnover/onActionProcess.js</onActionProcess> + </entityActionField> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/SalesprojectAnalyses_entity/entityfields/open_salesprojects/valueProcess.js b/entity/SalesprojectAnalyses_entity/entityfields/open_salesprojects/valueProcess.js index edfcaddcb840d27088338ff6d7b3624ce73938ff..119e4fcf205776e50ba9c179ad63300a763c32c8 100644 --- a/entity/SalesprojectAnalyses_entity/entityfields/open_salesprojects/valueProcess.js +++ b/entity/SalesprojectAnalyses_entity/entityfields/open_salesprojects/valueProcess.js @@ -1,13 +1,10 @@ -import("system.datetime"); -import("system.db"); import("system.result"); -import("system.vars"); -import("Date_lib"); -import("Sql_lib"); -import("system.SQLTYPES") +import("system.entities"); -var opensp = db.cell("select count(STATE) from SALESPROJECT \n\ -join AB_KEYWORD_ENTRY on KEYID = STATE and CONTAINER = 'SalesprojectState' and TITLE = 'Open' \n\ -group by KEYID, AB_KEYWORD_ENTRY.TITLE"); - +var conf = entities.createConfigForLoadingRows() + .entity("Salesproject_entity") + .provider("OpenSalesprojects"); + +var opensp = entities.getRowCount(conf); + result.string(opensp); \ No newline at end of file diff --git a/entity/SalesprojectAnalyses_entity/entityfields/openforecast/onActionProcess.js b/entity/SalesprojectAnalyses_entity/entityfields/openforecast/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a4f17e146fc1bc27447f0f53818616a254bcf6d1 --- /dev/null +++ b/entity/SalesprojectAnalyses_entity/entityfields/openforecast/onActionProcess.js @@ -0,0 +1,7 @@ +import("KeywordRegistry_basic"); +import("system.neon"); + +neon.openContext("Turnover", null, null, neon.OPERATINGSTATE_SEARCH, { + "ShowForecast_param": "true", + "ShowTurnover_param": "false" +}); diff --git a/entity/SalesprojectAnalyses_entity/entityfields/opensalesprojects/onActionProcess.js b/entity/SalesprojectAnalyses_entity/entityfields/opensalesprojects/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f4db85d3486709981abe865d0121c3d29a09c296 --- /dev/null +++ b/entity/SalesprojectAnalyses_entity/entityfields/opensalesprojects/onActionProcess.js @@ -0,0 +1,6 @@ +import("KeywordRegistry_basic"); +import("system.neon"); + +neon.openContext("Salesproject", null, null, neon.OPERATINGSTATE_SEARCH, { + "Status_param": $KeywordRegistry.salesprojectState$open() +}); diff --git a/entity/SalesprojectAnalyses_entity/entityfields/openturnover/onActionProcess.js b/entity/SalesprojectAnalyses_entity/entityfields/openturnover/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b278ec2dce925c93c0fcccbd8689f8ad68f7c781 --- /dev/null +++ b/entity/SalesprojectAnalyses_entity/entityfields/openturnover/onActionProcess.js @@ -0,0 +1,7 @@ +import("KeywordRegistry_basic"); +import("system.neon"); + +neon.openContext("Turnover", null, null, neon.OPERATINGSTATE_SEARCH, { + "ShowForecast_param": "false", + "ShowTurnover_param": "true" +}); diff --git a/entity/SalesprojectAnalyses_entity/entityfields/sent_offers/valueProcess.js b/entity/SalesprojectAnalyses_entity/entityfields/sent_offers/valueProcess.js index 8d610d08abc6ca281facdb29e790696741a5dd85..df5b51bfc46e739539a7520208607cf568100742 100644 --- a/entity/SalesprojectAnalyses_entity/entityfields/sent_offers/valueProcess.js +++ b/entity/SalesprojectAnalyses_entity/entityfields/sent_offers/valueProcess.js @@ -1,12 +1,10 @@ -import("system.datetime"); -import("system.db"); import("system.result"); -import("system.vars"); -import("Date_lib"); -import("Sql_lib"); -import("system.SQLTYPES") +import("system.entities"); -var sentoffer = db.cell("select count(STATUS) from OFFER join AB_KEYWORD_ENTRY \n\ -on KEYID = STATUS and CONTAINER = 'OfferStatus' and TITLE = 'Sent' group by KEYID, AB_KEYWORD_ENTRY.TITLE"); - -result.string(sentoffer); \ No newline at end of file +var conf = entities.createConfigForLoadingRows() + .entity("Offer_entity") + .provider("SentOffers"); + +var opensp = entities.getRowCount(conf); + +result.string(opensp); \ No newline at end of file diff --git a/entity/SalesprojectAnalyses_entity/entityfields/sentoffers/onActionProcess.js b/entity/SalesprojectAnalyses_entity/entityfields/sentoffers/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..90c452b6404bb557adec63073846a542c8e66e8f --- /dev/null +++ b/entity/SalesprojectAnalyses_entity/entityfields/sentoffers/onActionProcess.js @@ -0,0 +1,6 @@ +import("KeywordRegistry_basic"); +import("system.neon"); + +neon.openContext("Offer", null, null, neon.OPERATINGSTATE_SEARCH, { + "OfferStatus_param": $KeywordRegistry.offerStatus$sent() +}); diff --git a/entity/SalesprojectForecast_entity/entityfields/date_start/valueProcess.js b/entity/SalesprojectForecast_entity/entityfields/date_start/valueProcess.js index e2eb1642a6585c84aed1018bc17273b0b2b2f048..fc81fc3498b7b24b3ca94c69d034bdfd708ef5d2 100644 --- a/entity/SalesprojectForecast_entity/entityfields/date_start/valueProcess.js +++ b/entity/SalesprojectForecast_entity/entityfields/date_start/valueProcess.js @@ -1,11 +1,11 @@ -import("system.result"); -import("system.vars"); -import("system.neon"); -import("Date_lib"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) -{ - result.string(DateUtils.getTodayUTC()); -} -else +import("system.result"); +import("system.vars"); +import("system.neon"); +import("Date_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + result.string(DateUtils.getTodayUTC()); +} +else result.string(vars.get("$this.value")); \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/SalesprojectMilestone_entity.aod b/entity/SalesprojectMilestone_entity/SalesprojectMilestone_entity.aod index 52d11104295a661dc9e6349a371d4f100658ac0d..bafb1559f232afd27db8a500277221514961ae26 100644 --- a/entity/SalesprojectMilestone_entity/SalesprojectMilestone_entity.aod +++ b/entity/SalesprojectMilestone_entity/SalesprojectMilestone_entity.aod @@ -37,17 +37,17 @@ <valueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/salesproject_id/valueProcess.js</valueProcess> </entityField> <entityField> - <name>TYPE</name> + <name>KIND</name> <title>Type</title> <mandatory v="true" /> <displayValueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/type/displayValueProcess.js</displayValueProcess> </entityField> <entityField> - <name>VALUE</name> + <name>MILESTONEVALUE</name> <consumer>Keywords</consumer> <mandatory v="true" /> - <titleProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/value/titleProcess.js</titleProcess> - <displayValueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/value/displayValueProcess.js</displayValueProcess> + <titleProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/titleProcess.js</titleProcess> + <displayValueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/displayValueProcess.js</displayValueProcess> </entityField> <entityParameter> <name>SalesprojectId_param</name> @@ -64,7 +64,7 @@ <expose v="true" /> </entityParameter> <entityParameter> - <name>Type_param</name> + <name>Kind_param</name> <expose v="false" /> </entityParameter> </children> @@ -89,7 +89,7 @@ </children> </entityConsumer> <entityParameter> - <name>Type_param</name> + <name>Kind_param</name> <expose v="true" /> <description>PARAMETER</description> </entityParameter> @@ -105,9 +105,8 @@ </dependencies> <children> <entityParameter> - <name>Type_param</name> - <valueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/statemilestones/children/type_param/valueProcess.js</valueProcess> - <expose v="false" /> + <name>Kind_param</name> + <valueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/statemilestones/children/kind_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityProvider> @@ -123,9 +122,8 @@ </dependencies> <children> <entityParameter> - <name>Type_param</name> - <valueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/phasemilestones/children/type_param/valueProcess.js</valueProcess> - <expose v="false" /> + <name>Kind_param</name> + <valueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/phasemilestones/children/kind_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityProvider> @@ -147,6 +145,7 @@ <entityField> <name>valueLongName</name> <valueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/valuelongname/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/SalesprojectMilestone_entity/entityfields/valuelongname/displayValueProcess.js</displayValueProcess> </entityField> </entityFields> <recordContainers> @@ -180,12 +179,8 @@ <recordfield>SALESPROJECT_MILESTONE.SALESPROJECT_MILESTONEID</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>TYPE.value</name> - <recordfield>SALESPROJECT_MILESTONE.TYPE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>VALUE.value</name> - <recordfield>SALESPROJECT_MILESTONE.VALUE</recordfield> + <name>KIND.value</name> + <recordfield>SALESPROJECT_MILESTONE.KIND</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESPROJECT_ID.value</name> @@ -195,6 +190,11 @@ <name>PARENT_ID.value</name> <recordfield>SALESPROJECT_MILESTONE.PARENT_ID</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>MILESTONEVALUE.value</name> + <recordfield>SALESPROJECT_MILESTONE.MILESTONEVALUE</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/displayValueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b41ebba317deff35035cc9941f23c33869fe65c3 --- /dev/null +++ b/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("Keyword_lib"); + +result.string(KeywordUtils.getViewValue(vars.get("$field.KIND"), vars.get("$field.MILESTONEVALUE"))) \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/entityfields/value/titleProcess.js b/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/titleProcess.js similarity index 66% rename from entity/SalesprojectMilestone_entity/entityfields/value/titleProcess.js rename to entity/SalesprojectMilestone_entity/entityfields/milestonevalue/titleProcess.js index 658e8105ef136f6e374f80363f1c1d0ace5fba7e..f02879713e48f2970f9de7b2e423bb1b329e40cd 100644 --- a/entity/SalesprojectMilestone_entity/entityfields/value/titleProcess.js +++ b/entity/SalesprojectMilestone_entity/entityfields/milestonevalue/titleProcess.js @@ -4,7 +4,7 @@ import("system.result"); if (vars.exists("$field.TYPE") && vars.get("$field.TYPE")) { - result.string(translate.text("Milestones") + " " + translate.text(vars.get("$field.TYPE"))); + result.string(translate.text(vars.get("$field.TYPE"))); } else result.string(translate.text("Milestones")); \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/entityfields/phasemilestones/children/type_param/valueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/phasemilestones/children/kind_param/valueProcess.js similarity index 100% rename from entity/SalesprojectMilestone_entity/entityfields/phasemilestones/children/type_param/valueProcess.js rename to entity/SalesprojectMilestone_entity/entityfields/phasemilestones/children/kind_param/valueProcess.js diff --git a/entity/SalesprojectMilestone_entity/entityfields/statemilestones/children/type_param/valueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/statemilestones/children/kind_param/valueProcess.js similarity index 100% rename from entity/SalesprojectMilestone_entity/entityfields/statemilestones/children/type_param/valueProcess.js rename to entity/SalesprojectMilestone_entity/entityfields/statemilestones/children/kind_param/valueProcess.js diff --git a/entity/SalesprojectMilestone_entity/entityfields/type/displayValueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/type/displayValueProcess.js index 20dd9c7dc7b04a439a16a2a9b4cd833c78f3f964..3226a4d4661ac80f360bb7f2f9c10cfbc8ca758b 100644 --- a/entity/SalesprojectMilestone_entity/entityfields/type/displayValueProcess.js +++ b/entity/SalesprojectMilestone_entity/entityfields/type/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.result"); import("system.vars"); import("Keyword_lib"); -result.string(KeywordUtils.getTranslatedContainer(vars.get("$field.TYPE"))); \ No newline at end of file +result.string(KeywordUtils.getTranslatedContainer(vars.get("$field.KIND"))); \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/entityfields/value/displayValueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/value/displayValueProcess.js deleted file mode 100644 index 5a8a9c5933eb25e1aadbbdc66fa8ac545c1d12b5..0000000000000000000000000000000000000000 --- a/entity/SalesprojectMilestone_entity/entityfields/value/displayValueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.vars"); -import("system.result"); -import("Keyword_lib"); - -result.string(KeywordUtils.getViewValue(vars.get("$field.TYPE"), vars.get("$field.VALUE"))) \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/entityfields/valuelongname/displayValueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/valuelongname/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/SalesprojectMilestone_entity/entityfields/valuelongname/valueProcess.js b/entity/SalesprojectMilestone_entity/entityfields/valuelongname/valueProcess.js index 0ae48ddbbb0191c823d743878247074078e201f5..b153ca0c6bd48838fbd12bef7a2cb820d3f05e19 100644 --- a/entity/SalesprojectMilestone_entity/entityfields/valuelongname/valueProcess.js +++ b/entity/SalesprojectMilestone_entity/entityfields/valuelongname/valueProcess.js @@ -3,6 +3,6 @@ import("system.vars"); import("system.result"); import("Keyword_lib") -var keywordAttr = new KeywordAttribute(vars.get("$field.TYPE"), "longName", vars.get("$field.VALUE.displayValue")) +var keywordAttr = new KeywordAttribute(vars.get("$field.KIND"), "longName", vars.get("$field.MILESTONEVALUE.displayValue")) -result.string(translate.text(keywordAttr.getValue(vars.get("$field.VALUE")))) \ No newline at end of file +result.string(translate.text(keywordAttr.getValue(vars.get("$field.MILESTONEVALUE")))) \ No newline at end of file diff --git a/entity/SalesprojectMilestone_entity/recordcontainers/db/conditionProcess.js b/entity/SalesprojectMilestone_entity/recordcontainers/db/conditionProcess.js index e0aa733ba874bae3fa610a4f560592836dc9ba07..3706bc878d154b36e361b450036a77b917c71a78 100644 --- a/entity/SalesprojectMilestone_entity/recordcontainers/db/conditionProcess.js +++ b/entity/SalesprojectMilestone_entity/recordcontainers/db/conditionProcess.js @@ -5,7 +5,7 @@ import("Sql_lib"); var cond = SqlCondition.begin() .andPrepareVars("SALESPROJECT_MILESTONE.SALESPROJECT_ID", "$param.SalesprojectId_param") - .andPrepareVars("SALESPROJECT_MILESTONE.TYPE", "$param.Type_param"); + .andPrepareVars("SALESPROJECT_MILESTONE.KIND", "$param.Kind_param"); //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/SalesprojectPhase_entity/SalesprojectPhase_entity.aod b/entity/SalesprojectPhase_entity/SalesprojectPhase_entity.aod index eb6bc6678bf0bcaa23b2d5fd1b1d4e32d85af9f2..be7968a149ceeea00c2c0bfd9a802cfa3c886372 100644 --- a/entity/SalesprojectPhase_entity/SalesprojectPhase_entity.aod +++ b/entity/SalesprojectPhase_entity/SalesprojectPhase_entity.aod @@ -6,6 +6,7 @@ <siblings> <element>SalesprojectMilestone_entity</element> </siblings> + <contentTitleProcess>%aditoprj%/entity/SalesprojectPhase_entity/contentTitleProcess.js</contentTitleProcess> <titlePlural>Phases</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> diff --git a/entity/SalesprojectPhase_entity/contentTitleProcess.js b/entity/SalesprojectPhase_entity/contentTitleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..94f61859cc64100bb6a6dcd445efc67835002c1a --- /dev/null +++ b/entity/SalesprojectPhase_entity/contentTitleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.TITLE")); \ No newline at end of file diff --git a/entity/SalesprojectSource_entity/SalesprojectSource_entity.aod b/entity/SalesprojectSource_entity/SalesprojectSource_entity.aod index 0caca42fa25f0d6186addcacd54d2e2c81883ec0..82112726caff98dcb9d251b1e3a99453c5a885e9 100644 --- a/entity/SalesprojectSource_entity/SalesprojectSource_entity.aod +++ b/entity/SalesprojectSource_entity/SalesprojectSource_entity.aod @@ -48,15 +48,15 @@ <valueProcess>%aditoprj%/entity/SalesprojectSource_entity/entityfields/salesproject_id/valueProcess.js</valueProcess> </entityField> <entityField> - <name>SALESPROJECT_SOURCEID</name> - <valueProcess>%aditoprj%/entity/SalesprojectSource_entity/entityfields/salesproject_sourceid/valueProcess.js</valueProcess> + <name>SALESPROJECT_TOUCHPOINTID</name> + <valueProcess>%aditoprj%/entity/SalesprojectSource_entity/entityfields/salesproject_touchpointid/valueProcess.js</valueProcess> </entityField> <entityField> - <name>SOURCE</name> + <name>TOUCHPOINT</name> <title>Touchpoint</title> <consumer>KeywordSources</consumer> <mandatory v="true" /> - <displayValueProcess>%aditoprj%/entity/SalesprojectSource_entity/entityfields/source/displayValueProcess.js</displayValueProcess> + <displayValueProcess>%aditoprj%/entity/SalesprojectSource_entity/entityfields/touchpoint/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> <name>KeywordSources</name> @@ -91,9 +91,9 @@ <conditionProcess>%aditoprj%/entity/SalesprojectSource_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <linkInformation> <linkInformation> - <name>cbe646de-9bc8-4008-8a2f-41fa5728d85e</name> - <tableName>SALESPROJECT_SOURCE</tableName> - <primaryKey>SALESPROJECT_SOURCEID</primaryKey> + <name>fa43b303-700e-43ea-a755-7db8aceffa0f</name> + <tableName>SALESPROJECT_TOUCHPOINT</tableName> + <primaryKey>SALESPROJECT_TOUCHPOINTID</primaryKey> <isUIDTable v="true" /> <readonly v="false" /> </linkInformation> @@ -101,27 +101,34 @@ <recordFieldMappings> <dbRecordFieldMapping> <name>ENTRYDATE.value</name> - <recordfield>SALESPROJECT_SOURCE.ENTRYDATE</recordfield> + <recordfield>SALESPROJECT_TOUCHPOINT.ENTRYDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESPROJECT_ID.value</name> - <recordfield>SALESPROJECT_SOURCE.SALESPROJECT_ID</recordfield> + <recordfield>SALESPROJECT_TOUCHPOINT.SALESPROJECT_ID</recordfield> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>SALESPROJECT_SOURCEID.value</name> - <recordfield>SALESPROJECT_SOURCE.SALESPROJECT_SOURCEID</recordfield> + <name>SOURCE.displayValue</name> + <expression>%aditoprj%/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/source.displayvalue/expression.js</expression> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>SOURCE.value</name> - <recordfield>SALESPROJECT_SOURCE.SOURCE</recordfield> + <name>INFO.value</name> + <recordfield>SALESPROJECT_TOUCHPOINT.INFO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>SOURCE.displayValue</name> - <expression>%aditoprj%/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/source.displayvalue/expression.js</expression> + <name>TOUCHPOINT.displayValue</name> + <expression>%aditoprj%/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/touchpoint.displayvalue/expression.js</expression> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>INFO.value</name> - <recordfield>SALESPROJECT_SOURCE.INFO</recordfield> + <name>TOUCHPOINT.value</name> + <recordfield>SALESPROJECT_TOUCHPOINT.TOUCHPOINT</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>SALESPROJECT_TOUCHPOINTID.value</name> + <recordfield>SALESPROJECT_TOUCHPOINT.SALESPROJECT_TOUCHPOINTID</recordfield> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/SalesprojectSource_entity/conditionProcess.js b/entity/SalesprojectSource_entity/conditionProcess.js index 073fed32ea8fe5e90c22f5083a6d2bd22cdadf6a..fa1c8bc25f7f9731aa0bbc454fd669f4d6e62e43 100644 --- a/entity/SalesprojectSource_entity/conditionProcess.js +++ b/entity/SalesprojectSource_entity/conditionProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("Sql_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("SALESPROJECT_SOURCE.SALESPROJECT_ID", "$param.SalesprojectId_param"); +cond.andPrepareVars("SALESPROJECT_TOUCHPOINT.SALESPROJECT_ID", "$param.SalesprojectId_param"); //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/SalesprojectSource_entity/entityfields/entrydate/valueProcess.js b/entity/SalesprojectSource_entity/entityfields/entrydate/valueProcess.js index 651bbe1ba274ee0bea9f70ef309afe11a883b175..4f2202c6ae0a7cf767176ab29c830936649489dc 100644 --- a/entity/SalesprojectSource_entity/entityfields/entrydate/valueProcess.js +++ b/entity/SalesprojectSource_entity/entityfields/entrydate/valueProcess.js @@ -3,5 +3,5 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.getString("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) result.string(datetime.date()); \ No newline at end of file diff --git a/entity/SalesprojectSource_entity/entityfields/icon/valueProcess.js b/entity/SalesprojectSource_entity/entityfields/icon/valueProcess.js index 860f5656a20ddabd85f30a928382bf22de8a81d1..962b3f3541c1cd7ff482ded628714eefdd355f6f 100644 --- a/entity/SalesprojectSource_entity/entityfields/icon/valueProcess.js +++ b/entity/SalesprojectSource_entity/entityfields/icon/valueProcess.js @@ -1,14 +1,14 @@ -import("system.vars"); -import("system.result"); -import("system.neon"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var category = vars.getString("$field.SOURCE"); -var icon; -if (category) -{ - var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(category, $KeywordRegistry.salesprojectSource()) - icon = keywordAttributes.defaultAvatarRepresentation; - result.string(icon); -} +import("system.vars"); +import("system.result"); +import("system.neon"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var category = vars.getString("$field.TOUCHPOINT"); +var icon; +if (category) +{ + var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(category, $KeywordRegistry.salesprojectSource()) + icon = keywordAttributes.defaultAvatarRepresentation; + result.string(icon); +} diff --git a/entity/SalesprojectSource_entity/entityfields/salesproject_sourceid/valueProcess.js b/entity/SalesprojectSource_entity/entityfields/salesproject_touchpointid/valueProcess.js similarity index 100% rename from entity/SalesprojectSource_entity/entityfields/salesproject_sourceid/valueProcess.js rename to entity/SalesprojectSource_entity/entityfields/salesproject_touchpointid/valueProcess.js diff --git a/entity/Salesproject_entity/entityfields/state/displayValueProcess.js b/entity/SalesprojectSource_entity/entityfields/touchpoint/displayValueProcess.js similarity index 77% rename from entity/Salesproject_entity/entityfields/state/displayValueProcess.js rename to entity/SalesprojectSource_entity/entityfields/touchpoint/displayValueProcess.js index 4b194ebac26d8bb7718c2adae0a10d9d48ded35d..bc070bc91f2c735d11e9adaf68303b549e0d6825 100644 --- a/entity/Salesproject_entity/entityfields/state/displayValueProcess.js +++ b/entity/SalesprojectSource_entity/entityfields/touchpoint/displayValueProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), vars.get("$field.STATE"))); +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.salesprojectSource(), vars.get("$field.TOUCHPOINT"))); diff --git a/entity/SalesprojectSource_entity/recordcontainers/db/conditionProcess.js b/entity/SalesprojectSource_entity/recordcontainers/db/conditionProcess.js index 073fed32ea8fe5e90c22f5083a6d2bd22cdadf6a..fa1c8bc25f7f9731aa0bbc454fd669f4d6e62e43 100644 --- a/entity/SalesprojectSource_entity/recordcontainers/db/conditionProcess.js +++ b/entity/SalesprojectSource_entity/recordcontainers/db/conditionProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("Sql_lib"); var cond = new SqlCondition(); -cond.andPrepareVars("SALESPROJECT_SOURCE.SALESPROJECT_ID", "$param.SalesprojectId_param"); +cond.andPrepareVars("SALESPROJECT_TOUCHPOINT.SALESPROJECT_ID", "$param.SalesprojectId_param"); //TODO: use a preparedCondition when available #1030812 #1034026 result.string(db.translateCondition(cond.build("1 = 1"))); \ No newline at end of file diff --git a/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/source.displayvalue/expression.js b/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/source.displayvalue/expression.js index 78804de15943f7f1439549a5854d5d04f8918da6..9c2c59e5d23fee5e9c0318ba05d33739a47af82e 100644 --- a/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/source.displayvalue/expression.js +++ b/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/source.displayvalue/expression.js @@ -2,5 +2,5 @@ import("system.result"); import("Keyword_lib"); import("KeywordRegistry_basic"); -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectSource(), "SALESPROJECT_SOURCE.SOURCE"); +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectSource(), "SALESPROJECT_TOUCHPOINT.TOUCHPOINT"); result.string(sql); diff --git a/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/touchpoint.displayvalue/expression.js b/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/touchpoint.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..9c2c59e5d23fee5e9c0318ba05d33739a47af82e --- /dev/null +++ b/entity/SalesprojectSource_entity/recordcontainers/db/recordfieldmappings/touchpoint.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectSource(), "SALESPROJECT_TOUCHPOINT.TOUCHPOINT"); +result.string(sql); diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index 45d3e252c7e09f89c9d548c7aaae7ed45d697250..dc45ece712f9ede183d49751dabb204edbeb1ce4 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -6,6 +6,7 @@ <siblings> <element>SalesprojectMilestone_entity</element> </siblings> + <grantDeleteProcess>%aditoprj%/entity/Salesproject_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Salesproject_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Salesproject_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Salesproject_entity/onValidation.js</onValidation> @@ -17,12 +18,6 @@ <entityProvider> <name>#PROVIDER</name> <dependencies> - <entityDependency> - <name>497657f7-ebd7-4c9c-b8ab-da447a1556e5</name> - <entityName>Order_entity</entityName> - <fieldName>Salesprojects</fieldName> - <isConsumer v="false" /> - </entityDependency> <entityDependency> <name>f010781d-453d-4df3-b330-75c1336e4d4c</name> <entityName>Object_entity</entityName> @@ -92,15 +87,17 @@ <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/startdate/valueProcess.js</valueProcess> </entityField> <entityField> - <name>STATE</name> + <name>STATUS</name> <title>Status</title> <consumer>KeywordStates</consumer> <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/state/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/state/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/Salesproject_entity/entityfields/state/onValueChange.js</onValueChange> + <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/status/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/status/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/Salesproject_entity/entityfields/status/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> </onValueChangeTypes> </entityField> <entityField> @@ -434,6 +431,12 @@ <fieldName>Salesprojects</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>cb529e29-37cb-4e8d-9e89-f15cff56df68</name> + <entityName>Order_entity</entityName> + <fieldName>Salesprojects</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -473,7 +476,7 @@ </children> </entityConsumer> <entityProvider> - <name>openSalesprojects</name> + <name>OpenSalesprojects</name> <dependencies> <entityDependency> <name>631f55f9-fb0f-4205-bdb8-6e3476268ab4</name> @@ -484,14 +487,13 @@ </dependencies> <children> <entityParameter> - <name>State_param</name> - <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/opensalesprojects/children/state_param/valueProcess.js</valueProcess> - <expose v="false" /> + <name>Status_param</name> + <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/opensalesprojects/children/status_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityProvider> <entityParameter> - <name>State_param</name> + <name>Status_param</name> <expose v="true" /> <description>PARAMETER</description> </entityParameter> @@ -511,6 +513,7 @@ </entityConsumer> <entityConsumer> <name>Attributes</name> + <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/Salesproject_entity/entityfields/attributes/onValidation.js</onValidation> <dependency> <name>dependency</name> @@ -530,6 +533,7 @@ </entityConsumer> <entityConsumer> <name>AttributeTree</name> + <stateProcess>%aditoprj%/entity/Salesproject_entity/entityfields/attributetree/stateProcess.js</stateProcess> <dependency> <name>dependency</name> <entityName>AttributeRelation_entity</entityName> @@ -547,7 +551,7 @@ </children> </entityConsumer> <entityConsumer> - <name>LogHistoryConsumer</name> + <name>LogHistories</name> <dependency> <name>dependency</name> <entityName>LogHistory_entity</entityName> @@ -556,7 +560,7 @@ <children> <entityParameter> <name>tablenames_param</name> - <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> </entityParameter> </children> </entityConsumer> @@ -704,26 +708,32 @@ <dbRecordFieldMapping> <name>ENDDATE.value</name> <recordfield>SALESPROJECT.ENDDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>SALESPROJECT.INFO</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PHASE.value</name> <recordfield>SALESPROJECT.PHASE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PROBABILITY.value</name> <recordfield>SALESPROJECT.PROBABILITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PROJECTCODE.value</name> <recordfield>SALESPROJECT.PROJECTCODE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PROJECTTITLE.value</name> <recordfield>SALESPROJECT.PROJECTTITLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESPROJECTID.value</name> @@ -732,18 +742,17 @@ <dbRecordFieldMapping> <name>STARTDATE.value</name> <recordfield>SALESPROJECT.STARTDATE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STATE.value</name> - <recordfield>SALESPROJECT.STATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>VOLUME.value</name> <recordfield>SALESPROJECT.VOLUME</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>SALESPROJECT.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.displayValue</name> @@ -753,10 +762,6 @@ <name>PROBABILITY.displayValue</name> <expression>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/probability.displayvalue/expression.js</expression> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>STATE.displayValue</name> - <expression>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/state.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PHASE.displayValue</name> <expression>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js</expression> @@ -764,8 +769,39 @@ <dbRecordFieldMapping> <name>REASONS.value</name> <recordfield>SALESPROJECT.REASONS</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <consumerMapping> + <name>Organisations</name> + <filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>BASIC</filtertype> + </consumerMapping> + <consumerMapping> + <name>Activities</name> + <filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js</filterConditionProcess> + <isFilterable v="true" /> + <filtertype>EXTENDED</filtertype> + </consumerMapping> + <dbRecordFieldMapping> + <name>STATUS.displayValue</name> + <expression>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STATUS.value</name> + <recordfield>SALESPROJECT.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> </recordFieldMappings> + <filterExtensions> + <filterExtensionSet> + <name>Attribute_filter</name> + <filterFieldsProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js</filterFieldsProcess> + <filterValuesProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtensionSet> + </filterExtensions> </dbRecordContainer> <indexRecordContainer> <name>index</name> @@ -786,11 +822,11 @@ <indexFieldType>TEXT</indexFieldType> </indexRecordFieldMapping> <indexRecordFieldMapping> - <name>STATE.value</name> + <name>STATUS.value</name> <indexFieldType>STRING</indexFieldType> </indexRecordFieldMapping> <indexRecordFieldMapping> - <name>STATE.displayValue</name> + <name>STATUS.displayValue</name> <indexFieldType>TEXT_PLAIN</indexFieldType> </indexRecordFieldMapping> <indexRecordFieldMapping> diff --git a/entity/Salesproject_entity/entityfields/2pensalesprojects/children/state_param/valueProcess.js b/entity/Salesproject_entity/entityfields/2pensalesprojects/children/state_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2a82320164b8a1ee9cce3001fdbe18a385a7c77c --- /dev/null +++ b/entity/Salesproject_entity/entityfields/2pensalesprojects/children/state_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.salesprojectState$open()); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/attributes/onValidation.js b/entity/Salesproject_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..ce9ea36afd249806a964597c714ca1419db9985c 100644 --- a/entity/Salesproject_entity/entityfields/attributes/onValidation.js +++ b/entity/Salesproject_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/attributes/stateProcess.js b/entity/Salesproject_entity/entityfields/attributes/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Salesproject_entity/entityfields/attributes/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/attributetree/stateProcess.js b/entity/Salesproject_entity/entityfields/attributetree/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9cffc2b80461245d94a17604f60cc531e2d63a6d --- /dev/null +++ b/entity/Salesproject_entity/entityfields/attributetree/stateProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.result"); +import("Context_lib"); +import("Attribute_lib"); + +if (AttributeUtil.hasAttributes(ContextUtils.getCurrentContextId())) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/enddate/valueProcess.js b/entity/Salesproject_entity/entityfields/enddate/valueProcess.js index 4cfebdb8acb8403994a4c535f0319cca81bd7017..dd2908f617fb7c3700b361fd97933bd758d985cd 100644 --- a/entity/Salesproject_entity/entityfields/enddate/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/enddate/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("Date_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(DateUtils.getDateIncrementedByYears(DateUtils.getTodayUTC(), 1)); } \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js b/entity/Salesproject_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js similarity index 97% rename from entity/Salesproject_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js rename to entity/Salesproject_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js index 316546cb5cd3f41b3b4106b3a5bd45e2c09bec5b..97523412f94b7d77b72b9a0973be454ca2a0bf04 100644 --- a/entity/Salesproject_entity/entityfields/loghistoryconsumer/children/tablenames_param/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js @@ -1,10 +1,10 @@ -import("system.vars"); -import("system.result"); -import("Context_lib"); - -var res = []; -res.push({id: vars.get("$field.SALESPROJECTID"), tableNames: ["AB_ATTRIBUTERELATION", "ACTIVITY"]}); -res.push({id: vars.get("$field.SALESPROJECTID"), tableNames: ["SALESPROJECT"]}); - -res = JSON.stringify(res);//currently only strings can be passed as param +import("system.vars"); +import("system.result"); +import("Context_lib"); + +var res = []; +res.push({id: vars.get("$field.SALESPROJECTID"), tableNames: ["AB_ATTRIBUTERELATION", "ACTIVITY"]}); +res.push({id: vars.get("$field.SALESPROJECTID"), tableNames: ["SALESPROJECT"]}); + +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/Salesproject_entity/entityfields/opensalesprojects/children/state_param/valueProcess.js b/entity/Salesproject_entity/entityfields/opensalesprojects/children/state_param/valueProcess.js deleted file mode 100644 index 9074d4eece1ed8c26040d657c5c989aa1950ac12..0000000000000000000000000000000000000000 --- a/entity/Salesproject_entity/entityfields/opensalesprojects/children/state_param/valueProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); - -//The Id for the salesproject state keyword OPEN -result.string("483bcaeb-1e5b-4772-b54e-7d7d8aa65712"); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/opensalesprojects/children/status_param/valueProcess.js b/entity/Salesproject_entity/entityfields/opensalesprojects/children/status_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2a82320164b8a1ee9cce3001fdbe18a385a7c77c --- /dev/null +++ b/entity/Salesproject_entity/entityfields/opensalesprojects/children/status_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.salesprojectState$open()); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/phase/valueProcess.js b/entity/Salesproject_entity/entityfields/phase/valueProcess.js index c8e9543ca52fa6a3dd2d2760ca1d551447bfc032..7ff3aa7c6b2ad21f43934b9e4ff5131980b35005 100644 --- a/entity/Salesproject_entity/entityfields/phase/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/phase/valueProcess.js @@ -3,5 +3,5 @@ import("system.neon"); import("system.vars"); import("system.result"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) - result.string($KeywordRegistry.salesprojectPhase$nqc()); //NQC \ No newline at end of file +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string($KeywordRegistry.salesprojectPhase$nqc()); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/projectcode/onValidation.js b/entity/Salesproject_entity/entityfields/projectcode/onValidation.js index 92d5d098b6ccc7ca75bbfd0b38a64c063c8d33d5..2c9020b283b0fdbbbd8053aa313d14b19c347bf8 100644 --- a/entity/Salesproject_entity/entityfields/projectcode/onValidation.js +++ b/entity/Salesproject_entity/entityfields/projectcode/onValidation.js @@ -6,7 +6,7 @@ import("Util_lib"); import("Entity_lib"); if( vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW - && !Salesproject.validateProjectNumber(ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PROJECTCODE"))) ) + && !Salesproject.validateProjectNumber(vars.get("local.value")) ) { vars.set( "$field.PROJECTCODE", Salesproject.getNextProjectNumber().toString("1 = 1") ); } \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/reasons/mandatoryProcess.js b/entity/Salesproject_entity/entityfields/reasons/mandatoryProcess.js index e04fe64bb9f9475704a97e61647eef1cda571d94..6d8b636fc9c3e3cbe58ba454671589db70411d99 100644 --- a/entity/Salesproject_entity/entityfields/reasons/mandatoryProcess.js +++ b/entity/Salesproject_entity/entityfields/reasons/mandatoryProcess.js @@ -3,5 +3,5 @@ import("system.vars"); import("KeywordRegistry_basic"); // IDs: SalesprojectState Order and Lost -var res = vars.get("$field.STATE") && (vars.get("$field.STATE") == $KeywordRegistry.salesprojectState$order() || vars.get("$field.STATE") == $KeywordRegistry.salesprojectState$lost()); +var res = vars.get("$field.STATUS") && (vars.get("$field.STATUS") == $KeywordRegistry.salesprojectState$order() || vars.get("$field.STATUS") == $KeywordRegistry.salesprojectState$lost()); result.string(res); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/reasons/stateProcess.js b/entity/Salesproject_entity/entityfields/reasons/stateProcess.js index 666b25be556fdf618dc8fc730751b30d5b1ce085..57434eadd618e41c37a344f8890a7a8aed10a987 100644 --- a/entity/Salesproject_entity/entityfields/reasons/stateProcess.js +++ b/entity/Salesproject_entity/entityfields/reasons/stateProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("KeywordRegistry_basic"); // IDs: SalesprojectState Order and Lost -if(vars.get("$field.STATE") && (vars.get("$field.STATE") == $KeywordRegistry.salesprojectState$order() || vars.get("$field.STATE") == $KeywordRegistry.salesprojectState$lost())) +if(vars.get("$field.STATUS") && (vars.get("$field.STATUS") == $KeywordRegistry.salesprojectState$order() || vars.get("$field.STATUS") == $KeywordRegistry.salesprojectState$lost())) result.string("EDITABLE"); else result.string("INVISIBLE"); diff --git a/entity/Salesproject_entity/entityfields/startdate/valueProcess.js b/entity/Salesproject_entity/entityfields/startdate/valueProcess.js index e4ef3a804fc5b107cf7312e8133b2ee149882fdd..047e11fdb49fe7a57518e928bd5e6436d9f10065 100644 --- a/entity/Salesproject_entity/entityfields/startdate/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/startdate/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("Date_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(DateUtils.getTodayUTC()); } \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/state/onValueChange.js b/entity/Salesproject_entity/entityfields/state/onValueChange.js deleted file mode 100644 index 509f1db7864bbf1d05e44ad0f040196524f85dc4..0000000000000000000000000000000000000000 --- a/entity/Salesproject_entity/entityfields/state/onValueChange.js +++ /dev/null @@ -1,28 +0,0 @@ -import("system.vars"); -import("Sql_lib"); -import("system.db"); -import("KeywordRegistry_basic"); -import("Keyword_lib"); -import("system.translate"); -import("system.question"); -import("system.neon"); - -if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) -{ - var state = vars.get("$field.STATE"); - - // Postponed - if (state == $KeywordRegistry.salesprojectState$postponed()) - { - var stateName = KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), state); - var clearForecast = question.askYesNo(translate.withArguments("Clear forecast and set state to '%0'?", [stateName]), translate.withArguments("Would you really like to clear the forecast and set the state to '%0'?", [stateName]) + "\n" + translate.text("This cannot be undone!"), false); - - if (!clearForecast) - { - // reset to value from db - neon.setFieldValue("$field.STATE", db.cell(SqlCondition.begin() - .andPrepareVars("SALESPROJECT.SALESPROJECTID", "$field.SALESPROJECTID") - .buildSql("select STATE from SALESPROJECT", "1=2"))); - } - } -} diff --git a/entity/SalesprojectSource_entity/entityfields/source/displayValueProcess.js b/entity/Salesproject_entity/entityfields/status/displayValueProcess.js similarity index 77% rename from entity/SalesprojectSource_entity/entityfields/source/displayValueProcess.js rename to entity/Salesproject_entity/entityfields/status/displayValueProcess.js index b3db4887929c1f0298807bff7610a08cdfa79e17..fbea558b6977bded361339b3e117dca75fc0a52e 100644 --- a/entity/SalesprojectSource_entity/entityfields/source/displayValueProcess.js +++ b/entity/Salesproject_entity/entityfields/status/displayValueProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.salesprojectSource(), vars.get("$field.SOURCE"))); +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), vars.get("$field.STATUS"))); diff --git a/entity/Salesproject_entity/entityfields/status/onValueChange.js b/entity/Salesproject_entity/entityfields/status/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..4745b434f63d0151c8c511fdc73e9ac6d9cad1c0 --- /dev/null +++ b/entity/Salesproject_entity/entityfields/status/onValueChange.js @@ -0,0 +1,7 @@ +import("Sql_lib"); +import("system.vars"); +import("system.db"); + +vars.set("$context.statusBefore", db.cell(SqlCondition.begin() + .andPrepareVars("SALESPROJECT.SALESPROJECTID", "$field.SALESPROJECTID") + .buildSql("select STATUS from SALESPROJECT", "1=2"))); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/state/valueProcess.js b/entity/Salesproject_entity/entityfields/status/valueProcess.js similarity index 64% rename from entity/Salesproject_entity/entityfields/state/valueProcess.js rename to entity/Salesproject_entity/entityfields/status/valueProcess.js index a4457905d6e53c4ca6b3ac93001932fbdd6ae3c0..7da8d5f0142bc3fa41e1ca0b4d99c19194261594 100644 --- a/entity/Salesproject_entity/entityfields/state/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/status/valueProcess.js @@ -3,5 +3,5 @@ import("system.neon"); import("system.vars"); import("system.result"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string($KeywordRegistry.salesprojectState$open()); //Open \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js b/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js index 679d5eb17d8ddfa54d8c8b068b22321548416e09..376c72c136a831f2fb6215c6474c1918fbc798de 100644 --- a/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js +++ b/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js @@ -3,4 +3,4 @@ import("system.vars"); import("system.translate"); import("system.result"); -result.string(NumberUtils.formatWithCurrency(vars.get("$this.value"), translate.text("#0"), translate.text("${EURO_SIGN}"))); \ No newline at end of file +result.string(NumberUtils.formatWithCurrency(vars.get("$field.VOLUME"), translate.text("#0"), translate.text("${EURO_SIGN}"))); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/volume/onValidation.js b/entity/Salesproject_entity/entityfields/volume/onValidation.js index bf0a8f97253cff58d9188c390b044ecc2f1c26d5..410b72014ab2ce31519900fc218a7e064e0a2b05 100644 --- a/entity/Salesproject_entity/entityfields/volume/onValidation.js +++ b/entity/Salesproject_entity/entityfields/volume/onValidation.js @@ -7,7 +7,7 @@ import("Entity_lib"); // TODO: displayValue + contentType number crashes so we use TEXT and validate ourselve // Workaround for 1035861 -var volume = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.VOLUME")); +var volume = vars.get("local.value"); var message = ""; if (!/^\d+\.?\d*$/.test(volume)) message = translate.text("Only numbers are allowed."); diff --git a/entity/Salesproject_entity/grantDeleteProcess.js b/entity/Salesproject_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..66d8dcc67dbfa7addfbe250d3e1c6a074bb84a3a --- /dev/null +++ b/entity/Salesproject_entity/grantDeleteProcess.js @@ -0,0 +1,9 @@ +import("Context_lib"); +import("ActivityTask_lib"); +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("SALESPROJECT", null, vars.get("$field.SALESPROJECTID")) + && !TaskUtils.hasTasks(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId()) + && !ActivityUtils.hasActivities(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId())); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/conditionProcess.js b/entity/Salesproject_entity/recordcontainers/db/conditionProcess.js index f3a32a333dafdf4816b96cb701a339e4613f2827..718629c28ebd0cd9a84247b26c676ff40ac4b099 100644 --- a/entity/Salesproject_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Salesproject_entity/recordcontainers/db/conditionProcess.js @@ -3,18 +3,8 @@ import("system.result"); import("system.vars"); import("Sql_lib"); -if(vars.exists("$param.State_param") && vars.get("$param.State_param") && vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) -{ - result.string(db.translateCondition( - SqlCondition.begin() - .andPrepareVars("SALESPROJECT.CONTACT_ID", "$param.ContactId_param") - .andPrepareVars("SALESPROJECT.STATE", "$param.State_param") - .build("1 = 2"))); -} -else -{ - result.string(db.translateCondition( - SqlCondition.begin() - .andPrepareVars("SALESPROJECT.CONTACT_ID", "$param.ContactId_param") - .build("1 = 1"))); -} \ No newline at end of file +result.string(db.translateCondition( + SqlCondition.begin() + .andPrepareVars("SALESPROJECT.CONTACT_ID", "$param.ContactId_param") + .andPrepareVars("SALESPROJECT.STATUS", "$param.Status_param") + .build("1 = 1"))); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js b/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..65d6b67c6e0affc794a04043f264fa103f4c2ba0 --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterConditionProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var sqlCond = AttributeFilterExtensionMaker.makeFilterConditionSql(); +result.string(sqlCond); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js b/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..209ddd39ef4a15b1190ef2bd4955ccdc78f5808b --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterFieldsProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var fields = AttributeFilterExtensionMaker.makeFilterFields(); +result.string(fields); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js b/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..942b0a0495a179f9c25d19330bb8cd59c5563ec0 --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/filterextensions/attribute_filter/filterValuesProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("AttributeFilter_lib"); + +var values = AttributeFilterExtensionMaker.makeFilterValues(); +result.object(values); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js b/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js index dc8096032637d39091a4bec27f435dd08d99165e..805d98d50d962a373d80080c279a10a9a2b34938 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js @@ -1,42 +1,42 @@ -import("Context_lib"); -import("system.db"); -import("system.vars"); -import("Sql_lib"); - -var currentId = vars.getString("$field.SALESPROJECTID"); - -if (currentId) -{ - var toDelete = [ - "SALESPROJECT_MILESTONE", - "SALESPROJECT_SOURCE" - ]; - - - toDelete = toDelete.map(function(pTable) - { - return [pTable, SqlCondition.equals(pTable + ".SALESPROJECT_ID", currentId, "1=2")]; - }); - - - - var modulesToDelete = [ - "CLASSIFICATION", - "COMPETITION", - "MEMBER", - "FORECAST" - ]; - - toDelete = toDelete.concat(modulesToDelete.map(function(pTableComp) - { - return [pTableComp, SqlCondition.begin() - .andPrepare(pTableComp + ".OBJECT_TYPE", ContextUtils.getCurrentContextId()) - .andPrepare(pTableComp + ".OBJECT_ROWID", currentId) - .build("1=2")]; - })); - - - db.deletes(toDelete); - -// TODO: auch Dokumente, Aktivitäten, Aufgaben, Zeiterfassungen löschen? +import("Context_lib"); +import("system.db"); +import("system.vars"); +import("Sql_lib"); + +var currentId = vars.getString("$field.SALESPROJECTID"); + +if (currentId) +{ + var toDelete = [ + "SALESPROJECT_MILESTONE", + "SALESPROJECT_TOUCHPOINT" + ]; + + + toDelete = toDelete.map(function(pTable) + { + return [pTable, SqlCondition.equals(pTable + ".SALESPROJECT_ID", currentId, "1=2")]; + }); + + + + var modulesToDelete = [ + "CLASSIFICATION", + "COMPETITION", + "OBJECTMEMBER", + "FORECAST" + ]; + + toDelete = toDelete.concat(modulesToDelete.map(function(pTableComp) + { + return [pTableComp, SqlCondition.begin() + .andPrepare(pTableComp + ".OBJECT_TYPE", ContextUtils.getCurrentContextId()) + .andPrepare(pTableComp + ".OBJECT_ROWID", currentId) + .build("1=2")]; + })); + + + db.deletes(toDelete); + +// TODO: auch Dokumente, Aktivitäten, Aufgaben, Zeiterfassungen löschen? } \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js b/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js index 49491bda0074fa9406df07580128dfd6240db2cb..79ce21d64da8886c5e36bbe0b91d67072d815dc4 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js @@ -1,5 +1,7 @@ import("system.vars"); import("Salesproject_lib"); -Salesproject.insertMilestone(vars.getString("$field.SALESPROJECTID"), "SalesprojectPhase", vars.get("$field.PHASE"), false); -Salesproject.insertMilestone(vars.getString("$field.SALESPROJECTID"), "SalesprojectState", vars.get("$field.STATE"), true); \ No newline at end of file +var rowdata = vars.get("$local.rowdata"); + +Salesproject.insertMilestone(vars.getString("local.uid"), "SalesprojectPhase", rowdata["SALESPROJECT.PHASE"], false); +Salesproject.insertMilestone(vars.getString("$local.uid"), "SalesprojectState", rowdata["SALESPROJECT.STATUS"], true); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js index 775a8af9d388163a8d1208e001d41893eaa4447d..5cd8bb054ee172abdad725e8cd98e9a21da17d7f 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Context_lib"); import("system.neon"); import("system.translate"); import("system.vars"); @@ -9,31 +10,32 @@ import("KeywordRegistry_basic"); import("Keyword_lib"); var needToUpdateForecast = null; +var rowdata = vars.get("$local.rowdata"); // create Milestones if changed vars.get("$local.changed").forEach(function(fieldName) { var typeValue; - var fieldVar; var clearReason; switch (fieldName) { case "SALESPROJECT.PHASE": typeValue = "SalesprojectPhase"; - fieldVar = "$field.PHASE"; break; - case "SALESPROJECT.STATE": + case "SALESPROJECT.STATUS": // Milestone typeValue = "SalesprojectState"; - fieldVar = "$field.STATE"; - var state = vars.get(fieldVar); + var state = rowdata[fieldName]; // set COMPETITION / OFFER to Lost // Lost if (state == $KeywordRegistry.salesprojectState$lost()) { // set all offers of the salesproject to lost - db.updateData("OFFER", ["STATUS"], null, ["a5682630-01ae-4769-8f03-47dc1db44da4"], SqlCondition.equals("OFFER.OBJECT_ROWID", vars.getString("$field.SALESPROJECTID"), "1=2")); + db.updateData("OFFER", ["STATUS"], null, [$KeywordRegistry.offerStatus$lost()], SqlCondition.begin() + .andPrepare("OFFER.OBJECT_ROWID", vars.getString("$local.uid")) + .andPrepare("OFFER.OBJECT_TYPE", ContextUtils.getCurrentContextId()) + .build("1=2")); _updateReasons(); clearReason = false; } @@ -41,16 +43,31 @@ vars.get("$local.changed").forEach(function(fieldName) { else if (state == $KeywordRegistry.salesprojectState$order()) { // set all competitions of the salesproject to lost - db.updateData("COMPETITION", ["STATUS"], null, ["ff73172c-8517-4b6e-98cb-43aebacd9af1"], SqlCondition.equals("COMPETITION.OBJECT_ROWID", vars.getString("$field.SALESPROJECTID"), "1=2")); + db.updateData("COMPETITION", ["STATUS"], null, [$KeywordRegistry.competitionState$lost()], SqlCondition.begin() + .andPrepare("COMPETITION.OBJECT_ROWID", vars.getString("$local.uid")) + .andPrepare("COMPETITION.OBJECT_TYPE", ContextUtils.getCurrentContextId()) + .build("1=2")); _updateReasons(); clearReason = false; } // Postponed else if (state == $KeywordRegistry.salesprojectState$postponed()) { - // do not notify as the user just got a question, if he really would like to clear the forecast - needToUpdateForecast = false; - db.deleteData("FORECAST", SqlCondition.equals("FORECAST.OBJECT_ROWID", vars.getString("$field.SALESPROJECTID"), "1=2")); + // ask if forecast should be cleared. Else reset to old value. + var stateName = KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), state); + var clearForecast = question.askYesNo(translate.withArguments("Clear forecast and set state to '%0'?", [stateName]), translate.withArguments("Would you really like to clear the forecast and set the state to '%0'?", [stateName]) + "\n" + translate.text("This cannot be undone!"), false); + + if (!clearForecast) + { + // reset to value from db + db.updateData("SALESPROJECT", ["STATUS"], null, [vars.get("$context.statusBefore")], SqlCondition.begin() + .andPrepare("SALESPROJECT.SALESPROJECTID", vars.getString("$local.uid")) + .build("1=2")); + } else { + // do not notify as the user just got a question, if he really would like to clear the forecast + needToUpdateForecast = false; + db.deleteData("FORECAST", SqlCondition.equals("FORECAST.OBJECT_ROWID", vars.getString("$local.uid"), "1=2")); + } } // if state changed, but not to one of the above states else @@ -60,7 +77,7 @@ vars.get("$local.changed").forEach(function(fieldName) { break; } - // It clearReason is undefined, it the state did not change. So do nothing + // If clearReason is undefined, it the state did not change. So do nothing if (clearReason != undefined) { _clearReasons(clearReason); @@ -72,22 +89,24 @@ vars.get("$local.changed").forEach(function(fieldName) { if (needToUpdateForecast === null) needToUpdateForecast = true; - Salesproject.insertMilestone(vars.getString("$field.SALESPROJECTID"), typeValue, vars.getString(fieldVar)); + Salesproject.insertMilestone(vars.getString("$local.uid"), typeValue, rowdata[fieldName]); } }); if (needToUpdateForecast) Salesproject.notifyToUpdateForecast(); +neon.refreshAll(); + function _updateReasons() { - var reasons = vars.getString("field.REASONS"); + var reasons = rowdata["SALESPROJECT.REASONS"]; if(reasons) - db.updateData("SALESPROJECT", ["REASONS"], null, [reasons], SqlCondition.equals("SALESPROJECT.SALESPROJECTID", vars.getString("$field.SALESPROJECTID"), "1=2")); + db.updateData("SALESPROJECT", ["REASONS"], null, [reasons], SqlCondition.equals("SALESPROJECT.SALESPROJECTID", vars.getString("$local.uid"), "1=2")); } function _clearReasons(pReallyClear) { if (pReallyClear) - db.updateData("SALESPROJECT", ["REASONS"], null, [""], SqlCondition.equals("SALESPROJECT.SALESPROJECTID", vars.getString("$field.SALESPROJECTID"), "1=2")); + db.updateData("SALESPROJECT", ["REASONS"], null, [""], SqlCondition.equals("SALESPROJECT.SALESPROJECTID", vars.getString("$local.uid"), "1=2")); } \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3a8b1fd9f8491be342a16fd7967c756ef82b0e21 --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/activities/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Salesproject'"; + +result.string("SALESPROJECTID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c8e5d0b46457c78b827c4869afac5170cbc5c937 --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +var from = "CONTACT join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID)"; + +result.string("SALESPROJECT.CONTACT_ID in (select CONTACT.CONTACTID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..6846c7d6dd9c53baa06fb9eeb194c8ca6e25f735 --- /dev/null +++ b/entity/Salesproject_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "SALESPROJECT.STATUS"); +result.string(sql); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/index/query.js b/entity/Salesproject_entity/recordcontainers/index/query.js index ae0bd2e48c708ed1828ef89fbaf737d7100c8236..0328c42a67053de00025b4498a3e07c497c0bd16 100644 --- a/entity/Salesproject_entity/recordcontainers/index/query.js +++ b/entity/Salesproject_entity/recordcontainers/index/query.js @@ -15,17 +15,17 @@ if (vars.exists("$local.idvalue")) { //TODO: refactor this for incremental indexer (injections?) } sqlHelper = new SqlMaskingUtils(); -sqlQuery = "select SALESPROJECTID as uid" - + ", PROJECTTITLE as title, " +sqlQuery = 'select SALESPROJECTID as "_uid_"' + + ', PROJECTTITLE as "_title_", ' + sqlHelper.concat([ - "'" + translate.text("Status") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATE"), + "'" + translate.text("Status") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATUS"), "'| " + translate.text("Phase") + ":'", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "PHASE") ]) - + " as description" + + ' as "_description_" ' + ", PROJECTCODE" + ", PROJECTTITLE" - + ", STATE" - + ', ' + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATE") + ' as "STATE.displayValue"' + + ", STATUS" + + ', ' + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATUS") + ' as "STATUS.displayValue"' + ", PHASE" + ', ' + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "PHASE") + ' as "PHASE.displayValue"' + " from SALESPROJECT " diff --git a/entity/SalutationDistinct_entity/recordcontainers/jdito/contentProcess.js b/entity/SalutationDistinct_entity/recordcontainers/jdito/contentProcess.js index 0e53e6c736a0703710a88cb472eb79eff71ccd7e..2f0c02c1d198af20950d8b5d3395cd35a5af1684 100644 --- a/entity/SalutationDistinct_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/SalutationDistinct_entity/recordcontainers/jdito/contentProcess.js @@ -5,5 +5,5 @@ import("Sql_lib"); result.object(db.table(SqlCondition.begin() .and("SALUTATION is not NULL") - .andPrepareVars("SALUTATION.LANGUAGE", "$param.Language_param") + .andPrepareVars("SALUTATION.ISOLANGUAGE", "$param.Language_param") .buildSql("select distinct SALUTATION from SALUTATION", "1=1"))); \ No newline at end of file diff --git a/entity/Salutation_entity/Salutation_entity.aod b/entity/Salutation_entity/Salutation_entity.aod index ae913066e9db068fe7e3c0e1fd34a0bc5ab5dec2..bfc64038579eb494311e3d0f4490e96a6b15d11f 100644 --- a/entity/Salutation_entity/Salutation_entity.aod +++ b/entity/Salutation_entity/Salutation_entity.aod @@ -19,10 +19,10 @@ <title>Headline</title> </entityField> <entityField> - <name>LANGUAGE</name> + <name>ISOLANGUAGE</name> <title>Language</title> <consumer>KeywordLanguages</consumer> - <displayValueProcess>%aditoprj%/entity/Salutation_entity/entityfields/language/displayValueProcess.js</displayValueProcess> + <displayValueProcess>%aditoprj%/entity/Salutation_entity/entityfields/isolanguage/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>LETTERSALUTATION</name> @@ -88,18 +88,17 @@ <dbRecordFieldMapping> <name>HEADLINE.value</name> <recordfield>SALUTATION.HEADLINE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>LANGUAGE.value</name> - <recordfield>SALUTATION.LANGUAGE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>LETTERSALUTATION.value</name> <recordfield>SALUTATION.LETTERSALUTATION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALUTATION_TEXT.value</name> <recordfield>SALUTATION.SALUTATION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALUTATIONID.value</name> @@ -108,18 +107,26 @@ <dbRecordFieldMapping> <name>SEX.value</name> <recordfield>SALUTATION.SEX</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SORT.value</name> <recordfield>SALUTATION.SORT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TITLE.value</name> <recordfield>SALUTATION.TITLE</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ISOLANGUAGE.value</name> + <recordfield>SALUTATION.ISOLANGUAGE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> - <name>LANGUAGE.displayValue</name> - <expression>%aditoprj%/entity/Salutation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js</expression> + <name>ISOLANGUAGE.displayValue</name> + <expression>%aditoprj%/entity/Salutation_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js</expression> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/Salutation_entity/entityfields/language/displayValueProcess.js b/entity/Salutation_entity/entityfields/isolanguage/displayValueProcess.js similarity index 100% rename from entity/Salutation_entity/entityfields/language/displayValueProcess.js rename to entity/Salutation_entity/entityfields/isolanguage/displayValueProcess.js diff --git a/entity/Salutation_entity/entityfields/sex/valueProcess.js b/entity/Salutation_entity/entityfields/sex/valueProcess.js index de822d0de5f1aa434a54ff3b48d13a94613b0d55..ce31dcbede0d54a6db9b46ee1b4e0dbcb3b30752 100644 --- a/entity/Salutation_entity/entityfields/sex/valueProcess.js +++ b/entity/Salutation_entity/entityfields/sex/valueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("KeywordRegistry_basic"); import("system.result"); -/*if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && !vars.get("$this.value")) +/*if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null) { result.string($KeywordRegistry.personGender$other()); }*/ \ No newline at end of file diff --git a/entity/Salutation_entity/recordcontainers/db/orderClauseProcess.js b/entity/Salutation_entity/recordcontainers/db/orderClauseProcess.js index 93bf8f7342e27290a3f17d2047ec0dc50e4ea4f3..97891ac656a1275fb8c5a8f6198f1816eb71081d 100644 --- a/entity/Salutation_entity/recordcontainers/db/orderClauseProcess.js +++ b/entity/Salutation_entity/recordcontainers/db/orderClauseProcess.js @@ -2,6 +2,6 @@ import("system.db"); import("system.result"); result.object({ - "SALUTATION.LANGUAGE": db.ASCENDING, + "SALUTATION.ISOLANGUAGE": db.ASCENDING, "SALUTATION.SORT": db.ASCENDING }); \ No newline at end of file diff --git a/entity/Salutation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js b/entity/Salutation_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js similarity index 88% rename from entity/Salutation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js rename to entity/Salutation_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js index 746ecc543ae09b6ad2d81ff2aeb6964649d6f0ca..17f5b61a6698aa70c5884752fe09e218b2de660c 100644 --- a/entity/Salutation_entity/recordcontainers/db/recordfieldmappings/language.displayvalue/expression.js +++ b/entity/Salutation_entity/recordcontainers/db/recordfieldmappings/isolanguage.displayvalue/expression.js @@ -1,6 +1,6 @@ import("system.result"); import("Keyword_lib"); -var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("SALUTATION.LANGUAGE"); +var sql = LanguageKeywordUtils.getResolvedTitleSqlPart("SALUTATION.ISOLANGUAGE"); result.string(sql); diff --git a/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod b/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod index e29e0663fbc93dd601d4b3db8f2c7e6e098b6f3d..66768fb7f3e15a14ba0ddc984d193e7e7b88c4f7 100644 --- a/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod +++ b/entity/SerialLetterAddRecipients_entity/SerialLetterAddRecipients_entity.aod @@ -11,6 +11,7 @@ <name>SERIALLETTER_ID</name> <title>Serial letter</title> <consumer>SerialLetters</consumer> + <mandatory v="true" /> </entityField> <entityField> <name>UID</name> diff --git a/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js b/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js index 3afb7c68f28e9a1ca239132f704d76ceece13f40..e5d6b8596f1c2451faed96bf983c0993a864faee 100644 --- a/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js +++ b/entity/SerialLetterAddRecipients_entity/recordcontainers/jdito/onInsert.js @@ -5,3 +5,4 @@ var contactIds = JSON.parse(vars.getString("$field.recipientContactIds")); var letterId = vars.get("$field.SERIALLETTER_ID"); SerialLetterUtils.addRecipients(letterId, contactIds); +SerialLetterUtils.openSerialLetter(letterId); \ No newline at end of file diff --git a/entity/SerialLetter_entity/SerialLetter_entity.aod b/entity/SerialLetter_entity/SerialLetter_entity.aod index d09b63bd016da5945df7c1fa9cbc31d1aecf3c34..2ea9ac7cfa3ac27f3954f62602a0bd954df98861 100644 --- a/entity/SerialLetter_entity/SerialLetter_entity.aod +++ b/entity/SerialLetter_entity/SerialLetter_entity.aod @@ -5,6 +5,8 @@ <icon>VAADIN:ENVELOPES</icon> <title>Serial letter</title> <contentTitleProcess>%aditoprj%/entity/SerialLetter_entity/contentTitleProcess.js</contentTitleProcess> + <iconId>VAADIN:ENVELOPE</iconId> + <titlePlural>Serial letters</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -23,6 +25,7 @@ <title>Download letter</title> <onActionProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/downloadletter/onActionProcess.js</onActionProcess> <iconId>VAADIN:DOWNLOAD_ALT</iconId> + <tooltipProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/downloadletter/tooltipProcess.js</tooltipProcess> </entityActionField> <entityField> <name>SERIALLETTERID</name> @@ -31,7 +34,6 @@ <name>DOCUMENTTEMPLATE_ID</name> <title>Document Template</title> <consumer>Templates</consumer> - <mandatory v="true" /> </entityField> <entityConsumer> <name>Recipients</name> @@ -64,18 +66,58 @@ <name>TITLE</name> <title>Title</title> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/title/valueProcess.js</valueProcess> </entityField> <entityField> <name>DESCRIPTION</name> <title>Description</title> <contentType>LONG_TEXT</contentType> </entityField> + <entityConsumer> + <name>LogHistories</name> + <dependency> + <name>dependency</name> + <entityName>LogHistory_entity</entityName> + <fieldName>LogHistoryProvider</fieldName> + </dependency> + <children> + <entityParameter> + <name>tablenames_param</name> + <valueProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityActionField> + <name>openAdminView</name> + <title>Open admin view</title> + <onActionProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/openadminview/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CURLY_BRACKETS</iconId> + <stateProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/openadminview/stateProcess.js</stateProcess> + </entityActionField> + <entityField> + <name>bindata</name> + <contentType>FILE</contentType> + </entityField> + <entityField> + <name>STATUS</name> + <title>Status</title> + </entityField> + <entityActionField> + <name>downloadTemplate</name> + <title>Download template</title> + <onActionProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/downloadtemplate/onActionProcess.js</onActionProcess> + <iconId>VAADIN:FILE_FONT</iconId> + <stateProcess>%aditoprj%/entity/SerialLetter_entity/entityfields/downloadtemplate/stateProcess.js</stateProcess> + </entityActionField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> <fromClauseProcess>%aditoprj%/entity/SerialLetter_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> + <onDBInsert>%aditoprj%/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> + <onDBDelete>%aditoprj%/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>5d9c983a-b129-437a-ae9d-203fb8ad03ec</name> @@ -96,6 +138,7 @@ <dbRecordFieldMapping> <name>DOCUMENTTEMPLATE_ID.value</name> <recordfield>SERIALLETTER.DOCUMENTTEMPLATE_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SERIALLETTERID.value</name> @@ -108,10 +151,16 @@ <dbRecordFieldMapping> <name>TITLE.value</name> <recordfield>SERIALLETTER.TITLE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DESCRIPTION.value</name> <recordfield>SERIALLETTER.DESCRIPTION</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>STATUS.value</name> + <recordfield>SERIALLETTER.STATUS</recordfield> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/SerialLetter_entity/entityfields/downloadletter/tooltipProcess.js b/entity/SerialLetter_entity/entityfields/downloadletter/tooltipProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..28c658e9536bb301da7fe49ef201080db8430599 --- /dev/null +++ b/entity/SerialLetter_entity/entityfields/downloadletter/tooltipProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Download letter")); \ No newline at end of file diff --git a/entity/SerialLetter_entity/entityfields/downloadtemplate/onActionProcess.js b/entity/SerialLetter_entity/entityfields/downloadtemplate/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..08f18726798d5059a50a4559b66dce881dd40b4b --- /dev/null +++ b/entity/SerialLetter_entity/entityfields/downloadtemplate/onActionProcess.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.vars"); +import("DocumentTemplate_lib"); + +var template = DocumentTemplate.loadTemplate(vars.get("$field.DOCUMENTTEMPLATE_ID")); +if (template.type) + neon.download(template.content, template.filename); \ No newline at end of file diff --git a/entity/SerialLetter_entity/entityfields/downloadtemplate/stateProcess.js b/entity/SerialLetter_entity/entityfields/downloadtemplate/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5d14adc883f77e859201d92eeded2a5de21a8d97 --- /dev/null +++ b/entity/SerialLetter_entity/entityfields/downloadtemplate/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.DOCUMENTTEMPLATE_ID")) + result.string(neon.COMPONENTSTATE_EDITABLE); +else + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/SerialLetter_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js b/entity/SerialLetter_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..550976652bfc458dc34f9e87e39f4cda2c350fc8 --- /dev/null +++ b/entity/SerialLetter_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.SERIALLETTERID"), tableNames: ["SERIALLETTER"]}); + +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/SerialLetter_entity/entityfields/openadminview/onActionProcess.js b/entity/SerialLetter_entity/entityfields/openadminview/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3987f54cc36d46bc92fb70806d7481b80104cf6f --- /dev/null +++ b/entity/SerialLetter_entity/entityfields/openadminview/onActionProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("Context_lib"); + +AdminViewUtils.open("SERIALLETTERID", [ + ["DOCUMENTTEMPLATE_ID", vars.get("$field.DOCUMENTTEMPLATE_ID")] +]); \ No newline at end of file diff --git a/entity/SerialLetter_entity/entityfields/openadminview/stateProcess.js b/entity/SerialLetter_entity/entityfields/openadminview/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..38f2298db7304b4d44a15fbad7f720558c02da99 --- /dev/null +++ b/entity/SerialLetter_entity/entityfields/openadminview/stateProcess.js @@ -0,0 +1,4 @@ +import("Context_lib"); +import("system.result"); + +result.string(AdminViewUtils.getActionState()); \ No newline at end of file diff --git a/entity/SerialLetter_entity/entityfields/title/valueProcess.js b/entity/SerialLetter_entity/entityfields/title/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..94a33c3fc3288465e8959ea57f74eb9b983d1787 --- /dev/null +++ b/entity/SerialLetter_entity/entityfields/title/valueProcess.js @@ -0,0 +1,14 @@ +import("system.result"); +import("Document_lib"); +import("system.neon"); +import("system.vars"); + +if (vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var upload = vars.get("$field.bindata"); + if (upload) + { + var filename = DocumentUtil.getFilenameFromUpload(upload); + result.string(filename.split(".")[0]); + } +} \ No newline at end of file diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js b/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js new file mode 100644 index 0000000000000000000000000000000000000000..55085a49c3ce5eaca03b0a37dac814b5cf0e706c --- /dev/null +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js @@ -0,0 +1,12 @@ +import("system.vars"); +import("Sql_lib"); +import("system.db"); + +db.deleteData("LETTERRECIPIENT", SqlCondition.equals("LETTERRECIPIENT.SERIALLETTER_ID", vars.get("$local.uid"), "1=2")); +var SYSALIAS = SqlUtils.getSystemAlias(); +var binaryId = db.cell(SqlCondition.begin(SYSALIAS) + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$local.uid") + .buildSql("select ID from ASYS_BINARIES"), SYSALIAS); + +if (binaryId) + db.deleteBinary(binaryId, SYSALIAS); \ No newline at end of file diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js b/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..9b692c8c7d8c4c8588788f61f16a1e048c351481 --- /dev/null +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,19 @@ +import("Sql_lib"); +import("DocumentTemplate_lib"); +import("system.result"); +import("system.vars"); +import("system.db"); +import("Document_lib"); + +var bindata = vars.get("$field.bindata"); +var rowdata = vars.get("$local.rowdata"); +var letterId = rowdata["SERIALLETTER.SERIALLETTERID"]; +var templateId = rowdata["SERIALLETTER.DOCUMENTTEMPLATE_ID"]; + +var template = DocumentTemplate.fromUpload(bindata); + +if (template.content) +{ + db.insertBinary("SERIALLETTER", "DOCUMENT", letterId, + "", template.content, template.filename, "", "", SqlUtils.getSystemAlias()); +} \ No newline at end of file diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js b/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..8f8d362bc8c35d28fc77c9d00a5b192e016c411e --- /dev/null +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,29 @@ +import("system.neon"); +import("Sql_lib"); +import("DocumentTemplate_lib"); +import("system.result"); +import("system.vars"); +import("system.db"); +import("Document_lib"); + +var bindata = vars.get("$field.bindata"); +var rowdata = vars.get("$local.rowdata"); +var letterId = rowdata["SERIALLETTER.SERIALLETTERID"]; +var templateId = rowdata["SERIALLETTER.DOCUMENTTEMPLATE_ID"]; + +var template = DocumentTemplate.fromUpload(bindata); + +if (template.content) +{ + let sysAlias = SqlUtils.getSystemAlias(); + var binaryId = db.cell(SqlCondition.begin(sysAlias) + .andPrepareVars("ASYS_BINARIES.ROW_ID", "$local.uid") + .buildSql("select ID from ASYS_BINARIES", "1=2"), sysAlias); + + if (binaryId) + db.updateBinary(binaryId, "", template.content, template.filename, "", "", sysAlias); + else + db.insertBinary("SERIALLETTER", "DOCUMENT", letterId, + "", template.content, template.filename, "", "", sysAlias); + neon.refresh(["$field.content"]); +} diff --git a/entity/SupportTicket_entity/SupportTicket_entity.aod b/entity/SupportTicket_entity/SupportTicket_entity.aod index 8c7b8850b971e69894505ef730cf36fd781e39f9..55bb20dcf129a71f68038c8d61c240ebd87828f4 100644 --- a/entity/SupportTicket_entity/SupportTicket_entity.aod +++ b/entity/SupportTicket_entity/SupportTicket_entity.aod @@ -2,8 +2,12 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>SupportTicket_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> - <title>Supportticket</title> + <title>Support Ticket</title> + <contentTitleProcess>%aditoprj%/entity/SupportTicket_entity/contentTitleProcess.js</contentTitleProcess> + <afterUiInit>%aditoprj%/entity/SupportTicket_entity/afterUiInit.js</afterUiInit> + <onValidation>%aditoprj%/entity/SupportTicket_entity/onValidation.js</onValidation> <iconId>VAADIN:CHAT</iconId> + <titlePlural>Support Tickets</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -101,6 +105,7 @@ <entityParameter> <name>FilterOnlyOwnTicket_param</name> <valueProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/filteronlyownticket_param/valueProcess.js</valueProcess> + <expose v="true" /> </entityParameter> <entityConsumer> <name>Links</name> @@ -154,7 +159,7 @@ <dependency> <name>dependency</name> <entityName>Document_entity</entityName> - <fieldName>#PROVIDER</fieldName> + <fieldName>MainDocuments</fieldName> </dependency> <children> <entityParameter> @@ -277,6 +282,7 @@ <entityParameter> <name>TicketType_param</name> <valueProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/tickettype_param/valueProcess.js</valueProcess> + <expose v="true" /> </entityParameter> <entityConsumer> <name>KeywordTaskPriority</name> @@ -361,6 +367,18 @@ <onActionProcess>%aditoprj%/entity/SupportTicket_entity/entityfields/newsupportticket/onActionProcess.js</onActionProcess> <iconId>VAADIN:QUESTION</iconId> </entityActionField> + <entityParameter> + <name>PresetLinks_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>RowId_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -392,22 +410,27 @@ <dbRecordFieldMapping> <name>CODE.value</name> <recordfield>TICKET.CODE</recordfield> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_DESCRIPTION.value</name> <recordfield>TASK.DESCRIPTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_EDITOR_CONTACT_ID.value</name> <recordfield>TASK.EDITOR_CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_MATURITY_DATE.value</name> <recordfield>TASK.MATURITY_DATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_PRIORITY.value</name> <recordfield>TASK.PRIORITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_REQUESTOR_CONTACT_ID.value</name> @@ -416,14 +439,17 @@ <dbRecordFieldMapping> <name>TASK_START_DATE.value</name> <recordfield>TASK.START_DATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_STATUS.value</name> <recordfield>TASK.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_SUBJECT.value</name> <recordfield>TASK.SUBJECT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_EDITOR_CONTACT_ID.displayValue</name> @@ -440,6 +466,7 @@ <dbRecordFieldMapping> <name>TASK_PROGRESS.value</name> <recordfield>TASK.PROGRESS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_PROGRESS.displayValue</name> @@ -451,7 +478,8 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_TYPE.value</name> - <recordfield>TASK.TYPE</recordfield> + <recordfield>TASK.KIND</recordfield> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_ID.value</name> @@ -468,6 +496,7 @@ <dbRecordFieldMapping> <name>TICKETTYPE.value</name> <recordfield>TICKET.TICKETTYPE</recordfield> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASK_PARENT_ID.value</name> diff --git a/entity/SupportTicket_entity/afterUiInit.js b/entity/SupportTicket_entity/afterUiInit.js new file mode 100644 index 0000000000000000000000000000000000000000..65e0a8edc2c8f96cf8ba2714f0ecba08a6c98927 --- /dev/null +++ b/entity/SupportTicket_entity/afterUiInit.js @@ -0,0 +1,11 @@ +import("Context_lib"); +import("Attribute_lib"); +import("system.neon"); +import("system.vars"); +import("ActivityTask_lib"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + TaskUtils.addLinkRecords("$param.ObjectId_param", "$param.RowId_param", "$param.PresetLinks_param", "$field.TASK_PARENT_CONTEXT", "$field.TASK_PARENT_ID"); + AttributeRelationUtils.presetMandatoryAttributes(ContextUtils.getCurrentContextId(), "Attributes"); +} \ No newline at end of file diff --git a/entity/SupportTicket_entity/contentTitleProcess.js b/entity/SupportTicket_entity/contentTitleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d46871e0448b31bbfb5511705ca9f4ebcfffc3b6 --- /dev/null +++ b/entity/SupportTicket_entity/contentTitleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.TICKETTYPE.displayValue")) \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/attributes/onValidation.js b/entity/SupportTicket_entity/entityfields/attributes/onValidation.js index 508c2b5e9491f486c6c9ceb574b1b951dd5acc62..3b4aec6cadd157e128244b1f1105c9828d71056d 100644 --- a/entity/SupportTicket_entity/entityfields/attributes/onValidation.js +++ b/entity/SupportTicket_entity/entityfields/attributes/onValidation.js @@ -1,6 +1,6 @@ -import("Context_lib"); -import("system.vars"); -import("Attribute_lib"); -import("system.result"); - -result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$sys.uid"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file +import("Context_lib"); +import("system.vars"); +import("Attribute_lib"); +import("system.result"); + +result.string(AttributeRelationUtils.validateAttributeCount(vars.get("$field.TICKETID"), ContextUtils.getCurrentContextId(), "Attributes")); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/task_editor_contact_id/displayValueProcess.js b/entity/SupportTicket_entity/entityfields/task_editor_contact_id/displayValueProcess.js index 0dde82e7728286629b1c210326725aac2ebb92c5..40f8e064ba6a9d3248e9100abc4f52693effb034 100644 --- a/entity/SupportTicket_entity/entityfields/task_editor_contact_id/displayValueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_editor_contact_id/displayValueProcess.js @@ -2,7 +2,6 @@ import("system.result"); import("system.vars"); import("Contact_lib"); -var id = vars.get("$this.value"); //show the simpel title since this will be later an employee-entry and therefore no organisation is needed -var title = ContactUtils.getTitleByContactId(id); +var title = ContactUtils.getTitleByContactId(vars.get("$field.TASK_EDITOR_CONTACT_ID")); result.string(title); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/task_maturity_date/valueProcess.js b/entity/SupportTicket_entity/entityfields/task_maturity_date/valueProcess.js index f86620cd5deb97d5d66c61ef83d177d2da85f3ea..aefaa534ffadaee5803fd9278a26a25e2c8adff4 100644 --- a/entity/SupportTicket_entity/entityfields/task_maturity_date/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_maturity_date/valueProcess.js @@ -4,7 +4,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { var startDate = vars.get("$field.TASK_START_DATE"); var presetVal = eMath.addInt(startDate, datetime.ONE_WEEK); diff --git a/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/displayValueProcess.js b/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/displayValueProcess.js index 0dde82e7728286629b1c210326725aac2ebb92c5..35ee9d5af270f7b70e4827ca1717b9d96882cea6 100644 --- a/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/displayValueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/displayValueProcess.js @@ -2,7 +2,6 @@ import("system.result"); import("system.vars"); import("Contact_lib"); -var id = vars.get("$this.value"); -//show the simpel title since this will be later an employee-entry and therefore no organisation is needed -var title = ContactUtils.getTitleByContactId(id); +//show the simpel title since this is an employee-entry and therefore no organisation is needed +var title = ContactUtils.getTitleByContactId(vars.get("$field.TASK_REQUESTOR_CONTACT_ID")); result.string(title); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/valueProcess.js b/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/valueProcess.js index 1e62e7551ccb20b0b0d7aca34f64b6e448b5dda7..4711a17716cf559c48c73cd7ea780b2ffe5e2e03 100644 --- a/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_requestor_contact_id/valueProcess.js @@ -3,5 +3,5 @@ import("system.neon"); import("system.vars"); import("Employee_lib"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(EmployeeUtils.getCurrentContactId()); \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/task_start_date/valueProcess.js b/entity/SupportTicket_entity/entityfields/task_start_date/valueProcess.js index 5b098ba003d06ee9125c54f3f53559b2155ea8e3..6ac754253490d29b5f2653fdbdc335e381b475aa 100644 --- a/entity/SupportTicket_entity/entityfields/task_start_date/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_start_date/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { var presetVal = datetime.date(); //TODO: depending on what happens in #1032274 we need to manually set the resolution to MINUTES or not (which means we've to set everything smaller than MINUTES (Seconds, etc.) to zero) diff --git a/entity/SupportTicket_entity/entityfields/task_status/valueProcess.js b/entity/SupportTicket_entity/entityfields/task_status/valueProcess.js index caf782637394f5505b64eff69edd7685a80fabdc..b21b65e67884b19c3247e934aa7c8a00b3ca6b0f 100644 --- a/entity/SupportTicket_entity/entityfields/task_status/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_status/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(TicketUtils.begin(vars.get("$field.TICKETTYPE")).getDefaultStatus()); } \ No newline at end of file diff --git a/entity/SupportTicket_entity/entityfields/task_type/valueProcess.js b/entity/SupportTicket_entity/entityfields/task_type/valueProcess.js index 68c9898c516c39fd154e5c53f6e22ee2dd4e16e6..157831e6cbf022ac7d952e8367f39df6f89dd8c8 100644 --- a/entity/SupportTicket_entity/entityfields/task_type/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/task_type/valueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { // Sets the type to "Task" as default value. result.string($KeywordRegistry.taskType$ticket()); diff --git a/entity/SupportTicket_entity/entityfields/tickettype/valueProcess.js b/entity/SupportTicket_entity/entityfields/tickettype/valueProcess.js index c3e6ca34b7a1586f84141392adfffe8fb2b6dc38..d2dd15c5483608ffaceb4af7a6c7585431f24862 100644 --- a/entity/SupportTicket_entity/entityfields/tickettype/valueProcess.js +++ b/entity/SupportTicket_entity/entityfields/tickettype/valueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(vars.get("$param.TicketType_param")); } \ No newline at end of file diff --git a/entity/SupportTicket_entity/onValidation.js b/entity/SupportTicket_entity/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..d6ce533ea718a7917f32b17cb1152b2b2e240413 --- /dev/null +++ b/entity/SupportTicket_entity/onValidation.js @@ -0,0 +1,9 @@ +import("system.result"); +import("Date_lib"); +import("system.vars"); + +var startDate = vars.get("$field.TASK_START_DATE"); +var endDate = vars.get("$field.TASK_MATURITY_DATE"); + +if (!DateUtils.validateBeginnBeforeEnd(startDate, endDate)) + result.string(DateUtils.getValidationFailString()); \ No newline at end of file diff --git a/entity/SupportTicket_entity/recordcontainers/db/conditionProcess.js b/entity/SupportTicket_entity/recordcontainers/db/conditionProcess.js index ee924d8bf89b12b609a37e7428ca01f99d6566b4..fe0848af0b20c3fd92d98030779b011fbb42e11f 100644 --- a/entity/SupportTicket_entity/recordcontainers/db/conditionProcess.js +++ b/entity/SupportTicket_entity/recordcontainers/db/conditionProcess.js @@ -6,7 +6,7 @@ import("Sql_lib"); import("KeywordRegistry_basic"); var cond = new SqlCondition(); -cond.andPrepare("TASK.TYPE", $KeywordRegistry.taskType$ticket()) +cond.andPrepare("TASK.KIND", $KeywordRegistry.taskType$ticket()) .andPrepareVars("TICKET.TICKETTYPE", "$param.TicketType_param") var loadNothing = false; diff --git a/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js b/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js index 0a2c2a214c48b0e752b2c1bc122ae428e275fbc7..2d6454962cde27463f1b856741dbbc508adbe9ca 100644 --- a/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js +++ b/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js @@ -1,6 +1,6 @@ -import("Util_lib"); -import("system.vars"); -import("system.db"); -import("ActivityTask_lib") - -CodeUtils.setCode(vars.get("$field.TICKETID"), "TICKET", "TICKETID", "CODE"); \ No newline at end of file +import("Util_lib"); +import("system.vars"); +import("system.db"); +import("ActivityTask_lib") + +ConsecutiveCodeUtils.setCode(vars.get("$local.uid"), "TICKET", "TICKETID", "CODE"); \ No newline at end of file diff --git a/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/task_editor_contact_id.displayvalue/expression.js b/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/task_editor_contact_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..8e7ea35c7f489e257f771a9f67d1672d35817c4b --- /dev/null +++ b/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/task_editor_contact_id.displayvalue/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Person_lib"); + +var subSql = PersUtils.getResolvingDisplaySubSql("TASK.EDITOR_CONTACT_ID"); +result.string(subSql); \ No newline at end of file diff --git a/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/task_requestor_contact_id.displayvalue/expression.js b/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/task_requestor_contact_id.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..10b4b9967c878d5caeccc5ca25a4d897570bc185 --- /dev/null +++ b/entity/SupportTicket_entity/recordcontainers/db/recordfieldmappings/task_requestor_contact_id.displayvalue/expression.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Person_lib"); + +var subSql = PersUtils.getResolvingDisplaySubSql("TASK.REQUESTOR_CONTACT_ID"); +result.string(subSql); \ No newline at end of file diff --git a/entity/TaskLink_entity/TaskLink_entity.aod b/entity/TaskLink_entity/TaskLink_entity.aod index 74097453f8b79c6e8f0f1b90ebf11b0398b3017a..7eaef2f0d25a43c6306dc369095485d36221ada2 100644 --- a/entity/TaskLink_entity/TaskLink_entity.aod +++ b/entity/TaskLink_entity/TaskLink_entity.aod @@ -115,10 +115,6 @@ <name>TASKLINKID.value</name> <recordfield>TASKLINK.TASKLINKID</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.displayValue</name> - <expression>%aditoprj%/entity/TaskLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> - </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js b/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js index 9f4a7f9bd3974a260e541cb3c176cc77310d1a30..c87f4789fa9fd244ebff4881a6a8e59bffe58040 100644 --- a/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/TaskLink_entity/entityfields/object_rowid/displayValueProcess.js @@ -4,8 +4,7 @@ import("system.db"); import("system.result"); import("Context_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { - result.string(""); -}else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { +if(vars.get("$field.OBJECT_ROWID") && vars.get("$field.OBJECT_TYPE")) +{ result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); } \ No newline at end of file diff --git a/entity/TaskLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js b/entity/TaskLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js deleted file mode 100644 index 33554680cccd2c3d363443686457c41e0c1c5729..0000000000000000000000000000000000000000 --- a/entity/TaskLink_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.result"); -import("Context_lib"); - -result.string(ContextUtils.getNameSubselectSql("OBJECT_TYPE", "OBJECT_ROWID")) \ No newline at end of file diff --git a/entity/Task_entity/Task_entity.aod b/entity/Task_entity/Task_entity.aod index e0b135f0e02bbc6d66f0e7d534e99eec7ca6c512..701cceee3729ed3762d8666867f38c0de2365dcc 100644 --- a/entity/Task_entity/Task_entity.aod +++ b/entity/Task_entity/Task_entity.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/Task_entity/documentation.adoc</documentation> <title>Task</title> + <grantDeleteProcess>%aditoprj%/entity/Task_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Task_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Task_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Task_entity/onValidation.js</onValidation> @@ -53,6 +54,8 @@ <title>{$TASK_EDITOR}</title> <consumer>ContactEditors</consumer> <linkedContext>Person</linkedContext> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Task_entity/entityfields/editor_contact_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Task_entity/entityfields/editor_contact_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -447,38 +450,47 @@ <dbRecordFieldMapping> <name>DESCRIPTION.value</name> <recordfield>TASK.DESCRIPTION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>EDITOR_CONTACT_ID.value</name> <recordfield>TASK.EDITOR_CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MATURITY_DATE.value</name> <recordfield>TASK.MATURITY_DATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PRIORITY.value</name> <recordfield>TASK.PRIORITY</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PROTECTIONLEVEL.value</name> <recordfield>TASK.PROTECTIONLEVEL</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>REQUESTOR_CONTACT_ID.value</name> <recordfield>TASK.REQUESTOR_CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>START_DATE.value</name> <recordfield>TASK.START_DATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STATUS.value</name> <recordfield>TASK.STATUS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SUBJECT.value</name> <recordfield>TASK.SUBJECT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TASKID.value</name> @@ -495,6 +507,7 @@ <dbRecordFieldMapping> <name>PARENT_CONTEXT.value</name> <recordfield>TASK.PARENT_CONTEXT</recordfield> + <isFilterable v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PARENT_ID.value</name> @@ -507,6 +520,7 @@ <dbRecordFieldMapping> <name>PROGRESS.value</name> <recordfield>TASK.PROGRESS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PROGRESS.displayValue</name> @@ -518,7 +532,7 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TYPE.value</name> - <recordfield>TASK.TYPE</recordfield> + <recordfield>TASK.KIND</recordfield> </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> diff --git a/entity/Task_entity/entityfields/editor_contact_id/displayValueProcess.js b/entity/Task_entity/entityfields/editor_contact_id/displayValueProcess.js index 0dde82e7728286629b1c210326725aac2ebb92c5..ad1d3c7d63b681688b3deaafd83db7a89b24dc03 100644 --- a/entity/Task_entity/entityfields/editor_contact_id/displayValueProcess.js +++ b/entity/Task_entity/entityfields/editor_contact_id/displayValueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.vars"); import("Contact_lib"); -var id = vars.get("$this.value"); +var id = vars.get("$field.EDITOR_CONTACT_ID"); //show the simpel title since this will be later an employee-entry and therefore no organisation is needed var title = ContactUtils.getTitleByContactId(id); result.string(title); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/editor_contact_id/valueProcess.js b/entity/Task_entity/entityfields/editor_contact_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4cc8f2bb8a1e0399e937fc1ad3db093f4c0c590c --- /dev/null +++ b/entity/Task_entity/entityfields/editor_contact_id/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Employee_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string(EmployeeUtils.getCurrentContactId()); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/maturity_date/valueProcess.js b/entity/Task_entity/entityfields/maturity_date/valueProcess.js index d205c6478586ec9f272f1abe52d5fdd3414d7634..a318ed2990a73b3a88aff036446a1ab01f0c1fdd 100644 --- a/entity/Task_entity/entityfields/maturity_date/valueProcess.js +++ b/entity/Task_entity/entityfields/maturity_date/valueProcess.js @@ -1,12 +1,12 @@ -import("system.eMath"); -import("system.datetime"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) -{ - var startDate = vars.get("$field.START_DATE"); - var presetVal = eMath.addInt(startDate, datetime.ONE_WEEK); - result.string(presetVal); +import("system.eMath"); +import("system.datetime"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var startDate = vars.get("$field.START_DATE"); + var presetVal = eMath.addInt(startDate, datetime.ONE_WEEK); + result.string(presetVal); } \ No newline at end of file diff --git a/entity/Task_entity/entityfields/requestor_contact_id/displayValueProcess.js b/entity/Task_entity/entityfields/requestor_contact_id/displayValueProcess.js index 0dde82e7728286629b1c210326725aac2ebb92c5..a54eaa531bb911d666ce220e8ecf41da9f740c9e 100644 --- a/entity/Task_entity/entityfields/requestor_contact_id/displayValueProcess.js +++ b/entity/Task_entity/entityfields/requestor_contact_id/displayValueProcess.js @@ -2,7 +2,7 @@ import("system.result"); import("system.vars"); import("Contact_lib"); -var id = vars.get("$this.value"); +var id = vars.get("$field.REQUESTOR_CONTACT_ID"); //show the simpel title since this will be later an employee-entry and therefore no organisation is needed var title = ContactUtils.getTitleByContactId(id); result.string(title); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/requestor_contact_id/valueProcess.js b/entity/Task_entity/entityfields/requestor_contact_id/valueProcess.js index 1e62e7551ccb20b0b0d7aca34f64b6e448b5dda7..4cc8f2bb8a1e0399e937fc1ad3db093f4c0c590c 100644 --- a/entity/Task_entity/entityfields/requestor_contact_id/valueProcess.js +++ b/entity/Task_entity/entityfields/requestor_contact_id/valueProcess.js @@ -1,7 +1,7 @@ -import("system.result"); -import("system.neon"); -import("system.vars"); -import("Employee_lib"); - -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +import("system.result"); +import("system.neon"); +import("system.vars"); +import("Employee_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(EmployeeUtils.getCurrentContactId()); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/start_date/valueProcess.js b/entity/Task_entity/entityfields/start_date/valueProcess.js index 331eb9c3b542df4d726b2e1c2bb1c5718f93fa1b..6ac754253490d29b5f2653fdbdc335e381b475aa 100644 --- a/entity/Task_entity/entityfields/start_date/valueProcess.js +++ b/entity/Task_entity/entityfields/start_date/valueProcess.js @@ -1,12 +1,12 @@ -import("system.datetime"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) -{ - var presetVal = datetime.date(); - //TODO: depending on what happens in #1032274 we need to manually set the resolution to MINUTES or not (which means we've to set everything smaller than MINUTES (Seconds, etc.) to zero) - presetVal = Math.floor(presetVal / datetime.ONE_MINUTE) * datetime.ONE_MINUTE; - result.string(presetVal); +import("system.datetime"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var presetVal = datetime.date(); + //TODO: depending on what happens in #1032274 we need to manually set the resolution to MINUTES or not (which means we've to set everything smaller than MINUTES (Seconds, etc.) to zero) + presetVal = Math.floor(presetVal / datetime.ONE_MINUTE) * datetime.ONE_MINUTE; + result.string(presetVal); } \ No newline at end of file diff --git a/entity/Task_entity/entityfields/status/valueProcess.js b/entity/Task_entity/entityfields/status/valueProcess.js index db358521bc070d2a6bf07582bdf12573673a1ec4..3d13b59e80dd18b9ad676efea25ce97b1f973bb5 100644 --- a/entity/Task_entity/entityfields/status/valueProcess.js +++ b/entity/Task_entity/entityfields/status/valueProcess.js @@ -3,7 +3,7 @@ import("system.result"); import("system.neon"); import("system.vars"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string($KeywordRegistry.taskStatus$new()); } \ No newline at end of file diff --git a/entity/Task_entity/entityfields/type/valueProcess.js b/entity/Task_entity/entityfields/type/valueProcess.js index 04149ad63a18b650dc2e75a1792c870d88a55f43..b16e2dd8468175445cdd6a9f9d0437c87c73560e 100644 --- a/entity/Task_entity/entityfields/type/valueProcess.js +++ b/entity/Task_entity/entityfields/type/valueProcess.js @@ -3,7 +3,7 @@ import("system.vars"); import("system.neon"); import("KeywordRegistry_basic"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { // Sets the type to "Task" as default value. result.string($KeywordRegistry.taskType$task()); diff --git a/entity/Task_entity/grantDeleteProcess.js b/entity/Task_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..33915f18594e33e4aa413f9e737dd36158c312f3 --- /dev/null +++ b/entity/Task_entity/grantDeleteProcess.js @@ -0,0 +1,5 @@ +import("Document_lib"); +import("system.vars"); +import("system.result"); + +result.string(!DocumentUtil.hasDocuments("TASK", null, vars.get("$field.TASKID"))); \ No newline at end of file diff --git a/entity/Task_entity/recordcontainers/db/conditionProcess.js b/entity/Task_entity/recordcontainers/db/conditionProcess.js index 8169552d13ec3c4b1acf8a3c0864e289c1ac6ae5..7b2cb50176cb704458f0ab6d943e63e67b6c71da 100644 --- a/entity/Task_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Task_entity/recordcontainers/db/conditionProcess.js @@ -6,7 +6,7 @@ import("Sql_lib"); import("KeywordRegistry_basic"); var cond = new SqlCondition(); -cond.andPrepare("TASK.TYPE", $KeywordRegistry.taskType$task()) +cond.andPrepare("TASK.KIND", $KeywordRegistry.taskType$task()) var loadNothing = false; diff --git a/entity/Task_entity/recordcontainers/db/recordfieldmappings/editor_contact_id.displayvalue/expression.js b/entity/Task_entity/recordcontainers/db/recordfieldmappings/editor_contact_id.displayvalue/expression.js index e5961584dd2e3bd5741ac96032105a8cc43ec58b..8e7ea35c7f489e257f771a9f67d1672d35817c4b 100644 --- a/entity/Task_entity/recordcontainers/db/recordfieldmappings/editor_contact_id.displayvalue/expression.js +++ b/entity/Task_entity/recordcontainers/db/recordfieldmappings/editor_contact_id.displayvalue/expression.js @@ -1,6 +1,5 @@ import("system.result"); import("Person_lib"); -//TODO: try to find a better solution for this -> #TITLE-mechanic when available var subSql = PersUtils.getResolvingDisplaySubSql("TASK.EDITOR_CONTACT_ID"); result.string(subSql); \ No newline at end of file diff --git a/entity/Timetracking_entity/Timetracking_entity.aod b/entity/Timetracking_entity/Timetracking_entity.aod index e1ca6fe8ff154d4b1441237d8cc547fb555b37af..f2aee77b56396053d2d2eed051f4b9464ee3fe89 100644 --- a/entity/Timetracking_entity/Timetracking_entity.aod +++ b/entity/Timetracking_entity/Timetracking_entity.aod @@ -3,6 +3,7 @@ <name>Timetracking_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Timetracking</title> + <titlePlural>Timetracking entries</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -19,13 +20,13 @@ </onValueChangeTypes> </entityField> <entityField> - <name>MINUTES</name> + <name>TRACKINGMINUTES</name> <title>Time</title> <contentType>TEXT</contentType> <mandatory v="true" /> - <titleProcess>%aditoprj%/entity/Timetracking_entity/entityfields/minutes/titleProcess.js</titleProcess> - <displayValueProcess>%aditoprj%/entity/Timetracking_entity/entityfields/minutes/displayValueProcess.js</displayValueProcess> - <onValidation>%aditoprj%/entity/Timetracking_entity/entityfields/minutes/onValidation.js</onValidation> + <titleProcess>%aditoprj%/entity/Timetracking_entity/entityfields/trackingminutes/titleProcess.js</titleProcess> + <displayValueProcess>%aditoprj%/entity/Timetracking_entity/entityfields/trackingminutes/displayValueProcess.js</displayValueProcess> + <onValidation>%aditoprj%/entity/Timetracking_entity/entityfields/trackingminutes/onValidation.js</onValidation> </entityField> <entityField> <name>OBJECT_ID</name> @@ -52,14 +53,14 @@ <name>TIMETRACKINGID</name> </entityField> <entityField> - <name>DATE</name> + <name>TRACKINGDATE</name> <title>Date</title> <contentType>DATE</contentType> <resolution>DAY</resolution> <outputFormat>dd.MM.yyyy</outputFormat> <inputFormat>dd.MM.yyyy</inputFormat> <mandatory v="true" /> - <valueProcess>%aditoprj%/entity/Timetracking_entity/entityfields/date/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/Timetracking_entity/entityfields/trackingdate/valueProcess.js</valueProcess> </entityField> <entityParameter> <name>ObjectId_param</name> @@ -141,18 +142,10 @@ </linkInformation> </linkInformation> <recordFieldMappings> - <dbRecordFieldMapping> - <name>DATE.value</name> - <recordfield>TIMETRACKING.DATE</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> <recordfield>TIMETRACKING.INFO</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>MINUTES.value</name> - <recordfield>TIMETRACKING.MINUTES</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_ID.value</name> <recordfield>TIMETRACKING.OBJECT_ID</recordfield> @@ -173,6 +166,14 @@ <name>CONTACT_ID.displayValue</name> <expression>%aditoprj%/entity/Timetracking_entity/recordcontainers/db/recordfieldmappings/contact_id.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TRACKINGDATE.value</name> + <recordfield>TIMETRACKING.TRACKINGDATE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TRACKINGMINUTES.value</name> + <recordfield>TIMETRACKING.TRACKINGMINUTES</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Timetracking_entity/entityfields/totaltime/valueProcess.js b/entity/Timetracking_entity/entityfields/totaltime/valueProcess.js index a290a185f34580375697ab2d4796d54ff12a2a7c..0f403dcc2e977f172268995abf19ed2fdf770d2d 100644 --- a/entity/Timetracking_entity/entityfields/totaltime/valueProcess.js +++ b/entity/Timetracking_entity/entityfields/totaltime/valueProcess.js @@ -2,6 +2,6 @@ import("system.db"); import("system.vars"); import("system.result"); -var minutes = db.cell("select sum(MINUTES) from TIMETRACKING"); +var minutes = db.cell("select sum(TRACKINGMINUTES) from TIMETRACKING"); result.string(minutes); \ No newline at end of file diff --git a/entity/Timetracking_entity/entityfields/date/valueProcess.js b/entity/Timetracking_entity/entityfields/trackingdate/valueProcess.js similarity index 56% rename from entity/Timetracking_entity/entityfields/date/valueProcess.js rename to entity/Timetracking_entity/entityfields/trackingdate/valueProcess.js index 126ef5d056360ae2b27ee6712dc76ce696250aba..1bf123d91e52048f5e9077c2bd51591b156c92f3 100644 --- a/entity/Timetracking_entity/entityfields/date/valueProcess.js +++ b/entity/Timetracking_entity/entityfields/trackingdate/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(vars.getString("$sys.date")); } diff --git a/entity/Timetracking_entity/entityfields/minutes/displayValueProcess.js b/entity/Timetracking_entity/entityfields/trackingminutes/displayValueProcess.js similarity index 77% rename from entity/Timetracking_entity/entityfields/minutes/displayValueProcess.js rename to entity/Timetracking_entity/entityfields/trackingminutes/displayValueProcess.js index 326c2a9f306a8a9356e4f895c630ace18a27a91f..456d93137abf6958ee66e025efd3e8986b20ec36 100644 --- a/entity/Timetracking_entity/entityfields/minutes/displayValueProcess.js +++ b/entity/Timetracking_entity/entityfields/trackingminutes/displayValueProcess.js @@ -1,5 +1,5 @@ -import("system.vars"); -import("system.result"); -import("Timetracking_lib"); - -result.string(Timetracking.minutesToReadableHour(parseInt(vars.getString("$field.MINUTES")))); \ No newline at end of file +import("system.vars"); +import("system.result"); +import("Timetracking_lib"); + +result.string(Timetracking.minutesToReadableHour(parseInt(vars.getString("$field.TRACKINGMINUTES")))); \ No newline at end of file diff --git a/entity/Timetracking_entity/entityfields/minutes/onValidation.js b/entity/Timetracking_entity/entityfields/trackingminutes/onValidation.js similarity index 80% rename from entity/Timetracking_entity/entityfields/minutes/onValidation.js rename to entity/Timetracking_entity/entityfields/trackingminutes/onValidation.js index 8080e185f4cc8a1f4b3a3dc07081b6b04cf036eb..2c109d356e606c0e2306e09a2fef39a4d3a4b3fe 100644 --- a/entity/Timetracking_entity/entityfields/minutes/onValidation.js +++ b/entity/Timetracking_entity/entityfields/trackingminutes/onValidation.js @@ -7,7 +7,7 @@ import("Entity_lib"); // TODO: displayValue + contentType number crashes so we use TEXT and validate ourselve // 1035861 -var minutes = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.MINUTES")); +var minutes = vars.get("local.value"); var message = ""; if (!/^\d+$/.test(minutes)) message = translate.text("Only numbers are allowed."); diff --git a/entity/Timetracking_entity/entityfields/minutes/titleProcess.js b/entity/Timetracking_entity/entityfields/trackingminutes/titleProcess.js similarity index 100% rename from entity/Timetracking_entity/entityfields/minutes/titleProcess.js rename to entity/Timetracking_entity/entityfields/trackingminutes/titleProcess.js diff --git a/entity/Timetracking_entity/entityfields/year/valueProcess.js b/entity/Timetracking_entity/entityfields/year/valueProcess.js index 748a5cd78eae9a53d2f1ca0f4cdc11afa86c21c5..4b0dedd651d70008b39f34dbd46fd490e42a4f57 100644 --- a/entity/Timetracking_entity/entityfields/year/valueProcess.js +++ b/entity/Timetracking_entity/entityfields/year/valueProcess.js @@ -2,6 +2,6 @@ import("system.vars"); import("system.result"); import("system.neon"); -var year = vars.get("$field.DATE") +var year = vars.get("$field.TRACKINGDATE") result.string(year); \ No newline at end of file diff --git a/entity/Turnover_entity/Turnover_entity.aod b/entity/Turnover_entity/Turnover_entity.aod index a259527daf72a8c24f6691283644612026fd9bb0..5917a75329edd0c5b6b362855b5ecc01f57b20de 100644 --- a/entity/Turnover_entity/Turnover_entity.aod +++ b/entity/Turnover_entity/Turnover_entity.aod @@ -96,10 +96,6 @@ <name>ShowTurnover_param</name> <valueProcess>%aditoprj%/entity/Turnover_entity/entityfields/turnover_tree/children/showturnover_param/valueProcess.js</valueProcess> </entityParameter> - <entityParameter> - <name>SalesprojectId_param</name> - <valueProcess>%aditoprj%/entity/Turnover_entity/entityfields/turnover_tree/children/salesprojectid_param/valueProcess.js</valueProcess> - </entityParameter> </children> </entityConsumer> <entityParameter> diff --git a/entity/Turnover_entity/entityfields/turnover_tree/children/showforecast_param/valueProcess.js b/entity/Turnover_entity/entityfields/turnover_tree/children/showforecast_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..db6beff10fc0ac010b4af623b9a5a94624303cf8 --- /dev/null +++ b/entity/Turnover_entity/entityfields/turnover_tree/children/showforecast_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ShowForecast_param")); \ No newline at end of file diff --git a/entity/Turnover_entity/entityfields/turnover_tree/children/showturnover_param/valueProcess.js b/entity/Turnover_entity/entityfields/turnover_tree/children/showturnover_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..26cf4fde8e48ba35e753ac618da123f474125603 --- /dev/null +++ b/entity/Turnover_entity/entityfields/turnover_tree/children/showturnover_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ShowTurnover_param")); \ No newline at end of file diff --git a/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js b/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js index 38e6320ad771e3f38ab0dcdafc282be9f25dc25d..b2db244c25ca2825fed534f0e654f38842b3c929 100644 --- a/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js +++ b/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js @@ -27,7 +27,9 @@ for (var i = 0, l = files.length; i < l; i++) var mailObj = _getMailObj(files[i]); if (mailObj) { - var mailImportResult = IncomingEmailExecutor.mailToActivity(mailObj, null, dbAlias); + var incomingMailExec = new IncomingEmailExecutor(mailObj); + incomingMailExec.setAlias(dbAlias); + var mailImportResult = incomingMailExec.autoProcess() if (mailImportResult.activityId) status.activitiesCreated++; else if (mailImportResult.unlinkedMailId) diff --git a/entity/UnlinkedMailMappingLink_entity/UnlinkedMailMappingLink_entity.aod b/entity/UnlinkedMailMappingLink_entity/UnlinkedMailMappingLink_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..e749b7a469ea1c59b1eb16dd07699dcbd560acaf --- /dev/null +++ b/entity/UnlinkedMailMappingLink_entity/UnlinkedMailMappingLink_entity.aod @@ -0,0 +1,72 @@ +<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> + <name>UnlinkedMailMappingLink_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <title>${UNLINKEDMAILMAPPING_ADDITIONAL_LINK}</title> + <titlePlural>${UNLINKEDMAILMAPPING_ADDITIONAL_LINKS}</titlePlural> + <recordContainer>jdito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + <dependencies> + <entityDependency> + <name>9958543a-9e47-4f7f-8f06-8f18757f8586</name> + <entityName>UnlinkedMailMappingWrapper_entity</entityName> + <fieldName>UnlinkedMailMappingLinks</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityParameter> + <name>MailAsText_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>UID</name> + <valueProcess>%aditoprj%/entity/UnlinkedMailMappingLink_entity/entityfields/uid/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>CONTACT_ID</name> + <title>Contact</title> + <consumer>AnyContacts</consumer> + <displayValueProcess>%aditoprj%/entity/UnlinkedMailMappingLink_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>EMAILADDR</name> + <title>(optional) E-Mail to store in contact</title> + <dropDownProcess>%aditoprj%/entity/UnlinkedMailMappingLink_entity/entityfields/emailaddr/dropDownProcess.js</dropDownProcess> + </entityField> + <entityConsumer> + <name>AnyContacts</name> + <dependency> + <name>dependency</name> + <entityName>AnyContact_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + </entityConsumer> + <entityField> + <name>CONTEXT_NAME</name> + <state>INVISIBLE</state> + <valueProcess>%aditoprj%/entity/UnlinkedMailMappingLink_entity/entityfields/context_name/valueProcess.js</valueProcess> + </entityField> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jdito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <onInsert>%aditoprj%/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/onInsert.js</onInsert> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CONTACT_ID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>EMAILADDR.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/UnlinkedMailMappingLink_entity/entityfields/contact_id/displayValueProcess.js b/entity/UnlinkedMailMappingLink_entity/entityfields/contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c5d37f96068813c901f7944cceb30262eb31d7bb --- /dev/null +++ b/entity/UnlinkedMailMappingLink_entity/entityfields/contact_id/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); +import("system.neon"); + +result.string(ContactUtils.getFullTitleByContactId(vars.getString("$this.value"))); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingLink_entity/entityfields/context_name/valueProcess.js b/entity/UnlinkedMailMappingLink_entity/entityfields/context_name/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0a7fbd404908c94e73b6736881dcc7bab8ebbbf6 --- /dev/null +++ b/entity/UnlinkedMailMappingLink_entity/entityfields/context_name/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var res = ""; +var contactId = vars.get("$field.CONTACT_ID"); +if (contactId) + res = ContactUtils.getContextByContactId(contactId); + +result.string(res); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingLink_entity/entityfields/emailaddr/dropDownProcess.js b/entity/UnlinkedMailMappingLink_entity/entityfields/emailaddr/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2feaa275931a1341d40ee0b4870ba6cf2be8fb07 --- /dev/null +++ b/entity/UnlinkedMailMappingLink_entity/entityfields/emailaddr/dropDownProcess.js @@ -0,0 +1,36 @@ +import("EmailUtil_lib"); +import("IncomingEmailExecutor_lib"); +import("system.mail"); +import("system.util"); +import("system.db"); +import("system.vars"); +import("system.result"); + +var mailObject = null; +var res = []; + +var mailB64 = vars.get("$param.MailAsText_param"); +if (mailB64) +{ + mailObject = mail.parseRFC(mailB64); +} + +if (mailObject) +{ + var sender = mailObject[mail.MAIL_SENDER]; + var recipientsTo = mailObject[mail.RECIPIENT_TO].split(";"); + var recipientsCc = mailObject[mail.RECIPIENT_CC].split(";"); + var recipientsBcc = mailObject[mail.RECIPIENT_BCC].split(";"); + + var mapperFn = function (addr) { + if (addr) + res.push([EmailUtils.extractAddress(addr), addr]); + }; + + res.push([EmailUtils.extractAddress(sender), sender]); + recipientsTo.forEach(mapperFn); + recipientsCc.forEach(mapperFn); + recipientsBcc.forEach(mapperFn); +} + +result.object(res); \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/campaigncostid/valueProcess.js b/entity/UnlinkedMailMappingLink_entity/entityfields/uid/valueProcess.js similarity index 58% rename from entity/CampaignCost_entitiy/entityfields/campaigncostid/valueProcess.js rename to entity/UnlinkedMailMappingLink_entity/entityfields/uid/valueProcess.js index 622e00f05f77bd63405f4487831518087cc38d27..9fcbf8892c84afa4d8fc30dbd7b6fd0f2ce026cd 100644 --- a/entity/CampaignCost_entitiy/entityfields/campaigncostid/valueProcess.js +++ b/entity/UnlinkedMailMappingLink_entity/entityfields/uid/valueProcess.js @@ -1,7 +1,7 @@ -import("system.neon"); -import("system.util"); -import("system.vars"); -import("system.result"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +import("system.vars"); +import("system.result"); +import("system.neon"); +import("system.util"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(util.getNewUUID()); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/contentProcess.js b/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cfd1bf845e20edbe7cc993e39fec6fa9837b72c0 --- /dev/null +++ b/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,11 @@ +import("IncomingEmailExecutor_lib"); +import("system.mail"); +import("system.util"); +import("system.db"); +import("system.vars"); +import("system.result"); + +var mailObject = null; +var res = []; + +result.object(res); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/onInsert.js b/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..d162d2aeccc9d9c33903a3940185471e91d01b19 --- /dev/null +++ b/entity/UnlinkedMailMappingLink_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,2 @@ +/*nothing happens here, everything is done within the UnlinkedMailMappingWrapper + --do not remove this comment otherwhile the kernel will detect that this process is empty and throws an error--*/ \ No newline at end of file diff --git a/entity/UnlinkedMailMappingWrapper_entity/UnlinkedMailMappingWrapper_entity.aod b/entity/UnlinkedMailMappingWrapper_entity/UnlinkedMailMappingWrapper_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..d2162015a96e47ffa3f5f2f12430233ee1a4d881 --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/UnlinkedMailMappingWrapper_entity.aod @@ -0,0 +1,76 @@ +<?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.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> + <name>UnlinkedMailMappingWrapper_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Link unlinked e-mail</title> + <recordContainer>dummyJdito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityProvider> + <name>ForUnlinkedMail</name> + <children> + <entityParameter> + <name>UnlinkedMailId_param</name> + <expose v="true" /> + </entityParameter> + </children> + </entityProvider> + <entityParameter> + <name>UnlinkedMailId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>MailAsText_param</name> + <valueProcess>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/entityfields/mailastext_param/valueProcess.js</valueProcess> + </entityParameter> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>RESPONSIBLE_ID</name> + <title>Responsible</title> + <consumer>Employees</consumer> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>Employees</name> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>Employees</fieldName> + </dependency> + </entityConsumer> + <entityConsumer> + <name>UnlinkedMailMappingLinks</name> + <dependency> + <name>dependency</name> + <entityName>UnlinkedMailMappingLink_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + <children> + <entityParameter> + <name>MailAsText_param</name> + <valueProcess>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/entityfields/unlinkedmailmappinglinks/children/mailastext_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>dummyJdito</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/contentProcess.js</contentProcess> + <rowCountProcess>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/rowCountProcess.js</rowCountProcess> + <onUpdate>%aditoprj%/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/onUpdate.js</onUpdate> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/UnlinkedMailMappingWrapper_entity/entityfields/mailastext_param/valueProcess.js b/entity/UnlinkedMailMappingWrapper_entity/entityfields/mailastext_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..036eb71d8f5787718937584df763395322889b3c --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/entityfields/mailastext_param/valueProcess.js @@ -0,0 +1,15 @@ +import("system.result"); +import("system.db"); +import("system.vars"); +import("Sql_lib"); + +var res = ""; +var unlinkedMailId = vars.get("$param.UnlinkedMailId_param"); +if (unlinkedMailId) +{ + var mailDataSql = SqlCondition.begin() + .andPrepare("AB_UNLINKEDMAIL.AB_UNLINKEDMAILID", unlinkedMailId) + .buildSql("select AB_UNLINKEDMAIL.MAIL from AB_UNLINKEDMAIL"); + res = db.cell(mailDataSql); +} +result.string(res); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/displayValueProcess.js b/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..20d91b76f0fa90bd11c7b40976112c0f62aebce2 --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/displayValueProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var id = vars.get("$field.RESPONSIBLE_ID"); +//show the simpel title since this will be later an employee-entry and therefore no organisation is needed +var title = ContactUtils.getTitleByContactId(id); +result.string(title); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/valueProcess.js b/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..607eea3984823d552830b30448a952a7fc192958 --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/entityfields/responsible_id/valueProcess.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); +import("Employee_lib"); + +if (vars.get("$this.value") == null && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)) +{ + result.string(EmployeeUtils.getCurrentContactId()); +} \ No newline at end of file diff --git a/entity/UnlinkedMailMappingWrapper_entity/entityfields/unlinkedmailmappinglinks/children/mailastext_param/valueProcess.js b/entity/UnlinkedMailMappingWrapper_entity/entityfields/unlinkedmailmappinglinks/children/mailastext_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c36f8417f07a2bb7a9ff602a81d856ba0a6a464a --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/entityfields/unlinkedmailmappinglinks/children/mailastext_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$param.MailAsText_param")); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/contentProcess.js b/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/contentProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9a4d854baa7ad851819c3d3d1c99bfb59d72e551 --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/contentProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.object([["1"]]); \ No newline at end of file diff --git a/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/onUpdate.js b/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/onUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..1c866cce85e6ee96fb86a86ef55ea0b0503ba232 --- /dev/null +++ b/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/onUpdate.js @@ -0,0 +1,69 @@ +import("system.datetime"); +import("KeywordRegistry_basic"); +import("system.util"); +import("system.db"); +import("Contact_lib"); +import("system.neon"); +import("Employee_lib"); +import("IncomingEmailExecutor_lib"); +import("system.mail"); +import("system.vars"); +import("system.entities"); + +var activityLinks = []; +var changedRows = vars.get("$field.UnlinkedMailMappingLinks.insertedRows"); + +var communicationsToInsert = []; +var communicationCols = ["COMMUNICATIONID", "ADDR", "CONTACT_ID", "ISSTANDARD", "MEDIUM_ID", "USER_NEW", "DATE_NEW"]; +var communicationTypes = db.getColumnTypes("COMMUNICATION", communicationCols); + +if (changedRows.length > 0) +{ + //collect relevant uids + var contactIds = []; + var newCommNecessaryIdMap = {}; + changedRows.forEach(function (changedRow){ + var contactId = changedRow["CONTACT_ID"]; + if (changedRow["CONTACT_ID"]) + contactIds.push(contactId); + if (changedRow["EMAILADDR"]) + newCommNecessaryIdMap[contactId] = changedRow["EMAILADDR"]; + }); + //load relevant data + var loadingConfig = entities.createConfigForLoadingRows().entity("AnyContact_entity") + .uids(contactIds) + .fields(["CONTACTID", "ORGANISATION_ID", "PERSON_ID", "STANDARD_EMAIL_COMMUNICATION"]); + var contactRows = entities.getRows(loadingConfig); + //decide what to do with the data + + for (var i = 0, l = contactRows.length; i < l; i++) + { + //first create a link + var contactId = contactRows[i]["CONTACTID"]; + var contextName = ContactUtils.getContextByPersOrg(contactRows[i]["PERSON_ID"], contactRows[i]["ORGANISATION_ID"]); + activityLinks.push([contextName, contactId]); + + //then prepare insert statements for new comms + var emailAddrToAdd = newCommNecessaryIdMap[contactId]; + if (emailAddrToAdd) + { + var standardFlag = contactRows[i]["STANDARD_EMAIL_COMMUNICATION"] ? "0" : "1";//when no standard mail exists already: set it + var vals = [util.getNewUUID(), emailAddrToAdd, contactId, standardFlag, $KeywordRegistry.communicationMedium$mail(), vars.get("$sys.user"), datetime.date()]; + communicationsToInsert.push(["COMMUNICATION", communicationCols, communicationTypes, vals]); + //TODO: insert the COMM via a entities.***-method when available + } + } +} + +var mailObj = mail.parseRFC(vars.get("$param.MailAsText_param")); +var unlinkedMailId = vars.get("$param.UnlinkedMailId_param"); + +var incomingMailExec = new IncomingEmailExecutor(mailObj); +incomingMailExec.setActivityEmployeeContactId(EmployeeUtils.getCurrentContactId()); +var activityRes = incomingMailExec.createActivity(activityLinks); +incomingMailExec.deleteUnlinkedMail(unlinkedMailId); + +if (communicationsToInsert.length > 0) + db.inserts(communicationsToInsert); + +neon.refreshAll();//this is needed for the dashboard: other elements are refreshed and display for example unlinkedMails \ No newline at end of file diff --git a/entity/CampaignCost_entitiy/entityfields/stepcosts/children/campaignsteps_param/valueProcess.js b/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/rowCountProcess.js similarity index 93% rename from entity/CampaignCost_entitiy/entityfields/stepcosts/children/campaignsteps_param/valueProcess.js rename to entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/rowCountProcess.js index 4336563e79c0a64b263cca325ed6285fbbededa7..b92babf55f612058ae7ca82d2aed85746492cfe6 100644 --- a/entity/CampaignCost_entitiy/entityfields/stepcosts/children/campaignsteps_param/valueProcess.js +++ b/entity/UnlinkedMailMappingWrapper_entity/recordcontainers/dummyjdito/rowCountProcess.js @@ -1,3 +1,2 @@ -import("system.result"); - +import("system.result"); result.string(1); \ No newline at end of file diff --git a/entity/UnlinkedMail_entity/UnlinkedMail_entity.aod b/entity/UnlinkedMail_entity/UnlinkedMail_entity.aod index c7dcbb4cdafb6c2b0c8155bb3fd2166e69810c65..b302dcc9e402e4a3aee51f032a65db4ae2ecc5dd 100644 --- a/entity/UnlinkedMail_entity/UnlinkedMail_entity.aod +++ b/entity/UnlinkedMail_entity/UnlinkedMail_entity.aod @@ -2,10 +2,12 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11"> <name>UnlinkedMail_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Unlinked e-mail</title> <grantCreate v="false" /> <grantUpdate v="false" /> <iconId>VAADIN:AT</iconId> <imageProcess>%aditoprj%/entity/UnlinkedMail_entity/imageProcess.js</imageProcess> + <titlePlural>Unlinked e-mails</titlePlural> <recordContainer>db</recordContainer> <entityFields> <entityProvider> @@ -34,18 +36,11 @@ </entityField> <entityField> <name>MAIL</name> + <contentType>FILE</contentType> </entityField> <entityActionGroup> <name>ToActivity_ActionGroup</name> <children> - <entityActionField> - <name>ToActivity_action</name> - <title>Link automatically</title> - <onActionProcess>%aditoprj%/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/onActionProcess.js</onActionProcess> - <isSelectionAction v="true" /> - <iconIdProcess>%aditoprj%/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/iconIdProcess.js</iconIdProcess> - <tooltip>Try to link the e-mail automatically</tooltip> - </entityActionField> <entityActionField> <name>DownloadMail_action</name> <title>Download Mail</title> @@ -54,6 +49,14 @@ <iconId>VAADIN:DOWNLOAD_ALT</iconId> <tooltip>Download e-mail</tooltip> </entityActionField> + <entityActionField> + <name>ToActivity_action</name> + <title>Create activity</title> + <onActionProcess>%aditoprj%/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/onActionProcess.js</onActionProcess> + <isSelectionAction v="true" /> + <iconIdProcess>%aditoprj%/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/iconIdProcess.js</iconIdProcess> + <tooltip>Try to create activity automatically and ask for more information if necessary</tooltip> + </entityActionField> </children> </entityActionGroup> </entityFields> diff --git a/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/onActionProcess.js b/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/onActionProcess.js index ec00b9911e3a32e27d003cdb19f40c030846610a..38238664039762ee14eb60459947c46d3e12dd0c 100644 --- a/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/onActionProcess.js +++ b/entity/UnlinkedMail_entity/entityfields/toactivity_actiongroup/children/toactivity_action/onActionProcess.js @@ -1,9 +1,21 @@ +import("Employee_lib"); import("system.neon"); import("system.mail"); import("system.vars"); import("IncomingEmailExecutor_lib"); var mailObj = mail.parseRFC(vars.get("$field.MAIL")); -IncomingEmailExecutor.mailToActivity(mailObj, vars.get("$field.AB_UNLINKEDMAILID")); -//refresh is needed for the dashboard: other elements are refreshed and display for example a new activity in the filter view while the own record (=ulinked mail) is removed -neon.refreshAll(); \ No newline at end of file +var incomingMailExec = new IncomingEmailExecutor(mailObj); +if (incomingMailExec.isUnlinkable()) +{ + //helper context and entity for configuring the linking, further working (linking, creating activities, etc.) is done there + neon.openContext("UnlinkedMailMappingWrapper", null, ["1"], neon.OPERATINGSTATE_EDIT, {"UnlinkedMailId_param": vars.get("$sys.uid")}); +} +else +{ + incomingMailExec.setActivityEmployeeContactId(EmployeeUtils.getCurrentContactId()); + incomingMailExec.createActivity(); + incomingMailExec.deleteUnlinkedMail(vars.get("$sys.uid")); + //refresh is needed for the dashboard: other elements are refreshed and display for example a new activity in the filter view while the own record (=ulinked mail) is removed + neon.refreshAll(); +} \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index b78b681876f4078d50e7f11a6d033ba6dcb79685..425571f6c71f477e5fb792bdc1fe303b482fb864 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -33,9 +33,6 @@ <entry> <key>Medium</key> </entry> - <entry> - <key>Internet</key> - </entry> <entry> <key>Germany</key> </entry> @@ -594,9 +591,6 @@ <entry> <key>Latin Name</key> </entry> - <entry> - <key>Organisation name</key> - </entry> <entry> <key>Connection</key> </entry> @@ -885,9 +879,6 @@ <entry> <key>{$TASK_REQUESTOR}</key> </entry> - <entry> - <key>task number</key> - </entry> <entry> <key>{$TASK_EDITOR}</key> </entry> @@ -1827,9 +1818,6 @@ <entry> <key>Thailand</key> </entry> - <entry> - <key>in process</key> - </entry> <entry> <key>Saint Martin (French part)</key> </entry> @@ -2538,9 +2526,6 @@ <entry> <key>This private person doeas already exist and can not be created once more.</key> </entry> - <entry> - <key>Everyone</key> - </entry> <entry> <key>Project</key> </entry> @@ -2553,9 +2538,6 @@ <entry> <key>Field staff</key> </entry> - <entry> - <key>Resource</key> - </entry> <entry> <key>Human Resources</key> </entry> @@ -2586,9 +2568,6 @@ <entry> <key>Add the selection to a campaign</key> </entry> - <entry> - <key>participants will be added to the selected campaign step</key> - </entry> <entry> <key>Add participants to Campaign</key> </entry> @@ -2634,18 +2613,12 @@ <entry> <key>Chart</key> </entry> - <entry> - <key>Zeigt wie viele Vertriebsprojekte in den einzelnen Vertriebsphasen sind. </key> - </entry> <entry> <key>Enable relation type 2</key> </entry> <entry> <key>Salesproject Analyses</key> </entry> - <entry> - <key>Wichtigste Kennzahlen zu den Vertriebsprojekten.</key> - </entry> <entry> <key>Days count</key> </entry> @@ -2661,9 +2634,6 @@ <entry> <key>Campaign status</key> </entry> - <entry> - <key>Set campaign step</key> - </entry> <entry> <key>Add participant to Campaign</key> </entry> @@ -2754,9 +2724,6 @@ <entry> <key>file '%0' does not exist or you have got no permission on this file</key> </entry> - <entry> - <key>Zip</key> - </entry> <entry> <key>Layout costs</key> </entry> @@ -2841,9 +2808,6 @@ <entry> <key>NUMBER VALUE</key> </entry> - <entry> - <key>Salesproject forecast Id</key> - </entry> <entry> <key>ID</key> </entry> @@ -2892,12 +2856,6 @@ <entry> <key>Relation Type</key> </entry> - <entry> - <key>Salesproject member Id</key> - </entry> - <entry> - <key>Salesproject source Id</key> - </entry> <entry> <key>Item sort</key> </entry> @@ -2949,9 +2907,6 @@ <entry> <key>%0 deleted.</key> </entry> - <entry> - <key>Salesproject competition Id</key> - </entry> <entry> <key>Activity Id</key> </entry> @@ -3486,9 +3441,6 @@ <entry> <key> User</key> </entry> - <entry> - <key>Edit</key> - </entry> <entry> <key>Condition Type</key> </entry> @@ -3504,9 +3456,6 @@ <entry> <key>Entity</key> </entry> - <entry> - <key>Sales Project</key> - </entry> <entry> <key>Field</key> </entry> @@ -3525,9 +3474,6 @@ <entry> <key>Create</key> </entry> - <entry> - <key>To buildingnumber</key> - </entry> <entry> <key>Permission Overview</key> </entry> @@ -3537,9 +3483,6 @@ <entry> <key>View</key> </entry> - <entry> - <key>From buildingnumber</key> - </entry> <entry> <key>Salutations</key> </entry> @@ -3624,27 +3567,9 @@ <entry> <key>${SQL_LIB_FIELD_WRONG_FORMAT} field: %0</key> </entry> - <entry> - <key>testing</key> - </entry> - <entry> - <key>double</key> - </entry> - <entry> - <key>closed</key> - </entry> <entry> <key>New Supportticket</key> </entry> - <entry> - <key>Bug Ticket</key> - </entry> - <entry> - <key>Support ticket</key> - </entry> - <entry> - <key>New Bugticket</key> - </entry> <entry> <key>Keine Berechtigung zum Verschieben der Aufgabe</key> </entry> @@ -3654,9 +3579,6 @@ <entry> <key>Search for new Entries</key> </entry> - <entry> - <key>Additional link</key> - </entry> <entry> <key>Salesproject member</key> </entry> @@ -3666,27 +3588,9 @@ <entry> <key>Minimal count must be a positive whole number</key> </entry> - <entry> - <key>Meilensteine und Kontaktpunkte</key> - </entry> <entry> <key>Maximal count must be one or higher</key> </entry> - <entry> - <key>Campaign name</key> - </entry> - <entry> - <key>Step name</key> - </entry> - <entry> - <key>Assignment</key> - </entry> - <entry> - <key>Complaint</key> - </entry> - <entry> - <key>Employee responsible</key> - </entry> <entry> <key>Restrictions</key> </entry> @@ -3708,24 +3612,9 @@ <entry> <key>New letter</key> </entry> - <entry> - <key>No calls</key> - </entry> - <entry> - <key>No mails</key> - </entry> <entry> <key>Delete recurring appointment</key> </entry> - <entry> - <key>No fax</key> - </entry> - <entry> - <key>No SMS</key> - </entry> - <entry> - <key>No letters</key> - </entry> <entry> <key>ended (abandoned)</key> </entry> @@ -3765,21 +3654,12 @@ <entry> <key>Link</key> </entry> - <entry> - <key>This contact has no possible link.</key> - </entry> <entry> <key>Permissions</key> </entry> <entry> <key>Permission</key> </entry> - <entry> - <key>SalesprojectPhase</key> - </entry> - <entry> - <key>SalesprojectState</key> - </entry> <entry> <key>Maximal</key> </entry> @@ -3984,9 +3864,6 @@ <entry> <key>DOCUMENT</key> </entry> - <entry> - <key>Als Attribut ist der Name aus lib_frame z.B. 'ORG' 'PERS' 'OFFER' etc. zu verwenden.</key> - </entry> <entry> <key>Subordinate campaign of</key> </entry> @@ -4002,9 +3879,6 @@ <entry> <key>Transport damage</key> </entry> - <entry> - <key>Konditionen die bei Angebotserstellung übernommen werden</key> - </entry> <entry> <key>Sport</key> </entry> @@ -4272,9 +4146,6 @@ <entry> <key>%0/%1 participant(s) will be added to the selected campaign step</key> </entry> - <entry> - <key>No valid Selection</key> - </entry> <entry> <key>Sender address</key> </entry> @@ -4365,9 +4236,6 @@ <entry> <key>Connection Type</key> </entry> - <entry> - <key>UID (AB_ATTRIBUTEID)</key> - </entry> <entry> <key>Phases</key> </entry> @@ -4452,9 +4320,6 @@ <entry> <key>Dokument template usage</key> </entry> - <entry> - <key>Open admin info</key> - </entry> <entry> <key>USER_NEW_CONTACT</key> </entry> @@ -4470,18 +4335,9 @@ <entry> <key>Is being sent</key> </entry> - <entry> - <key>Preview</key> - </entry> <entry> <key>Content</key> </entry> - <entry> - <key>Bulk mail was sent!</key> - </entry> - <entry> - <key>%0 mails sent sucessfully, %1 mails failed</key> - </entry> <entry> <key>Bulk mail \"%0\" was sent!</key> </entry> @@ -4494,45 +4350,12 @@ <entry> <key>Support Ticket</key> </entry> - <entry> - <key>CC</key> - </entry> - <entry> - <key>Remarks</key> - </entry> <entry> <key>Xing</key> </entry> - <entry> - <key>Organisation</key> - </entry> - <entry> - <key>Km</key> - </entry> - <entry> - <key>Billed</key> - </entry> - <entry> - <key>Km Fee</key> - </entry> - <entry> - <key>Credit Card</key> - </entry> - <entry> - <key>Taxi</key> - </entry> - <entry> - <key>Overnight stay</key> - </entry> <entry> <key>LinkedIn</key> </entry> - <entry> - <key>In creation</key> - </entry> - <entry> - <key>Rented car</key> - </entry> <entry> <key>Update</key> </entry> @@ -4542,48 +4365,6 @@ <entry> <key>Blog</key> </entry> - <entry> - <key>Until</key> - </entry> - <entry> - <key>From</key> - </entry> - <entry> - <key>Park fees</key> - </entry> - <entry> - <key>Abscences</key> - </entry> - <entry> - <key>Expense Report</key> - </entry> - <entry> - <key>Special displays</key> - </entry> - <entry> - <key>Transport cost</key> - </entry> - <entry> - <key>Day Fee</key> - </entry> - <entry> - <key>Fuel</key> - </entry> - <entry> - <key>Month</key> - </entry> - <entry> - <key>Working material</key> - </entry> - <entry> - <key>Hospitality</key> - </entry> - <entry> - <key>Trip purpose</key> - </entry> - <entry> - <key>Bed and Breakfast</key> - </entry> <entry> <key>Update campaign step</key> </entry> @@ -4608,78 +4389,33 @@ <entry> <key>No data has been anonymized.</key> </entry> - <entry> - <key>Es wurden keine Daten anonymisiert.</key> - </entry> <entry> <key>Anonymization</key> </entry> <entry> <key>The following data has been anonymised: %0</key> </entry> - <entry> - <key>Your changes have an impact on the data privacy information (DSGVO).</key> - </entry> - <entry> - <key>Data Privacies</key> - </entry> - <entry> - <key>advertising consent</key> - </entry> - <entry> - <key>Sonstige personenbezogene Daten</key> - </entry> <entry> <key>Names</key> </entry> - <entry> - <key>Namen</key> - </entry> - <entry> - <key>Adressdaten</key> - </entry> <entry> <key>DSGVO anonymisation</key> </entry> - <entry> - <key>newsletter dispatch</key> - </entry> - <entry> - <key>Folgende Daten wurden anonymisiert: </key> - </entry> - <entry> - <key>Address data</key> - </entry> <entry> <key>contract of sale</key> </entry> <entry> <key>DataPrivacy Use</key> </entry> - <entry> - <key>Source</key> - </entry> <entry> <key>consent</key> </entry> <entry> <key>Information Report</key> </entry> - <entry> - <key>Attribute data</key> - </entry> <entry> <key>other personal data</key> </entry> - <entry> - <key>Kommunikationsdaten</key> - </entry> - <entry> - <key>DSGVO Anonymisierung</key> - </entry> - <entry> - <key>DSGVO Disclosure</key> - </entry> <entry> <key>Disclosure Report</key> </entry> @@ -4689,21 +4425,9 @@ <entry> <key>DataPrivacy Right</key> </entry> - <entry> - <key>balancing of interests</key> - </entry> - <entry> - <key>Personal data</key> - </entry> <entry> <key>The transfer of data to recipients located in a third country is based on the following guarantees:</key> </entry> - <entry> - <key>MarketingCampaign</key> - </entry> - <entry> - <key>Recipient, Country</key> - </entry> <entry> <key>We save your data until </key> </entry> @@ -4716,9 +4440,6 @@ <entry> <key>Nur eigene anzeigen</key> </entry> - <entry> - <key>CampaignManagement</key> - </entry> <entry> <key>For this report</key> </entry> @@ -4797,9 +4518,6 @@ <entry> <key>Newsletter dispatch</key> </entry> - <entry> - <key>We received data from </key> - </entry> <entry> <key>the number of your applications</key> </entry> @@ -4809,12 +4527,6 @@ <entry> <key>External Datasource</key> </entry> - <entry> - <key>Guarantee</key> - </entry> - <entry> - <key>%0 recipients will be added to the bulk mail.</key> - </entry> <entry> <key>%0 new recipients will be added to the bulk mail.</key> </entry> @@ -4932,9 +4644,6 @@ <entry> <key>seconds</key> </entry> - <entry> - <key>Link automatically</key> - </entry> <entry> <key>Duplicatescan</key> </entry> @@ -4960,7 +4669,424 @@ <key>Export letter for selection</key> </entry> <entry> - <key>Export letter</key> + <key>Privacy agreement</key> + </entry> + <entry> + <key>Sufficient guarantees</key> + </entry> + <entry> + <key>HIGH</key> + </entry> + <entry> + <key>NONE</key> + </entry> + <entry> + <key>LOW</key> + </entry> + <entry> + <key>MAX</key> + </entry> + <entry> + <key>NORMAL</key> + </entry> + <entry> + <key>Categorization</key> + </entry> + <entry> + <key>Phase progression</key> + </entry> + <entry> + <key>Occurrences</key> + </entry> + <entry> + <key>Milestones Phase</key> + </entry> + <entry> + <key>Milestones Status</key> + </entry> + <entry> + <key>Serial letters</key> + </entry> + <entry> + <key>Bulk mails</key> + </entry> + <entry> + <key>The contact is already a recipient!</key> + </entry> + <entry> + <key>New Notifications</key> + </entry> + <entry> + <key>Forecasts</key> + </entry> + <entry> + <key>Relation types</key> + </entry> + <entry> + <key>Data privacy entries</key> + </entry> + <entry> + <key>Timetracking entries</key> + </entry> + <entry> + <key>Appointments</key> + </entry> + <entry> + <key>Support Tickets</key> + </entry> + <entry> + <key>Cost entries</key> + </entry> + <entry> + <key>no valid phone number</key> + </entry> + <entry> + <key>Prognose</key> + </entry> + <entry> + <key>EntityToFilterParam</key> + </entry> + <entry> + <key>Sender</key> + </entry> + <entry> + <key>parameter</key> + </entry> + <entry> + <key>Test DuplicateSearch</key> + </entry> + <entry> + <key>Write bulk mail</key> + </entry> + <entry> + <key>Unlinked e-mail</key> + </entry> + <entry> + <key>(optional) E-Mail to store in contact</key> + </entry> + <entry> + <key>Link unlinked e-mail</key> + </entry> + <entry> + <key>Link e-mail addresses to contacts</key> + </entry> + <entry> + <key>${UNLINKEDMAILMAPPING_ADDITIONAL_LINKS}</key> + </entry> + <entry> + <key>${UNLINKEDMAILMAPPING_ADDITIONAL_LINK}</key> + </entry> + <entry> + <key>Create activity</key> + </entry> + <entry> + <key>Unlinked e-mails</key> + </entry> + <entry> + <key>Download</key> + </entry> + <entry> + <key>Copy Campaign</key> + </entry> + <entry> + <key>Excreted can't be in the future</key> + </entry> + <entry> + <key>Document templates</key> + </entry> + <entry> + <key>Turnover Last Year</key> + </entry> + <entry> + <key>Permission Details</key> + </entry> + <entry> + <key>Number of activities</key> + </entry> + <entry> + <key>Turnover Current Year</key> + </entry> + <entry> + <key>Turnover change</key> + </entry> + <entry> + <key>Remaining tasks and appointments</key> + </entry> + <entry> + <key>Tasks for which I am responsible</key> + </entry> + <entry> + <key>Shows unread notifications about different content, e.g. Appointments, serial mails, ...</key> + </entry> + <entry> + <key>Shows how many sales projects are in the various sales phases</key> + </entry> + <entry> + <key>Most important salse key figures</key> + </entry> + <entry> + <key>Shows the organisations turnover and forecast</key> + </entry> + <entry> + <key>Should the mail be sent now?</key> + </entry> + <entry> + <key>Add the selection to a bulk mail</key> + </entry> + <entry> + <key>Add the selection to a serial letter</key> + </entry> + <entry> + <key>Campaign management</key> + </entry> + <entry> + <key>Campaign costs</key> + </entry> + <entry> + <key>Shows all campaigns</key> + </entry> + <entry> + <key>Shows campaing costs graphically processed</key> + </entry> + <entry> + <key>Shows linked appointments</key> + </entry> + <entry> + <key>Possibility to search for terms</key> + </entry> + <entry> + <key>1</key> + </entry> + <entry> + <key>2</key> + </entry> + <entry> + <key>versendet</key> + </entry> + <entry> + <key>Netto</key> + </entry> + <entry> + <key>Währung</key> + </entry> + <entry> + <key>Transfer to Invoice</key> + </entry> + <entry> + <key>Pay due date</key> + </entry> + <entry> + <key>Invoice</key> + </entry> + <entry> + <key>Payment address</key> + </entry> + <entry> + <key>Receipt Footer Text</key> + </entry> + <entry> + <key>Texts</key> + </entry> + <entry> + <key>keine Standard-E-Mail Büro vorhanden !</key> + </entry> + <entry> + <key>Delivery note</key> + </entry> + <entry> + <key>Belegdatum</key> + </entry> + <entry> + <key>Firma</key> + </entry> + <entry> + <key>Choose payment address</key> + </entry> + <entry> + <key>Paid</key> + </entry> + <entry> + <key>Dunning level</key> + </entry> + <entry> + <key>Order confirmation</key> + </entry> + <entry> + <key>Beleg</key> + </entry> + <entry> + <key>Order Type</key> + </entry> + <entry> + <key>Notice</key> + </entry> + <entry> + <key>Bitte einen Adressat in 'to' eintragen!</key> + </entry> + <entry> + <key>Receipt Header Text</key> + </entry> + <entry> + <key>Dunning text</key> + </entry> + <entry> + <key>Choose delivery address</key> + </entry> + <entry> + <key>Cancellation</key> + </entry> + <entry> + <key>Links</key> + </entry> + <entry> + <key>geprüft</key> + </entry> + <entry> + <key>Set dunning</key> + </entry> + <entry> + <key>Beleg-Nr.</key> + </entry> + <entry> + <key>Cancel</key> + </entry> + <entry> + <key>Set to sent</key> + </entry> + <entry> + <key>Set paid amount</key> + </entry> + <entry> + <key>Belegliste</key> + </entry> + <entry> + <key>Pay date</key> + </entry> + <entry> + <key>Transfer to delivery note</key> + </entry> + <entry> + <key>Dunning date</key> + </entry> + <entry> + <key>Credit</key> + </entry> + <entry> + <key>Print order</key> + </entry> + <entry> + <key>Create activities</key> + </entry> + <entry> + <key>Adds the selection to a bulk mail</key> + </entry> + <entry> + <key>Order number</key> + </entry> + <entry> + <key>Permission Action</key> + </entry> + <entry> + <key>Filter</key> + </entry> + <entry> + <key>Recipient status</key> + </entry> + <entry> + <key>Adds the selection to a serial letter</key> + </entry> + <entry> + <key>Actions</key> + </entry> + <entry> + <key>Test email</key> + </entry> + <entry> + <key>Reminder</key> + </entry> + <entry> + <key>Print reminder</key> + </entry> + <entry> + <key>Rech.-Betrag</key> + </entry> + <entry> + <key>Order date</key> + </entry> + <entry> + <key>Due date</key> + </entry> + <entry> + <key>Order amount</key> + </entry> + <entry> + <key>Mahnung</key> + </entry> + <entry> + <key>Due</key> + </entry> + <entry> + <key>Testing contact</key> + </entry> + <entry> + <key>Recipient address</key> + </entry> + <entry> + <key>Testing</key> + </entry> + <entry> + <key>Save settings</key> + </entry> + <entry> + <key>No calls</key> + </entry> + <entry> + <key>No mails</key> + </entry> + <entry> + <key>No fax</key> + </entry> + <entry> + <key>No SMS</key> + </entry> + <entry> + <key>No letters</key> + </entry> + <entry> + <key>Only </key> + </entry> + <entry> + <key>Theme</key> + </entry> + <entry> + <key>Action '</key> + </entry> + <entry> + <key>No duplicates allowed: action '</key> + </entry> + <entry> + <key>Empty actions are not allowed!</key> + </entry> + <entry> + <key>Download template</key> + </entry> + <entry> + <key>Bulk mail \"%0\" sent</key> + </entry> + <entry> + <key>This error should never appear - contact administrator.</key> + </entry> + <entry> + <key>Entrydate (Year)</key> + </entry> + <entry> + <key>Permissions without actions are not allowed!</key> + </entry> + <entry> + <key>Attributes must be unique!</key> + </entry> + <entry> + <key>Export letter for selection</key> </entry> <entry> <key>Privacy agreement</key> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index ae4377a01ae18f929fe98b4ea017edafc47202bf..74f26cef628a36a857024d1cd83eb6943413e173 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -11,45 +11,124 @@ <value>DSGVO Informationen</value> </entry> <entry> - <key>Remarks</key> - <value>Anmerkungen</value> + <key>Recipient address</key> + <value>Empfängeradresse</value> </entry> <entry> <key>Data Privacy</key> <value>Datenschutz</value> </entry> <entry> - <key>Organisation</key> - <value>Organisation</value> + <key>No letters</key> + <value>Keine Briefe</value> + </entry> + <entry> + <key>No SMS</key> + <value>Keine SMS</value> + </entry> + <entry> + <key>Add the selection to a bulk mail</key> + <value>Fügt die Auswahl einer Serienmail hinzu</value> + </entry> + <entry> + <key>Testing</key> + <value>Testen</value> + </entry> + <entry> + <key>Number of activities</key> + <value>Anzahl Aktivitäten</value> + </entry> + <entry> + <key>Bulk mails</key> + <value>Serienmails</value> + </entry> + <entry> + <key>Copy Campaign</key> + <value>Kopiere Kampagne</value> </entry> <entry> <key>No data has been anonymized.</key> <value>Keine Daten wurden anonymisiert.</value> </entry> + <entry> + <key>No fax</key> + <value>Kein Fax</value> + </entry> + <entry> + <key>Excreted can't be in the future</key> + <value>Ausgeschieden darf nicht in der Zukunft liegen</value> + </entry> <entry> <key>Anonymization</key> <value>Anonymisierung</value> </entry> + <entry> + <key>Turnover change</key> + <value>Entwicklung Umsatz</value> + </entry> <entry> <key>The following data has been anonymised: %0</key> <value>Die folgenden Daten wurden anonymisiert: %0</value> </entry> <entry> - <key>Your changes have an impact on the data privacy information (DSGVO).</key> - <value>Ihre Änderungen haben Auswirkungen auf den Datenschutz (DSGVO).</value> + <key>Write bulk mail</key> + <value>Serienmail schreiben</value> </entry> <entry> - <key>Data Privacies</key> - <value>Datenprivilegien</value> + <key>MAX</key> + <value>maximal</value> </entry> <entry> - <key>advertising consent</key> - <value>Werbeeinwilligung</value> + <key>No mails</key> + <value>Keine E-Mails</value> + </entry> + <entry> + <key>Create activities</key> + <value>Aktivitäten erstellen</value> + </entry> + <entry> + <key>No calls</key> + <value>Keine Anrufe</value> + </entry> + <entry> + <key>NONE</key> + <value>keine</value> + </entry> + <entry> + <key>Recipient status</key> + </entry> + <entry> + <key>LOW</key> + <value>gering</value> + </entry> + <entry> + <key>NORMAL</key> + <value>normal</value> + </entry> + <entry> + <key>Add the selection to a serial letter</key> + <value>Fügt die Auswahl einem Serienbrief hinzu</value> + </entry> + <entry> + <key>HIGH</key> + <value>hoch</value> </entry> <entry> <key>Update campaign step</key> <value>Aktualisieren des Kampagnenschrittes</value> </entry> + <entry> + <key>Serial letters</key> + <value>Serienbriefe</value> + </entry> + <entry> + <key>Categorization</key> + <value>Kategorisierung</value> + </entry> + <entry> + <key>Should the mail be sent now?</key> + <value>Soll die Mail jetzt versendet werden?</value> + </entry> <entry> <key>Names</key> <value>Namen</value> @@ -59,12 +138,8 @@ <value>DSGVO Anonymisierung</value> </entry> <entry> - <key>newsletter dispatch</key> - <value>Newsletterversand</value> - </entry> - <entry> - <key>Address data</key> - <value>Adressdaten</value> + <key>The contact is already a recipient!</key> + <value>Der Kontakt ist bereits als Empfänger eingetragen!</value> </entry> <entry> <key>contract of sale</key> @@ -74,13 +149,9 @@ <key>DataPrivacy Use</key> <value>Nutzung</value> </entry> - <entry> - <key>Source</key> - <value>Quelle</value> - </entry> <entry> <key>Show my campaigns</key> - <value>Zeigen meine Kampagnen</value> + <value>Meine Kampagnen anzeigen</value> </entry> <entry> <key>consent</key> @@ -90,10 +161,6 @@ <key>Information Report</key> <value>Informationsbericht</value> </entry> - <entry> - <key>Attribute data</key> - <value>Attributdaten</value> - </entry> <entry> <key>other personal data</key> <value>andere persönliche Daten</value> @@ -102,17 +169,12 @@ <key>The contact has an advertising ban for emails!</key> <value>Der Kontakt hat ein Werbeverbot für E-Mails!</value> </entry> - <entry> - <key>DSGVO Disclosure</key> - <value>DSGVO Auskunft</value> - </entry> <entry> <key>Disclosure Report</key> <value>Auskunftsbericht</value> </entry> <entry> - <key>Abscences</key> - <value>Abszenzenen</value> + <key>Forecasts</key> </entry> <entry> <key>Update data privacy information</key> @@ -122,30 +184,14 @@ <key>DataPrivacy Right</key> <value>Datenschutzrecht</value> </entry> - <entry> - <key>balancing of interests</key> - <value>Interessenausgleich</value> - </entry> - <entry> - <key>Personal data</key> - <value>Persönliche Daten</value> - </entry> <entry> <key>The transfer of data to recipients located in a third country is based on the following guarantees:</key> <value>Die Übermittlung von Daten an Empfänger in einem Drittland basiert auf folgenden Garantien:</value> </entry> - <entry> - <key>Recipient, Country</key> - <value>Empfänger, Land</value> - </entry> <entry> <key>We save your data until </key> <value>Wir speichern Ihre Daten bis </value> </entry> - <entry> - <key>Guarantee</key> - <value>Garantie</value> - </entry> <entry> <key>On time</key> <value>Pünktlich</value> @@ -266,18 +312,10 @@ <key>External Datasource</key> <value>Externe Datenquelle</value> </entry> - <entry> - <key>No mails</key> - <value>Keine E-Mails</value> - </entry> <entry> <key>Steps</key> <value>Stufen</value> </entry> - <entry> - <key>Assignment</key> - <value>Zuordnung</value> - </entry> <entry> <key>Project management</key> <value>Projektmanagement</value> @@ -297,22 +335,6 @@ <key>Failed</key> <value>Fehlgeschlagen</value> </entry> - <entry> - <key>SalesprojectPhase</key> - <value>Phase</value> - </entry> - <entry> - <key>No calls</key> - <value>Keine Anrufe</value> - </entry> - <entry> - <key>No SMS</key> - <value>Keine SMS</value> - </entry> - <entry> - <key>This contact has no possible link.</key> - <value>Dieser Kontakt hat keine möglichen Verknüpfungen.</value> - </entry> <entry> <key>Is being sent</key> <value>Wird versendet</value> @@ -377,26 +399,10 @@ <key>Bulk mail \"%0\" was sent!</key> <value>Serienmail \"%0\" wurde versendet!</value> </entry> - <entry> - <key>No fax</key> - <value>Kein Fax</value> - </entry> - <entry> - <key>No letters</key> - <value>Keine Briefe</value> - </entry> - <entry> - <key>SalesprojectState</key> - <value>Status</value> - </entry> <entry> <key>Company</key> <value>Firma</value> </entry> - <entry> - <key>Complaint</key> - <value>Reklamation</value> - </entry> <entry> <key>SEEN</key> <value>Neu</value> @@ -525,6 +531,10 @@ <key>${COUNT_PREPOSITION_MULTIPLE}</key> <value>mal</value> </entry> + <entry> + <key>Data privacy entries</key> + <value>Datenschutzeinträge</value> + </entry> <entry> <key>Email must be unique!</key> <value>Die E-Mail-Adresse muss eindeutig sein!</value> @@ -605,10 +615,6 @@ <key>Activity</key> <value>Aktivität</value> </entry> - <entry> - <key>participants will be added to the selected campaign step</key> - <value>Teilnehmer/innen werden zur ausgewählten Kampagnenstufe hinzugefügt</value> - </entry> <entry> <key>Name</key> <value>Name</value> @@ -617,10 +623,6 @@ <key>Austria</key> <value>Österreich</value> </entry> - <entry> - <key>Set campaign step</key> - <value>Kampagnenstufe setzen</value> - </entry> <entry> <key>New time tracking</key> <value>Neuer Zeiteintrag</value> @@ -633,6 +635,10 @@ <key>The person is already associated with another employee!</key> <value>Die Person ist bereits mit einem anderen Mitarbeiter verknüpft!</value> </entry> + <entry> + <key>Appointments</key> + <value>Termine</value> + </entry> <entry> <key>Time expenses</key> <value>Aufwand</value> @@ -673,10 +679,6 @@ <key>Medium</key> <value>Medium</value> </entry> - <entry> - <key>Internet</key> - <value>Internet</value> - </entry> <entry> <key>Germany</key> <value>Deutschland</value> @@ -733,10 +735,6 @@ <key>Office address</key> <value>Firmenadresse</value> </entry> - <entry> - <key>Additional link</key> - <value>Zusätzliche Verknüpfung</value> - </entry> <entry> <key>Contact</key> <value>Kontakt</value> @@ -1131,9 +1129,6 @@ <key>Advertising material</key> <value>Werbemittel</value> </entry> - <entry> - <key>%0 mails sent sucessfully, %1 mails failed</key> - </entry> <entry> <key>Valid from</key> <value>gültig ab</value> @@ -1475,6 +1470,10 @@ <key>Remark</key> <value>Anmerkung</value> </entry> + <entry> + <key>Cost entries</key> + <value>Kosteneinträge</value> + </entry> <entry> <key>Competition</key> <value>Mitbewerber</value> @@ -1519,10 +1518,6 @@ <key>Show all offers</key> <value>Alle Angebote anzeigen</value> </entry> - <entry> - <key>Preview</key> - <value>Vorschau</value> - </entry> <entry> <key>Filetype</key> <value>Dateityp</value> @@ -1587,10 +1582,6 @@ <key>My Activities</key> <value>Meine Aktivitäten</value> </entry> - <entry> - <key>Everyone</key> - <value>Jeder</value> - </entry> <entry> <key>Combobox Value</key> <value>Combobox-Wert</value> @@ -1655,6 +1646,7 @@ </entry> <entry> <key>no valid format</key> + <value>kein gültiges Format</value> </entry> <entry> <key>Deliveryspecification</key> @@ -1753,6 +1745,7 @@ </entry> <entry> <key>no valid mail-address format</key> + <value>keine gültige E-Mail Adresse</value> </entry> <entry> <key>Amount</key> @@ -1765,10 +1758,6 @@ <key>Latin Name</key> <value>Lateinischer Name</value> </entry> - <entry> - <key>Organisation name</key> - <value>Name der Organisation</value> - </entry> <entry> <key>Connection</key> <value>Verknüpfung</value> @@ -1841,7 +1830,7 @@ </entry> <entry> <key>New receipt version</key> - <value>Neue Quittungsversion</value> + <value>Neue Belegsversion</value> </entry> <entry> <key>Orderitems</key> @@ -1952,12 +1941,12 @@ <value>Betreff</value> </entry> <entry> - <key>{$TASK_REQUESTOR}</key> - <value>Anforderer</value> + <key>Document templates</key> + <value>Dokumentvorlagen</value> </entry> <entry> - <key>task number</key> - <value>Aufgabennummer</value> + <key>{$TASK_REQUESTOR}</key> + <value>Anforderer</value> </entry> <entry> <key>description</key> @@ -2047,6 +2036,7 @@ </entry> <entry> <key>Key figures</key> + <value>Kennzahlen</value> </entry> <entry> <key>Person</key> @@ -2214,6 +2204,10 @@ <key>Product_functionality</key> <value>Produkt_Funktionalität</value> </entry> + <entry> + <key>Timetracking entries</key> + <value>Zeiteinträge</value> + </entry> <entry> <key>New appointment</key> <value>Neuer Termin</value> @@ -3097,10 +3091,6 @@ <key>Congo (Democratic Republic of the)</key> <value>Kongo (Demokratische Republik)</value> </entry> - <entry> - <key>Resource</key> - <value>Ressource</value> - </entry> <entry> <key>Greece</key> <value>Griechenland</value> @@ -3229,10 +3219,6 @@ <key>Thailand</key> <value>Thailand</value> </entry> - <entry> - <key>in process</key> - <value>in Bearbeitung</value> - </entry> <entry> <key>Saint Martin (French part)</key> <value>Saint Martin (französischer Teil)</value> @@ -3586,6 +3572,10 @@ <key>parent company</key> <value>Konzernmutter</value> </entry> + <entry> + <key>New Notifications</key> + <value>Neue Benachrichtigungen</value> + </entry> <entry> <key>society</key> <value>Verband</value> @@ -3958,9 +3948,6 @@ <entry> <key>Chart</key> </entry> - <entry> - <key>Zeigt wie viele Vertriebsprojekte in den einzelnen Vertriebsphasen sind. </key> - </entry> <entry> <key>Pending</key> <value>Ausstehend</value> @@ -4011,9 +3998,6 @@ <entry> <key>Salesproject Analyses</key> </entry> - <entry> - <key>Wichtigste Kennzahlen zu den Vertriebsprojekten.</key> - </entry> <entry> <key>Days count</key> <value>Anzahl Tage</value> @@ -4137,9 +4121,6 @@ <entry> <key>file '%0' does not exist or you have got no permission on this file</key> </entry> - <entry> - <key>Zip</key> - </entry> <entry> <key>Salesproject member</key> <value>Projektteam</value> @@ -4237,9 +4218,6 @@ <entry> <key>NUMBER VALUE</key> </entry> - <entry> - <key>Salesproject forecast Id</key> - </entry> <entry> <key>ID</key> </entry> @@ -4285,6 +4263,7 @@ </entry> <entry> <key>Indexsearch</key> + <value>Indexsuche</value> </entry> <entry> <key>Appointment link Id</key> @@ -4292,12 +4271,6 @@ <entry> <key>Relation Type</key> </entry> - <entry> - <key>Salesproject member Id</key> - </entry> - <entry> - <key>Salesproject source Id</key> - </entry> <entry> <key>Item sort</key> </entry> @@ -4351,9 +4324,6 @@ <key>%0 deleted.</key> <value>%0 gelöscht.</value> </entry> - <entry> - <key>Salesproject competition Id</key> - </entry> <entry> <key>Activity Id</key> </entry> @@ -4428,6 +4398,7 @@ </entry> <entry> <key>Address addition</key> + <value>Adresszusatz</value> </entry> <entry> <key>the \"%0\" table is configured to get logged but this is the logging-stoarge itself and cannot be monitored</key> @@ -4565,6 +4536,7 @@ </entry> <entry> <key>Keywords</key> + <value>Schlüsselwörter</value> </entry> <entry> <key>Days running</key> @@ -4612,6 +4584,7 @@ </entry> <entry> <key>Keyword Attributes</key> + <value>Schlüsselwort-Eigenschaften</value> </entry> <entry> <key>Student/Internship</key> @@ -4852,6 +4825,10 @@ <key>${HIGHER_THAN_MAX} max: %0</key> <value>Der eingegebene Wert ist über dem Maximalwert %0.</value> </entry> + <entry> + <key>Test email</key> + <value>E-Mail testen</value> + </entry> <entry> <key>Rating</key> <value>Bewertung</value> @@ -4901,9 +4878,6 @@ <entry> <key> User</key> </entry> - <entry> - <key>Edit</key> - </entry> <entry> <key>Condition Type</key> </entry> @@ -4919,10 +4893,6 @@ <entry> <key>Entity</key> </entry> - <entry> - <key>Sales Project</key> - <value>Vertriebsprojekt</value> - </entry> <entry> <key>Field</key> </entry> @@ -4941,9 +4911,6 @@ <entry> <key>Create</key> </entry> - <entry> - <key>To buildingnumber</key> - </entry> <entry> <key>Permission Overview</key> </entry> @@ -4953,11 +4920,9 @@ <entry> <key>View</key> </entry> - <entry> - <key>From buildingnumber</key> - </entry> <entry> <key>Salutations</key> + <value>Anreden</value> </entry> <entry> <key>Paymentterm</key> @@ -4988,7 +4953,7 @@ </entry> <entry> <key>Price Condition</key> - <value>Preis Konditionen</value> + <value>Preiskonditionen</value> </entry> <entry> <key>Entität</key> @@ -5049,29 +5014,10 @@ <entry> <key>Email Template</key> </entry> - <entry> - <key>testing</key> - </entry> - <entry> - <key>double</key> - </entry> - <entry> - <key>closed</key> - </entry> <entry> <key>New Supportticket</key> <value>Neues Supportticket</value> </entry> - <entry> - <key>Bug Ticket</key> - </entry> - <entry> - <key>Support ticket</key> - </entry> - <entry> - <key>New Bugticket</key> - <value>Neues Bugticket</value> - </entry> <entry> <key>Keine Berechtigung zum Verschieben der Aufgabe</key> </entry> @@ -5090,24 +5036,10 @@ <key>Minimal count must be a positive whole number</key> <value>Minimale Anzahl muss eine positive, ganze Zahl sein</value> </entry> - <entry> - <key>Meilensteine und Kontaktpunkte</key> - </entry> <entry> <key>Maximal count must be one or higher</key> <value>Maximale Anzahl muss eins oder höher sein</value> </entry> - <entry> - <key>Campaign name</key> - <value>Kampagnen Name</value> - </entry> - <entry> - <key>Step name</key> - <value>Stufen Name</value> - </entry> - <entry> - <key>Employee responsible</key> - </entry> <entry> <key>own company</key> <value>eigene Firma</value> @@ -5401,8 +5333,7 @@ <value>NPO</value> </entry> <entry> - <key>Als Attribut ist der Name aus lib_frame z.B. 'ORG' 'PERS' 'OFFER' etc. zu verwenden.</key> - <value>Als Attribut ist der Name aus lib_frame z.B. 'ORG' 'PERS' 'OFFER' etc. zu verwenden.</value> + <key>Support Tickets</key> </entry> <entry> <key>Handcraft</key> @@ -5416,10 +5347,6 @@ <key>Full calculation</key> <value>Vollberechnung</value> </entry> - <entry> - <key>Konditionen die bei Angebotserstellung übernommen werden</key> - <value>Konditionen die bei Angebotserstellung übernommen werden</value> - </entry> <entry> <key>Others</key> <value>Sonstiges</value> @@ -5452,6 +5379,10 @@ <key>Quality problem customer</key> <value>Qualitätsproblem Kunde</value> </entry> + <entry> + <key>Relation types</key> + <value>Beziehungstypen</value> + </entry> <entry> <key>Wine</key> <value>Wein</value> @@ -5516,10 +5447,18 @@ <key>Treat</key> <value>Genuss</value> </entry> + <entry> + <key>Testing contact</key> + <value>Testkontakt</value> + </entry> <entry> <key>Motor cycle</key> <value>Motorrad</value> </entry> + <entry> + <key>Save settings</key> + <value>Einstellung speichern</value> + </entry> <entry> <key>Revolution speed (rpm)</key> <value>Drehzahl (rpm)</value> @@ -5808,9 +5747,6 @@ <entry> <key>Connection Type</key> </entry> - <entry> - <key>UID (AB_ATTRIBUTEID)</key> - </entry> <entry> <key>Phases</key> </entry> @@ -5874,6 +5810,10 @@ <key>{$TICKET_EDITOR}</key> <value>Bearbeiter</value> </entry> + <entry> + <key>Turnover Last Year</key> + <value>Umsatz Vorjahr</value> + </entry> <entry> <key>Supportticket</key> </entry> @@ -5904,15 +5844,9 @@ <entry> <key>Dokument template usage</key> </entry> - <entry> - <key>Open admin info</key> - </entry> <entry> <key>USER_NEW_CONTACT</key> </entry> - <entry> - <key>Bulk mail was sent!</key> - </entry> <entry> <key>All selected participants already are in the campaign</key> <value>Alle selektierten Teilnehmer sind bereits in der Kampagne</value> @@ -5925,175 +5859,59 @@ <key>Not enough slots for %0/%1 participant(s)</key> <value>Nicht genügend Teilnehmerplätze verfügbar für %0/%1 Teilnehmer</value> </entry> - <entry> - <key>No valid Selection</key> - <value>Keine gültige Auswahl</value> - </entry> <entry> <key>Support Ticket</key> - <value>Support Ticket</value> - </entry> - <entry> - <key>Rented car</key> - <value>Mietwagen</value> - </entry> - <entry> - <key>Adressdaten</key> - <value>Adressdaten</value> + <value>Supportticket</value> </entry> <entry> <key>No contacts selected</key> <value>Keine Kontakte ausgewählt</value> </entry> - <entry> - <key>Transport cost</key> - <value>Transportkosten</value> - </entry> - <entry> - <key>Day Fee</key> - <value>Tagesgebühr</value> - </entry> - <entry> - <key>Month</key> - <value>Monat</value> - </entry> <entry> <key>My campaigns</key> <value>Meine Kampagnen</value> </entry> - <entry> - <key>Hospitality</key> - <value>Gastfreundschaft</value> - </entry> - <entry> - <key>Bed and Breakfast</key> - <value>Bett und Frühstück</value> - </entry> - <entry> - <key>Until</key> - <value>Bis</value> - </entry> - <entry> - <key>From</key> - <value>Von</value> - </entry> <entry> <key>Add to Bulkmail</key> <value>Zu Massenmail hinzufügen</value> </entry> - <entry> - <key>Park fees</key> - <value>Parkgebühren</value> - </entry> - <entry> - <key>Expense Report</key> - <value>Ausgabenabrechnung</value> - </entry> - <entry> - <key>Working material</key> - <value>Arbeitsmaterial</value> - </entry> - <entry> - <key>Trip purpose</key> - <value>Reisezweck</value> - </entry> <entry> <key>phase information</key> <value>Phaseninformationen</value> </entry> - <entry> - <key>MarketingCampaign</key> - </entry> <entry> <key>Nur eigene anzeigen</key> </entry> - <entry> - <key>Billed</key> - </entry> - <entry> - <key>Km Fee</key> - </entry> - <entry> - <key>Credit Card</key> - </entry> - <entry> - <key>Overnight stay</key> - </entry> - <entry> - <key>In creation</key> - </entry> - <entry> - <key>Es wurden keine Daten anonymisiert.</key> - </entry> - <entry> - <key>Sonstige personenbezogene Daten</key> - </entry> <entry> <key>Extension letter date</key> <value>Beantragung Fristverlängerung</value> </entry> - <entry> - <key>Namen</key> - </entry> <entry> <key>Update</key> </entry> <entry> <key>Blog</key> </entry> - <entry> - <key>Special displays</key> - </entry> <entry> <key>Guarantees</key> <value>Garantien</value> </entry> - <entry> - <key>Folgende Daten wurden anonymisiert: </key> - </entry> - <entry> - <key>Fuel</key> - </entry> - <entry> - <key>CC</key> - </entry> <entry> <key>Xing</key> </entry> - <entry> - <key>CampaignManagement</key> - </entry> - <entry> - <key>Km</key> - </entry> - <entry> - <key>Taxi</key> - </entry> <entry> <key>LinkedIn</key> </entry> - <entry> - <key>Kommunikationsdaten</key> - </entry> - <entry> - <key>DSGVO Anonymisierung</key> - </entry> - <entry> - <key>%0 recipients will be added to the bulk mail.</key> - </entry> <entry> <key>%0 new recipients will be added to the serial letter.</key> <value>Dem Serienbrief werden %0 neue Empfänger hinzugefügt.</value> </entry> - <entry> - <key>Export letter</key> - <value>Brief exportieren</value> - </entry> <entry> <key>Add to serial letter</key> </entry> <entry> <key>The contact has an advertising ban for letters!</key> + <value>Der Kontakt hat ein Werbeverbot für Briefe!</value> </entry> <entry> <key>one actitiy from mail created</key> @@ -6219,13 +6037,6 @@ <key>seconds</key> <value>Sekunden</value> </entry> - <entry> - <key>Link automatically</key> - <value>Automatisch verknüpfen</value> - </entry> - <entry> - <key>We received data from </key> - </entry> <entry> <key>Duplicatescan</key> <value>Dublettenermittlung</value> @@ -6256,6 +6067,362 @@ </entry> <entry> <key>Download letter</key> + <value>Brief herunterladen</value> + </entry> + <entry> + <key>Phase progression</key> + <value>Phasenfortschritt</value> + </entry> + <entry> + <key>Milestones Phase</key> + <value>Meilensteinphase</value> + </entry> + <entry> + <key>Occurrences</key> + <value>Ereignisse</value> + </entry> + <entry> + <key>Milestones Status</key> + <value>Meilensteinstatus</value> + </entry> + <entry> + <key>no valid phone number</key> + <value>keine gültige Telefonnummer</value> + </entry> + <entry> + <key>Prognose</key> + </entry> + <entry> + <key>EntityToFilterParam</key> + </entry> + <entry> + <key>Sender</key> + </entry> + <entry> + <key>parameter</key> + </entry> + <entry> + <key>Test DuplicateSearch</key> + </entry> + <entry> + <key>Unlinked e-mail</key> + <value>Unverknüpfte E-Mail</value> + </entry> + <entry> + <key>(optional) E-Mail to store in contact</key> + <value>(optional) E-Mail bei Kontakt speichern</value> + </entry> + <entry> + <key>Link unlinked e-mail</key> + <value>Verknüpfe E-Mail</value> + </entry> + <entry> + <key>Link e-mail addresses to contacts</key> + <value>Verknüpfe E-Mail-Adressen zu Kontakten</value> + </entry> + <entry> + <key>${UNLINKEDMAILMAPPING_ADDITIONAL_LINKS}</key> + <value>Weitere Verknüpfungen</value> + </entry> + <entry> + <key>${UNLINKEDMAILMAPPING_ADDITIONAL_LINK}</key> + <value>Weitere Verknüpfung</value> + </entry> + <entry> + <key>Create activity</key> + <value>Erstelle Aktivität</value> + </entry> + <entry> + <key>Unlinked e-mails</key> + <value>Unverknüpfte E-Mails</value> + </entry> + <entry> + <key>Download</key> + <value>Herunterladen</value> + </entry> + <entry> + <key>Turnover Current Year</key> + <value>Umsatz aktuelles Jahr</value> + </entry> + <entry> + <key>Permission Details</key> + </entry> + <entry> + <key>Remaining tasks and appointments</key> + <value>Aufgaben und Termine, die noch ausstehen</value> + </entry> + <entry> + <key>Tasks for which I am responsible</key> + <value>Aufgaben, für die ich zuständig bin</value> + </entry> + <entry> + <key>Shows unread notifications about different content, e.g. Appointments, serial mails, ...</key> + <value>Zeigt alle ungelesenen Benachrichtigungen mit verschiedenen Inhalten, z.B. zu Terminen, Serienmails</value> + </entry> + <entry> + <key>Shows how many sales projects are in the various sales phases</key> + <value>Zeigt wie viele Vertriebsprojekte in den einzelnen Vertriebsphasen sind</value> + </entry> + <entry> + <key>Most important salse key figures</key> + </entry> + <entry> + <key>Shows the organisations turnover and forecast</key> + <value>Zeigt den Umsatz und den Forecast der Firma für den Zeitraum von 4 Jahren</value> + </entry> + <entry> + <key>Campaign management</key> + <value>Kampagnenmanagement</value> + </entry> + <entry> + <key>Campaign costs</key> + <value>Kampagnenkosten</value> + </entry> + <entry> + <key>Shows all campaigns</key> + <value>Alle Kampagnen anzeigen</value> + </entry> + <entry> + <key>Shows campaing costs graphically processed</key> + <value>Kampagnenkosten graphisch aufbereitet</value> + </entry> + <entry> + <key>Shows linked appointments</key> + <value>Verknüpfte Termine anzeigen</value> + </entry> + <entry> + <key>Possibility to search for terms</key> + <value>Möglichkeit nach Begriffen zu suchen</value> + </entry> + <entry> + <key>1</key> + </entry> + <entry> + <key>2</key> + </entry> + <entry> + <key>versendet</key> + </entry> + <entry> + <key>Netto</key> + </entry> + <entry> + <key>Währung</key> + </entry> + <entry> + <key>Transfer to Invoice</key> + <value>In Rechnung übertragen</value> + </entry> + <entry> + <key>Pay due date</key> + <value>Zahlungsziel</value> + </entry> + <entry> + <key>Invoice</key> + <value>Rechnung</value> + </entry> + <entry> + <key>Payment address</key> + <value>Zahlungsadresse</value> + </entry> + <entry> + <key>Receipt Footer Text</key> + <value>Beleg Fußtext</value> + </entry> + <entry> + <key>Texts</key> + <value>Texte</value> + </entry> + <entry> + <key>keine Standard-E-Mail Büro vorhanden !</key> + </entry> + <entry> + <key>Delivery note</key> + <value>Lieferschein</value> + </entry> + <entry> + <key>Belegdatum</key> + </entry> + <entry> + <key>Firma</key> + </entry> + <entry> + <key>Choose payment address</key> + <value>Zahlungsadresse auswählen</value> + </entry> + <entry> + <key>Paid</key> + <value>Bezahlt</value> + </entry> + <entry> + <key>Dunning level</key> + <value>Mahnstufe</value> + </entry> + <entry> + <key>Order confirmation</key> + <value>Auftragsbestätigung</value> + </entry> + <entry> + <key>Beleg</key> + </entry> + <entry> + <key>Order Type</key> + <value>Belegtyp</value> + </entry> + <entry> + <key>Notice</key> + <value>Notiz</value> + </entry> + <entry> + <key>Bitte einen Adressat in 'to' eintragen!</key> + </entry> + <entry> + <key>Receipt Header Text</key> + <value>Beleg Kopftext</value> + </entry> + <entry> + <key>Dunning text</key> + <value>Mahnungstext</value> + </entry> + <entry> + <key>Choose delivery address</key> + <value>Lieferadresse auswählen</value> + </entry> + <entry> + <key>Cancellation</key> + <value>Storno</value> + </entry> + <entry> + <key>Links</key> + </entry> + <entry> + <key>geprüft</key> + </entry> + <entry> + <key>Set dunning</key> + <value>Mahnstufe setzen</value> + </entry> + <entry> + <key>Beleg-Nr.</key> + </entry> + <entry> + <key>Cancel</key> + <value>Stornieren</value> + </entry> + <entry> + <key>Set to sent</key> + <value>Versendet setzen</value> + </entry> + <entry> + <key>Set paid amount</key> + <value>Bezahlten Betrag setzen</value> + </entry> + <entry> + <key>Belegliste</key> + </entry> + <entry> + <key>Pay date</key> + <value>Zahlungseingang</value> + </entry> + <entry> + <key>Transfer to delivery note</key> + <value>In Lieferschein übertragen</value> + </entry> + <entry> + <key>Dunning date</key> + <value>Mahndatum</value> + </entry> + <entry> + <key>Credit</key> + <value>Gutschrift</value> + </entry> + <entry> + <key>Print order</key> + <value>Beleg drucken</value> + </entry> + <entry> + <key>Adds the selection to a bulk mail</key> + </entry> + <entry> + <key>Order number</key> + <value>Belegsnummer</value> + </entry> + <entry> + <key>Permission Action</key> + </entry> + <entry> + <key>Filter</key> + </entry> + <entry> + <key>Adds the selection to a serial letter</key> + </entry> + <entry> + <key>Actions</key> + </entry> + <entry> + <key>Reminder</key> + <value>Mahnung</value> + </entry> + <entry> + <key>Print reminder</key> + <value>Mahnung drucken</value> + </entry> + <entry> + <key>Rech.-Betrag</key> + </entry> + <entry> + <key>Order date</key> + <value>Belegsdatum</value> + </entry> + <entry> + <key>Due date</key> + <value>Mahndatum</value> + </entry> + <entry> + <key>Order amount</key> + </entry> + <entry> + <key>Mahnung</key> + </entry> + <entry> + <key>Due</key> + <value>Fällig</value> + </entry> + <entry> + <key>Only </key> + </entry> + <entry> + <key>Theme</key> + <value>Thema</value> + </entry> + <entry> + <key>Action '</key> + </entry> + <entry> + <key>No duplicates allowed: action '</key> + </entry> + <entry> + <key>Empty actions are not allowed!</key> + </entry> + <entry> + <key>Download template</key> + <value>Vorlage herunterladen</value> + </entry> + <entry> + <key>Bulk mail \"%0\" sent</key> + </entry> + <entry> + <key>This error should never appear - contact administrator.</key> + </entry> + <entry> + <key>Entrydate (Year)</key> + <value>Eingangsdatum (Jahr)</value> + </entry> + <entry> + <key>Attributes must be unique!</key> + </entry> + <entry> + <key>Permissions without actions are not allowed!</key> </entry> <entry> <key>The combination of filter name and target entity is already in use</key> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 259ad7e781a02e4114c2e8f9dfeaa5b65ea92f21..ff0ad14ebdad57e8dad03d45e4b1de75e2936fd7 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -39,9 +39,6 @@ <entry> <key>Medium</key> </entry> - <entry> - <key>Internet</key> - </entry> <entry> <key>Germany</key> </entry> @@ -604,9 +601,6 @@ <entry> <key>Latin Name</key> </entry> - <entry> - <key>Organisation name</key> - </entry> <entry> <key>Connection</key> </entry> @@ -900,9 +894,6 @@ <key>{$TASK_REQUESTOR}</key> <value>Requestor</value> </entry> - <entry> - <key>task number</key> - </entry> <entry> <key>{$TASK_EDITOR}</key> <value>Editor</value> @@ -1802,6 +1793,7 @@ </entry> <entry> <key>${GENDER_OTHER}</key> + <value>Other</value> </entry> <entry> <key>Turkey</key> @@ -1845,9 +1837,6 @@ <entry> <key>Thailand</key> </entry> - <entry> - <key>in process</key> - </entry> <entry> <key>Saint Martin (French part)</key> </entry> @@ -2568,9 +2557,6 @@ <entry> <key>This private person doeas already exist and can not be created once more.</key> </entry> - <entry> - <key>Everyone</key> - </entry> <entry> <key>Project</key> </entry> @@ -2583,9 +2569,6 @@ <entry> <key>Field staff</key> </entry> - <entry> - <key>Resource</key> - </entry> <entry> <key>Human Resources</key> </entry> @@ -2617,9 +2600,6 @@ <entry> <key>Add the selection to a campaign</key> </entry> - <entry> - <key>participants will be added to the selected campaign step</key> - </entry> <entry> <key>Add participants to Campaign</key> </entry> @@ -2665,18 +2645,12 @@ <entry> <key>Chart</key> </entry> - <entry> - <key>Zeigt wie viele Vertriebsprojekte in den einzelnen Vertriebsphasen sind. </key> - </entry> <entry> <key>Enable relation type 2</key> </entry> <entry> <key>Salesproject Analyses</key> </entry> - <entry> - <key>Wichtigste Kennzahlen zu den Vertriebsprojekten.</key> - </entry> <entry> <key>Days count</key> </entry> @@ -2692,9 +2666,6 @@ <entry> <key>Campaign status</key> </entry> - <entry> - <key>Set campaign step</key> - </entry> <entry> <key>Add participant to Campaign</key> </entry> @@ -2790,9 +2761,6 @@ <entry> <key>file '%0' does not exist or you have got no permission on this file</key> </entry> - <entry> - <key>Zip</key> - </entry> <entry> <key>Layout costs</key> </entry> @@ -2878,9 +2846,6 @@ <entry> <key>NUMBER VALUE</key> </entry> - <entry> - <key>Salesproject forecast Id</key> - </entry> <entry> <key>ID</key> </entry> @@ -2929,12 +2894,6 @@ <entry> <key>Relation Type</key> </entry> - <entry> - <key>Salesproject member Id</key> - </entry> - <entry> - <key>Salesproject source Id</key> - </entry> <entry> <key>Item sort</key> </entry> @@ -2986,9 +2945,6 @@ <entry> <key>%0 deleted.</key> </entry> - <entry> - <key>Salesproject competition Id</key> - </entry> <entry> <key>Activity Id</key> </entry> @@ -3540,9 +3496,6 @@ <entry> <key> User</key> </entry> - <entry> - <key>Edit</key> - </entry> <entry> <key>Condition Type</key> </entry> @@ -3558,9 +3511,6 @@ <entry> <key>Entity</key> </entry> - <entry> - <key>Sales Project</key> - </entry> <entry> <key>Field</key> </entry> @@ -3579,9 +3529,6 @@ <entry> <key>Create</key> </entry> - <entry> - <key>To buildingnumber</key> - </entry> <entry> <key>Permission Overview</key> </entry> @@ -3591,9 +3538,6 @@ <entry> <key>View</key> </entry> - <entry> - <key>From buildingnumber</key> - </entry> <entry> <key>Salutations</key> </entry> @@ -3673,27 +3617,9 @@ <key>${SQL_LIB_FIELD_WRONG_FORMAT} field: %0</key> <value>Field %0 is in an incorrect format. The database field has to be like "tablename.columnname" ("ORGANISATION.NAME") or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]</value> </entry> - <entry> - <key>testing</key> - </entry> - <entry> - <key>double</key> - </entry> - <entry> - <key>closed</key> - </entry> <entry> <key>New Supportticket</key> </entry> - <entry> - <key>Bug Ticket</key> - </entry> - <entry> - <key>Support ticket</key> - </entry> - <entry> - <key>New Bugticket</key> - </entry> <entry> <key>Keine Berechtigung zum Verschieben der Aufgabe</key> </entry> @@ -3703,9 +3629,6 @@ <entry> <key>Search for new Entries</key> </entry> - <entry> - <key>Additional link</key> - </entry> <entry> <key>Salesproject member</key> </entry> @@ -3715,27 +3638,9 @@ <entry> <key>Minimal count must be a positive whole number</key> </entry> - <entry> - <key>Meilensteine und Kontaktpunkte</key> - </entry> <entry> <key>Maximal count must be one or higher</key> </entry> - <entry> - <key>Campaign name</key> - </entry> - <entry> - <key>Step name</key> - </entry> - <entry> - <key>Assignment</key> - </entry> - <entry> - <key>Complaint</key> - </entry> - <entry> - <key>Employee responsible</key> - </entry> <entry> <key>Restrictions</key> </entry> @@ -3757,24 +3662,9 @@ <entry> <key>New letter</key> </entry> - <entry> - <key>No calls</key> - </entry> - <entry> - <key>No mails</key> - </entry> <entry> <key>Delete recurring appointment</key> </entry> - <entry> - <key>No fax</key> - </entry> - <entry> - <key>No SMS</key> - </entry> - <entry> - <key>No letters</key> - </entry> <entry> <key>ended (abandoned)</key> </entry> @@ -3814,21 +3704,12 @@ <entry> <key>Link</key> </entry> - <entry> - <key>This contact has no possible link.</key> - </entry> <entry> <key>Permissions</key> </entry> <entry> <key>Permission</key> </entry> - <entry> - <key>SalesprojectPhase</key> - </entry> - <entry> - <key>SalesprojectState</key> - </entry> <entry> <key>Maximal</key> </entry> @@ -4033,9 +3914,6 @@ <entry> <key>DOCUMENT</key> </entry> - <entry> - <key>Als Attribut ist der Name aus lib_frame z.B. 'ORG' 'PERS' 'OFFER' etc. zu verwenden.</key> - </entry> <entry> <key>Subordinate campaign of</key> </entry> @@ -4051,9 +3929,6 @@ <entry> <key>Transport damage</key> </entry> - <entry> - <key>Konditionen die bei Angebotserstellung übernommen werden</key> - </entry> <entry> <key>Sport</key> </entry> @@ -4321,9 +4196,6 @@ <entry> <key>Not enough slots for %0/%1 participant(s)</key> </entry> - <entry> - <key>No valid Selection</key> - </entry> <entry> <key>Sender address</key> </entry> @@ -4414,9 +4286,6 @@ <entry> <key>Connection Type</key> </entry> - <entry> - <key>UID (AB_ATTRIBUTEID)</key> - </entry> <entry> <key>Phases</key> </entry> @@ -4501,9 +4370,6 @@ <entry> <key>Dokument template usage</key> </entry> - <entry> - <key>Open admin info</key> - </entry> <entry> <key>USER_NEW_CONTACT</key> </entry> @@ -4519,18 +4385,9 @@ <entry> <key>Is being sent</key> </entry> - <entry> - <key>Preview</key> - </entry> <entry> <key>Content</key> </entry> - <entry> - <key>Bulk mail was sent!</key> - </entry> - <entry> - <key>%0 mails sent sucessfully, %1 mails failed</key> - </entry> <entry> <key>Bulk mail \"%0\" was sent!</key> </entry> @@ -4558,87 +4415,39 @@ <entry> <key>Data Privacy</key> </entry> - <entry> - <key>Attribute data</key> - </entry> <entry> <key>other personal data</key> </entry> <entry> <key>LinkedIn</key> </entry> - <entry> - <key>Kommunikationsdaten</key> - </entry> - <entry> - <key>Es wurden keine Daten anonymisiert.</key> - </entry> <entry> <key>Anonymization</key> </entry> - <entry> - <key>Data Privacies</key> - </entry> - <entry> - <key>advertising consent</key> - </entry> - <entry> - <key>Sonstige personenbezogene Daten</key> - </entry> - <entry> - <key>DSGVO Anonymisierung</key> - </entry> <entry> <key>Names</key> </entry> - <entry> - <key>Namen</key> - </entry> <entry> <key>Update</key> </entry> <entry> <key>The contact has an advertising ban for emails!</key> </entry> - <entry> - <key>Adressdaten</key> - </entry> <entry> <key>Blog</key> </entry> - <entry> - <key>DSGVO Disclosure</key> - </entry> <entry> <key>Disclosure Report</key> </entry> - <entry> - <key>newsletter dispatch</key> - </entry> - <entry> - <key>Folgende Daten wurden anonymisiert: </key> - </entry> <entry> <key>DataPrivacy Right</key> </entry> - <entry> - <key>Address data</key> - </entry> <entry> <key>contract of sale</key> </entry> - <entry> - <key>balancing of interests</key> - </entry> <entry> <key>DataPrivacy Use</key> </entry> - <entry> - <key>Personal data</key> - </entry> - <entry> - <key>Source</key> - </entry> <entry> <key>No data has been anonymized.</key> </entry> @@ -4648,87 +4457,9 @@ <entry> <key>DSGVO anonymisation</key> </entry> - <entry> - <key>Your changes have an impact on the data privacy information (DSGVO).</key> - </entry> <entry> <key>Update data privacy information</key> </entry> - <entry> - <key>CC</key> - </entry> - <entry> - <key>Remarks</key> - </entry> - <entry> - <key>Organisation</key> - </entry> - <entry> - <key>Km</key> - </entry> - <entry> - <key>Billed</key> - </entry> - <entry> - <key>Km Fee</key> - </entry> - <entry> - <key>Credit Card</key> - </entry> - <entry> - <key>Taxi</key> - </entry> - <entry> - <key>Overnight stay</key> - </entry> - <entry> - <key>In creation</key> - </entry> - <entry> - <key>Rented car</key> - </entry> - <entry> - <key>Until</key> - </entry> - <entry> - <key>From</key> - </entry> - <entry> - <key>Park fees</key> - </entry> - <entry> - <key>Abscences</key> - </entry> - <entry> - <key>Expense Report</key> - </entry> - <entry> - <key>Special displays</key> - </entry> - <entry> - <key>Transport cost</key> - </entry> - <entry> - <key>Day Fee</key> - </entry> - <entry> - <key>Fuel</key> - </entry> - <entry> - <key>Month</key> - </entry> - <entry> - <key>Working material</key> - </entry> - <entry> - <key>Hospitality</key> - </entry> - <entry> - <key>Trip purpose</key> - </entry> - <entry> - <key>Bed and Breakfast</key> - </entry> <entry> <key>Update campaign step</key> </entry> @@ -4747,12 +4478,6 @@ <entry> <key>The transfer of data to recipients located in a third country is based on the following guarantees:</key> </entry> - <entry> - <key>MarketingCampaign</key> - </entry> - <entry> - <key>Recipient, Country</key> - </entry> <entry> <key>We save your data until </key> </entry> @@ -4765,9 +4490,6 @@ <entry> <key>Nur eigene anzeigen</key> </entry> - <entry> - <key>CampaignManagement</key> - </entry> <entry> <key>For this report</key> </entry> @@ -4846,9 +4568,6 @@ <entry> <key>Newsletter dispatch</key> </entry> - <entry> - <key>We received data from </key> - </entry> <entry> <key>the number of your applications</key> </entry> @@ -4858,12 +4577,6 @@ <entry> <key>External Datasource</key> </entry> - <entry> - <key>Guarantee</key> - </entry> - <entry> - <key>%0 recipients will be added to the bulk mail.</key> - </entry> <entry> <key>%0 new recipients will be added to the bulk mail.</key> </entry> @@ -4981,9 +4694,6 @@ <entry> <key>seconds</key> </entry> - <entry> - <key>Link automatically</key> - </entry> <entry> <key>Duplicatescan</key> </entry> @@ -5008,6 +4718,423 @@ <entry> <key>Export letter for selection</key> </entry> + <entry> + <key>Privacy agreement</key> + </entry> + <entry> + <key>Sufficient guarantees</key> + </entry> + <entry> + <key>HIGH</key> + </entry> + <entry> + <key>NONE</key> + </entry> + <entry> + <key>LOW</key> + </entry> + <entry> + <key>MAX</key> + </entry> + <entry> + <key>NORMAL</key> + </entry> + <entry> + <key>Categorization</key> + </entry> + <entry> + <key>Phase progression</key> + </entry> + <entry> + <key>Occurrences</key> + </entry> + <entry> + <key>Milestones Phase</key> + </entry> + <entry> + <key>Milestones Status</key> + </entry> + <entry> + <key>Serial letters</key> + </entry> + <entry> + <key>Bulk mails</key> + </entry> + <entry> + <key>The contact is already a recipient!</key> + </entry> + <entry> + <key>New Notifications</key> + </entry> + <entry> + <key>Forecasts</key> + </entry> + <entry> + <key>Relation types</key> + </entry> + <entry> + <key>Data privacy entries</key> + </entry> + <entry> + <key>Timetracking entries</key> + </entry> + <entry> + <key>Appointments</key> + </entry> + <entry> + <key>Support Tickets</key> + </entry> + <entry> + <key>Cost entries</key> + </entry> + <entry> + <key>no valid phone number</key> + </entry> + <entry> + <key>Prognose</key> + </entry> + <entry> + <key>EntityToFilterParam</key> + </entry> + <entry> + <key>Sender</key> + </entry> + <entry> + <key>parameter</key> + </entry> + <entry> + <key>Test DuplicateSearch</key> + </entry> + <entry> + <key>Write bulk mail</key> + </entry> + <entry> + <key>Unlinked e-mail</key> + </entry> + <entry> + <key>(optional) E-Mail to store in contact</key> + </entry> + <entry> + <key>Link unlinked e-mail</key> + </entry> + <entry> + <key>Link e-mail addresses to contacts</key> + </entry> + <entry> + <key>${UNLINKEDMAILMAPPING_ADDITIONAL_LINKS}</key> + </entry> + <entry> + <key>${UNLINKEDMAILMAPPING_ADDITIONAL_LINK}</key> + </entry> + <entry> + <key>Create activity</key> + </entry> + <entry> + <key>Unlinked e-mails</key> + </entry> + <entry> + <key>Download</key> + </entry> + <entry> + <key>Copy Campaign</key> + </entry> + <entry> + <key>Excreted can't be in the future</key> + </entry> + <entry> + <key>Document templates</key> + </entry> + <entry> + <key>Turnover Last Year</key> + </entry> + <entry> + <key>Permission Details</key> + </entry> + <entry> + <key>Number of activities</key> + </entry> + <entry> + <key>Turnover Current Year</key> + </entry> + <entry> + <key>Turnover change</key> + </entry> + <entry> + <key>Remaining tasks and appointments</key> + </entry> + <entry> + <key>Tasks for which I am responsible</key> + </entry> + <entry> + <key>Shows unread notifications about different content, e.g. Appointments, serial mails, ...</key> + </entry> + <entry> + <key>Shows how many sales projects are in the various sales phases</key> + </entry> + <entry> + <key>Most important salse key figures</key> + </entry> + <entry> + <key>Shows the organisations turnover and forecast</key> + </entry> + <entry> + <key>Campaign management</key> + </entry> + <entry> + <key>Should the mail be sent now?</key> + </entry> + <entry> + <key>Add the selection to a bulk mail</key> + </entry> + <entry> + <key>Add the selection to a serial letter</key> + </entry> + <entry> + <key>Campaign costs</key> + </entry> + <entry> + <key>Shows all campaigns</key> + </entry> + <entry> + <key>Shows campaing costs graphically processed</key> + </entry> + <entry> + <key>Shows linked appointments</key> + </entry> + <entry> + <key>Possibility to search for terms</key> + </entry> + <entry> + <key>1</key> + </entry> + <entry> + <key>2</key> + </entry> + <entry> + <key>versendet</key> + </entry> + <entry> + <key>Netto</key> + </entry> + <entry> + <key>Währung</key> + </entry> + <entry> + <key>Transfer to Invoice</key> + </entry> + <entry> + <key>Pay due date</key> + </entry> + <entry> + <key>Invoice</key> + </entry> + <entry> + <key>Payment address</key> + </entry> + <entry> + <key>Receipt Footer Text</key> + </entry> + <entry> + <key>Texts</key> + </entry> + <entry> + <key>keine Standard-E-Mail Büro vorhanden !</key> + </entry> + <entry> + <key>Delivery note</key> + </entry> + <entry> + <key>Belegdatum</key> + </entry> + <entry> + <key>Firma</key> + </entry> + <entry> + <key>Choose payment address</key> + </entry> + <entry> + <key>Paid</key> + </entry> + <entry> + <key>Dunning level</key> + </entry> + <entry> + <key>Order confirmation</key> + </entry> + <entry> + <key>Beleg</key> + </entry> + <entry> + <key>Order Type</key> + </entry> + <entry> + <key>Notice</key> + </entry> + <entry> + <key>Bitte einen Adressat in 'to' eintragen!</key> + </entry> + <entry> + <key>Receipt Header Text</key> + </entry> + <entry> + <key>Dunning text</key> + </entry> + <entry> + <key>Choose delivery address</key> + </entry> + <entry> + <key>Cancellation</key> + </entry> + <entry> + <key>Links</key> + </entry> + <entry> + <key>geprüft</key> + </entry> + <entry> + <key>Set dunning</key> + </entry> + <entry> + <key>Beleg-Nr.</key> + </entry> + <entry> + <key>Cancel</key> + </entry> + <entry> + <key>Set to sent</key> + </entry> + <entry> + <key>Set paid amount</key> + </entry> + <entry> + <key>Belegliste</key> + </entry> + <entry> + <key>Pay date</key> + </entry> + <entry> + <key>Transfer to delivery note</key> + </entry> + <entry> + <key>Dunning date</key> + </entry> + <entry> + <key>Credit</key> + </entry> + <entry> + <key>Print order</key> + </entry> + <entry> + <key>Create activities</key> + </entry> + <entry> + <key>Adds the selection to a bulk mail</key> + </entry> + <entry> + <key>Order number</key> + </entry> + <entry> + <key>Permission Action</key> + </entry> + <entry> + <key>Filter</key> + </entry> + <entry> + <key>Recipient status</key> + </entry> + <entry> + <key>Adds the selection to a serial letter</key> + </entry> + <entry> + <key>Actions</key> + </entry> + <entry> + <key>Test email</key> + </entry> + <entry> + <key>Reminder</key> + </entry> + <entry> + <key>Print reminder</key> + </entry> + <entry> + <key>Rech.-Betrag</key> + </entry> + <entry> + <key>Order date</key> + </entry> + <entry> + <key>Due date</key> + </entry> + <entry> + <key>Order amount</key> + </entry> + <entry> + <key>Mahnung</key> + </entry> + <entry> + <key>Due</key> + </entry> + <entry> + <key>Testing contact</key> + </entry> + <entry> + <key>Recipient address</key> + </entry> + <entry> + <key>Testing</key> + </entry> + <entry> + <key>Save settings</key> + </entry> + <entry> + <key>No calls</key> + </entry> + <entry> + <key>No mails</key> + </entry> + <entry> + <key>No fax</key> + </entry> + <entry> + <key>No SMS</key> + </entry> + <entry> + <key>No letters</key> + </entry> + <entry> + <key>Only </key> + </entry> + <entry> + <key>Theme</key> + </entry> + <entry> + <key>Action '</key> + </entry> + <entry> + <key>No duplicates allowed: action '</key> + </entry> + <entry> + <key>Empty actions are not allowed!</key> + </entry> + <entry> + <key>Download template</key> + </entry> + <entry> + <key>Bulk mail \"%0\" sent</key> + </entry> + <entry> + <key>This error should never appear - contact administrator.</key> + </entry> + <entry> + <key>Entrydate (Year)</key> + </entry> + <entry> + <key>Permissions without actions are not allowed!</key> + </entry> + <entry> + <key>Attributes must be unique!</key> + </entry> <entry> <key>Export letter</key> </entry> diff --git a/neonContext/BulkMail/BulkMail.aod b/neonContext/BulkMail/BulkMail.aod index 8001515cc6c87991d8701f4cfe4ffd8168388acb..b6e2ea9a7a328a517cbb068c11196aec2e4d4826 100644 --- a/neonContext/BulkMail/BulkMail.aod +++ b/neonContext/BulkMail/BulkMail.aod @@ -27,7 +27,11 @@ </neonViewReference> <neonViewReference> <name>6b057fb0-94ac-4bca-88b2-c97fdfcf9d6e</name> - <view>BulkMailTest_view</view> + <view>BulkMailContent_view</view> + </neonViewReference> + <neonViewReference> + <name>fb5bc6ed-d3c9-45ef-a0c7-17b190e3ce74</name> + <view>BulkMailMainPreview_view</view> </neonViewReference> </references> </neonContext> diff --git a/neonContext/BulkMailStatusChart/BulkMailStatusChart.aod b/neonContext/BulkMailStatusChart/BulkMailStatusChart.aod new file mode 100644 index 0000000000000000000000000000000000000000..da6eee86883a6fd594f8c90e0284a354782b6519 --- /dev/null +++ b/neonContext/BulkMailStatusChart/BulkMailStatusChart.aod @@ -0,0 +1,12 @@ +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>BulkMailStatusChart</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>BulkMailStatusChart_entity</entity> + <references> + <neonViewReference> + <name>403b6458-f106-436c-abf7-5620ecb42eae</name> + <view>BulkMailStatusChart_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/BulkMailTesting/BulkMailTesting.aod b/neonContext/BulkMailTesting/BulkMailTesting.aod new file mode 100644 index 0000000000000000000000000000000000000000..bd41c66175b414b5760d29f1ac787d6658501b30 --- /dev/null +++ b/neonContext/BulkMailTesting/BulkMailTesting.aod @@ -0,0 +1,12 @@ +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>BulkMailTesting</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>BulkMailTesting_entity</entity> + <references> + <neonViewReference> + <name>5ed51616-707d-4418-b63a-2e884f903cb3</name> + <view>BulkMailTesting_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/CommRestriction/CommRestriction.aod b/neonContext/CommRestriction/CommRestriction.aod index 4b27ac29d8604030f95e86435e67a6d0249c4c59..e7734b9ca4dcd2913a142c2639a69027dcedc7f8 100644 --- a/neonContext/CommRestriction/CommRestriction.aod +++ b/neonContext/CommRestriction/CommRestriction.aod @@ -20,5 +20,9 @@ <name>c0ffb2e0-0190-47ee-aa0a-e774fe5400fb</name> <view>CommRestrictionPreview_view</view> </neonViewReference> + <neonViewReference> + <name>0f29e6bd-f4cb-488f-867f-a65b84ba341f</name> + <view>CommRestrictionDrawer_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/DSGVO/DSGVO.aod b/neonContext/DSGVO/DSGVO.aod index 3b01fff52f6de6d910e943d3aace9fd3dcf4a139..06c58cb090b1d6a885e4cf394694a6c55a34fcfc 100644 --- a/neonContext/DSGVO/DSGVO.aod +++ b/neonContext/DSGVO/DSGVO.aod @@ -23,5 +23,9 @@ <name>4cf0e8c3-900a-43f1-a2c0-3f8990644b64</name> <view>DSGVOPreview_view</view> </neonViewReference> + <neonViewReference> + <name>5be7aa7b-2b66-41e1-b1f5-f86af1f6e50d</name> + <view>DSGVODrawer_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/KeywordEntry/KeywordEntry.aod b/neonContext/KeywordEntry/KeywordEntry.aod index 9c8eee02ee349531f5f2bb4cf2bdcfcdb084fc5d..a42880585c7a8d5b9a2eaccd30fa44fbf0e38a33 100644 --- a/neonContext/KeywordEntry/KeywordEntry.aod +++ b/neonContext/KeywordEntry/KeywordEntry.aod @@ -4,7 +4,6 @@ <title>Keyword</title> <description><null value></description> <majorModelMode>DISTRIBUTED</majorModelMode> - <mainview>KeywordEntryMain_view</mainview> <filterview>KeywordEntryFilter_view</filterview> <editview>KeywordEntryEdit_view</editview> <preview>KeywordEntryPreview_view</preview> @@ -22,13 +21,5 @@ <name>9bb352b9-5a8c-41ac-9c42-7f4f7f4827f3</name> <view>KeywordEntryPreview_view</view> </neonViewReference> - <neonViewReference> - <name>bba3520e-3e12-44e9-89dc-b42183e332ec</name> - <view>KeywordEntryMain_view</view> - </neonViewReference> - <neonViewReference> - <name>fb697cca-5e7d-4814-a6ed-09f32f9f60fd</name> - <view>KeywordEntryMainSide_view</view> - </neonViewReference> </references> </neonContext> diff --git a/neonContext/LetterRecipient/LetterRecipient.aod b/neonContext/LetterRecipient/LetterRecipient.aod index f5abaff8b05b29e80fffa4ea065c85da321aa051..1cffd97b9ec08e07e062a357f31c665f643ebe0a 100644 --- a/neonContext/LetterRecipient/LetterRecipient.aod +++ b/neonContext/LetterRecipient/LetterRecipient.aod @@ -1,13 +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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> - <name>LetterRecipient</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterview>LetterRecipientFilter_view</filterview> - <entity>LetterRecipient_entity</entity> - <references> - <neonViewReference> - <name>7dd21dff-43c3-4595-a377-06a286e0df0e</name> - <view>LetterRecipientFilter_view</view> - </neonViewReference> - </references> -</neonContext> +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>LetterRecipient</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterview>LetterRecipientFilter_view</filterview> + <editview>LetterRecipientEdit_view</editview> + <entity>LetterRecipient_entity</entity> + <references> + <neonViewReference> + <name>7dd21dff-43c3-4595-a377-06a286e0df0e</name> + <view>LetterRecipientFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>18aac426-4cfa-46b3-b2e4-03e425a19eb0</name> + <view>LetterRecipientEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/Order/Order.aod b/neonContext/Order/Order.aod index d4e54824f96757373a0e44b20dd6037ce53cbe3c..88ec8b568937b828c6239ce2562db76e591627f8 100644 --- a/neonContext/Order/Order.aod +++ b/neonContext/Order/Order.aod @@ -1,35 +1,51 @@ -<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> - <name>Order</name> - <title>Receipt</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>VAADIN:FILE_TEXT_O</icon> - <mainview>OrderMain_view</mainview> - <filterview>OrderFilter_view</filterview> - <editview>OrderEdit_view</editview> - <preview>OrderPreview_view</preview> - <lookupview>OrderFilter_view</lookupview> - <entity>Order_entity</entity> - <references> - <neonViewReference> - <name>e9de537a-43e9-4ea3-9da4-0a4812954543</name> - <view>OrderDetail_view</view> - </neonViewReference> - <neonViewReference> - <name>dba88ac9-716e-4907-8bc7-9a623fbad1e1</name> - <view>OrderFilter_view</view> - </neonViewReference> - <neonViewReference> - <name>53966f88-a6e9-4b41-8c71-2ebbbaf2e568</name> - <view>OrderMain_view</view> - </neonViewReference> - <neonViewReference> - <name>1015ce77-7be5-4d70-8b35-2953a5b25a2a</name> - <view>OrderPreview_view</view> - </neonViewReference> - <neonViewReference> - <name>26c6c56a-7e5a-4101-884a-41f522f071ae</name> - <view>OrderEdit_view</view> - </neonViewReference> - </references> -</neonContext> +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>Order</name> + <title>Receipt</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:FILE_TEXT_O</icon> + <mainview>OrderMain_view</mainview> + <filterview>OrderFilter_view</filterview> + <editview>OrderEdit_view</editview> + <preview>OrderPreview_view</preview> + <lookupview>OrderFilter_view</lookupview> + <entity>Order_entity</entity> + <references> + <neonViewReference> + <name>e9de537a-43e9-4ea3-9da4-0a4812954543</name> + <view>OrderDetail_view</view> + </neonViewReference> + <neonViewReference> + <name>dba88ac9-716e-4907-8bc7-9a623fbad1e1</name> + <view>OrderFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>53966f88-a6e9-4b41-8c71-2ebbbaf2e568</name> + <view>OrderMain_view</view> + </neonViewReference> + <neonViewReference> + <name>1015ce77-7be5-4d70-8b35-2953a5b25a2a</name> + <view>OrderPreview_view</view> + </neonViewReference> + <neonViewReference> + <name>26c6c56a-7e5a-4101-884a-41f522f071ae</name> + <view>OrderEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>ac222647-40b8-43e3-a054-edfc3d69106b</name> + <view>OrderLink_view</view> + </neonViewReference> + <neonViewReference> + <name>e8fb5f3b-e166-4ee3-9752-e20d9aec0e75</name> + <view>OrderClassification_view</view> + </neonViewReference> + <neonViewReference> + <name>cea44230-2a80-4a3e-9dc4-3d199f8f6edc</name> + <view>OrderDunning_view</view> + </neonViewReference> + <neonViewReference> + <name>5a70d5cf-d1d8-4773-900c-1376f5b9a988</name> + <view>OrderPaid_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/Orderitem/Orderitem.aod b/neonContext/Orderitem/Orderitem.aod index eef110136d8d776a4ef989980323dca83d2cadcd..0c47397ed44b52deee83a6d824751cc669184548 100644 --- a/neonContext/Orderitem/Orderitem.aod +++ b/neonContext/Orderitem/Orderitem.aod @@ -2,6 +2,9 @@ <neonContext 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/neonContext/1.1.0"> <name>Orderitem</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <filterview>OrderitemFilter_view</filterview> + <editview>OrderitemEdit_view</editview> + <preview>OrderitemPreview_view</preview> <entity>Orderitem_entity</entity> <references> <neonViewReference> @@ -16,5 +19,9 @@ <name>f86311e6-1afa-4470-be34-ce145d3570b2</name> <view>OrderitemPreview_view</view> </neonViewReference> + <neonViewReference> + <name>7da75934-7cc5-4271-a054-a6e82007b25c</name> + <view>OrderitemEdit_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/PermissionAction/PermissionAction.aod b/neonContext/PermissionAction/PermissionAction.aod new file mode 100644 index 0000000000000000000000000000000000000000..d59ee2df144a9e3cff48b0f6a69a2063c6ab5a71 --- /dev/null +++ b/neonContext/PermissionAction/PermissionAction.aod @@ -0,0 +1,17 @@ +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>PermissionAction</name> + <title>Permission Action</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>PermissionAction_entity</entity> + <references> + <neonViewReference> + <name>e2098ef8-52da-4a97-abf9-e313be9ba43f</name> + <view>PermissionActionEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>2d27ce8b-7676-4db8-9644-006b2d83d61f</name> + <view>PermissionActionFilter_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/Person/Person.aod b/neonContext/Person/Person.aod index 07f8c24364ee6b4716b75d392b44c9d5116f9f98..7a804792a5b5bf5fe6bf80f20f2d8bb40b7f8ed7 100644 --- a/neonContext/Person/Person.aod +++ b/neonContext/Person/Person.aod @@ -3,6 +3,7 @@ <name>Person</name> <title>Contact</title> <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:USERS</icon> <mainview>PersonMain_view</mainview> <filterview>PersonFilter_view</filterview> <editview>PersonEdit_view</editview> @@ -46,5 +47,13 @@ <name>fc7e2546-b42a-48c0-8670-2d4033ad0598</name> <view>PersonTaskAppointment_view</view> </neonViewReference> + <neonViewReference> + <name>296af7da-1994-49a3-a26f-903f29609fae</name> + <view>PersonAttributeRestriction_view</view> + </neonViewReference> + <neonViewReference> + <name>c91a69c4-8699-4117-9154-cb6be65f6a69</name> + <view>PersonDataPrivacy_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/Prod2prod/Prod2prod.aod b/neonContext/Prod2prod/Prod2prod.aod index 00dad8c407034533c52c2d6eb08cae568a25a7c9..b80bbf86edffeb5fec59e32fabcdb97ee1567989 100644 --- a/neonContext/Prod2prod/Prod2prod.aod +++ b/neonContext/Prod2prod/Prod2prod.aod @@ -1,20 +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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> - <name>Prod2prod</name> - <title></title> - <comment>Prod2Prod is mainly used for the parts list of products</comment> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterview>Prod2prodFilter_view</filterview> - <editview>Prod2ProdEdit_view</editview> - <entity>Prod2prod_entity</entity> - <references> - <neonViewReference> - <name>0f388c5e-7873-49de-8396-16a2e01dfa84</name> - <view>Prod2prodFilter_view</view> - </neonViewReference> - <neonViewReference> - <name>428b22a1-427f-4547-a478-964442078bc1</name> - <view>Prod2ProdEdit_view</view> - </neonViewReference> - </references> -</neonContext> +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>Prod2prod</name> + <title>Parts list</title> + <comment>Prod2Prod is mainly used for the parts list of products</comment> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterview>Prod2prodFilter_view</filterview> + <editview>Prod2ProdEdit_view</editview> + <entity>Prod2prod_entity</entity> + <references> + <neonViewReference> + <name>0f388c5e-7873-49de-8396-16a2e01dfa84</name> + <view>Prod2prodFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>428b22a1-427f-4547-a478-964442078bc1</name> + <view>Prod2ProdEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/Product/Product.aod b/neonContext/Product/Product.aod index a91bfe8529ca21610ebc1edcea60092691199a93..48e0689ad689e2e10a99877fb4ab129bac24b0e6 100644 --- a/neonContext/Product/Product.aod +++ b/neonContext/Product/Product.aod @@ -3,6 +3,7 @@ <name>Product</name> <title>Product</title> <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:HAMMER</icon> <mainview>ProductMain_view</mainview> <filterview>ProductFilter_view</filterview> <editview>ProductEdit_view</editview> diff --git a/neonContext/Productprice/Productprice.aod b/neonContext/Productprice/Productprice.aod index 705012cef4192bf010547b88fdacc2242bf92dd7..52e0c4aa761b241c4a0a17410e29554faf3d3666 100644 --- a/neonContext/Productprice/Productprice.aod +++ b/neonContext/Productprice/Productprice.aod @@ -2,6 +2,7 @@ <neonContext 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/neonContext/1.1.0"> <name>Productprice</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:MONEY</icon> <filterview>ProductpriceFilter_view</filterview> <editview>ProductpriceEdit_view</editview> <preview>ProductpricePreview_view</preview> @@ -23,5 +24,9 @@ <name>590ab927-5303-451b-824a-c16adfb00772</name> <view>ProductpricePreview_view</view> </neonViewReference> + <neonViewReference> + <name>ff71c944-42f4-46ff-bb61-2b7205609a49</name> + <view>ProductpriceForProductFilter_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/Salesproject/Salesproject.aod b/neonContext/Salesproject/Salesproject.aod index 93eddff13862c77ac7d29a6470c8d70a519099e6..26e1a368de5c2bd997096b394ebac3ea0c7c6038 100644 --- a/neonContext/Salesproject/Salesproject.aod +++ b/neonContext/Salesproject/Salesproject.aod @@ -75,5 +75,13 @@ <name>1c957028-bf6b-4b9c-9b46-60f8b53f9edd</name> <view>SaleprojectOverviewCharts_view</view> </neonViewReference> + <neonViewReference> + <name>42bc01e0-ba80-4e7f-bcf9-30b3d647f565</name> + <view>SalesprojectClassificationDrawer_view</view> + </neonViewReference> + <neonViewReference> + <name>8db978be-4362-48e2-9cc9-6b6774d92f5a</name> + <view>SalesprojectForecastDrawer_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/SalesprojectMilestone/SalesprojectMilestone.aod b/neonContext/SalesprojectMilestone/SalesprojectMilestone.aod index 08aae3b687227450b3c4c886e03285a58e17cae9..93653cb716a220c1864945dea9c74f2cd46a813c 100644 --- a/neonContext/SalesprojectMilestone/SalesprojectMilestone.aod +++ b/neonContext/SalesprojectMilestone/SalesprojectMilestone.aod @@ -3,16 +3,20 @@ <name>SalesprojectMilestone</name> <description>Milestones of a salesproject</description> <majorModelMode>DISTRIBUTED</majorModelMode> - <filterview>SalesprojectMilestoneChart_view</filterview> + <filterview>SalesprojectMilestoneChartPhase_view</filterview> <entity>SalesprojectMilestone_entity</entity> <references> <neonViewReference> <name>54bee07a-f45d-458a-bfc6-56ba4992b63d</name> - <view>SalesprojectMilestoneChart_view</view> + <view>SalesprojectMilestoneChartPhase_view</view> </neonViewReference> <neonViewReference> <name>8efe4695-9e0c-43e5-876c-374338a346af</name> <view>SalesprojectMilestoneInfo_view</view> </neonViewReference> + <neonViewReference> + <name>e3909e48-c921-47db-9e83-d95674490c4e</name> + <view>SalesprojectMilestoneChartState_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/Turnover/Turnover.aod b/neonContext/Turnover/Turnover.aod index bcc760c0b99eb813dd254fcb9eff490bf394e2e4..4c52db361ddbf3d941e4f35b1993db729225fa5a 100644 --- a/neonContext/Turnover/Turnover.aod +++ b/neonContext/Turnover/Turnover.aod @@ -14,5 +14,9 @@ <name>539f403e-f2c2-4459-9193-fefc236204ad</name> <view>TurnoverChartForecast_view</view> </neonViewReference> + <neonViewReference> + <name>29a44f69-d9a5-4916-8242-4ba470506d92</name> + <view>TurnoverChartForcastDrawer_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/UnlinkedMailMappingLink/UnlinkedMailMappingLink.aod b/neonContext/UnlinkedMailMappingLink/UnlinkedMailMappingLink.aod new file mode 100644 index 0000000000000000000000000000000000000000..6546416194e47b77440f69a3e60cd392caf267b9 --- /dev/null +++ b/neonContext/UnlinkedMailMappingLink/UnlinkedMailMappingLink.aod @@ -0,0 +1,12 @@ +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>UnlinkedMailMappingLink</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>UnlinkedMailMappingLink_entity</entity> + <references> + <neonViewReference> + <name>dd9bfc47-a38c-4d54-89a1-2e95323a1ceb</name> + <view>UnlinkedMailMappingLinkList_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonContext/UnlinkedMailMappingWrapper/UnlinkedMailMappingWrapper.aod b/neonContext/UnlinkedMailMappingWrapper/UnlinkedMailMappingWrapper.aod new file mode 100644 index 0000000000000000000000000000000000000000..d270b74d5ea0f79aadbc5f879922644c3d03cc79 --- /dev/null +++ b/neonContext/UnlinkedMailMappingWrapper/UnlinkedMailMappingWrapper.aod @@ -0,0 +1,13 @@ +<?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.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.0"> + <name>UnlinkedMailMappingWrapper</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <editview>UnlinkedMailMappingWrapperMapping_view</editview> + <entity>UnlinkedMailMappingWrapper_entity</entity> + <references> + <neonViewReference> + <name>22ac623a-2cb6-46f2-ac22-561ad7e9a0da</name> + <view>UnlinkedMailMappingWrapperMapping_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonDashboard/Home/Home.aod b/neonDashboard/Home/Home.aod index 82a843b819c93a5c5ffbde865c5fefbebd84cf78..0d73ce30727ec5887d834f8efca238cf4d9745c5 100644 --- a/neonDashboard/Home/Home.aod +++ b/neonDashboard/Home/Home.aod @@ -57,8 +57,8 @@ </neonDashlet> <neonDashlet> <name>Dashlet5</name> - <viewName>ActivityFilter_view</viewName> - <configName>InnateActivitiesDashlet</configName> + <viewName>NotificationFilter_view</viewName> + <configName>NotificationDashletConfiguration</configName> <uiConfiguration> <name>uiConfiguration</name> <xPos v="1" /> diff --git a/neonNotificationType/DownloadReady/onResultOpen.js b/neonNotificationType/DownloadReady/onResultOpen.js index 36c2e4242a33907fbc3744b4776675dd74b58459..eeb3fb518402c487ce24684d38dc2ba296b03249 100644 --- a/neonNotificationType/DownloadReady/onResultOpen.js +++ b/neonNotificationType/DownloadReady/onResultOpen.js @@ -1,21 +1,18 @@ -import("system.logging"); -import("system.vars"); - -var varses = [ - "$local.content", - "$local.data", - "$local.description", - "$local.idvalue", - "$local.idvalues", - "$local.row", - "$local.row_id", - "$local.rowdata", - "$local.uid", - "$local.binId", -]; -var existses = {}; -varses.forEach(function (v) { - this[v] = vars.exists(v); -}, existses); - -logging.log(JSON.stringify(existses, null, "\t")) \ No newline at end of file +import("system.vars"); + +var varses = [ + "$local.content", + "$local.data", + "$local.description", + "$local.idvalue", + "$local.idvalues", + "$local.row", + "$local.row_id", + "$local.rowdata", + "$local.uid", + "$local.binId", +]; +var existses = {}; +varses.forEach(function (v) { + this[v] = vars.exists(v); +}, existses); \ No newline at end of file diff --git a/neonView/360DegreeFilter_view/360DegreeFilter_view.aod b/neonView/360DegreeFilter_view/360DegreeFilter_view.aod index fea00e6a3eaad4b41c47b071673be1b2ce3bc11a..ee49c6301c367d2dfb8b5caf4bd8ff74e64cd10e 100644 --- a/neonView/360DegreeFilter_view/360DegreeFilter_view.aod +++ b/neonView/360DegreeFilter_view/360DegreeFilter_view.aod @@ -1,31 +1,31 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>360DegreeFilter_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> - <layout> - <groupLayout> - <name>layout</name> - </groupLayout> - </layout> - <children> - <treeViewTemplate> - <name>Treetable</name> - <favoriteActionGroup2>newModule</favoriteActionGroup2> - <titleField>TITLE</titleField> - <descriptionField>DATE</descriptionField> - <iconField>ICON</iconField> - <defaultGroupFields> - <element>CONTEXT_NAME</element> - </defaultGroupFields> - <entityField>#ENTITY</entityField> - </treeViewTemplate> - <timelineViewTemplate> - <name>Timeline</name> - <dateField>DATE</dateField> - <titleField>TITLE</titleField> - <descriptionField>CONTEXT_NAME</descriptionField> - <entityField>#ENTITY</entityField> - </timelineViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>360DegreeFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <layout> + <groupLayout> + <name>layout</name> + </groupLayout> + </layout> + <children> + <treeViewTemplate> + <name>Treetable</name> + <favoriteActionGroup2>newModule</favoriteActionGroup2> + <titleField>TITLE</titleField> + <descriptionField>DATE</descriptionField> + <iconField>ICON</iconField> + <defaultGroupFields> + <element>CONTEXT_NAME</element> + </defaultGroupFields> + <entityField>#ENTITY</entityField> + </treeViewTemplate> + <timelineViewTemplate> + <name>Timeline</name> + <dateField>DATE</dateField> + <titleField>TITLE</titleField> + <descriptionField>CONTEXT_NAME</descriptionField> + <entityField>#ENTITY</entityField> + </timelineViewTemplate> + </children> +</neonView> diff --git a/neonView/ActivityDetail_view/ActivityDetail_view.aod b/neonView/ActivityDetail_view/ActivityDetail_view.aod index 0d6fcca22d1325f180996bdb408926f013493491..3e27e5c05feca4c203ceb49506acd40d42f46985 100644 --- a/neonView/ActivityDetail_view/ActivityDetail_view.aod +++ b/neonView/ActivityDetail_view/ActivityDetail_view.aod @@ -1,28 +1,37 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>ActivityDetail_view</name> - <title>Description</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>OfferInfo</name> - <editMode v="false" /> - <showDrawer v="true" /> - <drawerCaption></drawerCaption> - <fixedDrawer v="true" /> - <hideLabels v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>c7e75393-4745-478b-9f89-878b9a19b722</name> - <entityField>INFO</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ActivityDetail_view</name> + <title>Description</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + <direction>HORIZONTAL</direction> + <maxDirectionElements v="2" /> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>f3e3d589-16a5-45a3-878f-7f00548c4370</name> + <entityField>ActivityAtrributes</entityField> + <view>AttributeTree_view</view> + </neonViewReference> + <neonViewReference> + <name>9a9c4df0-abec-42b8-af90-b9fe57f28337</name> + <entityField>AttributeTreeIsTheme</entityField> + <view>AttributeRelationTree_view</view> + </neonViewReference> + <genericViewTemplate> + <name>Generic</name> + <showDrawer v="true" /> + <fixedDrawer v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>ca781b9b-9e93-41c3-9373-cb559c347194</name> + <entityField>INFO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/ActivityDrawer_view/ActivityDrawer_view.aod b/neonView/ActivityDrawer_view/ActivityDrawer_view.aod index 432a1ebbffbc7b85f4d42fc5dffbc92af7d7ac58..15b80657d260e559855a05415fb8ca690a624d81 100644 --- a/neonView/ActivityDrawer_view/ActivityDrawer_view.aod +++ b/neonView/ActivityDrawer_view/ActivityDrawer_view.aod @@ -1,19 +1,19 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>ActivityDrawer_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <drawerLayout> - <name>layout</name> - <layoutCaption>Activities</layoutCaption> - <fixedDrawer v="true" /> - </drawerLayout> - </layout> - <children> - <neonViewReference> - <name>9a0bf95e-8e6f-47ac-aff0-c420d5fb86aa</name> - <entityField>#ENTITY</entityField> - <view>ActivityFilter_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ActivityDrawer_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Activities</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <neonViewReference> + <name>9a0bf95e-8e6f-47ac-aff0-c420d5fb86aa</name> + <entityField>#ENTITY</entityField> + <view>ActivityFilter_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/ActivityEdit_view/ActivityEdit_view.aod b/neonView/ActivityEdit_view/ActivityEdit_view.aod index 9104cb060a28c3a3abf60e4e6fe25feff6c5435d..6c5f95b50c631abaec7d35e3882b0b2f33e13a04 100644 --- a/neonView/ActivityEdit_view/ActivityEdit_view.aod +++ b/neonView/ActivityEdit_view/ActivityEdit_view.aod @@ -1,56 +1,56 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>ActivityEdit_view</name> - <title>Activity</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>VAADIN:HOURGLASS_END</icon> - <quickEntry v="3" /> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Edit</name> - <editMode v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>290c8b73-4078-47eb-8009-a011f0ae670c</name> - <entityField>SUBJECT</entityField> - </entityFieldLink> - <entityFieldLink> - <name>b90a5d96-9d1f-4eeb-b42c-0debeb7cf260</name> - <entityField>INFO</entityField> - </entityFieldLink> - <entityFieldLink> - <name>d767e312-b28a-42e9-9e7d-b4ad82f25ff0</name> - <entityField>DIRECTION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>a787b6c0-078d-47ff-9bff-eee1623d1760</name> - <entityField>ENTRYDATE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>921a6690-43dc-488b-ae0a-4a0ab88a99ab</name> - <entityField>CATEGORY</entityField> - </entityFieldLink> - <entityFieldLink> - <name>91514e62-f4f7-4eb7-84c0-8d94adbb3408</name> - <entityField>RESPONSIBLE</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - <neonViewReference> - <name>868cfbbe-f5f4-48d1-88cd-56207e0e6dcc</name> - <entityField>Links</entityField> - <view>ActivityLinkMultiEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>7fcf9c09-189a-47b7-a171-9975676ed704</name> - <entityField>Attributes</entityField> - <view>AttributeRelationMultiEdit_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ActivityEdit_view</name> + <title>Activity</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:HOURGLASS_END</icon> + <quickEntry v="3" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>290c8b73-4078-47eb-8009-a011f0ae670c</name> + <entityField>SUBJECT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b90a5d96-9d1f-4eeb-b42c-0debeb7cf260</name> + <entityField>INFO</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d767e312-b28a-42e9-9e7d-b4ad82f25ff0</name> + <entityField>DIRECTION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>a787b6c0-078d-47ff-9bff-eee1623d1760</name> + <entityField>ENTRYDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>921a6690-43dc-488b-ae0a-4a0ab88a99ab</name> + <entityField>CATEGORY</entityField> + </entityFieldLink> + <entityFieldLink> + <name>91514e62-f4f7-4eb7-84c0-8d94adbb3408</name> + <entityField>RESPONSIBLE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <neonViewReference> + <name>868cfbbe-f5f4-48d1-88cd-56207e0e6dcc</name> + <entityField>Links</entityField> + <view>ActivityLinkMultiEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>7fcf9c09-189a-47b7-a171-9975676ed704</name> + <entityField>Attributes</entityField> + <view>AttributeRelationMultiEdit_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/ActivityMain_view/ActivityMain_view.aod b/neonView/ActivityMain_view/ActivityMain_view.aod index 7e6b4d9d31aebfb618f6ea6945be82ca0badb0f6..ab6b487ce18af1700ed1a7461f8364c11239e52d 100644 --- a/neonView/ActivityMain_view/ActivityMain_view.aod +++ b/neonView/ActivityMain_view/ActivityMain_view.aod @@ -1,38 +1,38 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>ActivityMain_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <masterSlaveLayout> - <name>layout</name> - <master>25da1e58-2fb4-4db4-8a46-9af73074c22c</master> - </masterSlaveLayout> - </layout> - <children> - <neonViewReference> - <name>25da1e58-2fb4-4db4-8a46-9af73074c22c</name> - <entityField>#ENTITY</entityField> - <view>ActivityPreview_view</view> - </neonViewReference> - <neonViewReference> - <name>a3a45cd7-587f-4bc0-9980-e6d1c89a8212</name> - <entityField>#ENTITY</entityField> - <view>ActivityDetail_view</view> - </neonViewReference> - <neonViewReference> - <name>f6c6888a-f3d6-410a-b97b-30c34a9dd6a2</name> - <entityField>ModuleTrees</entityField> - <view>ModuleTree_view</view> - </neonViewReference> - <neonViewReference> - <name>f57fb116-d356-47c7-8da6-ee64b4a01b46</name> - <entityField>AttributeTree</entityField> - <view>AttributeRelationTree_view</view> - </neonViewReference> - <neonViewReference> - <name>7bab8dbf-b69e-412d-a604-3a6999658e10</name> - <entityField>Documents</entityField> - <view>DocumentFilter_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ActivityMain_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <masterSlaveLayout> + <name>layout</name> + <master>25da1e58-2fb4-4db4-8a46-9af73074c22c</master> + </masterSlaveLayout> + </layout> + <children> + <neonViewReference> + <name>25da1e58-2fb4-4db4-8a46-9af73074c22c</name> + <entityField>#ENTITY</entityField> + <view>ActivityPreview_view</view> + </neonViewReference> + <neonViewReference> + <name>a3a45cd7-587f-4bc0-9980-e6d1c89a8212</name> + <entityField>#ENTITY</entityField> + <view>ActivityDetail_view</view> + </neonViewReference> + <neonViewReference> + <name>f6c6888a-f3d6-410a-b97b-30c34a9dd6a2</name> + <entityField>ModuleTrees</entityField> + <view>ModuleTree_view</view> + </neonViewReference> + <neonViewReference> + <name>f57fb116-d356-47c7-8da6-ee64b4a01b46</name> + <entityField>AttributeTree</entityField> + <view>AttributeRelationTree_view</view> + </neonViewReference> + <neonViewReference> + <name>7bab8dbf-b69e-412d-a604-3a6999658e10</name> + <entityField>Documents</entityField> + <view>DocumentFilter_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/AddressList_view/AddressList_view.aod b/neonView/AddressList_view/AddressList_view.aod index f108e9adc2318366a3c02887429e9b4d44f799eb..10095234b558f9901fbf2462387c9117b99826dc 100644 --- a/neonView/AddressList_view/AddressList_view.aod +++ b/neonView/AddressList_view/AddressList_view.aod @@ -50,6 +50,10 @@ <name>935bcecf-fdd9-4e82-a53f-3c3082c85340</name> <entityField>BUILDINGNO</entityField> </neonTableColumn> + <neonTableColumn> + <name>6e369a01-965f-41d9-9b0a-6128a3827e47</name> + <entityField>ADDRESSADDITION</entityField> + </neonTableColumn> <neonTableColumn> <name>6af52273-25bf-4286-83cc-217aea94ad09</name> <entityField>ADDRIDENTIFIER</entityField> diff --git a/neonView/AddressLookup_view/AddressLookup_view.aod b/neonView/AddressLookup_view/AddressLookup_view.aod index b42f03b1ed6affa4dc5560b5828e044c15d680c1..f4a662aa314aac1b9e46c8890490456877bb0cd3 100644 --- a/neonView/AddressLookup_view/AddressLookup_view.aod +++ b/neonView/AddressLookup_view/AddressLookup_view.aod @@ -48,6 +48,10 @@ <name>9651a718-ab01-4c97-8da0-6e7133f26466</name> <entityField>REGION</entityField> </neonTableColumn> + <neonTableColumn> + <name>9a5b1c97-c2b5-4f3a-b845-7cf56c0cb4eb</name> + <entityField>ADDRESSADDITION</entityField> + </neonTableColumn> <neonTableColumn> <name>24f73ac8-ac90-4beb-83fe-bdaa2d0806b6</name> <entityField>ADDRIDENTIFIER</entityField> diff --git a/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod b/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod index 92c6d10ee43549b6440cf480efc47c16f40c98f3..e7a369269f249718e54c683682892202a415a3b0 100644 --- a/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod +++ b/neonView/AdressMultiEdit_view/AdressMultiEdit_view.aod @@ -50,6 +50,10 @@ <name>61261845-740e-4f4b-a1f8-5e6aeac2deba</name> <entityField>BUILDINGNO</entityField> </neonTableColumn> + <neonTableColumn> + <name>37df9198-cb7b-4080-a040-21ed32e26948</name> + <entityField>ADDRESSADDITION</entityField> + </neonTableColumn> <neonTableColumn> <name>443b9d7d-dac2-40b2-bb2b-d5e0091877a9</name> <entityField>ADDRIDENTIFIER</entityField> diff --git a/neonView/AnyContactLookup_view/AnyContactLookup_view.aod b/neonView/AnyContactLookup_view/AnyContactLookup_view.aod index ad0693a501347c51e7ee554afdab84b54227f42d..ddfce75ee73028bd0ecfe20ebccbc041946c5891 100644 --- a/neonView/AnyContactLookup_view/AnyContactLookup_view.aod +++ b/neonView/AnyContactLookup_view/AnyContactLookup_view.aod @@ -1,44 +1,44 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>AnyContactLookup_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Relations</name> - <entityField>#ENTITY</entityField> - <columns> - <neonTableColumn> - <name>5a0d38bb-bfa5-4abc-86e7-fac65804bb5c</name> - <entityField>IMAGE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>ca59a64a-adce-49c3-93ad-2978c81809f8</name> - <entityField>ORGANISATION_NAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>4b05d812-aa6c-49a5-afa3-ea5cd99560ef</name> - <entityField>PERSON_FULL_NAME</entityField> - <width v="75" /> - <expandRatio v="100" /> - </neonTableColumn> - <neonTableColumn> - <name>2ee5838b-e0ff-4f21-bf57-e41d0766fdec</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>16174be3-c8fb-46a8-8f73-f6b8d8fad963</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>c7d50d7a-11da-491c-a4be-7d5f75d335f0</name> - <entityField>ADDRESS_ID</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>AnyContactLookup_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Relations</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>5a0d38bb-bfa5-4abc-86e7-fac65804bb5c</name> + <entityField>IMAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>ca59a64a-adce-49c3-93ad-2978c81809f8</name> + <entityField>ORGANISATION_NAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>4b05d812-aa6c-49a5-afa3-ea5cd99560ef</name> + <entityField>PERSON_FULL_NAME</entityField> + <width v="75" /> + <expandRatio v="100" /> + </neonTableColumn> + <neonTableColumn> + <name>2ee5838b-e0ff-4f21-bf57-e41d0766fdec</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>16174be3-c8fb-46a8-8f73-f6b8d8fad963</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>c7d50d7a-11da-491c-a4be-7d5f75d335f0</name> + <entityField>ADDRESS_ID</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod b/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod index 0a181c30ff5d62b9b35d8c3d2858563d761fee01..509b780078a9944e235d8b1720dd9fcde0c3a1bc 100644 --- a/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod +++ b/neonView/AppointmentFilterDashlet_view/AppointmentFilterDashlet_view.aod @@ -8,6 +8,7 @@ <neonDashletConfiguration> <name>appointmentFilterConfig</name> <title>Linked Appointments</title> + <description>Shows linked appointments</description> <fragment>Appointment/full</fragment> <icon>VAADIN:CALENDAR</icon> <categories> diff --git a/neonView/AttributeEdit_view/AttributeEdit_view.aod b/neonView/AttributeEdit_view/AttributeEdit_view.aod index 329523a7fcd14a6df07e6b2789ac787ff3ce324c..22e0de724ed6fcd70dd5ef7a4ea07dad3b81f8f0 100644 --- a/neonView/AttributeEdit_view/AttributeEdit_view.aod +++ b/neonView/AttributeEdit_view/AttributeEdit_view.aod @@ -45,5 +45,11 @@ <entityField>AttributeUsages</entityField> <view>AttributeUsageMultiEdit_view</view> </neonViewReference> + <filterTreeViewTemplate> + <name>FilterTree</name> + <entityNameField>DROPDOWNDEFINITION</entityNameField> + <filterField>DROPDOWNFILTER</filterField> + <entityField>#ENTITY</entityField> + </filterTreeViewTemplate> </children> </neonView> diff --git a/neonView/AttributeRelationPreviewList/AttributeRelationPreviewList.aod b/neonView/AttributeRelationPreviewList/AttributeRelationPreviewList.aod index e08729e129284e022051f747a8c7ddacc6e991fb..cb9f2cf1bcf8f76b78fd5684ebdad7b858f93840 100644 --- a/neonView/AttributeRelationPreviewList/AttributeRelationPreviewList.aod +++ b/neonView/AttributeRelationPreviewList/AttributeRelationPreviewList.aod @@ -11,6 +11,7 @@ <titledListViewTemplate> <name>Relations</name> <titleField>AB_ATTRIBUTE_ID</titleField> + <fixedDrawer v="true" /> <entityField>#ENTITY</entityField> <columns> <neonTableColumn> diff --git a/neonView/AttributeTree_view/AttributeTree_view.aod b/neonView/AttributeTree_view/AttributeTree_view.aod index b2c3cd2492fccd60cb31eeb4feeba3cd13225275..98ab9068d15e04a349e86f51fec6b2bba50642a8 100644 --- a/neonView/AttributeTree_view/AttributeTree_view.aod +++ b/neonView/AttributeTree_view/AttributeTree_view.aod @@ -12,8 +12,11 @@ <name>Attributes</name> <parentField>ATTRIBUTE_PARENT_ID</parentField> <titleField>ATTRIBUTE_NAME</titleField> - <descriptionField>ATTRIBUTE_TYPE</descriptionField> + <entryAction>openDetails</entryAction> <entityField>#ENTITY</entityField> + <isCreatable v="false" /> + <isEditable v="false" /> + <isDeletable v="false" /> </treeViewTemplate> </children> </neonView> diff --git a/neonView/BulkMailTest_view/BulkMailTest_view.aod b/neonView/BulkMailContent_view/BulkMailContent_view.aod similarity index 87% rename from neonView/BulkMailTest_view/BulkMailTest_view.aod rename to neonView/BulkMailContent_view/BulkMailContent_view.aod index 5345b7255d7a55a7b08c16507366ffadd3cf8141..83d2fdaa7b9013c602ed68d980cab7a13e1cd1c3 100644 --- a/neonView/BulkMailTest_view/BulkMailTest_view.aod +++ b/neonView/BulkMailContent_view/BulkMailContent_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>BulkMailTest_view</name> - <title>Preview</title> + <name>BulkMailContent_view</name> + <title>Content</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <noneLayout> @@ -32,8 +32,8 @@ <entityField>#ENTITY</entityField> <fields> <entityFieldLink> - <name>13d21d66-6f52-4535-9cb9-3b26db11dfbf</name> - <entityField>preview</entityField> + <name>af0d45a2-a96f-4031-a93d-62ac177efb43</name> + <entityField>content</entityField> </entityFieldLink> </fields> </genericViewTemplate> diff --git a/neonView/BulkMailEdit_view/BulkMailEdit_view.aod b/neonView/BulkMailEdit_view/BulkMailEdit_view.aod index 1b1bf06c33069a4964df658ebd7542f55c856b4e..6673a4671bd569e5f51055fce543bea35d3ca5b7 100644 --- a/neonView/BulkMailEdit_view/BulkMailEdit_view.aod +++ b/neonView/BulkMailEdit_view/BulkMailEdit_view.aod @@ -18,17 +18,13 @@ <entityField>DOCUMENTTEMPLATE_ID</entityField> </entityFieldLink> <entityFieldLink> - <name>f040d032-823c-4199-8314-01d784fdc167</name> - <entityField>BINDATA</entityField> + <name>40628318-2c0e-4324-b676-f7bda2740166</name> + <entityField>bindata</entityField> </entityFieldLink> <entityFieldLink> <name>e363bda2-d8bf-456e-bcae-d1870408022a</name> <entityField>NAME</entityField> </entityFieldLink> - <entityFieldLink> - <name>06f08869-5a81-41cb-8c7e-51be6a7041a7</name> - <entityField>DESCRIPTION</entityField> - </entityFieldLink> <entityFieldLink> <name>c73d0fb7-b740-48ac-8f3e-fd4199f169da</name> <entityField>SUBJECT</entityField> @@ -37,6 +33,18 @@ <name>e4ec09c2-3815-4a3b-bce8-c12d5b919b04</name> <entityField>SENDER</entityField> </entityFieldLink> + <entityFieldLink> + <name>d9b91083-948e-4a0f-a29c-4962ddd78b41</name> + <entityField>CREATEACTIVITIES</entityField> + </entityFieldLink> + <entityFieldLink> + <name>06f08869-5a81-41cb-8c7e-51be6a7041a7</name> + <entityField>DESCRIPTION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>0a67f430-dbcd-4605-b626-ee6d715ab248</name> + <entityField>content</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/neonView/KeywordEntryMain_view/KeywordEntryMain_view.aod b/neonView/BulkMailMainPreview_view/BulkMailMainPreview_view.aod similarity index 54% rename from neonView/KeywordEntryMain_view/KeywordEntryMain_view.aod rename to neonView/BulkMailMainPreview_view/BulkMailMainPreview_view.aod index 775654caca3b34a444b27446e38993016812c049..27aab06baf390b03d2bb4a685c0cfe31b604f13a 100644 --- a/neonView/KeywordEntryMain_view/KeywordEntryMain_view.aod +++ b/neonView/BulkMailMainPreview_view/BulkMailMainPreview_view.aod @@ -1,23 +1,23 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>KeywordEntryMain_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <masterSlaveLayout> - <name>layout</name> - <master>267eb426-08d6-4699-9b9f-743c9c071463</master> - </masterSlaveLayout> - </layout> - <children> - <neonViewReference> - <name>267eb426-08d6-4699-9b9f-743c9c071463</name> - <entityField>#ENTITY</entityField> - <view>KeywordEntryMainSide_view</view> - </neonViewReference> - <neonViewReference> - <name>e722eb4b-5737-4801-b6e4-550fca43963a</name> - <entityField>KeywordAttributeRelations</entityField> - <view>KeywordAttributeRelationRows_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>BulkMailMainPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <headerFooterLayout> + <name>layout</name> + <footer>e8f0200f-3447-4196-8aba-f2966e83689a</footer> + </headerFooterLayout> + </layout> + <children> + <neonViewReference> + <name>2a1f719c-1838-4f30-8fb7-27cd7bbf16ee</name> + <entityField>#ENTITY</entityField> + <view>BulkMailPreview_view</view> + </neonViewReference> + <neonViewReference> + <name>e8f0200f-3447-4196-8aba-f2966e83689a</name> + <entityField>RecipientStatusChart</entityField> + <view>BulkMailStatusChart_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/BulkMailMain_view/BulkMailMain_view.aod b/neonView/BulkMailMain_view/BulkMailMain_view.aod index 6545f87d592e57cb2ac31151f3f13dc26d12c871..d5529d583077bcfee3707cf20cca98d2b8928d40 100644 --- a/neonView/BulkMailMain_view/BulkMailMain_view.aod +++ b/neonView/BulkMailMain_view/BulkMailMain_view.aod @@ -5,15 +5,10 @@ <layout> <masterSlaveLayout> <name>layout</name> - <master>9f5528f7-230e-42e5-8831-66bdee9a9588</master> + <master>3f7fc7d4-7cda-428c-8acb-364addc5239c</master> </masterSlaveLayout> </layout> <children> - <neonViewReference> - <name>9f5528f7-230e-42e5-8831-66bdee9a9588</name> - <entityField>#ENTITY</entityField> - <view>BulkMailPreview_view</view> - </neonViewReference> <neonViewReference> <name>8be4ed02-1c54-41d0-9bba-3b785346a550</name> <entityField>Recipients</entityField> @@ -22,7 +17,17 @@ <neonViewReference> <name>3222ace8-c6d6-4dab-ada1-1f50b983e7e7</name> <entityField>#ENTITY</entityField> - <view>BulkMailTest_view</view> + <view>BulkMailContent_view</view> + </neonViewReference> + <neonViewReference> + <name>49eb2dd2-0df9-4b58-bdae-f941200be8d9</name> + <entityField>LogHistories</entityField> + <view>LogHistoryFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>3f7fc7d4-7cda-428c-8acb-364addc5239c</name> + <entityField>#ENTITY</entityField> + <view>BulkMailMainPreview_view</view> </neonViewReference> </children> </neonView> diff --git a/neonView/BulkMailPreview_view/BulkMailPreview_view.aod b/neonView/BulkMailPreview_view/BulkMailPreview_view.aod index f6f68c3a24cb687ac356f5612219f51a9e7b07af..dc2079b658b5c2eb1cc5b75034f9ecb91dba28d3 100644 --- a/neonView/BulkMailPreview_view/BulkMailPreview_view.aod +++ b/neonView/BulkMailPreview_view/BulkMailPreview_view.aod @@ -14,6 +14,7 @@ <iconField>ICON</iconField> <titleField>NAME</titleField> <descriptionField>STATUS</descriptionField> + <favoriteAction1>sendMail</favoriteAction1> <entityField>#ENTITY</entityField> </cardViewTemplate> <genericViewTemplate> @@ -37,11 +38,31 @@ <name>edbeea4d-019f-4661-b0d7-c07468e747cc</name> <entityField>DOCUMENTTEMPLATE_ID</entityField> </entityFieldLink> + <entityFieldLink> + <name>514d0861-ad00-4d32-9c56-6be0443e03e3</name> + <entityField>CREATEACTIVITIES</entityField> + </entityFieldLink> <entityFieldLink> <name>8bb72d39-3348-4bd6-b57d-f7f5ae573e73</name> <entityField>DESCRIPTION</entityField> </entityFieldLink> </fields> </genericViewTemplate> + <genericViewTemplate> + <name>Testing</name> + <showDrawer v="true" /> + <drawerCaption>Testing</drawerCaption> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>ea406803-6189-4de0-aa41-f09f7e1b2336</name> + <entityField>TESTING_CONTACT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>f8963199-c89b-48e5-a92c-8f655c05acab</name> + <entityField>TESTING_EMAIL_ADDRESS</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> </children> </neonView> diff --git a/neonView/BulkMailStatusChart_view/BulkMailStatusChart_view.aod b/neonView/BulkMailStatusChart_view/BulkMailStatusChart_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..efd092ba46067e5b1ef4fbff2ee1cbc12b40a05f --- /dev/null +++ b/neonView/BulkMailStatusChart_view/BulkMailStatusChart_view.aod @@ -0,0 +1,20 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>BulkMailStatusChart_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <singleDataChartViewTemplate> + <name>SingleDataChart</name> + <chartType>PIE</chartType> + <xAxis>X</xAxis> + <yAxis>Y</yAxis> + <entityField>#ENTITY</entityField> + <title>Recipients</title> + </singleDataChartViewTemplate> + </children> +</neonView> diff --git a/neonView/KeywordEntryMainSide_view/KeywordEntryMainSide_view.aod b/neonView/BulkMailTesting_view/BulkMailTesting_view.aod similarity index 51% rename from neonView/KeywordEntryMainSide_view/KeywordEntryMainSide_view.aod rename to neonView/BulkMailTesting_view/BulkMailTesting_view.aod index 14c3727a0420c02d8de1a73c39d5da6a82fc88cf..6fee3e30ccdab6233676b7af3d8242fad0e5f2fa 100644 --- a/neonView/KeywordEntryMainSide_view/KeywordEntryMainSide_view.aod +++ b/neonView/BulkMailTesting_view/BulkMailTesting_view.aod @@ -1,37 +1,32 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>KeywordEntryMainSide_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <cardViewTemplate> - <name>Header</name> - <titleField>TITLE</titleField> - <subtitleField>CONTAINER</subtitleField> - <descriptionField>KEYID</descriptionField> - <entityField>#ENTITY</entityField> - </cardViewTemplate> - <genericViewTemplate> - <name>Info</name> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>12e16874-32ee-47d7-b9d7-acaa32ca0402</name> - <entityField>ISACTIVE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>74f8f491-43e2-4de5-b1c6-c83055b4ffa1</name> - <entityField>ISESSENTIAL</entityField> - </entityFieldLink> - <entityFieldLink> - <name>5608493f-90b5-4baf-9114-63cb6a2e85bf</name> - <entityField>SORTING</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>BulkMailTesting_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Generic</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>d99dbdae-54cf-432c-8aba-ccb220d330b9</name> + <entityField>TESTING_CONTACT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>43ce58eb-76c8-4b6d-9aa7-1b63d5415895</name> + <entityField>TESTING_EMAIL_ADDRESS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7d83d5ca-52a9-4770-894d-d91d81e3ca14</name> + <entityField>SAVESETTINGS</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/CampaignCharts_view/CampaignCharts_view.aod b/neonView/CampaignCharts_view/CampaignCharts_view.aod index 5992e7af68d77b5c65895fe49215f17902bcefc1..d9f3ce742ad12da260a8bdc6d72824e6fc170a39 100644 --- a/neonView/CampaignCharts_view/CampaignCharts_view.aod +++ b/neonView/CampaignCharts_view/CampaignCharts_view.aod @@ -1,25 +1,25 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>CampaignCharts_view</name> - <title>Overview</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - <direction>HORIZONTAL</direction> - <maxDirectionElements v="2" /> - </boxLayout> - </layout> - <children> - <neonViewReference> - <name>e6d6c775-3d85-4a59-8df0-d57e7174ed90</name> - <entityField>CampaignParticipantsChart</entityField> - <view>CampaignParticipantChart_view</view> - </neonViewReference> - <neonViewReference> - <name>e96b6827-e47e-4d85-a1fd-b1b52f36fe31</name> - <entityField>CampaignCostsChart</entityField> - <view>CampaignCostChart_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>CampaignCharts_view</name> + <title>Overview</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + <direction>HORIZONTAL</direction> + <maxDirectionElements v="2" /> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>e6d6c775-3d85-4a59-8df0-d57e7174ed90</name> + <entityField>CampaignParticipantsChart</entityField> + <view>CampaignParticipantChart_view</view> + </neonViewReference> + <neonViewReference> + <name>e96b6827-e47e-4d85-a1fd-b1b52f36fe31</name> + <entityField>CampaignCostsChart</entityField> + <view>CampaignCostChart_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/CampaignCostAnalysis_view/CampaignCostAnalysis_view.aod b/neonView/CampaignCostAnalysis_view/CampaignCostAnalysis_view.aod index b6fbdd6f1877a0b300715615205c2dde263c6440..dac0fb3657833f05d114f66733d3a2fe71765fba 100644 --- a/neonView/CampaignCostAnalysis_view/CampaignCostAnalysis_view.aod +++ b/neonView/CampaignCostAnalysis_view/CampaignCostAnalysis_view.aod @@ -3,15 +3,18 @@ <name>CampaignCostAnalysis_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> - <boxLayout> + <drawerLayout> <name>layout</name> - </boxLayout> + <layoutCaption>Total costs</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> </layout> <children> <genericViewTemplate> <name>Costs</name> - <showDrawer v="true" /> + <showDrawer v="false" /> <drawerCaption>Total costs</drawerCaption> + <fixedDrawer v="false" /> <entityField>#ENTITY</entityField> <fields> <entityFieldLink> diff --git a/neonView/CampaignCostChart_view/CampaignCostChart_view.aod b/neonView/CampaignCostChart_view/CampaignCostChart_view.aod index d8e2121fad46b3f4c9bb23cd9033774e717d1f8c..3f59125e8e523cab4e5e7010e23a690d3d542b9a 100644 --- a/neonView/CampaignCostChart_view/CampaignCostChart_view.aod +++ b/neonView/CampaignCostChart_view/CampaignCostChart_view.aod @@ -2,6 +2,26 @@ <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>CampaignCostChart_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <dashletConfigurations> + <neonDashletConfiguration> + <name>CampaignCostsChart</name> + <title>Campaign costs</title> + <description>Shows campaing costs graphically processed</description> + <fragment>Campaign/full</fragment> + <singleton v="true" /> + <icon>VAADIN:MONEY</icon> + <categories> + <neonDashletCategory> + <name>marketing</name> + <title>Marketing</title> + </neonDashletCategory> + <neonDashletCategory> + <name>campaignmanagement</name> + <title>Campaign management</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> + </dashletConfigurations> <layout> <boxLayout> <name>layout</name> diff --git a/neonView/CampaignCost_view/CampaignCost_view.aod b/neonView/CampaignCost_view/CampaignCost_view.aod index 1b00af4c86618b854816e3113a2bff89797dedb1..eb804851d761b54a64113e6108f63e4560d16cf4 100644 --- a/neonView/CampaignCost_view/CampaignCost_view.aod +++ b/neonView/CampaignCost_view/CampaignCost_view.aod @@ -1,35 +1,35 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>CampaignCost_view</name> - <title>Cost</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - <direction>HORIZONTAL</direction> - <maxDirectionElements v="2" /> - </boxLayout> - </layout> - <children> - <neonViewReference> - <name>5830d1ed-c118-4a37-ab65-4727e8312c0a</name> - <entityField>CampaignStepCosts</entityField> - <view>CampaignCostVariable_view</view> - </neonViewReference> - <neonViewReference> - <name>c4476130-ca57-4707-9448-266138c09880</name> - <entityField>#ENTITY</entityField> - <view>CampaignCostFix_view</view> - </neonViewReference> - <neonViewReference> - <name>4f5b74d6-cbae-458d-811e-4f83a65d43ad</name> - <entityField>CampaignCostsChart</entityField> - <view>CampaignCostChart_view</view> - </neonViewReference> - <neonViewReference> - <name>5d65fb20-7704-45a0-93c8-513c7b2e3f5f</name> - <entityField>CampaignAnalysisConsumer</entityField> - <view>CampaignCostAnalysis_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>CampaignCost_view</name> + <title>Cost</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + <direction>HORIZONTAL</direction> + <maxDirectionElements v="2" /> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>5830d1ed-c118-4a37-ab65-4727e8312c0a</name> + <entityField>CampaignStepCosts</entityField> + <view>CampaignCostVariable_view</view> + </neonViewReference> + <neonViewReference> + <name>c4476130-ca57-4707-9448-266138c09880</name> + <entityField>#ENTITY</entityField> + <view>CampaignCostFix_view</view> + </neonViewReference> + <neonViewReference> + <name>4f5b74d6-cbae-458d-811e-4f83a65d43ad</name> + <entityField>CampaignCostsChart</entityField> + <view>CampaignCostChart_view</view> + </neonViewReference> + <neonViewReference> + <name>5d65fb20-7704-45a0-93c8-513c7b2e3f5f</name> + <entityField>CampaignAnalysisConsumer</entityField> + <view>CampaignCostAnalysis_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/CampaignEdit_view/CampaignEdit_view.aod b/neonView/CampaignEdit_view/CampaignEdit_view.aod index 6deb23ba68652cb89208e26eb61ae74b75a46427..4bb37192b8c65c51c262ec258cea39680cf176bf 100644 --- a/neonView/CampaignEdit_view/CampaignEdit_view.aod +++ b/neonView/CampaignEdit_view/CampaignEdit_view.aod @@ -28,8 +28,12 @@ <entityField>EMPLOYEE_CONTACT_ID</entityField> </entityFieldLink> <entityFieldLink> - <name>8372cca8-be9f-4910-bebd-64bd41cc7083</name> - <entityField>STATE</entityField> + <name>88f13d08-d164-4bac-95fb-713d47ba255b</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>e5e42cfb-094e-4352-8e53-0f15002d1394</name> + <entityField>CURRENCY</entityField> </entityFieldLink> <entityFieldLink> <name>114121d3-093a-40e7-9e0e-f187c9eaa5f1</name> diff --git a/neonView/CampaignFilter_view/CampaignFilter_view.aod b/neonView/CampaignFilter_view/CampaignFilter_view.aod index ff7cd4e13e46ef0152378b8827eea87aa1178f06..10ec1fbfe7d56ef510e8d2ad0730b11e0cbf1841 100644 --- a/neonView/CampaignFilter_view/CampaignFilter_view.aod +++ b/neonView/CampaignFilter_view/CampaignFilter_view.aod @@ -15,12 +15,12 @@ <icon>NEON:GROUP_APPOINTMENT</icon> <categories> <neonDashletCategory> - <name>marketingcampaign</name> - <title>MarketingCampaign</title> + <name>marketing</name> + <title>Marketing</title> </neonDashletCategory> <neonDashletCategory> <name>campaignmanagement</name> - <title>CampaignManagement</title> + <title>Campaign management</title> </neonDashletCategory> </categories> <parameters> @@ -30,6 +30,24 @@ </neonDashletParameter> </parameters> </neonDashletConfiguration> + <neonDashletConfiguration> + <name>AllCampaigns</name> + <title>Campaigns</title> + <description>Shows all campaigns</description> + <fragment>Campaign/filter</fragment> + <singleton v="true" /> + <icon>NEON:GROUP_APPOINTMENT</icon> + <categories> + <neonDashletCategory> + <name>marketing</name> + <title>Marketing</title> + </neonDashletCategory> + <neonDashletCategory> + <name>campaignmanagement</name> + <title>Campaign management</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> </dashletConfigurations> <layout> <boxLayout> @@ -67,7 +85,7 @@ </neonTableColumn> <neonTableColumn> <name>3f075c57-e61a-4db2-a402-141da6bbf29d</name> - <entityField>STATE</entityField> + <entityField>STATUS</entityField> </neonTableColumn> <neonTableColumn> <name>f5fc40b2-c6d3-4f03-9ffa-b7e269323b4d</name> diff --git a/neonView/CampaignMain_view/CampaignMain_view.aod b/neonView/CampaignMain_view/CampaignMain_view.aod index f724842e2c3b10cac56b15ab38b54219d2e87f0f..16172228e5472ce346a1aa44447649a81d534111 100644 --- a/neonView/CampaignMain_view/CampaignMain_view.aod +++ b/neonView/CampaignMain_view/CampaignMain_view.aod @@ -52,8 +52,13 @@ <view>TaskFilter_view</view> </neonViewReference> <neonViewReference> - <name>c6237b30-d638-43e3-93c5-fc3abbb87443</name> - <entityField>Attributes</entityField> + <name>3b87a113-aa39-4d20-8902-ad2a9f6aba5f</name> + <entityField>Documents</entityField> + <view>DocumentFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>de47ab41-231f-48dc-a15b-fcd3fc740373</name> + <entityField>AttributeTree</entityField> <view>AttributeRelationTree_view</view> </neonViewReference> </children> diff --git a/neonView/CampaignParticipantChart_view/CampaignParticipantChart_view.aod b/neonView/CampaignParticipantChart_view/CampaignParticipantChart_view.aod index a989b8cd10359ee1688f0ecc3a98f10cdd9f6a50..6f7bebc0991f02153cd3e10d3954279211722f88 100644 --- a/neonView/CampaignParticipantChart_view/CampaignParticipantChart_view.aod +++ b/neonView/CampaignParticipantChart_view/CampaignParticipantChart_view.aod @@ -1,20 +1,20 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>CampaignParticipantChart_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <multiDataChartViewTemplate> - <name>MultiDataChart</name> - <chartType>BAR</chartType> - <xAxis>X</xAxis> - <yAxis>Y</yAxis> - <categoryField>CATEGORY</categoryField> - <entityField>#ENTITY</entityField> - </multiDataChartViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>CampaignParticipantChart_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <multiDataChartViewTemplate> + <name>MultiDataChart</name> + <chartType>BAR</chartType> + <xAxis>X</xAxis> + <yAxis>Y</yAxis> + <categoryField>CATEGORY</categoryField> + <entityField>#ENTITY</entityField> + </multiDataChartViewTemplate> + </children> +</neonView> diff --git a/neonView/CampaignParticipantFilter_view/CampaignParticipantFilter_view.aod b/neonView/CampaignParticipantFilter_view/CampaignParticipantFilter_view.aod index 240d2d812b910bde5bb2e70c29991a2bca51e819..f977448e5c7f7ed98beca7801fba57935cf694e5 100644 --- a/neonView/CampaignParticipantFilter_view/CampaignParticipantFilter_view.aod +++ b/neonView/CampaignParticipantFilter_view/CampaignParticipantFilter_view.aod @@ -30,6 +30,14 @@ <name>1649e2e9-e3b3-4a41-960d-39002cb6b2d8</name> <entityField>CAMPAIGNSTEP_ID</entityField> </neonTableColumn> + <neonTableColumn> + <name>20c9aed5-cf30-484b-a68b-c1f6ca0459db</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>0071a91d-b716-4ee9-a373-9c8eac9626b8</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> </columns> </tableViewTemplate> </children> diff --git a/neonView/CampaignPreview_view/CampaignPreview_view.aod b/neonView/CampaignPreview_view/CampaignPreview_view.aod index 93a9532044817d2702f1b2c930e251ab8fd69990..74073d0218b2be07d66c0d58ff1c13fcf22b6c94 100644 --- a/neonView/CampaignPreview_view/CampaignPreview_view.aod +++ b/neonView/CampaignPreview_view/CampaignPreview_view.aod @@ -16,7 +16,7 @@ <name>Header</name> <iconField>#IMAGE</iconField> <titleField>NAME</titleField> - <subtitleField>STATE</subtitleField> + <subtitleField>STATUS</subtitleField> <descriptionField>EMPLOYEE_CONTACT_ID</descriptionField> <favoriteAction1>newActivity</favoriteAction1> <entityField>#ENTITY</entityField> @@ -47,10 +47,13 @@ <genericViewTemplate> <name>Description</name> <showDrawer v="true" /> - <hideLabels v="true" /> <entityField>#ENTITY</entityField> <title>Beschreibung</title> <fields> + <entityFieldLink> + <name>4f429cd5-2a89-44fc-8c25-37a5350a711f</name> + <entityField>CURRENCY</entityField> + </entityFieldLink> <entityFieldLink> <name>d7c993ff-9696-4de8-9ba5-fc7c92a1a22b</name> <entityField>DESCRIPTION</entityField> diff --git a/neonView/CampaignStepEdit_view/CampaignStepEdit_view.aod b/neonView/CampaignStepEdit_view/CampaignStepEdit_view.aod index 4732ab77a152a8f1e4fd8c9c2e381817d3e92351..aed29a24f50a1b59c56a9e964832200a1fe9250c 100644 --- a/neonView/CampaignStepEdit_view/CampaignStepEdit_view.aod +++ b/neonView/CampaignStepEdit_view/CampaignStepEdit_view.aod @@ -37,8 +37,8 @@ <entityField>DATE_END</entityField> </entityFieldLink> <entityFieldLink> - <name>80c1df2f-2458-4e4c-a6da-9ce56b17bbf0</name> - <entityField>STATE</entityField> + <name>2d851503-c699-44cc-9528-e3828aeb548f</name> + <entityField>STATUS</entityField> </entityFieldLink> <entityFieldLink> <name>2447348f-4ed9-4b8c-8b0e-94e663fd781d</name> diff --git a/neonView/CampaignStepFilter_view/CampaignStepFilter_view.aod b/neonView/CampaignStepFilter_view/CampaignStepFilter_view.aod index 22dc086bc342905aa93fe05a45b8d5ed88327031..7f2a355e8a0b79e84e296b9072c8f78b22e41b67 100644 --- a/neonView/CampaignStepFilter_view/CampaignStepFilter_view.aod +++ b/neonView/CampaignStepFilter_view/CampaignStepFilter_view.aod @@ -48,7 +48,7 @@ </neonTableColumn> <neonTableColumn> <name>9fa9d9f4-5851-4125-ba59-09aa2fb07f89</name> - <entityField>STATE</entityField> + <entityField>STATUS</entityField> </neonTableColumn> <neonTableColumn> <name>aa317ce2-058b-4956-9bbc-ce5477436e2d</name> diff --git a/neonView/CampaignStepLookup_view/CampaignStepLookup_view.aod b/neonView/CampaignStepLookup_view/CampaignStepLookup_view.aod index 4cacbf875d7d501cdd347b04d6124ec277bac243..b6e331db086495ea0eeb6204a02cde755993fc13 100644 --- a/neonView/CampaignStepLookup_view/CampaignStepLookup_view.aod +++ b/neonView/CampaignStepLookup_view/CampaignStepLookup_view.aod @@ -43,7 +43,7 @@ </neonTableColumn> <neonTableColumn> <name>9fa9d9f4-5851-4125-ba59-09aa2fb07f89</name> - <entityField>STATE</entityField> + <entityField>STATUS</entityField> </neonTableColumn> </columns> </tableViewTemplate> diff --git a/neonView/CampaignStepPreview_view/CampaignStepPreview_view.aod b/neonView/CampaignStepPreview_view/CampaignStepPreview_view.aod index 0037c8dea0b4d7dadd139c72fec318da0db2392c..e4623ec0d8373eda71ebcc6f08c19a43a2cb998a 100644 --- a/neonView/CampaignStepPreview_view/CampaignStepPreview_view.aod +++ b/neonView/CampaignStepPreview_view/CampaignStepPreview_view.aod @@ -14,7 +14,7 @@ <name>CampaignStepCard</name> <iconField>#IMAGE</iconField> <titleField>NAME</titleField> - <subtitleField>STATE</subtitleField> + <subtitleField>STATUS</subtitleField> <descriptionField>DESCRIPTION</descriptionField> <favoriteAction1>newActivity</favoriteAction1> <entityField>#ENTITY</entityField> @@ -63,7 +63,7 @@ </genericViewTemplate> <genericViewTemplate> <name>Medium</name> - <editMode v="true" /> + <editMode v="false" /> <showDrawer v="false" /> <drawerCaption></drawerCaption> <entityField>#ENTITY</entityField> diff --git a/neonView/ClassificationGroupAnalysesChart_view/ClassificationGroupAnalysesChart_view.aod b/neonView/ClassificationGroupAnalysesChart_view/ClassificationGroupAnalysesChart_view.aod index ae50d501c07822b625fb8836f5313c191894c885..fe6a231aa86e86a3970d109fef171aee79c61738 100644 --- a/neonView/ClassificationGroupAnalysesChart_view/ClassificationGroupAnalysesChart_view.aod +++ b/neonView/ClassificationGroupAnalysesChart_view/ClassificationGroupAnalysesChart_view.aod @@ -3,9 +3,11 @@ <name>ClassificationGroupAnalysesChart_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> - <boxLayout> + <drawerLayout> <name>layout</name> - </boxLayout> + <layoutCaption>Classification</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> </layout> <children> <singleDataChartViewTemplate> @@ -14,6 +16,7 @@ <xAxis>GROUP</xAxis> <yAxis>SCORE</yAxis> <entityField>#ENTITY</entityField> + <title></title> </singleDataChartViewTemplate> </children> </neonView> diff --git a/neonView/CommRestrictionDrawer_view/CommRestrictionDrawer_view.aod b/neonView/CommRestrictionDrawer_view/CommRestrictionDrawer_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..b4fc14a8478e8fdb03ff851774552be2ff970553 --- /dev/null +++ b/neonView/CommRestrictionDrawer_view/CommRestrictionDrawer_view.aod @@ -0,0 +1,19 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>CommRestrictionDrawer_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Advertising bans</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <neonViewReference> + <name>fba5fb33-43d4-4885-84ed-9fe5cc367566</name> + <entityField>#ENTITY</entityField> + <view>CommRestrictionFilter_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/ContactEdit_view/ContactEdit_view.aod b/neonView/ContactEdit_view/ContactEdit_view.aod index 9a0437291b0bfc25b2f4101749dbabab12000641..9eb6099fa1931c5f8ba2578562a9101383a2eddd 100644 --- a/neonView/ContactEdit_view/ContactEdit_view.aod +++ b/neonView/ContactEdit_view/ContactEdit_view.aod @@ -1,53 +1,53 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>ContactEdit_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Edit</name> - <editMode v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>35e8b7a8-30b0-4c6f-921d-c199158aa294</name> - <entityField>PERSON_TITLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>40d2367e-c197-424c-8442-9b04c7369e3a</name> - <entityField>ORGANISATION_ID</entityField> - </entityFieldLink> - <entityFieldLink> - <name>847e9231-d6df-4ead-903d-b70dbcd69333</name> - <entityField>DEPARTMENT</entityField> - </entityFieldLink> - <entityFieldLink> - <name>74e712fb-595f-4f96-9ecb-bd6a99948dce</name> - <entityField>CONTACTROLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>e7c57e62-ff21-4ccd-8458-55d2fcca7b97</name> - <entityField>POSITION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>3028e060-b360-4584-96e6-4cf17ef94b07</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - <neonViewReference> - <name>2912698f-2123-4c4f-b277-b7aa16b1c5e0</name> - <entityField>Communications</entityField> - <view>CommunicationMultiEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>3e90f469-405f-46e4-9fed-ce017dc0c222</name> - <entityField>ContactAddresses</entityField> - <view>AdressMultiEdit_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ContactEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>35e8b7a8-30b0-4c6f-921d-c199158aa294</name> + <entityField>PERSON_TITLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>40d2367e-c197-424c-8442-9b04c7369e3a</name> + <entityField>ORGANISATION_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>847e9231-d6df-4ead-903d-b70dbcd69333</name> + <entityField>DEPARTMENT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>74e712fb-595f-4f96-9ecb-bd6a99948dce</name> + <entityField>CONTACTROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>e7c57e62-ff21-4ccd-8458-55d2fcca7b97</name> + <entityField>POSITION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>3028e060-b360-4584-96e6-4cf17ef94b07</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <neonViewReference> + <name>2912698f-2123-4c4f-b277-b7aa16b1c5e0</name> + <entityField>Communications</entityField> + <view>CommunicationMultiEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>3e90f469-405f-46e4-9fed-ce017dc0c222</name> + <entityField>ContactAddresses</entityField> + <view>AdressMultiEdit_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/ContactList_view/ContactList_view.aod b/neonView/ContactList_view/ContactList_view.aod index 942d351abc90db0e54bb10a20805b68744d83648..5aa047e4afc7dea067e45a03a1b780e7ef0182b1 100644 --- a/neonView/ContactList_view/ContactList_view.aod +++ b/neonView/ContactList_view/ContactList_view.aod @@ -1,40 +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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>ContactList_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Contacts</name> - <hideContentSearch v="true" /> - <entityField>#ENTITY</entityField> - <isEditable v="false" /> - <columns> - <neonTableColumn> - <name>ef71b5ad-8581-4845-ae66-7df17d1459e0</name> - <entityField>ORGANISATION_ID</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a3f3a2b8-1f7a-4783-b080-1853df3d1613</name> - <entityField>CONTACTROLE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a8f4283d-7a40-4ee9-ae34-e4d424a9342a</name> - <entityField>DEPARTMENT</entityField> - </neonTableColumn> - <neonTableColumn> - <name>13b085a4-9ee7-418b-b3a9-acaf053c44f1</name> - <entityField>POSITION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>1daa17e8-0e8d-4760-b229-651ae9a121d3</name> - <entityField>STATUS</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ContactList_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Contacts</name> + <hideContentSearch v="true" /> + <entityField>#ENTITY</entityField> + <isEditable v="false" /> + <columns> + <neonTableColumn> + <name>ef71b5ad-8581-4845-ae66-7df17d1459e0</name> + <entityField>ORGANISATION_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a3f3a2b8-1f7a-4783-b080-1853df3d1613</name> + <entityField>CONTACTROLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a8f4283d-7a40-4ee9-ae34-e4d424a9342a</name> + <entityField>DEPARTMENT</entityField> + </neonTableColumn> + <neonTableColumn> + <name>13b085a4-9ee7-418b-b3a9-acaf053c44f1</name> + <entityField>POSITION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1daa17e8-0e8d-4760-b229-651ae9a121d3</name> + <entityField>STATUS</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/ContractMain_view/ContractMain_view.aod b/neonView/ContractMain_view/ContractMain_view.aod index 3b3c5ff6714d7d2b6e1edb7b1ef5499a25fe55e2..6356de27a0c15b37f521869aa0d71d6c5e53de74 100644 --- a/neonView/ContractMain_view/ContractMain_view.aod +++ b/neonView/ContractMain_view/ContractMain_view.aod @@ -36,7 +36,7 @@ </neonViewReference> <neonViewReference> <name>fa15c239-7bf6-4ec6-8f62-49e83d7f2d2c</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> </children> diff --git a/neonView/DSGVODrawer_view/DSGVODrawer_view.aod b/neonView/DSGVODrawer_view/DSGVODrawer_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..f496bc78bcd5659a8f48402b5abc50f8e7c8a924 --- /dev/null +++ b/neonView/DSGVODrawer_view/DSGVODrawer_view.aod @@ -0,0 +1,19 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>DSGVODrawer_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Data privacy entries</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <neonViewReference> + <name>61142c4e-e82d-451e-a491-9a71ac0ec5c0</name> + <entityField>#ENTITY</entityField> + <view>DSGVOFilter_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/DSGVOFilter_view/DSGVOFilter_view.aod b/neonView/DSGVOFilter_view/DSGVOFilter_view.aod index 2277ab49431ed708509fe88d11c3b8bd6f8ed90a..0eca797bfdef74a2d4a56a3edafe163967bc54ee 100644 --- a/neonView/DSGVOFilter_view/DSGVOFilter_view.aod +++ b/neonView/DSGVOFilter_view/DSGVOFilter_view.aod @@ -1,6 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>DSGVOFilter_view</name> + <title>Data Privacy</title> <majorModelMode>DISTRIBUTED</majorModelMode> <filterable v="true" /> <layout> @@ -13,6 +14,10 @@ <name>Table</name> <favoriteActionGroup1>DSGVOActions</favoriteActionGroup1> <favoriteActionGroup2>Reports</favoriteActionGroup2> + <iconField>#IMAGE</iconField> + <titleField>DSGVOTYPE</titleField> + <subtitleField>VALUE</subtitleField> + <descriptionField>STATUORITYSOURCE</descriptionField> <entityField>#ENTITY</entityField> <columns> <neonTableColumn> diff --git a/neonView/DocumentTemplateEdit_view/DocumentTemplateEdit_view.aod b/neonView/DocumentTemplateEdit_view/DocumentTemplateEdit_view.aod index afa7a07b00de8a3de24a5cb15f52275f67836e59..b7bd922aa7df3f121444d6b2fcfd8d8d11d07126 100644 --- a/neonView/DocumentTemplateEdit_view/DocumentTemplateEdit_view.aod +++ b/neonView/DocumentTemplateEdit_view/DocumentTemplateEdit_view.aod @@ -26,16 +26,16 @@ <entityField>NAME</entityField> </entityFieldLink> <entityFieldLink> - <name>e3940793-c511-4fb1-93e7-68fb9f614b32</name> - <entityField>TYPE</entityField> + <name>50b5fd96-ef75-41a6-90e8-d928d5cbd6fd</name> + <entityField>KIND</entityField> </entityFieldLink> <entityFieldLink> <name>de86d66c-8281-4050-946b-a6b35bb01db8</name> <entityField>CLASSIFICATION</entityField> </entityFieldLink> <entityFieldLink> - <name>c25464a6-1111-4f9f-a834-92015c2d87bc</name> - <entityField>LANGUAGE</entityField> + <name>49d5c94c-f2ba-42a5-aab7-82fecc649dea</name> + <entityField>ISOLANGUAGE</entityField> </entityFieldLink> <entityFieldLink> <name>bf313ea8-821a-4693-8ba2-4246ad8a4f62</name> diff --git a/neonView/DocumentTemplateFilterSmall_view/DocumentTemplateFilterSmall_view.aod b/neonView/DocumentTemplateFilterSmall_view/DocumentTemplateFilterSmall_view.aod index 9dcad04f3a8053943484f8c43742a8bbb46c1230..dd90de123b872df703c8c26ae66d7303d33714e2 100644 --- a/neonView/DocumentTemplateFilterSmall_view/DocumentTemplateFilterSmall_view.aod +++ b/neonView/DocumentTemplateFilterSmall_view/DocumentTemplateFilterSmall_view.aod @@ -22,7 +22,7 @@ </neonTableColumn> <neonTableColumn> <name>cd4067b5-befe-459a-8a41-043eb884caff</name> - <entityField>LANGUAGE</entityField> + <entityField>ISOLANGUAGE</entityField> </neonTableColumn> </columns> </tableViewTemplate> diff --git a/neonView/DocumentTemplateFilter_view/DocumentTemplateFilter_view.aod b/neonView/DocumentTemplateFilter_view/DocumentTemplateFilter_view.aod index 2e950261abae2bbb514bb2fce58e7f565d14d852..9a9e593a2f186b5e266e5483d307a3b1b2f332af 100644 --- a/neonView/DocumentTemplateFilter_view/DocumentTemplateFilter_view.aod +++ b/neonView/DocumentTemplateFilter_view/DocumentTemplateFilter_view.aod @@ -14,9 +14,9 @@ <children> <treeTableViewTemplate> <name>SearchTree</name> - <parentField>TYPE</parentField> + <parentField>KIND</parentField> <defaultGroupFields> - <element>TYPE</element> + <element>KIND</element> </defaultGroupFields> <entityField>#ENTITY</entityField> <columns> @@ -26,7 +26,7 @@ </neonTableColumn> <neonTableColumn> <name>f163cdaa-ed96-431a-a648-1823b2a8ded6</name> - <entityField>TYPE</entityField> + <entityField>KIND</entityField> </neonTableColumn> <neonTableColumn> <name>7554151d-a099-4573-89c7-2f2b3070bff6</name> @@ -34,7 +34,7 @@ </neonTableColumn> <neonTableColumn> <name>65c98ef0-a3cc-4153-a58d-db4776e33532</name> - <entityField>LANGUAGE</entityField> + <entityField>ISOLANGUAGE</entityField> </neonTableColumn> <neonTableColumn> <name>0cb3d1b9-40af-4b0c-9fc0-14ab33e4967a</name> diff --git a/neonView/DocumentTemplatePreview_view/DocumentTemplatePreview_view.aod b/neonView/DocumentTemplatePreview_view/DocumentTemplatePreview_view.aod index 91964148f20691ce27541fbb04f54bd988562252..1c05831b09bd65f8631a61924b6b4e75b98f2b31 100644 --- a/neonView/DocumentTemplatePreview_view/DocumentTemplatePreview_view.aod +++ b/neonView/DocumentTemplatePreview_view/DocumentTemplatePreview_view.aod @@ -13,7 +13,7 @@ <cardViewTemplate> <name>Card</name> <titleField>NAME</titleField> - <subtitleField>TYPE</subtitleField> + <subtitleField>KIND</subtitleField> <descriptionField>CLASSIFICATION</descriptionField> <entityField>#ENTITY</entityField> <title>Document Template</title> diff --git a/neonView/IndexSearchView/IndexSearchView.aod b/neonView/IndexSearchView/IndexSearchView.aod index a3017cd692bdb3c0654890f72d05614e8a2dc0cc..f662adb0d69001d5f2600481fd9f6a4af395c849 100644 --- a/neonView/IndexSearchView/IndexSearchView.aod +++ b/neonView/IndexSearchView/IndexSearchView.aod @@ -6,6 +6,7 @@ <neonDashletConfiguration> <name>IndexSearchDashlet</name> <title>Indexsearch</title> + <description>Possibility to search for terms</description> <fragment>IndexSearchContext/full</fragment> <storeRoles /> <icon>VAADIN:SEARCH</icon> diff --git a/neonView/KeywordEntryPreview_view/KeywordEntryPreview_view.aod b/neonView/KeywordEntryPreview_view/KeywordEntryPreview_view.aod index f29227ac5a1a2c7f74f8fb7fa0142e94b42a35dd..c169f74709810b2d1f0caabe23b1c1e075f67722 100644 --- a/neonView/KeywordEntryPreview_view/KeywordEntryPreview_view.aod +++ b/neonView/KeywordEntryPreview_view/KeywordEntryPreview_view.aod @@ -38,7 +38,7 @@ </genericViewTemplate> <neonViewReference> <name>31f3e341-19b3-452e-a381-942c9860f696</name> - <entityField>KeywordAttributeRelationsReadOnly</entityField> + <entityField>KeywordAttributeRelations</entityField> <view>KeywordAttriubteRelationTitled_view</view> </neonViewReference> </children> diff --git a/neonView/LetterEdit_view/LetterEdit_view.aod b/neonView/LetterEdit_view/LetterEdit_view.aod index cfd6eba37cd937c96a9da9ef64e1248be625c2cb..d6e86204f9feb58dcfa3645561eae152ca1cb9e8 100644 --- a/neonView/LetterEdit_view/LetterEdit_view.aod +++ b/neonView/LetterEdit_view/LetterEdit_view.aod @@ -4,9 +4,9 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <isSmall v="true" /> <layout> - <boxLayout> + <noneLayout> <name>layout</name> - </boxLayout> + </noneLayout> </layout> <children> <genericViewTemplate> @@ -19,8 +19,8 @@ <entityField>DOCUMENT_TEMPLATE</entityField> </entityFieldLink> <entityFieldLink> - <name>1b614c44-29b5-4557-8ce6-9ef533a55c65</name> - <entityField>CREATEACTIVITY</entityField> + <name>6513b2f4-d7c8-4bbe-b31a-290cf9bf7ded</name> + <entityField>bindata</entityField> </entityFieldLink> </fields> </genericViewTemplate> diff --git a/neonView/LetterRecipientEdit_view/LetterRecipientEdit_view.aod b/neonView/LetterRecipientEdit_view/LetterRecipientEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..4d2449910552d78c852156f5f9a00c86561d0230 --- /dev/null +++ b/neonView/LetterRecipientEdit_view/LetterRecipientEdit_view.aod @@ -0,0 +1,24 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>LetterRecipientEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Generic</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>846f303d-2314-4261-b04a-2fc4087cabd3</name> + <entityField>CONTACT_ID</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/LetterRecipientFilter_view/LetterRecipientFilter_view.aod b/neonView/LetterRecipientFilter_view/LetterRecipientFilter_view.aod index 6375b23476ff004e1ca2cee8d3bf0a0f6d42b5fd..48c2df8f23efdaa215170f000201ab0298ed9db0 100644 --- a/neonView/LetterRecipientFilter_view/LetterRecipientFilter_view.aod +++ b/neonView/LetterRecipientFilter_view/LetterRecipientFilter_view.aod @@ -24,6 +24,10 @@ <name>037e6bac-1e49-4c89-ae72-a5c64b9261d0</name> <entityField>CONTACT_ID</entityField> </neonTableColumn> + <neonTableColumn> + <name>e4e4ac89-100c-4fb8-b365-3e8f909ca526</name> + <entityField>ADDRESS_ID</entityField> + </neonTableColumn> </columns> </tableViewTemplate> </children> diff --git a/neonView/MyDashboardScoreCard_view/MyDashboardScoreCard_view.aod b/neonView/MyDashboardScoreCard_view/MyDashboardScoreCard_view.aod index 59789b2ccde6367f227bd4b0ffe7a99aed2e5f02..b1e060e24f903f0c7cc13acc7dfb94ea20f63374 100644 --- a/neonView/MyDashboardScoreCard_view/MyDashboardScoreCard_view.aod +++ b/neonView/MyDashboardScoreCard_view/MyDashboardScoreCard_view.aod @@ -1,53 +1,55 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>MyDashboardScoreCard_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <dashletConfigurations> - <neonDashletConfiguration> - <name>Information</name> - <title>To-Do</title> - <fragment>Analyses/full</fragment> - <singleton v="true" /> - <icon>VAADIN:CLIPBOARD_CHECK</icon> - <categories> - <neonDashletCategory> - <name>tasks</name> - <title>Tasks</title> - </neonDashletCategory> - <neonDashletCategory> - <name>calendar</name> - <title>Calendar</title> - </neonDashletCategory> - </categories> - </neonDashletConfiguration> - </dashletConfigurations> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <scoreCardViewTemplate> - <name>Scorecard</name> - <fieldActions> - <element>openOverdueTasks</element> - <element>openNewTasks</element> - </fieldActions> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>158d3dd5-4de6-470b-b61d-6de1e9907264</name> - <entityField>OVERDUE_TASKS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>5bbd7580-6fdd-4134-b33a-1082f4891c7c</name> - <entityField>NEW_TASKS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>3631eda6-dfda-4c75-9caa-8b2c2e7c39e4</name> - <entityField>IMMINENT_APPOINTMENTS</entityField> - </entityFieldLink> - </fields> - </scoreCardViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>MyDashboardScoreCard_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <dashletConfigurations> + <neonDashletConfiguration> + <name>Information</name> + <title>To-Do</title> + <description>Remaining tasks and appointments</description> + <fragment>Analyses/full</fragment> + <singleton v="true" /> + <icon>VAADIN:CLIPBOARD_CHECK</icon> + <categories> + <neonDashletCategory> + <name>tasks</name> + <title>Tasks</title> + </neonDashletCategory> + <neonDashletCategory> + <name>calendar</name> + <title>Calendar</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> + </dashletConfigurations> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <scoreCardViewTemplate> + <name>Scorecard</name> + <fieldActions> + <element>openOverdueTasks</element> + <element>openNewTasks</element> + <element>openCalendar</element> + </fieldActions> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>158d3dd5-4de6-470b-b61d-6de1e9907264</name> + <entityField>OVERDUE_TASKS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>5bbd7580-6fdd-4134-b33a-1082f4891c7c</name> + <entityField>NEW_TASKS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>3631eda6-dfda-4c75-9caa-8b2c2e7c39e4</name> + <entityField>IMMINENT_APPOINTMENTS</entityField> + </entityFieldLink> + </fields> + </scoreCardViewTemplate> + </children> +</neonView> diff --git a/neonView/NotificationFilter_view/NotificationFilter_view.aod b/neonView/NotificationFilter_view/NotificationFilter_view.aod index 2056fdfa2e94a010fe2b388d19da45f643782e39..8971c73ee26bfcfea2222a4e49b060e75aa85525 100644 --- a/neonView/NotificationFilter_view/NotificationFilter_view.aod +++ b/neonView/NotificationFilter_view/NotificationFilter_view.aod @@ -3,6 +3,23 @@ <name>NotificationFilter_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <filterable v="true" /> + <dashletConfigurations> + <neonDashletConfiguration> + <name>NotificationDashletConfiguration</name> + <title>New Notifications</title> + <description>Shows unread notifications about different content, e.g. Appointments, serial mails, ...</description> + <fragment>Notification/filter?search=eyJ0eXBlIjoiZ3JvdXAiLCJvcGVyYXRvciI6Ik9SIiwiY2hpbGRzIjpbeyJ0eXBlIjoicm93IiwibmFtZSI6IlNUQVRFIiwib3BlcmF0b3IiOiJFUVVBTCIsInZhbHVlIjoiVU5TRUVOICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiwia2V5IjoiVU5TRUVOICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiwiY29udGVudHR5cGUiOiJVTktOT1dOIn0seyJ0eXBlIjoicm93IiwibmFtZSI6IlNUQVRFIiwib3BlcmF0b3IiOiJFUVVBTCIsInZhbHVlIjoiU0VFTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiwia2V5IjoiU0VFTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiwiY29udGVudHR5cGUiOiJVTktOT1dOIn1dfQ%253D%253D</fragment> + <singleton v="true" /> + <storeRoles /> + <icon>VAADIN:BELL</icon> + <categories> + <neonDashletCategory> + <name>Notifications</name> + <title>Notifications</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> + </dashletConfigurations> <layout> <boxLayout> <name>layout</name> diff --git a/neonView/OfferEdit_view/OfferEdit_view.aod b/neonView/OfferEdit_view/OfferEdit_view.aod index 558cf0f431752a09a60e177dbf8b288dcfcf3352..b160d884b5b0ae6cd796a83b85b4f4e38c54bf67 100644 --- a/neonView/OfferEdit_view/OfferEdit_view.aod +++ b/neonView/OfferEdit_view/OfferEdit_view.aod @@ -46,7 +46,7 @@ </entityFieldLink> <entityFieldLink> <name>7ab3eb65-b713-4251-9eb1-3119432565f5</name> - <entityField>LANGUAGE</entityField> + <entityField>ISOLANGUAGE</entityField> </entityFieldLink> <entityFieldLink> <name>7a9b0943-eb06-4b44-a111-ed4e2749da6a</name> diff --git a/neonView/OfferFilter_view/OfferFilter_view.aod b/neonView/OfferFilter_view/OfferFilter_view.aod index 93ccc4173bf05f8d90b268a70268a489abd38d08..66a91c612d147a064e2b1761a86d40dfd6f2712c 100644 --- a/neonView/OfferFilter_view/OfferFilter_view.aod +++ b/neonView/OfferFilter_view/OfferFilter_view.aod @@ -27,7 +27,7 @@ <name>SendOffersDashlet</name> <title>Sent offers</title> <description>Show all sent offers</description> - <fragment>Offer/filter?search=W3sibmFtZSI6IlNUQVRVUyIsIm9wZXJhdG9yIjoiRVFVQUwiLCJ2YWx1ZSI6ImU1ZDZiNWE0LTc1NzYtNDQwZi04MzMyLWJjNDAxNDdjMDMzNSIsImNvbnRlbnRUeXBlIjoiVEVYVCJ9XQ%253D%253D</fragment> + <fragment>Offer/filter?search=eyJ0eXBlIjoiZ3JvdXAiLCJvcGVyYXRvciI6IkFORCIsImNoaWxkcyI6W3sidHlwZSI6InJvdyIsIm5hbWUiOiJTVEFUVVMiLCJvcGVyYXRvciI6IkVRVUFMIiwidmFsdWUiOiJWZXJzZW5kZXQiLCJrZXkiOiJPRkZFUlNUQVRTRU5UICAgICAgICAgICAgICAgICAgICAgICAiLCJjb250ZW50dHlwZSI6IlRFWFQifV19</fragment> <singleton v="true" /> <requiresConfiguration v="false" /> <icon>vaadin:cart</icon> diff --git a/neonView/OfferMain_view/OfferMain_view.aod b/neonView/OfferMain_view/OfferMain_view.aod index a973e2221d14e6e308634eb45b9f4e32f2e913c4..36213d479186dfbcf347b2573c39cf462724bd4e 100644 --- a/neonView/OfferMain_view/OfferMain_view.aod +++ b/neonView/OfferMain_view/OfferMain_view.aod @@ -46,7 +46,7 @@ </neonViewReference> <neonViewReference> <name>d79a0304-4106-4749-b2e1-c5ba005b4448</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> </children> diff --git a/neonView/OfferPreview_view/OfferPreview_view.aod b/neonView/OfferPreview_view/OfferPreview_view.aod index a1b87c0332c19fab0cf521e62e88ac18a4876e08..371fc562762549ffa99d28ce5e9803111dcee429 100644 --- a/neonView/OfferPreview_view/OfferPreview_view.aod +++ b/neonView/OfferPreview_view/OfferPreview_view.aod @@ -34,7 +34,7 @@ </entityFieldLink> <entityFieldLink> <name>49e446b5-015e-45ad-9417-c5c50f9756f1</name> - <entityField>LANGUAGE</entityField> + <entityField>ISOLANGUAGE</entityField> </entityFieldLink> <entityFieldLink> <name>ce062531-603e-4c33-8a6b-935d2f07f516</name> diff --git a/neonView/OrderClassification_view/OrderClassification_view.aod b/neonView/OrderClassification_view/OrderClassification_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..b98440e7e9260a00117ebc32f82adfb7af9b05a9 --- /dev/null +++ b/neonView/OrderClassification_view/OrderClassification_view.aod @@ -0,0 +1,39 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrderClassification_view</name> + <title>Classifications</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Classifications</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>6c01c691-c587-438c-9c92-77682c4fd34e</name> + <entityField>PAYMENTTERMS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>16f9e458-eab5-4ed1-954c-0f2f8cb474e3</name> + <entityField>DELIVERYTERMS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>aed251c9-caa6-462f-9b22-6a87f5998b4e</name> + <entityField>PAYMENTADDRESS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>52dd0767-3a92-4d13-9f72-1bd9e7745b79</name> + <entityField>DELIVERYADDRESS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7c486c49-22e2-4d61-ac86-b599adbf9522</name> + <entityField>NOTICE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrderDetail_view/OrderDetail_view.aod b/neonView/OrderDetail_view/OrderDetail_view.aod index 842b4ffaf56402f72fece957e91f946c16915128..7f87b9147fcb96eff575b08746cc3e0b7a533ef1 100644 --- a/neonView/OrderDetail_view/OrderDetail_view.aod +++ b/neonView/OrderDetail_view/OrderDetail_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>OrderDetail_view</name> - <title>Details</title> + <title>Texts</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <noneLayout> @@ -23,6 +23,10 @@ <name>d6f2774b-34c2-4db8-9730-e98b4c83503a</name> <entityField>FOOTER</entityField> </entityFieldLink> + <entityFieldLink> + <name>6c1b2311-f15f-4d03-9301-0839b504d24a</name> + <entityField>DUNNINGTEXT</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/neonView/OrderDunning_view/OrderDunning_view.aod b/neonView/OrderDunning_view/OrderDunning_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..99e8338d52d28087d49c42bc523b59fc7fad0cbe --- /dev/null +++ b/neonView/OrderDunning_view/OrderDunning_view.aod @@ -0,0 +1,28 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrderDunning_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Dunning_info</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>66b04976-21fa-4ea7-b82e-ff2dd02f7ab9</name> + <entityField>DUNNINGDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>1f8b88dc-f07c-4803-b985-cc385723d492</name> + <entityField>DUNNINGLEVEL</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrderEdit_view/OrderEdit_view.aod b/neonView/OrderEdit_view/OrderEdit_view.aod index b7831d0d709673a2e59e6e4962dc613d8835304f..b11bd4217936e37fbb7952966a8187a520d03887 100644 --- a/neonView/OrderEdit_view/OrderEdit_view.aod +++ b/neonView/OrderEdit_view/OrderEdit_view.aod @@ -20,17 +20,25 @@ <name>17536f17-4160-4027-8486-07321692147d</name> <entityField>OrderCode_VersNr_fieldgroup</entityField> </entityFieldLink> + <entityFieldLink> + <name>0f63ee93-c4bb-41e9-a38d-c52bb07f5a11</name> + <entityField>ORDERTYPE</entityField> + </entityFieldLink> <entityFieldLink> <name>1b323e80-820d-402a-98d2-f3649ec8e91f</name> <entityField>CONTACT_ID</entityField> </entityFieldLink> <entityFieldLink> - <name>767a9e6e-596b-4903-aa86-7bc0f66cd037</name> - <entityField>STATUS</entityField> + <name>c9efcb50-ed61-453b-baa3-02071d99e4b0</name> + <entityField>OBJECT_ROWID</entityField> </entityFieldLink> <entityFieldLink> - <name>c1d37263-7cb1-4d0c-9701-be9b44f904e5</name> - <entityField>ORDERDATE</entityField> + <name>acb42613-102e-42cc-984f-5820b36ad2a8</name> + <entityField>OBJECT_TYPE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b21c6438-0283-4f99-80ec-1c43e1630598</name> + <entityField>ORDERSTATUS</entityField> </entityFieldLink> <entityFieldLink> <name>64cb7376-3a7c-4ce9-99e8-e70bc91b41d0</name> @@ -41,17 +49,81 @@ <entityField>LANGUAGE</entityField> </entityFieldLink> <entityFieldLink> - <name>ac6f81a2-5012-461a-bcf1-4534182b0973</name> - <entityField>SALESPROJECT_ID</entityField> + <name>7514c5cf-3e92-4d38-9dff-dd373b964a35</name> + <entityField>SALESORDERDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>236a3654-dce9-4786-ae13-9b1babd5f75f</name> + <entityField>PAYDUEDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b42c6333-d6ac-4628-b7b4-509fea676276</name> + <entityField>DELIVERYTERMS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>09f67f92-e6d1-4439-92fa-2b2741b3de5b</name> + <entityField>PAYMENTTERMS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>f79c4c09-8082-4c88-83f5-a26aaf425c12</name> + <entityField>OFFER_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>cd8bcf86-80d7-47f8-88da-f425417198d8</name> + <entityField>ChosenTexHeader</entityField> </entityFieldLink> <entityFieldLink> <name>ed71986f-303c-4118-a895-51ec31ba8775</name> <entityField>HEADER</entityField> </entityFieldLink> + <entityFieldLink> + <name>f1729940-3df7-44c7-9acf-911f247ad832</name> + <entityField>ChosenTexFooter</entityField> + </entityFieldLink> <entityFieldLink> <name>c4b3c8ed-4625-4785-abc6-c726171ff7f4</name> <entityField>FOOTER</entityField> </entityFieldLink> + <entityFieldLink> + <name>cdd4504c-3af2-414f-9f1a-d8ab646487f1</name> + <entityField>PAYDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>31ed9eba-66a1-4114-a1fe-61ef475d532d</name> + <entityField>PAID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>9f25be07-768a-4598-a766-c78beb9ac650</name> + <entityField>DUNNINGDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>658b9f0b-fcd8-49f9-87ba-6d867e6b6e26</name> + <entityField>DUNNINGLEVEL</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d745c24f-009b-4f95-97e6-e55c53860261</name> + <entityField>DUNNINGTEXT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8333aea5-0be3-47ac-94c3-f6f8485ba7e0</name> + <entityField>CANCELLATION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>9cc1be03-6dc6-4c73-960a-fd8c3a9beec1</name> + <entityField>ChosenPaymentAddress</entityField> + </entityFieldLink> + <entityFieldLink> + <name>21860875-55d6-4686-9e1d-6b45963878ff</name> + <entityField>PAYMENTADDRESS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>884b0458-52ac-401c-ba62-447d37889784</name> + <entityField>ChosenDeliveryAddress</entityField> + </entityFieldLink> + <entityFieldLink> + <name>73687971-85f9-4120-98b2-e93f7f906ebb</name> + <entityField>DELIVERYADDRESS</entityField> + </entityFieldLink> </fields> </genericViewTemplate> <neonViewReference> diff --git a/neonView/OrderFilter_view/OrderFilter_view.aod b/neonView/OrderFilter_view/OrderFilter_view.aod index 81649535818754a2b2ea84ff10ef0da5af4cec6a..b366c7fa1fd841b1de423807c6efbe2f754c3088 100644 --- a/neonView/OrderFilter_view/OrderFilter_view.aod +++ b/neonView/OrderFilter_view/OrderFilter_view.aod @@ -59,12 +59,20 @@ <entityField>#ENTITY</entityField> <columns> <neonTableColumn> - <name>8d4948c3-40cb-45dd-ae04-32ae06458b26</name> + <name>71f23753-601d-49fa-810d-daa02a1323d8</name> <entityField>IMAGE</entityField> </neonTableColumn> + <neonTableColumn> + <name>443c8480-5676-43a3-9617-f86dae39c960</name> + <entityField>SALESORDERDATE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>dba5604f-cc1b-4083-8115-7bbe1ba07bf4</name> + <entityField>ORDERTYPE</entityField> + </neonTableColumn> <neonTableColumn> <name>60b83daa-9349-4bef-94d8-5f1fc350da59</name> - <entityField>SALESORDERCODE</entityField> + <entityField>FullOrderCode</entityField> </neonTableColumn> <neonTableColumn> <name>5688908f-7c50-46a3-8899-2767ea5b4a90</name> @@ -77,12 +85,12 @@ <entityField>CONTACT_PERSON_ID</entityField> </neonTableColumn> <neonTableColumn> - <name>443c8480-5676-43a3-9617-f86dae39c960</name> - <entityField>SALESORDERDATE</entityField> + <name>513826d9-7bb3-4cdd-b26a-f3c3976a6063</name> + <entityField>ORDERSTATUS</entityField> </neonTableColumn> <neonTableColumn> - <name>c5780864-ac2c-4650-8630-2690a9a074ea</name> - <entityField>STATUS</entityField> + <name>f0b61831-07b1-41dc-bac6-0e27252f6b74</name> + <entityField>CANCELLATION</entityField> </neonTableColumn> <neonTableColumn> <name>6f55da1e-281c-44ba-ab97-729b75516c32</name> diff --git a/neonView/OrderLink_view/OrderLink_view.aod b/neonView/OrderLink_view/OrderLink_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..8913e89be6ab8d66d5472957bd92be2be972effa --- /dev/null +++ b/neonView/OrderLink_view/OrderLink_view.aod @@ -0,0 +1,31 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrderLink_view</name> + <title>Links</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Links</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>3a8b8210-72d3-4b58-b964-0a1058909346</name> + <entityField>OFFER_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>11cb37e5-d902-44ba-8494-c26215e2a46a</name> + <entityField>OBJECT_ROWID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>470b177a-7df6-4433-acf5-e43d77ebb04b</name> + <entityField>OBJECT_TYPE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrderMain_view/OrderMain_view.aod b/neonView/OrderMain_view/OrderMain_view.aod index b7a6c72a7becc0b046e2941a0fb323296c51b5bf..31513c92e55ea8e667e1d862495fb21a360d762f 100644 --- a/neonView/OrderMain_view/OrderMain_view.aod +++ b/neonView/OrderMain_view/OrderMain_view.aod @@ -20,14 +20,14 @@ <view>OrderitemFilter_view</view> </neonViewReference> <neonViewReference> - <name>7ec102f5-fb45-44a7-9bbf-0eba7f1536d7</name> - <entityField>Activities</entityField> - <view>ActivityFilter_view</view> + <name>1e0af6a9-9bb6-47b5-944b-636d21ac74d2</name> + <entityField>AttributeTree</entityField> + <view>AttributeRelationTree_view</view> </neonViewReference> <neonViewReference> - <name>351a9b5d-a050-4fb9-b3e4-402dcd84b331</name> - <entityField>Tasks</entityField> - <view>TaskFilter_view</view> + <name>106a79b1-332d-47b0-8c24-431d21bdea1e</name> + <entityField>#ENTITY</entityField> + <view>OrderClassification_view</view> </neonViewReference> <neonViewReference> <name>92918210-a64f-49c8-8a04-c82c7a2a0a51</name> @@ -35,18 +35,28 @@ <view>OrderDetail_view</view> </neonViewReference> <neonViewReference> - <name>1e0af6a9-9bb6-47b5-944b-636d21ac74d2</name> - <entityField>AttributeTree</entityField> - <view>AttributeRelationTree_view</view> + <name>bfad682f-f033-4813-87fc-7cce05f3a962</name> + <entityField>#ENTITY</entityField> + <view>OrderLink_view</view> </neonViewReference> <neonViewReference> <name>b3014999-da86-45ae-86ae-feb738d62906</name> <entityField>Documents</entityField> <view>DocumentFilter_view</view> </neonViewReference> + <neonViewReference> + <name>7ec102f5-fb45-44a7-9bbf-0eba7f1536d7</name> + <entityField>Activities</entityField> + <view>ActivityFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>351a9b5d-a050-4fb9-b3e4-402dcd84b331</name> + <entityField>Tasks</entityField> + <view>TaskFilter_view</view> + </neonViewReference> <neonViewReference> <name>b0dea506-7dd9-4de9-9ebe-ecad9965c300</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> </children> diff --git a/neonView/OrderPaid_view/OrderPaid_view.aod b/neonView/OrderPaid_view/OrderPaid_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..fd7a180961f454fb5e0e30bd0307b999c2437313 --- /dev/null +++ b/neonView/OrderPaid_view/OrderPaid_view.aod @@ -0,0 +1,28 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrderPaid_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Paid</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>e02ce25c-891d-4285-a42c-8d79ce086bd3</name> + <entityField>PAYDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>cb3e76a5-a34f-4e02-bd41-e9acad7fa01a</name> + <entityField>PAID</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrderPreview_view/OrderPreview_view.aod b/neonView/OrderPreview_view/OrderPreview_view.aod index 4cb38fef22a44f1b4084f566a7093e415fcf9dcb..a5c5761ef0f2690cad4a2f814d523e028828bb30 100644 --- a/neonView/OrderPreview_view/OrderPreview_view.aod +++ b/neonView/OrderPreview_view/OrderPreview_view.aod @@ -24,18 +24,50 @@ <drawerCaption>Details</drawerCaption> <entityField>#ENTITY</entityField> <fields> + <entityFieldLink> + <name>0ee64080-2459-4a56-b4b9-cab2cac0f8c3</name> + <entityField>SALESORDERDATE</entityField> + </entityFieldLink> <entityFieldLink> <name>d7bb0f49-34db-4485-9908-598e83f3e73b</name> <entityField>ORDERDATE</entityField> </entityFieldLink> <entityFieldLink> - <name>8d780ff6-9ca0-4067-b2b1-6e092c62253e</name> - <entityField>STATUS</entityField> + <name>beb2d15c-6ed9-41fb-b59b-f874568a9896</name> + <entityField>ORDERTYPE</entityField> </entityFieldLink> <entityFieldLink> <name>49e446b5-015e-45ad-9417-c5c50f9756f1</name> <entityField>LANGUAGE</entityField> </entityFieldLink> + <entityFieldLink> + <name>fecf7457-825d-40a3-b330-bace7ed75ddc</name> + <entityField>DUNNINGDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>9ed18271-5060-4538-867a-d5f0744fc078</name> + <entityField>DUNNINGLEVEL</entityField> + </entityFieldLink> + <entityFieldLink> + <name>22013ee3-0ea1-4830-affd-73429ebd18f5</name> + <entityField>PAYDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>e58a3aab-0cd7-493f-a24e-ed9e30f970ce</name> + <entityField>PAYMENTTERMS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8f976c0e-f31d-4482-a8f7-7c93864f1815</name> + <entityField>DELIVERYTERMS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>39a40fbb-b3af-49a2-8ce2-0ece7bbf6fda</name> + <entityField>ORDERSTATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8604c69f-5f3d-472a-9b8f-b8f1bcaf25fe</name> + <entityField>CANCELLATION</entityField> + </entityFieldLink> </fields> </genericViewTemplate> <genericViewTemplate> @@ -56,6 +88,10 @@ <name>43972a26-67f7-4fb5-9107-111731d326af</name> <entityField>TotalGross</entityField> </entityFieldLink> + <entityFieldLink> + <name>893e3b20-891e-49ba-a460-7dadfca7b18a</name> + <entityField>PAID</entityField> + </entityFieldLink> </fields> </genericViewTemplate> <genericViewTemplate> @@ -64,8 +100,12 @@ <entityField>#ENTITY</entityField> <fields> <entityFieldLink> - <name>3317b73e-68e8-41a8-a678-89c7c7c8513e</name> - <entityField>SALESPROJECT_ID</entityField> + <name>5039cdab-f324-4559-ac24-390b95cf31c3</name> + <entityField>OBJECT_ROWID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>6cd53fd8-1c8a-4871-826d-129917751a54</name> + <entityField>OBJECT_TYPE</entityField> </entityFieldLink> <entityFieldLink> <name>ca9602d9-03fe-450b-9349-949bf206b4bf</name> diff --git a/neonView/OrderitemEdit_view/OrderitemEdit_view.aod b/neonView/OrderitemEdit_view/OrderitemEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..9d82f0ec71a42952a49fca14dd9f8d057d3e7885 --- /dev/null +++ b/neonView/OrderitemEdit_view/OrderitemEdit_view.aod @@ -0,0 +1,69 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrderitemEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Info</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>734d4d6f-621c-48c1-8c86-d5bae29a1f7d</name> + <entityField>ITEMPOSITION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>18f23d05-0ef0-4106-8fc1-7a9b1418353e</name> + <entityField>PRODUCT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>193cdd2b-7807-4da7-8e22-30bcd6d6ba14</name> + <entityField>QUANTITY</entityField> + </entityFieldLink> + <entityFieldLink> + <name>4aefc53a-8245-4f9f-8ce5-0aaaba53fab6</name> + <entityField>UNIT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>1fe53620-db28-451f-8f59-09baf1626a2d</name> + <entityField>VAT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>f7bd09a0-ed27-4989-940e-e3baac4c3c80</name> + <entityField>PRICE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>2b38de6e-85de-479c-99fd-27ff0d2e1c33</name> + <entityField>DISCOUNT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>242825ab-fd74-4be5-b8c8-bf945a501494</name> + <entityField>OPTIONAL</entityField> + </entityFieldLink> + <entityFieldLink> + <name>ff49cd49-d539-4c43-b9c7-822360ae6881</name> + <entityField>TotalPrice</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <genericViewTemplate> + <name>Description</name> + <editMode v="true" /> + <drawerCaption>Description</drawerCaption> + <hideLabels v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>b5404b05-ecf7-47c8-86cb-db4d9a16f426</name> + <entityField>INFO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrderitemPreview_view/OrderitemPreview_view.aod b/neonView/OrderitemPreview_view/OrderitemPreview_view.aod index 6731bf57ed2e36f09e2aae4cf47aa577e9b98ca4..b714ecf2fd8b589e5e0f77c033e225642cc6e074 100644 --- a/neonView/OrderitemPreview_view/OrderitemPreview_view.aod +++ b/neonView/OrderitemPreview_view/OrderitemPreview_view.aod @@ -5,35 +5,70 @@ <layout> <headerFooterLayout> <name>layout</name> - <header>Header</header> </headerFooterLayout> </layout> <children> - <cardViewTemplate> - <name>Header</name> - <iconField>IMAGE</iconField> - <titleField>ITEMNAME</titleField> - <descriptionField>INFO</descriptionField> - <entityField>#ENTITY</entityField> - </cardViewTemplate> <genericViewTemplate> <name>Info</name> <showDrawer v="true" /> <entityField>#ENTITY</entityField> <fields> <entityFieldLink> - <name>9868560c-41c7-4641-b0f1-627a61b796b3</name> - <entityField>TotalPrice</entityField> + <name>ad4fb267-277c-47ca-ad3d-c518cd234a39</name> + <entityField>ITEMPOSITION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>a704c785-f27f-431b-a6ac-77fd21217d9d</name> + <entityField>PRODUCT_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d501d9d5-f149-4685-903d-0394dc6e40e2</name> + <entityField>QUANTITY</entityField> + </entityFieldLink> + <entityFieldLink> + <name>f6438e24-f7c8-45a2-8f5e-d5430ab59ef6</name> + <entityField>UNIT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b434c556-c1c9-4c6d-a96d-272e2262010c</name> + <entityField>VAT</entityField> </entityFieldLink> <entityFieldLink> - <name>c0c04d1c-90a7-4c0b-9323-1f0783757987</name> - <entityField>GROUPCODEID</entityField> + <name>53c04932-b042-4a47-8f94-27d95b8e2ef2</name> + <entityField>PRICE</entityField> </entityFieldLink> <entityFieldLink> - <name>e25386dc-a740-4f93-a1f0-32317cf5a36a</name> + <name>e679761b-c004-4bd8-940c-b12e8b209762</name> + <entityField>DISCOUNT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>1cfd6a95-4789-43aa-941c-6f69eeedd6b2</name> <entityField>OPTIONAL</entityField> </entityFieldLink> </fields> </genericViewTemplate> + <genericViewTemplate> + <name>Price</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>e96b71a9-132a-4b56-a097-31055bdec600</name> + <entityField>TotalPrice</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <genericViewTemplate> + <name>Description</name> + <showDrawer v="true" /> + <drawerCaption>Description</drawerCaption> + <hideLabels v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>23711a64-b750-4ef7-84f3-8574973472df</name> + <entityField>INFO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> </children> </neonView> diff --git a/neonView/OrganisationConditionPricelist_view/OrganisationConditionPricelist_view.aod b/neonView/OrganisationConditionPricelist_view/OrganisationConditionPricelist_view.aod index 13f530e164fbc215e1d418b84f93b542b999f7d5..b46f48aac73e57823b6f9af069a9360658fd52cc 100644 --- a/neonView/OrganisationConditionPricelist_view/OrganisationConditionPricelist_view.aod +++ b/neonView/OrganisationConditionPricelist_view/OrganisationConditionPricelist_view.aod @@ -1,23 +1,23 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationConditionPricelist_view</name> - <title>Conditions</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <neonViewReference> - <name>4ac57eb5-8011-4e32-b3c1-0c48bebd35a4</name> - <entityField>#ENTITY</entityField> - <view>OrganisationCondition_view</view> - </neonViewReference> - <neonViewReference> - <name>16260b28-b350-4bc2-b29a-23b632969070</name> - <entityField>Productprices</entityField> - <view>ProductpriceRelation_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationConditionPricelist_view</name> + <title>Conditions</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>4ac57eb5-8011-4e32-b3c1-0c48bebd35a4</name> + <entityField>#ENTITY</entityField> + <view>OrganisationCondition_view</view> + </neonViewReference> + <neonViewReference> + <name>16260b28-b350-4bc2-b29a-23b632969070</name> + <entityField>Productprices</entityField> + <view>ProductpriceRelation_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/OrganisationCondition_view/OrganisationCondition_view.aod b/neonView/OrganisationCondition_view/OrganisationCondition_view.aod index f096b7699941f8eeec7019a0640d46024592be98..392c3d55a089114cef2351242f3819bbbe4dc60c 100644 --- a/neonView/OrganisationCondition_view/OrganisationCondition_view.aod +++ b/neonView/OrganisationCondition_view/OrganisationCondition_view.aod @@ -1,34 +1,34 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationCondition_view</name> - <title>Conditions</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - <direction>HORIZONTAL</direction> - <maxDirectionElements v="2" /> - <autoHeight v="true" /> - </boxLayout> - </layout> - <children> - <neonViewReference> - <name>a81eca8c-e22e-43f2-8f23-1d63eff36ffd</name> - <entityField>AttributeConditions</entityField> - <view>AttributeRelationPreviewList</view> - </neonViewReference> - <genericViewTemplate> - <name>Information</name> - <showDrawer v="true" /> - <drawerCaption>Information</drawerCaption> - <fixedDrawer v="false" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>d867f7c4-221a-43cc-8ffb-f2838239fab3</name> - <entityField>INFO</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationCondition_view</name> + <title>Conditions</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + <direction>HORIZONTAL</direction> + <maxDirectionElements v="2" /> + <autoHeight v="true" /> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>a81eca8c-e22e-43f2-8f23-1d63eff36ffd</name> + <entityField>AttributeConditions</entityField> + <view>AttributeRelationPreviewList</view> + </neonViewReference> + <genericViewTemplate> + <name>Information</name> + <showDrawer v="true" /> + <drawerCaption>Information</drawerCaption> + <fixedDrawer v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>d867f7c4-221a-43cc-8ffb-f2838239fab3</name> + <entityField>INFO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrganisationEditDefaults_view/OrganisationEditDefaults_view.aod b/neonView/OrganisationEditDefaults_view/OrganisationEditDefaults_view.aod index 4f6a69cf91f991b48bd9321b44b50d51c14cb97b..9fa0f7d194c7ec8af51eb518a8e5b2b6d1b1d4ef 100644 --- a/neonView/OrganisationEditDefaults_view/OrganisationEditDefaults_view.aod +++ b/neonView/OrganisationEditDefaults_view/OrganisationEditDefaults_view.aod @@ -1,32 +1,32 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationEditDefaults_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <isSmall v="true" /> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Edit</name> - <editMode v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>ccc421c9-3943-4668-a6c7-960753c38562</name> - <entityField>ADDRESS_ID</entityField> - </entityFieldLink> - <entityFieldLink> - <name>8625fb63-550c-4ad3-9b39-3091762e3f29</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>a984c913-54e8-492e-928a-3553a1e76726</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationEditDefaults_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>ccc421c9-3943-4668-a6c7-960753c38562</name> + <entityField>ADDRESS_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8625fb63-550c-4ad3-9b39-3091762e3f29</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>a984c913-54e8-492e-928a-3553a1e76726</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/OrganisationEdit_view/OrganisationEdit_view.aod b/neonView/OrganisationEdit_view/OrganisationEdit_view.aod index 942fde0a8a8b98570defff5d9d521fba682ed302..2efdd5acf67112db049d395d84aae6284bf8087f 100644 --- a/neonView/OrganisationEdit_view/OrganisationEdit_view.aod +++ b/neonView/OrganisationEdit_view/OrganisationEdit_view.aod @@ -1,61 +1,61 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationEdit_view</name> - <title>Company</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>VAADIN:BUILDING</icon> - <quickEntry v="1" /> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Edit</name> - <editMode v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>05ea829a-07b1-418a-b634-01fbf8bcfcf5</name> - <entityField>NAME</entityField> - </entityFieldLink> - <entityFieldLink> - <name>1208d378-8992-42d8-a919-81ff5c0985d2</name> - <entityField>CUSTOMERCODE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>1af0f937-298b-411d-be16-7ca49446e780</name> - <entityField>INFO</entityField> - </entityFieldLink> - <entityFieldLink> - <name>6009a1a1-0cec-4dc8-b646-99b594dee765</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>2e4b0273-a02a-4afa-9de2-bab48a7af12a</name> - <entityField>STATUS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>edecd4d4-dece-42a6-b25c-c4c4ccb0dd8f</name> - <entityField>TYPE</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - <neonViewReference> - <name>148e3a6c-d30b-470c-84e5-273293348611</name> - <entityField>Addresses</entityField> - <view>AdressMultiEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>6355808f-ee94-4caf-95b1-3848e81c75b7</name> - <entityField>Communications</entityField> - <view>CommunicationMultiEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>2114d459-851a-4ead-b3ec-a81ec78af607</name> - <entityField>Attributes</entityField> - <view>AttributeRelationMultiEdit_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationEdit_view</name> + <title>Company</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:BUILDING</icon> + <quickEntry v="1" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>05ea829a-07b1-418a-b634-01fbf8bcfcf5</name> + <entityField>NAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>1208d378-8992-42d8-a919-81ff5c0985d2</name> + <entityField>CUSTOMERCODE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>1af0f937-298b-411d-be16-7ca49446e780</name> + <entityField>INFO</entityField> + </entityFieldLink> + <entityFieldLink> + <name>6009a1a1-0cec-4dc8-b646-99b594dee765</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>2e4b0273-a02a-4afa-9de2-bab48a7af12a</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>edecd4d4-dece-42a6-b25c-c4c4ccb0dd8f</name> + <entityField>TYPE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <neonViewReference> + <name>148e3a6c-d30b-470c-84e5-273293348611</name> + <entityField>Addresses</entityField> + <view>AdressMultiEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>6355808f-ee94-4caf-95b1-3848e81c75b7</name> + <entityField>Communications</entityField> + <view>CommunicationMultiEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>2114d459-851a-4ead-b3ec-a81ec78af607</name> + <entityField>Attributes</entityField> + <view>AttributeRelationMultiEdit_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/OrganisationFilter_view/OrganisationFilter_view.aod b/neonView/OrganisationFilter_view/OrganisationFilter_view.aod index f219f2d335d818af6a3553dbb70ac3f913cf1331..68f25862f2745179150af77398976599c2f9e9fe 100644 --- a/neonView/OrganisationFilter_view/OrganisationFilter_view.aod +++ b/neonView/OrganisationFilter_view/OrganisationFilter_view.aod @@ -1,75 +1,75 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationFilter_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> - <dashletConfigurations> - <neonDashletConfiguration> - <name>AllOrgsDashlet</name> - <title>Companies</title> - <description>Show all companies</description> - <fragment>Organisation/filter</fragment> - <singleton v="true" /> - <requiresConfiguration v="false" /> - <icon>vaadin:building</icon> - <categories> - <neonDashletCategory> - <name>contactmanagement</name> - <title>Contactmanagement</title> - </neonDashletCategory> - <neonDashletCategory> - <name>org</name> - <title>Company</title> - </neonDashletCategory> - </categories> - </neonDashletConfiguration> - </dashletConfigurations> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Organisations</name> - <favoriteActionGroup1>campaignActionGroup</favoriteActionGroup1> - <subtitleField>CUSTOMERCODE_DISPLAY_fieldGroup</subtitleField> - <entityField>#ENTITY</entityField> - <columns> - <neonTableColumn> - <name>2008e7ac-9e6a-4104-9d5b-da60a10a1c02</name> - <entityField>#IMAGE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a290a2ca-3236-4eb0-bf51-99f99d8414d6</name> - <entityField>NAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>f94d2ffe-4fa7-489b-9e94-08f15dbd0a41</name> - <entityField>CUSTOMERCODE</entityField> - <expandRatio v="100" /> - </neonTableColumn> - <neonTableColumn> - <name>b09730e2-5d7d-4b88-aeb9-45fbea6e86c1</name> - <entityField>LANGUAGE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>1908e7ac-9e6a-4104-9d5b-da60a10a1c02</name> - <entityField>STATUS</entityField> - </neonTableColumn> - <neonTableColumn> - <name>2a82ed1e-05bf-408a-82e0-4de6195dad49</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>213d7434-cac6-42d8-aa3a-d893dc77b7b3</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>067eeef9-9a98-483b-9b4f-67bcc46eca3a</name> - <entityField>ADDRESS_ID</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <dashletConfigurations> + <neonDashletConfiguration> + <name>AllOrgsDashlet</name> + <title>Companies</title> + <description>Show all companies</description> + <fragment>Organisation/filter</fragment> + <singleton v="true" /> + <requiresConfiguration v="false" /> + <icon>vaadin:building</icon> + <categories> + <neonDashletCategory> + <name>contactmanagement</name> + <title>Contactmanagement</title> + </neonDashletCategory> + <neonDashletCategory> + <name>org</name> + <title>Company</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> + </dashletConfigurations> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Organisations</name> + <favoriteActionGroup1>campaignActionGroup</favoriteActionGroup1> + <subtitleField>CUSTOMERCODE_DISPLAY_fieldGroup</subtitleField> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>2008e7ac-9e6a-4104-9d5b-da60a10a1c02</name> + <entityField>#IMAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a290a2ca-3236-4eb0-bf51-99f99d8414d6</name> + <entityField>NAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>f94d2ffe-4fa7-489b-9e94-08f15dbd0a41</name> + <entityField>CUSTOMERCODE</entityField> + <expandRatio v="100" /> + </neonTableColumn> + <neonTableColumn> + <name>b09730e2-5d7d-4b88-aeb9-45fbea6e86c1</name> + <entityField>LANGUAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1908e7ac-9e6a-4104-9d5b-da60a10a1c02</name> + <entityField>STATUS</entityField> + </neonTableColumn> + <neonTableColumn> + <name>2a82ed1e-05bf-408a-82e0-4de6195dad49</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>213d7434-cac6-42d8-aa3a-d893dc77b7b3</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>067eeef9-9a98-483b-9b4f-67bcc46eca3a</name> + <entityField>ADDRESS_ID</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/OrganisationLookup_view/OrganisationLookup_view.aod b/neonView/OrganisationLookup_view/OrganisationLookup_view.aod index c52dec522d4a5b76c4692e4089195217af822440..489fa46c7bfc02662a3f370a18bd8f8efc003a8c 100644 --- a/neonView/OrganisationLookup_view/OrganisationLookup_view.aod +++ b/neonView/OrganisationLookup_view/OrganisationLookup_view.aod @@ -1,38 +1,38 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationLookup_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Organisations</name> - <entityField>#ENTITY</entityField> - <columns> - <neonTableColumn> - <name>8c14a108-c672-4b48-bd10-b5ca2e777168</name> - <entityField>#IMAGE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>c2b34d5e-cefa-4bea-88bb-b62874956c19</name> - <entityField>NAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>61a8f2be-98d3-4bfc-84c2-35b60aa0e2d6</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>44f2a229-3288-448e-9f74-b29751ab3c49</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>6e0191b5-468b-41f6-b87e-732bb1c0ded8</name> - <entityField>ADDRESS_ID</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationLookup_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Organisations</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>8c14a108-c672-4b48-bd10-b5ca2e777168</name> + <entityField>#IMAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>c2b34d5e-cefa-4bea-88bb-b62874956c19</name> + <entityField>NAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>61a8f2be-98d3-4bfc-84c2-35b60aa0e2d6</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>44f2a229-3288-448e-9f74-b29751ab3c49</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>6e0191b5-468b-41f6-b87e-732bb1c0ded8</name> + <entityField>ADDRESS_ID</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/OrganisationMain_view/OrganisationMain_view.aod b/neonView/OrganisationMain_view/OrganisationMain_view.aod index 7706cefc5cf53442c91cacdf35d1fa252976f56d..36c146d7b2e61f22224e80cc810f3798ef49a24d 100644 --- a/neonView/OrganisationMain_view/OrganisationMain_view.aod +++ b/neonView/OrganisationMain_view/OrganisationMain_view.aod @@ -57,7 +57,7 @@ </neonViewReference> <neonViewReference> <name>0686ad7e-8dc7-4b10-9df2-bf066ae3a310</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> <neonViewReference> diff --git a/neonView/OrganisationPreview_view/OrganisationPreview_view.aod b/neonView/OrganisationPreview_view/OrganisationPreview_view.aod index f7b34aee786d37da915e2861fe9ddb64996da98d..086e32cacebfc76fd231bafc2150c8b6c88be799 100644 --- a/neonView/OrganisationPreview_view/OrganisationPreview_view.aod +++ b/neonView/OrganisationPreview_view/OrganisationPreview_view.aod @@ -1,54 +1,91 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>OrganisationPreview_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <headerFooterLayout> - <name>layout</name> - <header>Header</header> - </headerFooterLayout> - </layout> - <children> - <cardViewTemplate> - <name>Header</name> - <iconField>PICTURE</iconField> - <titleField>NAME</titleField> - <descriptionField>CUSTOMERCODE_DISPLAY_fieldGroup</descriptionField> - <favoriteAction1>newActivity</favoriteAction1> - <entityField>#ENTITY</entityField> - </cardViewTemplate> - <neonViewReference> - <name>2cb11b4e-dd8e-419b-8fff-ef0852ef2641</name> - <entityField>Communications</entityField> - <view>CommunicationList_view</view> - </neonViewReference> - <neonViewReference> - <name>df605bb6-5d18-4233-abc0-1da82e4910ca</name> - <entityField>Addresses</entityField> - <view>AddressList_view</view> - </neonViewReference> - <genericViewTemplate> - <name>Info</name> - <showDrawer v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>4bad7219-1a3a-4e6e-ae5a-533d3acb6845</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>5a397737-2768-4e16-8c58-890b8a26b4a2</name> - <entityField>STATUS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>89e9aa74-1568-4f74-b42a-a02b13752802</name> - <entityField>TYPE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>180e8467-4eb2-4f89-a59f-ff76b8810925</name> - <entityField>INFO</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>OrganisationPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <headerFooterLayout> + <name>layout</name> + <header>Header</header> + <footer>OrganistaionInformation</footer> + </headerFooterLayout> + </layout> + <children> + <cardViewTemplate> + <name>Header</name> + <iconField>PICTURE</iconField> + <titleField>NAME</titleField> + <descriptionField>CUSTOMERCODE_DISPLAY_fieldGroup</descriptionField> + <favoriteAction1>newActivity</favoriteAction1> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + <neonViewReference> + <name>2cb11b4e-dd8e-419b-8fff-ef0852ef2641</name> + <entityField>Communications</entityField> + <view>CommunicationList_view</view> + </neonViewReference> + <neonViewReference> + <name>df605bb6-5d18-4233-abc0-1da82e4910ca</name> + <entityField>Addresses</entityField> + <view>AddressList_view</view> + </neonViewReference> + <genericViewTemplate> + <name>Turnover</name> + <showDrawer v="true" /> + <drawerCaption>Turnover</drawerCaption> + <entityField>#ENTITY</entityField> + <title>Turnover</title> + <devices /> + <fields> + <entityFieldLink> + <name>1998bb83-a6c3-4bfb-9372-d592379591da</name> + <entityField>TurnoverCurrentYear</entityField> + </entityFieldLink> + <entityFieldLink> + <name>894a32ef-84cb-4331-a215-616b7402521d</name> + <entityField>TurnoverLastYear</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <genericViewTemplate> + <name>Info</name> + <showDrawer v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>4bad7219-1a3a-4e6e-ae5a-533d3acb6845</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>5a397737-2768-4e16-8c58-890b8a26b4a2</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>89e9aa74-1568-4f74-b42a-a02b13752802</name> + <entityField>TYPE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>180e8467-4eb2-4f89-a59f-ff76b8810925</name> + <entityField>INFO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <scoreCardViewTemplate> + <name>OrganistaionInformation</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>66f460bd-164c-4c8f-a129-49a6626a3696</name> + <entityField>TurnoverPercentDiff</entityField> + </entityFieldLink> + <entityFieldLink> + <name>e1d7710b-f696-434d-b3e4-5b31f847a916</name> + <entityField>LastActivity</entityField> + </entityFieldLink> + <entityFieldLink> + <name>cc143e94-006f-4059-925a-212e91c1ece7</name> + <entityField>CountActivity</entityField> + </entityFieldLink> + </fields> + </scoreCardViewTemplate> + </children> +</neonView> diff --git a/neonView/PermissionActionEdit_view/PermissionActionEdit_view.aod b/neonView/PermissionActionEdit_view/PermissionActionEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..9a9c84f8257b9f369d7c8455519121792ffe4f1e --- /dev/null +++ b/neonView/PermissionActionEdit_view/PermissionActionEdit_view.aod @@ -0,0 +1,23 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PermissionActionEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <genericMultipleViewTemplate> + <name>GenericMultiple</name> + <entityField>#ENTITY</entityField> + <title>Action</title> + <columns> + <neonTableColumn> + <name>0272107d-c34c-40e7-974e-5a63d2239fdb</name> + <entityField>ACTION</entityField> + </neonTableColumn> + </columns> + </genericMultipleViewTemplate> + </children> +</neonView> diff --git a/neonView/PermissionActionFilter_view/PermissionActionFilter_view.aod b/neonView/PermissionActionFilter_view/PermissionActionFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..3bbf8059184dc70dc4053b1c43338fc19f829655 --- /dev/null +++ b/neonView/PermissionActionFilter_view/PermissionActionFilter_view.aod @@ -0,0 +1,22 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PermissionActionFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <tableViewTemplate> + <name>Table</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>87d9c672-bce9-489a-b0cd-f8fcd2e4cdfd</name> + <entityField>ACTION</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/PermissionDetailEdit_view/PermissionDetailEdit_view.aod b/neonView/PermissionDetailEdit_view/PermissionDetailEdit_view.aod index 316ad57afd6b8cc7f88b7dbcb7625bccd3b62f46..980e68861e38a6cc528cf888e8c1524587cdc952 100644 --- a/neonView/PermissionDetailEdit_view/PermissionDetailEdit_view.aod +++ b/neonView/PermissionDetailEdit_view/PermissionDetailEdit_view.aod @@ -4,9 +4,9 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <isSmall v="true" /> <layout> - <boxLayout> + <noneLayout> <name>layout</name> - </boxLayout> + </noneLayout> </layout> <children> <genericViewTemplate> @@ -40,5 +40,10 @@ </entityFieldLink> </fields> </genericViewTemplate> + <neonViewReference> + <name>bde148a0-e0ba-45e1-9402-f2855fd2ec4a</name> + <entityField>PermissionActions</entityField> + <view>PermissionActionEdit_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/PermissionDetailPreview_view/PermissionDetailPreview_view.aod b/neonView/PermissionDetailPreview_view/PermissionDetailPreview_view.aod index 74052521ecf15e2d6bc3344c653628a8deb598d5..d5fd135dd4d7bf95e88226a964e4d38a44453aea 100644 --- a/neonView/PermissionDetailPreview_view/PermissionDetailPreview_view.aod +++ b/neonView/PermissionDetailPreview_view/PermissionDetailPreview_view.aod @@ -3,9 +3,9 @@ <name>PermissionDetailPreview_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> - <boxLayout> + <noneLayout> <name>layout</name> - </boxLayout> + </noneLayout> </layout> <children> <cardViewTemplate> @@ -29,5 +29,10 @@ </entityFieldLink> </fields> </genericViewTemplate> + <neonViewReference> + <name>b9e52e84-8ed8-4fe1-a938-6c6ff399c418</name> + <entityField>PermissionActions</entityField> + <view>PermissionActionFilter_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/PersonAttributeRestriction_view/PersonAttributeRestriction_view.aod b/neonView/PersonAttributeRestriction_view/PersonAttributeRestriction_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..4ae99a71b66ac2d4b044a16890773c5b2783ef47 --- /dev/null +++ b/neonView/PersonAttributeRestriction_view/PersonAttributeRestriction_view.aod @@ -0,0 +1,23 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonAttributeRestriction_view</name> + <title>Attributes</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <neonViewReference> + <name>0398cc40-98f9-42a5-a2ed-938a5e8945e0</name> + <entityField>AttributeTree</entityField> + <view>AttributeRelationTree_view</view> + </neonViewReference> + <neonViewReference> + <name>38199f7b-af85-4576-a6ee-3add0e6761aa</name> + <entityField>CommRestrictions</entityField> + <view>CommRestrictionDrawer_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/PersonDetail_view/PersonDetail_view.aod b/neonView/PersonDetail_view/PersonDetail_view.aod index 8f38e32a4452940e15bb1a90139e9fcc266acbb0..7e3af7954ba7d81135173732b750307c826c5ab4 100644 --- a/neonView/PersonDetail_view/PersonDetail_view.aod +++ b/neonView/PersonDetail_view/PersonDetail_view.aod @@ -1,35 +1,35 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonDetail_view</name> - <title>Details</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Details</name> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>c08b6952-9825-42fa-9b42-7a20a376fec7</name> - <entityField>FULL_NAME_fieldGroup</entityField> - </entityFieldLink> - <entityFieldLink> - <name>bfd5e2d2-d89d-4c90-a8e2-f85fb2cc48f3</name> - <entityField>GENDER</entityField> - </entityFieldLink> - <entityFieldLink> - <name>39ca0ab2-b2d5-4d56-9ded-f8df1ae4dd0a</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>86e3b7c4-44ee-4fd4-83f1-2842a0eabda7</name> - <entityField>ORGNAME</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonDetail_view</name> + <title>Details</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Details</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>c08b6952-9825-42fa-9b42-7a20a376fec7</name> + <entityField>FULL_NAME_fieldGroup</entityField> + </entityFieldLink> + <entityFieldLink> + <name>bfd5e2d2-d89d-4c90-a8e2-f85fb2cc48f3</name> + <entityField>GENDER</entityField> + </entityFieldLink> + <entityFieldLink> + <name>39ca0ab2-b2d5-4d56-9ded-f8df1ae4dd0a</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>86e3b7c4-44ee-4fd4-83f1-2842a0eabda7</name> + <entityField>ORGNAME</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/PersonEditDefaults_view/PersonEditDefaults_view.aod b/neonView/PersonEditDefaults_view/PersonEditDefaults_view.aod index 526c0999da94ee8ac40cee815c0573d99cbba4e0..ea6022eaac1b8d781b5a4f6993ac17eb5979d8c5 100644 --- a/neonView/PersonEditDefaults_view/PersonEditDefaults_view.aod +++ b/neonView/PersonEditDefaults_view/PersonEditDefaults_view.aod @@ -1,32 +1,32 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonEditDefaults_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <isSmall v="true" /> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Edit</name> - <editMode v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>c28f9bd4-5ed4-43cb-a431-3164d862f3e6</name> - <entityField>ADDRESS_ID</entityField> - </entityFieldLink> - <entityFieldLink> - <name>b3451cde-029d-4339-8b07-8549c06b6796</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>ca07d91a-a673-438a-8590-874392993efb</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonEditDefaults_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>c28f9bd4-5ed4-43cb-a431-3164d862f3e6</name> + <entityField>ADDRESS_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b3451cde-029d-4339-8b07-8549c06b6796</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>ca07d91a-a673-438a-8590-874392993efb</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/PersonEdit_view/PersonEdit_view.aod b/neonView/PersonEdit_view/PersonEdit_view.aod index 1534581725c50057aa3b03c9668513de352a3ff3..af2f533b0e3987a37f84a93f8786868ed34cfd1d 100644 --- a/neonView/PersonEdit_view/PersonEdit_view.aod +++ b/neonView/PersonEdit_view/PersonEdit_view.aod @@ -1,90 +1,90 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonEdit_view</name> - <title>Contact</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>VAADIN:USERS</icon> - <quickEntry v="0" /> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <genericViewTemplate> - <name>Edit</name> - <editMode v="true" /> - <showDrawer v="false" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>7a647c90-3a1c-4f8d-9ecd-6bdf35ab2f80</name> - <entityField>ORGANISATION_ID</entityField> - </entityFieldLink> - <entityFieldLink> - <name>8f7b95e8-e15e-4d9b-960a-ecd142c71c9e</name> - <entityField>SALUTATION</entityField> - </entityFieldLink> - <entityFieldLink> - <name>413db0e9-00e8-4fd0-9bdc-8100509e622f</name> - <entityField>TITLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>ac32ab06-5b8f-460d-b136-384e879dd5c1</name> - <entityField>FIRSTNAME</entityField> - </entityFieldLink> - <entityFieldLink> - <name>7222d731-80e0-4ef1-9761-e31dce4ed782</name> - <entityField>MIDDLENAME</entityField> - </entityFieldLink> - <entityFieldLink> - <name>a5ad1cc7-8e97-4828-8eaa-02d0876af35b</name> - <entityField>LASTNAME</entityField> - </entityFieldLink> - <entityFieldLink> - <name>35861eb9-59c3-4317-8164-ee7c53ce397e</name> - <entityField>GENDER</entityField> - </entityFieldLink> - <entityFieldLink> - <name>74de507e-75e0-4957-a4fb-7070fa3c5a4a</name> - <entityField>DATEOFBIRTH</entityField> - </entityFieldLink> - <entityFieldLink> - <name>d8d04e36-de46-48a3-994a-fa72d1f2ea89</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>f8ec0e41-7ead-4c80-878c-df75ce5fce34</name> - <entityField>STATUS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>16b3b029-eed3-45b7-94b0-446c89d70594</name> - <entityField>DEPARTMENT</entityField> - </entityFieldLink> - <entityFieldLink> - <name>720ba110-faa2-4c64-823b-82a2089f337c</name> - <entityField>CONTACTROLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>7bad6e30-fda3-4ee4-858c-712a60437397</name> - <entityField>POSITION</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - <neonViewReference> - <name>78dcb8dc-61c3-4cf9-a37b-28dbeeb27001</name> - <entityField>PersAddresses</entityField> - <view>AdressMultiEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>fc64789f-b4c6-401e-86e3-f484451c7689</name> - <entityField>Communications</entityField> - <view>CommunicationMultiEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>520f3056-2a24-4469-a86f-76ba80090829</name> - <entityField>Attributes</entityField> - <view>AttributeRelationMultiEdit_view</view> - </neonViewReference> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonEdit_view</name> + <title>Contact</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:USERS</icon> + <quickEntry v="0" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <showDrawer v="false" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>7a647c90-3a1c-4f8d-9ecd-6bdf35ab2f80</name> + <entityField>ORGANISATION_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8f7b95e8-e15e-4d9b-960a-ecd142c71c9e</name> + <entityField>SALUTATION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>413db0e9-00e8-4fd0-9bdc-8100509e622f</name> + <entityField>TITLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>ac32ab06-5b8f-460d-b136-384e879dd5c1</name> + <entityField>FIRSTNAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7222d731-80e0-4ef1-9761-e31dce4ed782</name> + <entityField>MIDDLENAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>a5ad1cc7-8e97-4828-8eaa-02d0876af35b</name> + <entityField>LASTNAME</entityField> + </entityFieldLink> + <entityFieldLink> + <name>35861eb9-59c3-4317-8164-ee7c53ce397e</name> + <entityField>GENDER</entityField> + </entityFieldLink> + <entityFieldLink> + <name>74de507e-75e0-4957-a4fb-7070fa3c5a4a</name> + <entityField>DATEOFBIRTH</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d8d04e36-de46-48a3-994a-fa72d1f2ea89</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>f8ec0e41-7ead-4c80-878c-df75ce5fce34</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>16b3b029-eed3-45b7-94b0-446c89d70594</name> + <entityField>DEPARTMENT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>720ba110-faa2-4c64-823b-82a2089f337c</name> + <entityField>CONTACTROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7bad6e30-fda3-4ee4-858c-712a60437397</name> + <entityField>POSITION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <neonViewReference> + <name>78dcb8dc-61c3-4cf9-a37b-28dbeeb27001</name> + <entityField>PersAddresses</entityField> + <view>AdressMultiEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>fc64789f-b4c6-401e-86e3-f484451c7689</name> + <entityField>Communications</entityField> + <view>CommunicationMultiEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>520f3056-2a24-4469-a86f-76ba80090829</name> + <entityField>Attributes</entityField> + <view>AttributeRelationMultiEdit_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/PersonFilter_view/PersonFilter_view.aod b/neonView/PersonFilter_view/PersonFilter_view.aod index f44943ddbd1db0a0105ad4e51d404abd4e9f0ee4..f2d1db5194d9d513c3cfd7132079819c268289bf 100644 --- a/neonView/PersonFilter_view/PersonFilter_view.aod +++ b/neonView/PersonFilter_view/PersonFilter_view.aod @@ -1,87 +1,87 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonFilter_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> - <dashletConfigurations> - <neonDashletConfiguration> - <name>AllContactsDashlet</name> - <title>Contacts</title> - <description>Show all contacts</description> - <fragment>Person/filter</fragment> - <singleton v="true" /> - <requiresConfiguration v="false" /> - <icon>vaadin:users</icon> - <categories> - <neonDashletCategory> - <name>contactmanagement</name> - <title>Contactmanagement</title> - </neonDashletCategory> - <neonDashletCategory> - <name>person</name> - <title>Contact</title> - </neonDashletCategory> - </categories> - </neonDashletConfiguration> - </dashletConfigurations> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Persons</name> - <favoriteActionGroup1>campaignActionGroup</favoriteActionGroup1> - <favoriteActionGroup2>DuplicateActions</favoriteActionGroup2> - <hideActions v="false" /> - <iconField>PICTURE</iconField> - <titleField>NAME_fieldGroup</titleField> - <subtitleField>LANGUAGE</subtitleField> - <descriptionField>ORGANISATION_ID</descriptionField> - <entityField>#ENTITY</entityField> - <showHeader v="true" /> - <columns> - <neonTableColumn> - <name>210cc6ab-5123-4d8a-8f2e-a6cd91d494ef</name> - <entityField>PICTURE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>125d04cc-5c7a-4c38-bd0f-b5d02d21067d</name> - <entityField>SALUTATION</entityField> - <collapse v="false" /> - </neonTableColumn> - <neonTableColumn> - <name>2cdfaf73-d3ee-4ad8-83ea-f50acba0335a</name> - <entityField>TITLE</entityField> - <collapse v="true" /> - </neonTableColumn> - <neonTableColumn> - <name>210cc6ab-5023-4d8a-8f2e-a6cd91d994ef</name> - <entityField>FIRSTNAME</entityField> - <collapse v="true" /> - </neonTableColumn> - <neonTableColumn> - <name>187bcb25-db19-4e35-8723-34764166b7bd</name> - <entityField>LASTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>125d04cc-5c7a-4c38-bd3f-b5d02d21067d</name> - <entityField>ORGANISATION_ID</entityField> - </neonTableColumn> - <neonTableColumn> - <name>0a4cc9be-3946-4863-b3a6-a798ff801c83</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>1b99eaf7-7ce7-4b7d-bb71-f21e6cae4417</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>4e9d69fc-a072-41b9-a089-0a9c5c1e37c2</name> - <entityField>ADDRESS_ID</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <dashletConfigurations> + <neonDashletConfiguration> + <name>AllContactsDashlet</name> + <title>Contacts</title> + <description>Show all contacts</description> + <fragment>Person/filter</fragment> + <singleton v="true" /> + <requiresConfiguration v="false" /> + <icon>vaadin:users</icon> + <categories> + <neonDashletCategory> + <name>contactmanagement</name> + <title>Contactmanagement</title> + </neonDashletCategory> + <neonDashletCategory> + <name>person</name> + <title>Contact</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> + </dashletConfigurations> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Persons</name> + <favoriteActionGroup1>campaignActionGroup</favoriteActionGroup1> + <favoriteActionGroup2>DuplicateActions</favoriteActionGroup2> + <hideActions v="false" /> + <iconField>PICTURE</iconField> + <titleField>NAME_fieldGroup</titleField> + <subtitleField>LANGUAGE</subtitleField> + <descriptionField>ORGANISATION_ID</descriptionField> + <entityField>#ENTITY</entityField> + <showHeader v="true" /> + <columns> + <neonTableColumn> + <name>210cc6ab-5123-4d8a-8f2e-a6cd91d494ef</name> + <entityField>PICTURE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>125d04cc-5c7a-4c38-bd0f-b5d02d21067d</name> + <entityField>SALUTATION</entityField> + <collapse v="false" /> + </neonTableColumn> + <neonTableColumn> + <name>2cdfaf73-d3ee-4ad8-83ea-f50acba0335a</name> + <entityField>TITLE</entityField> + <collapse v="true" /> + </neonTableColumn> + <neonTableColumn> + <name>210cc6ab-5023-4d8a-8f2e-a6cd91d994ef</name> + <entityField>FIRSTNAME</entityField> + <collapse v="true" /> + </neonTableColumn> + <neonTableColumn> + <name>187bcb25-db19-4e35-8723-34764166b7bd</name> + <entityField>LASTNAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>125d04cc-5c7a-4c38-bd3f-b5d02d21067d</name> + <entityField>ORGANISATION_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>0a4cc9be-3946-4863-b3a6-a798ff801c83</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1b99eaf7-7ce7-4b7d-bb71-f21e6cae4417</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>4e9d69fc-a072-41b9-a089-0a9c5c1e37c2</name> + <entityField>ADDRESS_ID</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/PersonLookup_view/PersonLookup_view.aod b/neonView/PersonLookup_view/PersonLookup_view.aod index 2595cfdb740cc5a0d48529e7a5bead4962d062a6..b8da1508e862b5975fe77fa05a010d699f1f8542 100644 --- a/neonView/PersonLookup_view/PersonLookup_view.aod +++ b/neonView/PersonLookup_view/PersonLookup_view.aod @@ -1,46 +1,46 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonLookup_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Persons</name> - <entityField>#ENTITY</entityField> - <columns> - <neonTableColumn> - <name>9541c336-10e9-4767-b6e5-52b6108d967a</name> - <entityField>#IMAGE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>876baf47-81c8-477a-951c-18df2dd4d972</name> - <entityField>FIRSTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>fb150402-a576-4e21-855c-91dd7574f353</name> - <entityField>LASTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>9760f1eb-8296-4d29-9afc-45c7440a0dc5</name> - <entityField>ORGANISATION_ID</entityField> - </neonTableColumn> - <neonTableColumn> - <name>768f2294-2c4e-4c71-9992-ee9cea299041</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>eb778e57-1f2d-436e-b22a-e92f7a190606</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>27d03313-3ec6-438f-b79b-724369316ef3</name> - <entityField>ADDRESS_ID</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonLookup_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Persons</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>9541c336-10e9-4767-b6e5-52b6108d967a</name> + <entityField>#IMAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>876baf47-81c8-477a-951c-18df2dd4d972</name> + <entityField>FIRSTNAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>fb150402-a576-4e21-855c-91dd7574f353</name> + <entityField>LASTNAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>9760f1eb-8296-4d29-9afc-45c7440a0dc5</name> + <entityField>ORGANISATION_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>768f2294-2c4e-4c71-9992-ee9cea299041</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>eb778e57-1f2d-436e-b22a-e92f7a190606</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>27d03313-3ec6-438f-b79b-724369316ef3</name> + <entityField>ADDRESS_ID</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/PersonMain_view/PersonMain_view.aod b/neonView/PersonMain_view/PersonMain_view.aod index 28c272f7147b3fbf636fd3013cf8edb8e520e7c9..527484f8846118dd84eb544f6b16f4e3a30e21c4 100644 --- a/neonView/PersonMain_view/PersonMain_view.aod +++ b/neonView/PersonMain_view/PersonMain_view.aod @@ -29,11 +29,6 @@ <entityField>ObjectTrees</entityField> <view>ObjectTreeFilter_view</view> </neonViewReference> - <neonViewReference> - <name>265efe97-d759-476c-9546-0f339d56474d</name> - <entityField>CommRestrictions</entityField> - <view>CommRestrictionFilter_view</view> - </neonViewReference> <neonViewReference> <name>c2606a8b-eac1-412e-893d-bb788d4a5b5c</name> <entityField>OtherContacts</entityField> @@ -45,9 +40,14 @@ <view>PersonTaskAppointment_view</view> </neonViewReference> <neonViewReference> - <name>cf989bf6-3e49-44fc-ba98-322aae377da3</name> - <entityField>AttributeTree</entityField> - <view>AttributeRelationTree_view</view> + <name>05846541-3e37-43f8-ab39-017b947d40dc</name> + <entityField>DSGVOEntries</entityField> + <view>DSGVOFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>0470a456-1132-4802-ba69-4a1b562b8f14</name> + <entityField>#ENTITY</entityField> + <view>PersonAttributeRestriction_view</view> </neonViewReference> <neonViewReference> <name>4b50b784-484f-4cdf-a705-4c356da763fa</name> @@ -56,7 +56,7 @@ </neonViewReference> <neonViewReference> <name>5754fc3a-c81c-42ba-90ea-2859b10bb391</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> <neonViewReference> diff --git a/neonView/PersonPreview_view/PersonPreview_view.aod b/neonView/PersonPreview_view/PersonPreview_view.aod index 4ca633ad42acae9e69a8e7a83706474330ab48e7..43d0a9c2871ca2023a2ba81888fd694d9665b920 100644 --- a/neonView/PersonPreview_view/PersonPreview_view.aod +++ b/neonView/PersonPreview_view/PersonPreview_view.aod @@ -1,71 +1,71 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonPreview_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <headerFooterLayout> - <name>layout</name> - <header>Header</header> - </headerFooterLayout> - </layout> - <children> - <cardViewTemplate> - <name>Header</name> - <iconField>PICTURE</iconField> - <titleField>FULL_NAME_fieldGroup</titleField> - <descriptionField>ORGANISATION_ID</descriptionField> - <favoriteAction1>newActivity</favoriteAction1> - <entityField>#ENTITY</entityField> - </cardViewTemplate> - <neonViewReference> - <name>5a1b7683-2fec-4763-9b45-e4c7a18d70fd</name> - <entityField>Communications</entityField> - <view>CommunicationList_view</view> - </neonViewReference> - <neonViewReference> - <name>4c4b1e66-fdc2-469c-a553-244b6dbffbe0</name> - <entityField>PersAddresses</entityField> - <view>AddressList_view</view> - </neonViewReference> - <neonViewReference> - <name>38bd1cc7-8b75-4755-8bb2-0177f02bbef5</name> - <entityField>OrgAddresses</entityField> - <view>AddressList_view</view> - </neonViewReference> - <genericViewTemplate> - <name>Info</name> - <showDrawer v="true" /> - <entityField>#ENTITY</entityField> - <fields> - <entityFieldLink> - <name>f9875d78-3d72-47d3-b729-9cf80d236f6e</name> - <entityField>GENDER</entityField> - </entityFieldLink> - <entityFieldLink> - <name>5d4e0828-b7fe-4f54-a47a-f9b5838fb1ae</name> - <entityField>DATEOFBIRTH</entityField> - </entityFieldLink> - <entityFieldLink> - <name>3aa3e89b-91ce-4607-8d76-53ee309a688f</name> - <entityField>LANGUAGE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>278c4e64-6f0f-4ea9-b683-75f272a6c088</name> - <entityField>STATUS</entityField> - </entityFieldLink> - <entityFieldLink> - <name>8ca0067d-4bfa-45b6-89e8-5c58c4e0d6ec</name> - <entityField>DEPARTMENT</entityField> - </entityFieldLink> - <entityFieldLink> - <name>99904332-fa07-411f-b9e8-7d0ae6918aa6</name> - <entityField>CONTACTROLE</entityField> - </entityFieldLink> - <entityFieldLink> - <name>d5cc98c9-9483-4c2d-b0f3-69e25a0474f3</name> - <entityField>POSITION</entityField> - </entityFieldLink> - </fields> - </genericViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <headerFooterLayout> + <name>layout</name> + <header>Header</header> + </headerFooterLayout> + </layout> + <children> + <cardViewTemplate> + <name>Header</name> + <iconField>PICTURE</iconField> + <titleField>FULL_NAME_fieldGroup</titleField> + <descriptionField>ORGANISATION_ID</descriptionField> + <favoriteAction1>newActivity</favoriteAction1> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + <neonViewReference> + <name>5a1b7683-2fec-4763-9b45-e4c7a18d70fd</name> + <entityField>Communications</entityField> + <view>CommunicationList_view</view> + </neonViewReference> + <neonViewReference> + <name>4c4b1e66-fdc2-469c-a553-244b6dbffbe0</name> + <entityField>PersAddresses</entityField> + <view>AddressList_view</view> + </neonViewReference> + <neonViewReference> + <name>38bd1cc7-8b75-4755-8bb2-0177f02bbef5</name> + <entityField>OrgAddresses</entityField> + <view>AddressList_view</view> + </neonViewReference> + <genericViewTemplate> + <name>Info</name> + <showDrawer v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>f9875d78-3d72-47d3-b729-9cf80d236f6e</name> + <entityField>GENDER</entityField> + </entityFieldLink> + <entityFieldLink> + <name>5d4e0828-b7fe-4f54-a47a-f9b5838fb1ae</name> + <entityField>DATEOFBIRTH</entityField> + </entityFieldLink> + <entityFieldLink> + <name>3aa3e89b-91ce-4607-8d76-53ee309a688f</name> + <entityField>LANGUAGE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>278c4e64-6f0f-4ea9-b683-75f272a6c088</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>8ca0067d-4bfa-45b6-89e8-5c58c4e0d6ec</name> + <entityField>DEPARTMENT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>99904332-fa07-411f-b9e8-7d0ae6918aa6</name> + <entityField>CONTACTROLE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d5cc98c9-9483-4c2d-b0f3-69e25a0474f3</name> + <entityField>POSITION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/PersonSimpleList_view/PersonSimpleList_view.aod b/neonView/PersonSimpleList_view/PersonSimpleList_view.aod index 4573ad314322b091cbaf3439d0c71adebd583d50..5d4f929a7d3784339ef8901b6c9a7f5065f4a0cb 100644 --- a/neonView/PersonSimpleList_view/PersonSimpleList_view.aod +++ b/neonView/PersonSimpleList_view/PersonSimpleList_view.aod @@ -1,52 +1,64 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>PersonSimpleList_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <tableViewTemplate> - <name>Persons</name> - <favoriteActionGroup1>campaignActionGroup</favoriteActionGroup1> - <iconField>PICTURE</iconField> - <titleField>NAME_fieldGroup</titleField> - <subtitleField>LANGUAGE</subtitleField> - <descriptionField>DEPARTMENT</descriptionField> - <entityField>#ENTITY</entityField> - <columns> - <neonTableColumn> - <name>d6207ade-29e7-4af0-ba5f-e9ddd799de7b</name> - <entityField>#IMAGE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>1053d3a7-c5ee-4260-86f6-54e820f53e9f</name> - <entityField>SALUTATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>a7eb48e2-d2a0-4ddb-b197-74ee77896960</name> - <entityField>TITLE</entityField> - </neonTableColumn> - <neonTableColumn> - <name>302d875b-644d-4f75-b8c2-f99bab8ae88d</name> - <entityField>FIRSTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>eacb1707-191c-4f09-b213-fbe87988c523</name> - <entityField>LASTNAME</entityField> - </neonTableColumn> - <neonTableColumn> - <name>38e8ea31-060d-4a4c-aa70-a6752019dcff</name> - <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> - </neonTableColumn> - <neonTableColumn> - <name>60cb743a-7a1f-4faa-92d6-780bd2ad0564</name> - <entityField>STANDARD_PHONE_COMMUNICATION</entityField> - </neonTableColumn> - </columns> - </tableViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>PersonSimpleList_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Persons</name> + <favoriteActionGroup1>campaignActionGroup</favoriteActionGroup1> + <iconField>PICTURE</iconField> + <titleField>NAME_fieldGroup</titleField> + <subtitleField>LANGUAGE</subtitleField> + <descriptionField>DEPARTMENT</descriptionField> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>d6207ade-29e7-4af0-ba5f-e9ddd799de7b</name> + <entityField>#IMAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>1053d3a7-c5ee-4260-86f6-54e820f53e9f</name> + <entityField>SALUTATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a7eb48e2-d2a0-4ddb-b197-74ee77896960</name> + <entityField>TITLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>302d875b-644d-4f75-b8c2-f99bab8ae88d</name> + <entityField>FIRSTNAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>eacb1707-191c-4f09-b213-fbe87988c523</name> + <entityField>LASTNAME</entityField> + </neonTableColumn> + <neonTableColumn> + <name>38e8ea31-060d-4a4c-aa70-a6752019dcff</name> + <entityField>STANDARD_EMAIL_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>60cb743a-7a1f-4faa-92d6-780bd2ad0564</name> + <entityField>STANDARD_PHONE_COMMUNICATION</entityField> + </neonTableColumn> + <neonTableColumn> + <name>f3afd575-7a44-44c0-8d8c-7b8b20382b39</name> + <entityField>DEPARTMENT</entityField> + </neonTableColumn> + <neonTableColumn> + <name>07400a08-4dad-4c04-9349-e2e94f58bfec</name> + <entityField>CONTACTROLE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>6ae815ae-117b-4349-8a8b-f63a404e9a05</name> + <entityField>POSITION</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/Prod2prodFilter_view/Prod2prodFilter_view.aod b/neonView/Prod2prodFilter_view/Prod2prodFilter_view.aod index f7db7096ccbdf4e153b1120b624e52cca7901c1c..d0ada3ee0fef209a5d57cb71a249eaa007dbdb2f 100644 --- a/neonView/Prod2prodFilter_view/Prod2prodFilter_view.aod +++ b/neonView/Prod2prodFilter_view/Prod2prodFilter_view.aod @@ -1,8 +1,8 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>Prod2prodFilter_view</name> + <title>Parts list</title> <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="true" /> <layout> <boxLayout> <name>layout</name> @@ -14,6 +14,8 @@ <parentField>DEST_ID</parentField> <favoriteActionGroup1>alter</favoriteActionGroup1> <entityField>#ENTITY</entityField> + <devices /> + <title>Parts list</title> <columns> <neonTableColumn> <name>43d3c9b0-21ab-4996-8d24-af74a5ee1e1a</name> diff --git a/neonView/ProductFilter_view/ProductFilter_view.aod b/neonView/ProductFilter_view/ProductFilter_view.aod index a98e77592bf0e3c83b333613191be4f165693d80..872dbd01f7f90b1a0c153b3cc967425c5b9647a3 100644 --- a/neonView/ProductFilter_view/ProductFilter_view.aod +++ b/neonView/ProductFilter_view/ProductFilter_view.aod @@ -39,7 +39,7 @@ <columns> <neonTableColumn> <name>2b03ec87-92a8-44dd-932e-80df160b2c8e</name> - <entityField>#IMAGE</entityField> + <entityField>PICTURE</entityField> </neonTableColumn> <neonTableColumn> <name>ee627d12-c60c-48c2-a86e-2a144f5853e6</name> diff --git a/neonView/ProductMain_view/ProductMain_view.aod b/neonView/ProductMain_view/ProductMain_view.aod index d435be42d7cad5bfeec0418bb9a18e8b3a9c9467..205b0e34998d8922727c490b284c2076fc516675 100644 --- a/neonView/ProductMain_view/ProductMain_view.aod +++ b/neonView/ProductMain_view/ProductMain_view.aod @@ -37,7 +37,7 @@ <neonViewReference> <name>11c4c5a0-27fa-4748-a6c6-3a667d2f3d8f</name> <entityField>Productprices</entityField> - <view>ProductpriceFilter_view</view> + <view>ProductpriceForProductFilter_view</view> </neonViewReference> <neonViewReference> <name>616f7cc3-93e7-41ee-8d38-027dd3d4b299</name> @@ -51,7 +51,7 @@ </neonViewReference> <neonViewReference> <name>0faf6a9e-b1f3-452d-b7fd-d0c9e3fc25f8</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> </children> diff --git a/neonView/ProductPreview_view/ProductPreview_view.aod b/neonView/ProductPreview_view/ProductPreview_view.aod index fe3363f42e3221dd5e8343e3b006b29445bc8760..abfa51a6897cebecaa70166895149a33c36d0c3b 100644 --- a/neonView/ProductPreview_view/ProductPreview_view.aod +++ b/neonView/ProductPreview_view/ProductPreview_view.aod @@ -11,7 +11,7 @@ <children> <cardViewTemplate> <name>Header</name> - <iconField>IMAGE</iconField> + <iconField>PICTURE</iconField> <titleField>PRODUCTCODE</titleField> <descriptionField>PRODUCTNAME</descriptionField> <favoriteAction1>newActivity</favoriteAction1> diff --git a/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod b/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod index f93ccef9c31a8b2a38f4c6ec1a029c26934f2d9d..846ebe961b4b07f6c34017908af8ef2864210b73 100644 --- a/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod +++ b/neonView/ProductpriceFilter_view/ProductpriceFilter_view.aod @@ -17,6 +17,10 @@ <name>44311686-a24a-4cf0-87a0-6e354b3f457a</name> <entityField>IMAGE</entityField> </neonTableColumn> + <neonTableColumn> + <name>c97a0ba1-90de-4dd9-b917-c474b4de0f8e</name> + <entityField>PRODUCT_ID</entityField> + </neonTableColumn> <neonTableColumn> <name>695ce7be-d738-48a9-833d-e8815c6eff74</name> <entityField>PRICELIST</entityField> @@ -48,6 +52,7 @@ <neonTableColumn> <name>981f29b1-b4c5-4591-8064-21a72f339179</name> <entityField>VAT</entityField> + <collapse v="false" /> </neonTableColumn> </columns> </tableViewTemplate> diff --git a/neonView/ProductpriceForProductFilter_view/ProductpriceForProductFilter_view.aod b/neonView/ProductpriceForProductFilter_view/ProductpriceForProductFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..52af81ef82c88c1f695981bccad2e221b9c85a5f --- /dev/null +++ b/neonView/ProductpriceForProductFilter_view/ProductpriceForProductFilter_view.aod @@ -0,0 +1,55 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>ProductpriceForProductFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <tableViewTemplate> + <name>Table</name> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>05bed0da-33f6-483a-b7d8-82ff4ef573f1</name> + <entityField>IMAGE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>83216e42-ad22-40d7-b01e-fccc940af44c</name> + <entityField>PRICELIST</entityField> + </neonTableColumn> + <neonTableColumn> + <name>c1211cf5-ad9b-43ef-9ce5-ab93f01eb5c9</name> + <entityField>VALID_FROM</entityField> + </neonTableColumn> + <neonTableColumn> + <name>35e5daad-a34a-45f9-a81e-dc6b654184df</name> + <entityField>VALID_TO</entityField> + </neonTableColumn> + <neonTableColumn> + <name>b14d91ad-bfc0-4c18-b447-8c8e7568a600</name> + <entityField>PRICE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>f5f43936-fa42-46a7-b152-e5a8fa0228c9</name> + <entityField>CURRENCY</entityField> + </neonTableColumn> + <neonTableColumn> + <name>16bcb0f7-6dd5-449b-830d-0eef6c11a600</name> + <entityField>BUYSELL</entityField> + </neonTableColumn> + <neonTableColumn> + <name>bce5ad39-9325-4582-a34b-908b40b69762</name> + <entityField>FROMQUANTITY</entityField> + </neonTableColumn> + <neonTableColumn> + <name>6e6d8582-08d0-464d-9632-f21a205de661</name> + <entityField>VAT</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + </children> +</neonView> diff --git a/neonView/ProductpricePreview_view/ProductpricePreview_view.aod b/neonView/ProductpricePreview_view/ProductpricePreview_view.aod index 2788fa5c7701ea3076b6a9723fe94b23e1c52a52..b5039c392066e51b42601d3dcca9df5d352a3ea3 100644 --- a/neonView/ProductpricePreview_view/ProductpricePreview_view.aod +++ b/neonView/ProductpricePreview_view/ProductpricePreview_view.aod @@ -11,6 +11,7 @@ <children> <genericViewTemplate> <name>PriceInfo</name> + <showDrawer v="true" /> <entityField>#ENTITY</entityField> <fields> <entityFieldLink> @@ -47,6 +48,7 @@ <name>Header</name> <iconField>IMAGE</iconField> <titleField>PRICELIST</titleField> + <subtitleField>PRODUCT_ID</subtitleField> <entityField>#ENTITY</entityField> </cardViewTemplate> </children> diff --git a/neonView/SaleprojectOverviewCharts_view/SaleprojectOverviewCharts_view.aod b/neonView/SaleprojectOverviewCharts_view/SaleprojectOverviewCharts_view.aod index 0d0c84492a2c7202559bf11cabf345b92ab848e3..dc509334b65635464802f71eac7f0f2b0feceaed 100644 --- a/neonView/SaleprojectOverviewCharts_view/SaleprojectOverviewCharts_view.aod +++ b/neonView/SaleprojectOverviewCharts_view/SaleprojectOverviewCharts_view.aod @@ -16,9 +16,9 @@ <view>ClassificationGroupAnalysesChart_view</view> </neonViewReference> <neonViewReference> - <name>5cb29574-2cca-44da-a987-a2be76032b27</name> + <name>a5583507-7e5a-40dd-9af8-a227b6be5af3</name> <entityField>SalesprojectForecastCharts</entityField> - <view>TurnoverChartForecast_view</view> + <view>TurnoverChartForcastDrawer_view</view> </neonViewReference> </children> </neonView> diff --git a/neonView/SalesprojectClassificationAttribute_view/SalesprojectClassificationAttribute_view.aod b/neonView/SalesprojectClassificationAttribute_view/SalesprojectClassificationAttribute_view.aod index b19d5b2cc8ecfb1a965d1cd70e29b1e74e8edbd5..6fcb299d56a503d8d2284141fa716b9a3a453721 100644 --- a/neonView/SalesprojectClassificationAttribute_view/SalesprojectClassificationAttribute_view.aod +++ b/neonView/SalesprojectClassificationAttribute_view/SalesprojectClassificationAttribute_view.aod @@ -1,20 +1,18 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalesprojectClassificationAttribute_view</name> - <title>Classification</title> + <title>Categorization</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> <name>layout</name> - <direction>VERTICAL</direction> - <autoHeight v="false" /> </boxLayout> </layout> <children> <neonViewReference> - <name>1af0e58c-db49-41c3-b7ce-d69498070699</name> + <name>2cb777a4-cf46-4337-9b17-fc8b6026209b</name> <entityField>#ENTITY</entityField> - <view>SalesprojectClassificationAndChart_view</view> + <view>SalesprojectClassificationDrawer_view</view> </neonViewReference> <neonViewReference> <name>523e3855-eade-4cce-842d-9b272b028cbb</name> diff --git a/neonView/SalesprojectClassificationDrawer_view/SalesprojectClassificationDrawer_view.aod b/neonView/SalesprojectClassificationDrawer_view/SalesprojectClassificationDrawer_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..7b27a7db771933874c5657e0a0104f2f0bb932fe --- /dev/null +++ b/neonView/SalesprojectClassificationDrawer_view/SalesprojectClassificationDrawer_view.aod @@ -0,0 +1,19 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>SalesprojectClassificationDrawer_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Classification</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <neonViewReference> + <name>8cec9c22-7304-47f3-9d46-909dec12ca2a</name> + <entityField>#ENTITY</entityField> + <view>SalesprojectClassificationAndChart_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod b/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod index 833b45a2dcdab4c599390bb97737639215d2d798..551862821e5322552b84c75cad08679687476d3d 100644 --- a/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod +++ b/neonView/SalesprojectEdit_view/SalesprojectEdit_view.aod @@ -33,8 +33,8 @@ <entityField>INFO</entityField> </entityFieldLink> <entityFieldLink> - <name>426a20c1-5d79-417b-bab1-d3100fabb25b</name> - <entityField>STATE</entityField> + <name>07581a02-dc4d-4eaf-835d-b7990bf105f9</name> + <entityField>STATUS</entityField> </entityFieldLink> <entityFieldLink> <name>373ba27b-5f27-4c5d-865e-da50447124fa</name> diff --git a/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod b/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod index 0dcf8d013552a42667adc634254b51a50126d0bf..964dfa8a660128becca63d07a0ecf027fff3e4c4 100644 --- a/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod +++ b/neonView/SalesprojectFilter_view/SalesprojectFilter_view.aod @@ -27,7 +27,7 @@ <name>OpenSalesprojectsDashlet</name> <title>Open salesprojects</title> <description>Show open salesprojects</description> - <fragment>Salesproject/filter?search=W3sibmFtZSI6IlNUQVRFIiwib3BlcmF0b3IiOiJFUVVBTCIsInZhbHVlIjoiU0FMUFJPSlNUQVRPUEVOICAgICAgICAgICAgICAgICAgICAgIiwiY29udGVudFR5cGUiOiJURVhUIn1d</fragment> + <fragment>Salesproject/filter?search=eyJ0eXBlIjoiZ3JvdXAiLCJvcGVyYXRvciI6IkFORCIsImNoaWxkcyI6W3sidHlwZSI6InJvdyIsIm5hbWUiOiJTVEFUVVMiLCJvcGVyYXRvciI6IkVRVUFMIiwidmFsdWUiOiJPZmZlbiIsImtleSI6IlNBTFBST0pTVEFUT1BFTiAgICAgICAgICAgICAgICAgICAgICIsImNvbnRlbnR0eXBlIjoiVEVYVCJ9XX0%253D</fragment> <singleton v="true" /> <requiresConfiguration v="false" /> <icon>vaadin:filter</icon> @@ -88,7 +88,7 @@ </neonTableColumn> <neonTableColumn> <name>52a851b0-9059-4d57-8ff5-335c819359e8</name> - <entityField>STATE</entityField> + <entityField>STATUS</entityField> </neonTableColumn> </columns> </tableViewTemplate> diff --git a/neonView/SalesprojectForecastDrawer_view/SalesprojectForecastDrawer_view.aod b/neonView/SalesprojectForecastDrawer_view/SalesprojectForecastDrawer_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..ec4ceb7e8927f70e4b4983d688454b698b99787c --- /dev/null +++ b/neonView/SalesprojectForecastDrawer_view/SalesprojectForecastDrawer_view.aod @@ -0,0 +1,19 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>SalesprojectForecastDrawer_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Forecast</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <neonViewReference> + <name>427414e0-f179-48cc-ae21-dc7a9d66d7b2</name> + <entityField>#ENTITY</entityField> + <view>SalesprojectOfferForecast_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/SalesprojectMain_view/SalesprojectMain_view.aod b/neonView/SalesprojectMain_view/SalesprojectMain_view.aod index 3919cd944e6a33275c0389960971755372b6fa6b..97e6cc9f7ab759e338db9bda85f8e52de23fa2f9 100644 --- a/neonView/SalesprojectMain_view/SalesprojectMain_view.aod +++ b/neonView/SalesprojectMain_view/SalesprojectMain_view.aod @@ -18,6 +18,7 @@ <name>673a34c7-5781-4c72-b0c8-944f1e5de9c6</name> <entityField>#ENTITY</entityField> <view>SalesprojectOverview_view</view> + <devices /> </neonViewReference> <neonViewReference> <name>d4daa13e-bf57-45e4-af43-d58c04f113f5</name> @@ -56,7 +57,7 @@ </neonViewReference> <neonViewReference> <name>6ed5fc92-1056-418f-a0b7-3d55414efe3a</name> - <entityField>LogHistoryConsumer</entityField> + <entityField>LogHistories</entityField> <view>LogHistoryFilter_view</view> </neonViewReference> </children> diff --git a/neonView/SalesprojectMemberActivity_view/SalesprojectMemberActivity_view.aod b/neonView/SalesprojectMemberActivity_view/SalesprojectMemberActivity_view.aod index cc6db2d30af734466138aa5d19279537c3f8bf19..c023c6dcc276579166c810011bb43b10b7231124 100644 --- a/neonView/SalesprojectMemberActivity_view/SalesprojectMemberActivity_view.aod +++ b/neonView/SalesprojectMemberActivity_view/SalesprojectMemberActivity_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalesprojectMemberActivity_view</name> - <title>Activities</title> + <title>Project</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> diff --git a/neonView/SalesprojectMilestoneChartPhase_view/SalesprojectMilestoneChartPhase_view.aod b/neonView/SalesprojectMilestoneChartPhase_view/SalesprojectMilestoneChartPhase_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..7e7337b41b00800a09362cc91e575038d114395d --- /dev/null +++ b/neonView/SalesprojectMilestoneChartPhase_view/SalesprojectMilestoneChartPhase_view.aod @@ -0,0 +1,22 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>SalesprojectMilestoneChartPhase_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Milestones Phase</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <multiDataChartViewTemplate> + <name>MilestoneChart</name> + <chartType>COLUMN</chartType> + <xAxis>MILESTONEVALUE</xAxis> + <yAxis>DaysCount</yAxis> + <categoryField>KIND</categoryField> + <entityField>#ENTITY</entityField> + </multiDataChartViewTemplate> + </children> +</neonView> diff --git a/neonView/SalesprojectMilestoneChart_view/SalesprojectMilestoneChart_view.aod b/neonView/SalesprojectMilestoneChartState_view/SalesprojectMilestoneChartState_view.aod similarity index 70% rename from neonView/SalesprojectMilestoneChart_view/SalesprojectMilestoneChart_view.aod rename to neonView/SalesprojectMilestoneChartState_view/SalesprojectMilestoneChartState_view.aod index 36f0845c65887d28cb18fd88e1dbbe94b4124661..d38a2ed9e98ae55eef05dcb5cea30a3127cd00aa 100644 --- a/neonView/SalesprojectMilestoneChart_view/SalesprojectMilestoneChart_view.aod +++ b/neonView/SalesprojectMilestoneChartState_view/SalesprojectMilestoneChartState_view.aod @@ -1,20 +1,22 @@ -<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> - <name>SalesprojectMilestoneChart_view</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <layout> - <boxLayout> - <name>layout</name> - </boxLayout> - </layout> - <children> - <multiDataChartViewTemplate> - <name>MilestoneChart</name> - <chartType>COLUMN</chartType> - <xAxis>VALUE</xAxis> - <yAxis>DaysCount</yAxis> - <categoryField>TYPE</categoryField> - <entityField>#ENTITY</entityField> - </multiDataChartViewTemplate> - </children> -</neonView> +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>SalesprojectMilestoneChartState_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Milestones Status</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <multiDataChartViewTemplate> + <name>MilestoneChart</name> + <chartType>COLUMN</chartType> + <xAxis>MILESTONEVALUE</xAxis> + <yAxis>DaysCount</yAxis> + <categoryField>KIND</categoryField> + <entityField>#ENTITY</entityField> + </multiDataChartViewTemplate> + </children> +</neonView> diff --git a/neonView/SalesprojectMilestoneInfo_view/SalesprojectMilestoneInfo_view.aod b/neonView/SalesprojectMilestoneInfo_view/SalesprojectMilestoneInfo_view.aod index 84d13ad9885629b753d06e3af52debbd4b936f7f..6e8fb6ca97ba3a1fb8548ef4c4fbd35b80271c20 100644 --- a/neonView/SalesprojectMilestoneInfo_view/SalesprojectMilestoneInfo_view.aod +++ b/neonView/SalesprojectMilestoneInfo_view/SalesprojectMilestoneInfo_view.aod @@ -3,15 +3,16 @@ <name>SalesprojectMilestoneInfo_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> - <boxLayout> + <drawerLayout> <name>layout</name> - </boxLayout> + <layoutCaption>Phase progression</layoutCaption> + </drawerLayout> </layout> <children> <ganttViewTemplate> <name>MilestoneGantt</name> <uidField>SALESPROJECT_MILESTONEID</uidField> - <titleField>VALUE</titleField> + <titleField>valueLongName</titleField> <beginDateField>DATE_START</beginDateField> <endDateField>dateEndGantt</endDateField> <predecessorIdField>PARENT_ID</predecessorIdField> diff --git a/neonView/SalesprojectMilestoneSource_view/SalesprojectMilestoneSource_view.aod b/neonView/SalesprojectMilestoneSource_view/SalesprojectMilestoneSource_view.aod index a10a187cb6ea06cf2da409d3f67cd22eefbbcd8d..ddf1edb463cccde9063542434d823449ef2e1bd4 100644 --- a/neonView/SalesprojectMilestoneSource_view/SalesprojectMilestoneSource_view.aod +++ b/neonView/SalesprojectMilestoneSource_view/SalesprojectMilestoneSource_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalesprojectMilestoneSource_view</name> - <title>Milestones</title> + <title>Occurrences</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> diff --git a/neonView/SalesprojectMilestone_view/SalesprojectMilestone_view.aod b/neonView/SalesprojectMilestone_view/SalesprojectMilestone_view.aod index 3dad97a4d429d0f4ec631342565eb4303d9619b3..66d7c646f842bb0e94b1070d2bc74826a71271a2 100644 --- a/neonView/SalesprojectMilestone_view/SalesprojectMilestone_view.aod +++ b/neonView/SalesprojectMilestone_view/SalesprojectMilestone_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalesprojectMilestone_view</name> - <title>Milestones</title> + <title></title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> @@ -12,14 +12,14 @@ </layout> <children> <neonViewReference> - <name>30c775ea-7488-4dfd-8e6d-c65b7982849d</name> - <entityField>SalesprojectStateMilestones</entityField> - <view>SalesprojectMilestoneChart_view</view> + <name>af5d5121-2d6e-40f7-8236-37392a3a44e5</name> + <entityField>SalesprojectPhaseMilestones</entityField> + <view>SalesprojectMilestoneChartPhase_view</view> </neonViewReference> <neonViewReference> - <name>cc8f1469-805f-4e2c-aa4f-d55f932c6deb</name> - <entityField>SalesprojectPhaseMilestones</entityField> - <view>SalesprojectMilestoneChart_view</view> + <name>867fec73-23a3-48ed-bd56-33aabb59315d</name> + <entityField>SalesprojectStateMilestones</entityField> + <view>SalesprojectMilestoneChartState_view</view> </neonViewReference> </children> </neonView> diff --git a/neonView/SalesprojectOfferForecastChart_view/SalesprojectOfferForecastChart_view.aod b/neonView/SalesprojectOfferForecastChart_view/SalesprojectOfferForecastChart_view.aod index 07ef6fa54e0d2b3a83eda9d33b7bd7c0ca32343a..c328dd3a297c07cf6277fc45ac9dd4a79acd65de 100644 --- a/neonView/SalesprojectOfferForecastChart_view/SalesprojectOfferForecastChart_view.aod +++ b/neonView/SalesprojectOfferForecastChart_view/SalesprojectOfferForecastChart_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalesprojectOfferForecastChart_view</name> - <title>Forecast</title> + <title>Prognose</title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> @@ -11,9 +11,9 @@ </layout> <children> <neonViewReference> - <name>d37e05d3-659f-4d96-9d86-277b4d95090b</name> + <name>03ee8624-3c62-40e4-90ff-f47e10ce1189</name> <entityField>#ENTITY</entityField> - <view>SalesprojectOfferForecast_view</view> + <view>SalesprojectForecastDrawer_view</view> </neonViewReference> <neonViewReference> <name>72e09476-f603-4bc8-ae97-4525c44fab3c</name> diff --git a/neonView/SalesprojectOfferForecast_view/SalesprojectOfferForecast_view.aod b/neonView/SalesprojectOfferForecast_view/SalesprojectOfferForecast_view.aod index 7d86124d841e5e7c8b2dff81258efde7b3d582f3..742af331cda871bbe48e7ceb8f74f6640aea6748 100644 --- a/neonView/SalesprojectOfferForecast_view/SalesprojectOfferForecast_view.aod +++ b/neonView/SalesprojectOfferForecast_view/SalesprojectOfferForecast_view.aod @@ -1,7 +1,7 @@ <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalesprojectOfferForecast_view</name> - <title>Forecast</title> + <title></title> <majorModelMode>DISTRIBUTED</majorModelMode> <layout> <boxLayout> diff --git a/neonView/SalesprojectOverview_view/SalesprojectOverview_view.aod b/neonView/SalesprojectOverview_view/SalesprojectOverview_view.aod index 5508429b3e638b3e4cc2af1f2300434e54f06aa6..af8313163121c38fbc697923fb2c1d4c53e170f7 100644 --- a/neonView/SalesprojectOverview_view/SalesprojectOverview_view.aod +++ b/neonView/SalesprojectOverview_view/SalesprojectOverview_view.aod @@ -6,7 +6,6 @@ <layout> <boxLayout> <name>layout</name> - <autoHeight v="false" /> </boxLayout> </layout> <children> @@ -19,6 +18,10 @@ <name>7c365878-0f88-4bc3-aed4-0667951e70af</name> <entityField>SalesprojectPhaseMilestones</entityField> <view>SalesprojectMilestoneInfo_view</view> + <devices> + <element>TABLET</element> + <element>DESKTOP</element> + </devices> </neonViewReference> <neonViewReference> <name>dd0dd64f-1135-46c5-82d7-9d1e67cf4810</name> diff --git a/neonView/SalesprojectPhases_view/SalesprojectPhases_view.aod b/neonView/SalesprojectPhases_view/SalesprojectPhases_view.aod index 68b95709e881d76c8555bfa800f0315962fbd171..6eba3c2afc9b288b28ba1d7813b259fe1ecce4de 100644 --- a/neonView/SalesprojectPhases_view/SalesprojectPhases_view.aod +++ b/neonView/SalesprojectPhases_view/SalesprojectPhases_view.aod @@ -6,7 +6,7 @@ <neonDashletConfiguration> <name>SalesprojectPhases</name> <title>Salesproject phases</title> - <description>Zeigt wie viele Vertriebsprojekte in den einzelnen Vertriebsphasen sind. </description> + <description>Shows how many sales projects are in the various sales phases</description> <fragment>SalesprojectAnalyses/full</fragment> <singleton v="true" /> <icon>VAADIN:FUNNEL</icon> diff --git a/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod b/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod index 84b32b4c963c872a01a5b547e5b2a7dd5f147c81..03dbb600f57c8e99a44c21eed5907409a95b6ec5 100644 --- a/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod +++ b/neonView/SalesprojectPreview_view/SalesprojectPreview_view.aod @@ -30,8 +30,8 @@ <entityField>RELATION_ID</entityField> </entityFieldLink> <entityFieldLink> - <name>4e3d7a37-f55b-4c18-9ba1-ab4ab0bbb442</name> - <entityField>STATE</entityField> + <name>b3e902de-072f-4a41-8562-f4d30ad9a564</name> + <entityField>STATUS</entityField> </entityFieldLink> <entityFieldLink> <name>2867e662-b824-4bbf-8eaf-bbd34f44598e</name> diff --git a/neonView/SalesprojectScoreCard_view/SalesprojectScoreCard_view.aod b/neonView/SalesprojectScoreCard_view/SalesprojectScoreCard_view.aod index a19b50e4d11b4e3bda6b2884ae35dacc0b6b4591..37bc76d803c77e9739069108f97c5ea5b9d8de48 100644 --- a/neonView/SalesprojectScoreCard_view/SalesprojectScoreCard_view.aod +++ b/neonView/SalesprojectScoreCard_view/SalesprojectScoreCard_view.aod @@ -6,7 +6,7 @@ <neonDashletConfiguration> <name>KeyFigures</name> <title>Key figures</title> - <description>Wichtigste Kennzahlen zu den Vertriebsprojekten.</description> + <description>Most important salse key figures</description> <fragment>SalesprojectAnalyses/full</fragment> <singleton v="true" /> <icon>VAADIN:GRID_BIG</icon> @@ -26,16 +26,22 @@ <children> <scoreCardViewTemplate> <name>KeyFigures</name> + <fieldActions> + <element>openForecast</element> + <element>openTurnover</element> + <element>openSalesprojects</element> + <element>sentOffers</element> + </fieldActions> <entityField>#ENTITY</entityField> <fields> - <entityFieldLink> - <name>44449f24-ed9d-4053-8202-db4b43032067</name> - <entityField>OVERALL_TURNOVER</entityField> - </entityFieldLink> <entityFieldLink> <name>3377fe1b-1f29-4c49-88c8-7a1b1ee6d0ce</name> <entityField>OVERALL_FORECAST</entityField> </entityFieldLink> + <entityFieldLink> + <name>44449f24-ed9d-4053-8202-db4b43032067</name> + <entityField>OVERALL_TURNOVER</entityField> + </entityFieldLink> <entityFieldLink> <name>2ba5a5e7-0ae6-4001-84a6-9444730d6611</name> <entityField>OPEN_SALESPROJECTS</entityField> diff --git a/neonView/SalesprojectSourceEdit_view/SalesprojectSourceEdit_view.aod b/neonView/SalesprojectSourceEdit_view/SalesprojectSourceEdit_view.aod index 865adfc21d236d97a9bf9a7112964b12a60051ad..3d2145d400e9bfaa3ec482234bac7dbbe5300c40 100644 --- a/neonView/SalesprojectSourceEdit_view/SalesprojectSourceEdit_view.aod +++ b/neonView/SalesprojectSourceEdit_view/SalesprojectSourceEdit_view.aod @@ -19,8 +19,8 @@ <entityField>ENTRYDATE</entityField> </entityFieldLink> <entityFieldLink> - <name>594e9e35-cf0c-45b6-a32c-885d442adad4</name> - <entityField>SOURCE</entityField> + <name>3464b72a-8081-49a8-a37f-eda0290bda4c</name> + <entityField>TOUCHPOINT</entityField> </entityFieldLink> <entityFieldLink> <name>f97539fd-70ec-44a0-9d49-01fe829f8d81</name> diff --git a/neonView/SalesprojectSourceFilter_view/SalesprojectSourceFilter_view.aod b/neonView/SalesprojectSourceFilter_view/SalesprojectSourceFilter_view.aod index 747f0530283c5528854b442162cf621e3e35e579..a726464e870995ae96feba3c7c9e021930e24c4b 100644 --- a/neonView/SalesprojectSourceFilter_view/SalesprojectSourceFilter_view.aod +++ b/neonView/SalesprojectSourceFilter_view/SalesprojectSourceFilter_view.aod @@ -28,7 +28,7 @@ </neonTableColumn> <neonTableColumn> <name>5e672c0f-af11-46e2-8c25-8c9bd3f153f1</name> - <entityField>SOURCE</entityField> + <entityField>TOUCHPOINT</entityField> </neonTableColumn> <neonTableColumn> <name>304ed9dd-0f3d-45b2-9195-cc145775f16d</name> diff --git a/neonView/SalesprojectSourcePreview_view/SalesprojectSourcePreview_view.aod b/neonView/SalesprojectSourcePreview_view/SalesprojectSourcePreview_view.aod index f9b7128d14842b1117d827019a3d350f94ca0acc..7f0e3101cb4026a783b0a34ab084c55b53466cff 100644 --- a/neonView/SalesprojectSourcePreview_view/SalesprojectSourcePreview_view.aod +++ b/neonView/SalesprojectSourcePreview_view/SalesprojectSourcePreview_view.aod @@ -11,7 +11,7 @@ <children> <cardViewTemplate> <name>Header</name> - <titleField>SOURCE</titleField> + <titleField>TOUCHPOINT</titleField> <descriptionField>ENTRYDATE</descriptionField> <entityField>#ENTITY</entityField> </cardViewTemplate> diff --git a/neonView/SalutationFilter_view/SalutationFilter_view.aod b/neonView/SalutationFilter_view/SalutationFilter_view.aod index 6af973fb1cfbbd9ffd02c111218c16dc13a20f83..ea34e5efd6c4e2e20dbbdc14ef05f388be13d3d1 100644 --- a/neonView/SalutationFilter_view/SalutationFilter_view.aod +++ b/neonView/SalutationFilter_view/SalutationFilter_view.aod @@ -2,6 +2,7 @@ <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SalutationFilter_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> <layout> <boxLayout> <name>layout</name> @@ -17,7 +18,7 @@ <columns> <neonTableColumn> <name>32e3fa28-1749-45a2-ae77-27ddfb221dba</name> - <entityField>LANGUAGE</entityField> + <entityField>ISOLANGUAGE</entityField> </neonTableColumn> <neonTableColumn> <name>9cccf3a4-bbe7-453a-955c-246691c27dba</name> diff --git a/neonView/SerialLetterEdit_view/SerialLetterEdit_view.aod b/neonView/SerialLetterEdit_view/SerialLetterEdit_view.aod index 0d85498e0505fe81827c53ffe42995074ca7e1d4..a7414e5f2776ac45060fb932612b6b6407723d8e 100644 --- a/neonView/SerialLetterEdit_view/SerialLetterEdit_view.aod +++ b/neonView/SerialLetterEdit_view/SerialLetterEdit_view.aod @@ -13,14 +13,18 @@ <editMode v="true" /> <entityField>#ENTITY</entityField> <fields> - <entityFieldLink> - <name>b33a8886-75b0-4644-890d-97a8133079ea</name> - <entityField>TITLE</entityField> - </entityFieldLink> <entityFieldLink> <name>98b1c32e-8f7e-45f9-bbc8-048851133048</name> <entityField>DOCUMENTTEMPLATE_ID</entityField> </entityFieldLink> + <entityFieldLink> + <name>057f064d-53fd-4d80-a43e-20a4a40d4ffb</name> + <entityField>bindata</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b33a8886-75b0-4644-890d-97a8133079ea</name> + <entityField>TITLE</entityField> + </entityFieldLink> <entityFieldLink> <name>1845ae78-7132-4efc-aba0-737dc4d7fc9b</name> <entityField>DESCRIPTION</entityField> diff --git a/neonView/SerialLetterFilter_view/SerialLetterFilter_view.aod b/neonView/SerialLetterFilter_view/SerialLetterFilter_view.aod index 07fc34581663be997945ba36620b3ae6e5f7a740..3ee26598c9baaca8a82da78bae9f75edeb09f97f 100644 --- a/neonView/SerialLetterFilter_view/SerialLetterFilter_view.aod +++ b/neonView/SerialLetterFilter_view/SerialLetterFilter_view.aod @@ -2,6 +2,7 @@ <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>SerialLetterFilter_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> <layout> <boxLayout> <name>layout</name> @@ -24,6 +25,10 @@ <name>84aedf68-f90e-479c-912d-55cd499523cb</name> <entityField>DOCUMENTTEMPLATE_ID</entityField> </neonTableColumn> + <neonTableColumn> + <name>caf4b86c-bf11-492d-b487-522ff010fb22</name> + <entityField>DESCRIPTION</entityField> + </neonTableColumn> </columns> </tableViewTemplate> </children> diff --git a/neonView/SerialLetterMain_view/SerialLetterMain_view.aod b/neonView/SerialLetterMain_view/SerialLetterMain_view.aod index fcf3051cace381f66f0bb8e6cae517d803f34e62..94126a57ef4924dbed94a213990b156e3153784f 100644 --- a/neonView/SerialLetterMain_view/SerialLetterMain_view.aod +++ b/neonView/SerialLetterMain_view/SerialLetterMain_view.aod @@ -19,5 +19,10 @@ <entityField>Recipients</entityField> <view>LetterRecipientFilter_view</view> </neonViewReference> + <neonViewReference> + <name>5cba2de9-e00b-4548-8477-5fc76b1e3cb6</name> + <entityField>LogHistories</entityField> + <view>LogHistoryFilter_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/SerialLetterPreview_view/SerialLetterPreview_view.aod b/neonView/SerialLetterPreview_view/SerialLetterPreview_view.aod index 99bc3ac75a125f51e43c1a5d092f69535156e760..f81ecaef089576bd91fc9cd3ff7dd26bcd88dbce 100644 --- a/neonView/SerialLetterPreview_view/SerialLetterPreview_view.aod +++ b/neonView/SerialLetterPreview_view/SerialLetterPreview_view.aod @@ -12,6 +12,7 @@ <name>Card</name> <iconField>ICON</iconField> <titleField>TITLE</titleField> + <favoriteAction1>downloadLetter</favoriteAction1> <entityField>#ENTITY</entityField> </cardViewTemplate> <genericViewTemplate> diff --git a/neonView/TaskFilter_view/TaskFilter_view.aod b/neonView/TaskFilter_view/TaskFilter_view.aod index 4dc54182492f504f86d283531d19934dadf6b87f..7c22a4b14a667499f619bfbbfb65ba6ec8900ab9 100644 --- a/neonView/TaskFilter_view/TaskFilter_view.aod +++ b/neonView/TaskFilter_view/TaskFilter_view.aod @@ -7,7 +7,7 @@ <neonDashletConfiguration> <name>mytasks</name> <title>My tasks</title> - <description>Show tasks where I am editor</description> + <description>Tasks for which I am responsible</description> <fragment>Task/filter</fragment> <singleton v="true" /> <requiresConfiguration v="false" /> diff --git a/neonView/TimetrackingEdit_view/TimetrackingEdit_view.aod b/neonView/TimetrackingEdit_view/TimetrackingEdit_view.aod index 19d4ceacef30419a0d3116eab1ee4637a08984e3..36ff738d6ca2c1d3f210ab15f6345477e4f42cbe 100644 --- a/neonView/TimetrackingEdit_view/TimetrackingEdit_view.aod +++ b/neonView/TimetrackingEdit_view/TimetrackingEdit_view.aod @@ -15,16 +15,16 @@ <entityField>#ENTITY</entityField> <fields> <entityFieldLink> - <name>8a0941a2-2c33-4a66-a460-5f2f7258e051</name> - <entityField>DATE</entityField> + <name>6bf1e6e0-6cf1-46e6-8fd1-e88dec5a83a7</name> + <entityField>TRACKINGDATE</entityField> </entityFieldLink> <entityFieldLink> <name>8c27f579-543a-484f-ba3d-ba0579e6db12</name> <entityField>CONTACT_ID</entityField> </entityFieldLink> <entityFieldLink> - <name>ef97d0da-a0d4-4147-b440-96d249ffec73</name> - <entityField>MINUTES</entityField> + <name>d485bdf8-5ebf-4bcc-b4ea-7423ea449206</name> + <entityField>TRACKINGMINUTES</entityField> </entityFieldLink> <entityFieldLink> <name>57370b00-130c-439e-9b70-fd56fc28c892</name> diff --git a/neonView/TimetrackingFilter_view/TimetrackingFilter_view.aod b/neonView/TimetrackingFilter_view/TimetrackingFilter_view.aod index 7172354bf802ff23155bbe36f2cc6d8a33b65e39..19375f3b617ead0d27ccfb898c5b4caffc8c8586 100644 --- a/neonView/TimetrackingFilter_view/TimetrackingFilter_view.aod +++ b/neonView/TimetrackingFilter_view/TimetrackingFilter_view.aod @@ -20,7 +20,7 @@ <columns> <neonTableColumn> <name>fa423332-8987-4fc2-981c-66447678b922</name> - <entityField>DATE</entityField> + <entityField>TRACKINGDATE</entityField> </neonTableColumn> <neonTableColumn> <name>63068c6c-1508-47f2-ad2e-bbe66a448af1</name> @@ -28,7 +28,7 @@ </neonTableColumn> <neonTableColumn> <name>7e18967d-3c78-4f75-bc03-f6d925553484</name> - <entityField>MINUTES</entityField> + <entityField>TRACKINGMINUTES</entityField> </neonTableColumn> <neonTableColumn> <name>e17a680c-5a05-42a1-ab34-067a97192690</name> diff --git a/neonView/TimetrackingPreview_view/TimetrackingPreview_view.aod b/neonView/TimetrackingPreview_view/TimetrackingPreview_view.aod index a01bad27b0c43f7f5cd96a930ddffeca46ba9a30..906cdbe142a346a59d58922aeef0356fbbceda12 100644 --- a/neonView/TimetrackingPreview_view/TimetrackingPreview_view.aod +++ b/neonView/TimetrackingPreview_view/TimetrackingPreview_view.aod @@ -19,12 +19,12 @@ <entityField>CONTACT_ID</entityField> </entityFieldLink> <entityFieldLink> - <name>64005996-e735-4c5d-bdb7-29aaf8851107</name> - <entityField>DATE</entityField> + <name>ce7d8cc0-ac9c-4195-861f-23483db6cd91</name> + <entityField>TRACKINGDATE</entityField> </entityFieldLink> <entityFieldLink> - <name>25921a31-5563-4a74-aa7e-67d660c60f0b</name> - <entityField>MINUTES</entityField> + <name>45f4f97c-5fde-4c90-9dba-4e5b540328b3</name> + <entityField>TRACKINGMINUTES</entityField> </entityFieldLink> </fields> </genericViewTemplate> diff --git a/neonView/TurnoverChartForcastDrawer_view/TurnoverChartForcastDrawer_view.aod b/neonView/TurnoverChartForcastDrawer_view/TurnoverChartForcastDrawer_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..9530478a02b1362f9b6c4453199d5808906fbda6 --- /dev/null +++ b/neonView/TurnoverChartForcastDrawer_view/TurnoverChartForcastDrawer_view.aod @@ -0,0 +1,19 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>TurnoverChartForcastDrawer_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Forecast</layoutCaption> + <fixedDrawer v="true" /> + </drawerLayout> + </layout> + <children> + <neonViewReference> + <name>b7fd781d-9f52-413c-a993-20760985bc9c</name> + <entityField>#ENTITY</entityField> + <view>TurnoverChartForecast_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/neonView/TurnoverChartForecast_view/TurnoverChartForecast_view.aod b/neonView/TurnoverChartForecast_view/TurnoverChartForecast_view.aod index e1b204a458e73310fa920ae0afbf32914fdb5f7e..8ccd4373c364378b2a83b7b1e7a69f0f6cafaa84 100644 --- a/neonView/TurnoverChartForecast_view/TurnoverChartForecast_view.aod +++ b/neonView/TurnoverChartForecast_view/TurnoverChartForecast_view.aod @@ -7,6 +7,7 @@ <neonDashletConfiguration> <name>TurnoverDashlet</name> <title>Turnover</title> + <description>Shows the organisations turnover and forecast</description> <fragment>Turnover/full</fragment> <singleton v="true" /> <storeRoles> @@ -36,7 +37,7 @@ <parentField>PARENT</parentField> <categoryField>CATEGORY</categoryField> <entityField>#ENTITY</entityField> - <title>Forecast</title> + <title></title> </multiDataChartViewTemplate> <multiDataChartViewTemplate> <name>LineChart</name> @@ -46,7 +47,7 @@ <parentField>PARENT</parentField> <categoryField>CATEGORY</categoryField> <entityField>#ENTITY</entityField> - <title>Forecast</title> + <title></title> </multiDataChartViewTemplate> <multiDataChartViewTemplate> <name>AreaChart</name> @@ -56,7 +57,7 @@ <parentField>PARENT</parentField> <categoryField>CATEGORY</categoryField> <entityField>#ENTITY</entityField> - <title>Forecast</title> + <title></title> </multiDataChartViewTemplate> <multiDataChartViewTemplate> <name>BarChart</name> @@ -66,7 +67,7 @@ <parentField>PARENT</parentField> <categoryField>CATEGORY</categoryField> <entityField>#ENTITY</entityField> - <title>Forecast</title> + <title></title> </multiDataChartViewTemplate> <multiDataChartViewTemplate> <name>SplineChart</name> @@ -76,7 +77,7 @@ <parentField>PARENT</parentField> <categoryField>CATEGORY</categoryField> <entityField>#ENTITY</entityField> - <title>Forecast</title> + <title></title> </multiDataChartViewTemplate> </children> </neonView> diff --git a/neonView/TurnoverChart_view/TurnoverChart_view.aod b/neonView/TurnoverChart_view/TurnoverChart_view.aod index d0973c67d064ada96158eb063c7b9aab73bd5fd5..1f8c54f39321ad174b7b30f16f506e7b12bbee8a 100644 --- a/neonView/TurnoverChart_view/TurnoverChart_view.aod +++ b/neonView/TurnoverChart_view/TurnoverChart_view.aod @@ -3,25 +3,6 @@ <name>TurnoverChart_view</name> <title></title> <majorModelMode>DISTRIBUTED</majorModelMode> - <dashletConfigurations> - <neonDashletConfiguration> - <name>TurnoverDashlet</name> - <title>Turnover</title> - <fragment>Turnover/full</fragment> - <singleton v="true" /> - <storeRoles> - <element>INTERNAL_ADMINISTRATOR</element> - <element>INTERNAL_DASHBOARDSTOREADMIN</element> - </storeRoles> - <icon>VAADIN:CHART</icon> - <categories> - <neonDashletCategory> - <name>turnover</name> - <title>Turnover</title> - </neonDashletCategory> - </categories> - </neonDashletConfiguration> - </dashletConfigurations> <layout> <groupLayout> <name>layout</name> @@ -74,7 +55,7 @@ <entityField>#ENTITY</entityField> </multiDataChartViewTemplate> <neonViewReference> - <name>b0a9f719-3768-4ce5-9d32-e0f5fa5bf1eb</name> + <name>d5e15acc-21a3-464f-aebc-6a11a969cf97</name> <entityField>Turnover_tree</entityField> <view>TurnoverTree_view</view> </neonViewReference> diff --git a/neonView/UnlinkedMailMappingLinkList_view/UnlinkedMailMappingLinkList_view.aod b/neonView/UnlinkedMailMappingLinkList_view/UnlinkedMailMappingLinkList_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..0f84912c15741f9a6ef4f420ade85d92fefab85a --- /dev/null +++ b/neonView/UnlinkedMailMappingLinkList_view/UnlinkedMailMappingLinkList_view.aod @@ -0,0 +1,35 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>UnlinkedMailMappingLinkList_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>${UNLINKEDMAILMAPPING_ADDITIONAL_LINKS}</layoutCaption> + </drawerLayout> + </layout> + <children> + <genericMultipleViewTemplate> + <name>GenericMultiple</name> + <autoNewRow v="true" /> + <entityField>#ENTITY</entityField> + <columns> + <neonTableColumn> + <name>0f4fc4e4-2a1f-404e-84c0-6ede00e89a09</name> + <entityField>CONTACT_ID</entityField> + <width v="100" /> + <expandRatio v="100" /> + </neonTableColumn> + <neonTableColumn> + <name>bd45c8bc-bb7b-4109-a42d-b25feda0977b</name> + <entityField>EMAILADDR</entityField> + <width v="100" /> + </neonTableColumn> + <neonTableColumn> + <name>7bae119d-a760-450b-9b51-b17d97af1ed3</name> + <entityField>CONTEXT_NAME</entityField> + </neonTableColumn> + </columns> + </genericMultipleViewTemplate> + </children> +</neonView> diff --git a/neonView/UnlinkedMailMappingWrapperMapping_view/UnlinkedMailMappingWrapperMapping_view.aod b/neonView/UnlinkedMailMappingWrapperMapping_view/UnlinkedMailMappingWrapperMapping_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..0686a25fef2c84db0a021eb2ebf559d682b3c20f --- /dev/null +++ b/neonView/UnlinkedMailMappingWrapperMapping_view/UnlinkedMailMappingWrapperMapping_view.aod @@ -0,0 +1,31 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> + <name>UnlinkedMailMappingWrapperMapping_view</name> + <title>Link e-mail addresses to contacts</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <headerFooterLayout> + <name>layout</name> + <header>Generic</header> + </headerFooterLayout> + </layout> + <children> + <genericViewTemplate> + <name>Generic</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>52ee726e-fcad-43fd-8b08-29cd31bfa1ba</name> + <entityField>RESPONSIBLE_ID</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <neonViewReference> + <name>10cbd0dc-4297-4703-ad84-b52312700f2e</name> + <entityField>UnlinkedMailMappingLinks</entityField> + <view>UnlinkedMailMappingLinkList_view</view> + </neonViewReference> + </children> +</neonView> diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod index 54fe69854e9b505bf62586da79e1d9b4e164a95a..595e71e77c5cd9abb3be45cafa51024b1262a847 100644 --- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod +++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod @@ -65,7 +65,7 @@ <customStringProperty> <name>phoneValidation.url</name> <description></description> - <property>https://services.aditosoftware.local/services/rest/ws_checkPhoneNumber</property> + <property>https://services.de/services/rest/ws_checkPhoneNumber</property> </customStringProperty> <customStringProperty> <name>phoneValidation.user</name> @@ -81,7 +81,7 @@ </customStringProperty> <customBooleanProperty> <name>dsgvo.active</name> - <property v="true" /> + <property v="false" /> </customBooleanProperty> <customDurationProperty> <name>dsgvo.deletionTimeDays</name> @@ -93,7 +93,7 @@ </customDurationProperty> <customBooleanProperty> <name>nominatim.enable</name> - <property v="true" /> + <property v="false" /> </customBooleanProperty> <customStringProperty> <name>nominatim.url</name> diff --git a/process/ActivityTask_lib/process.js b/process/ActivityTask_lib/process.js index 5be1d63e1bb94cf666dc8ebcc9cf36fb04c42798..3987c9533e07e9ca7a30e8f5bf68e0035a4900b9 100644 --- a/process/ActivityTask_lib/process.js +++ b/process/ActivityTask_lib/process.js @@ -1,306 +1,353 @@ -import("Binary_lib"); -import("system.vars"); -import("system.util"); -import("system.datetime"); -import("system.text"); -import("system.neon"); -import("system.db"); -import("system.translate"); -import("system.eMath"); -import("Util_lib"); -import("Sql_lib"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); -import("Product_lib"); -import("Report_lib"); -import("Context_lib"); - -/** - * Methods used by for activities (former history). - * Do not create an instance of this! - * - * @class - */ -function ActivityUtils() {} - -/** - * Create a new activity within the database-scope. - * This funciton will insert a complete new activity into the Database - * - * @param {Object} [pDataPreset={}] an object that contains the data for the activity, you do not need to specify any preset data at all, - * but you CAN define the following properties: - * <ul> - * <li>activityId</li> - * <li>responsibleContactId</li> - * <li>categoryKeywordId</li> - * <li>directionKeywordId</li> - * <li>subject</li> - * <li>content</li> - * </ul> - * @param {Array} [pActivityLinks] 2D array where each element is an array of Contextname and objectid, for example: - * <pre>[["Organisation", "2d1e505c-a75a-4fa6-826b-7224a97d5b51"]]</pre> - * @param {Array} [pDocuments] 2D array where each element is an array of: - * <ul> - * <li>document-name</li> - * <li>document-content(base64-string)</li> - * <li>true/false if it's mainDocument or not</li> - * </ul> - * for example: - * <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre> - * @param {String} [pDbAlias=current db alias] database alias where the activity shall be inserted - * - * @return {Object} js object where the following are filled: - * <ul> - * <li>activityId</li> - * </ul> - */ -ActivityUtils.insertNewActivity = function(pDataPreset, pActivityLinks, pDocuments, pDbAlias) -{ - var dataPreset = pDataPreset || {}; - var dbAlias = pDbAlias || db.getCurrentAlias(); - var insertStatements = []; - - var creationUser = vars.get("$sys.user"); - var creationDate = datetime.date(); - - var activityId = dataPreset.activityId || util.getNewUUID(); - var entrydate = pDataPreset.entrydate || creationDate; - - var activityColumns = ["ACTIVITYID", "DATE_NEW", "USER_NEW", "ENTRYDATE"]; - var activityValues = [activityId, creationDate, creationUser, entrydate]; - - _addActivityCol("CATEGORY", dataPreset.categoryKeywordId); - _addActivityCol("DIRECTION", dataPreset.directionKeywordId); - _addActivityCol("INFO", dataPreset.content); - _addActivityCol("RESPONSIBLE", dataPreset.responsibleContactId); - _addActivityCol("SUBJECT", dataPreset.subject); - - insertStatements.push(["ACTIVITY", activityColumns, db.getColumnTypes("ACTIVITY", activityColumns, dbAlias), activityValues]); - - if (pActivityLinks) - { - var activityLinkColumns = ["ACTIVITYLINKID", "ACTIVITY_ID", "DATE_NEW", "USER_NEW", "OBJECT_TYPE", "OBJECT_ROWID"]; - var activityLinkColumnTypes = db.getColumnTypes("ACTIVITYLINK", activityLinkColumns, dbAlias); - var activityLinkValues; - for (var i = 0, l = pActivityLinks.length; i < l; i++) - { - activityLinkValues = [util.getNewUUID(), activityId, creationDate, creationUser, pActivityLinks[i][0], pActivityLinks[i][1]]; - insertStatements.push(["ACTIVITYLINK", activityLinkColumns, activityLinkColumnTypes, activityLinkValues]); - } - } - - db.inserts(insertStatements, dbAlias); - - if (pDocuments) - { - pDocuments.forEach(function (document){ - var filename, b64Content, isMainDocument; - [filename, b64Content, isMainDocument] = document; - if (isMainDocument) - SingleBinaryUtils.insertMainDocument("ACTIVITY", "DOCUMENT", activityId, b64Content, filename); - else - SingleBinaryUtils.insert("ACTIVITY", "DOCUMENT", activityId, b64Content, filename); - }); - } - - return { - activityId: activityId - }; - - function _addActivityCol(pColumn, pValue, pDefaultValue) - { - if (pValue || pDefaultValue) - { - activityColumns.push(pColumn); - activityValues.push(pValue || pDefaultValue); - } - } -}; - -/** - * Create a new activity - */ -ActivityUtils.createNewActivity = function(pRowId, pAdditionalLinks, pParentContext, pParentId) -{ - _ActivityTaskUtils._createNew("Activity", pRowId, pAdditionalLinks, pParentContext, pParentId) -} - -/* - * Gets the date of the last activity - * - * @param {String} pRowId the rowid of the dataset - * - * @return {number|null} the date of the last actvity as long - */ -ActivityUtils.getLastActivityDate = function(pRowId) -{ - var context = ContextUtils.getCurrentContextId(); - var sqlUtil = new SqlMaskingUtils(); - var activitySql = "select " + sqlUtil.max("ENTRYDATE") + " from ACTIVITY " - + " join ACTIVITYLINK on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID"; - activitySql = SqlCondition.begin() - .andPrepare("ACTIVITYLINK.OBJECT_TYPE", context) - .andPrepare("ACTIVITYLINK.OBJECT_ROWID", pRowId) - .buildSql(activitySql); - - var entryDate = db.cell(activitySql); - if (entryDate != "") - return parseInt(entryDate); - return null; -} - -/** - * add the links to the link-table in new mode - * - * @return {String} pObjectIdField jdito Field for the objectId - * @return {String} pRowIdField jdito Field for the rowId - * @return {String} pAdditionalLinksField jdito Field for additional links - */ -ActivityUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField) -{ - _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links"); -} - -/** - * Methods used by for tasks. - * Do not create an instance of this! - * - * @class - */ -function TaskUtils () {} - - -/** - * Create a new task - */ -TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pParams) -{ - _ActivityTaskUtils._createNew("Task", pRowId, pAdditionalLinks, pParentContext, pParentId, pParams) -} - -/** - * Create a new task - */ -TaskUtils.hasTasks = function(pRowId, pObjectType) -{ - if (pRowId != "" && pObjectType != "") - { - var cond = SqlCondition.begin().andPrepare("TASKLINK.OBJECT_TYPE", pObjectType) - .andPrepare("TASKLINK.OBJECT_ROWID", pRowId); - var taskCount = db.cell(cond.buildSql("select count(*) from TASKLINK")); - if (taskCount != "0") - return true; - else - return false; - } - else - return true; -} - -TaskUtils.getStatusIcon = function(pStatus) -{ - return KeywordUtils.getAttributeRelation(pStatus, $KeywordRegistry.taskStatus(), "icon", "NEON:STATUS_NOT_STARTED"); -} - -/** - * add the links to the link-table in new mode - * - * @return {String} pObjectIdField jdito Field for the objectId - * @return {String} pRowIdField jdito Field for the rowId - * @return {String} pAdditionalLinksField jdito Field for additional links - */ -TaskUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField) -{ - _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links"); -} - -/** - * Methods used by for tasks. - * Do not create an instance of this! - * - * @ignore - * @class - */ -function _ActivityTaskUtils() {} - - -/** - * Create a new task - * @ignore - */ -_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId, pParams) -{ - if (pAdditionalLinks == undefined) - pAdditionalLinks = []; - - var params = {}; - - if (pParams) - params = pParams - - if (pRowId) - { - params["ObjectId_param"] = ContextUtils.getCurrentContextId(); - params["RowId_param"] = pRowId; - } - - params["PresetLinks_param"] = JSON.stringify(pAdditionalLinks); - - if (pParentContext && pParentId) - { - - - params["ParentContext_param"] = pParentContext; - params["ParentId_param"] = pParentId; - } - - neon.openContext(pContext, null, null, neon.OPERATINGSTATE_NEW, params); -} - -/** - * add the links to the link-table in new mode - * - * @return {String} pObjectIdField jdito Field for the objectId - * @return {String} pRowIdField jdito Field for the rowId - * @return {String} pAdditionalLinksField jdito Field for additional links - * - * @ignore - */ -_ActivityTaskUtils._addLinkRecords = function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, pConsumerName) -{ - if (vars.exists(pAdditionalLinksField)) - presetLinks = JSON.parse(vars.getString(pAdditionalLinksField)); - - if (!presetLinks) - presetLinks = []; - - if (vars.exists(pRowIdField) && vars.get(pRowIdField) - && vars.exists(pObjectIdField) && vars.get(pObjectIdField)) - presetLinks.push([vars.get(pObjectIdField), vars.get(pRowIdField)]); - - if (vars.exists(pParentContextField) && vars.exists(pParentIdField)) - { - switch (vars.get(pParentContextField)) - { - case "Activity": - presetLinks = presetLinks.concat(db.table(SqlCondition.begin() - .andPrepare("ACTIVITYLINK.ACTIVITY_ID", vars.get(pParentIdField)) - .buildSql("select OBJECT_TYPE, OBJECT_ROWID from ACTIVITYLINK", "1=2"))); - break; - case "Task": - presetLinks = presetLinks.concat(db.table(SqlCondition.begin() - .andPrepare("TASKLINK.TASK_ID", vars.get(pParentIdField)) - .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TASKLINK", "1=2"))); - break; - } - - } - - presetLinks.forEach(function(link) { - neon.addRecord(pConsumerName, { - "OBJECT_TYPE" : link[0], - "OBJECT_ROWID" : link[1] - }); - }); -} - +import("system.logging"); +import("Binary_lib"); +import("system.vars"); +import("system.util"); +import("system.datetime"); +import("system.text"); +import("system.neon"); +import("system.db"); +import("system.translate"); +import("system.eMath"); +import("Util_lib"); +import("Sql_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("Product_lib"); +import("Report_lib"); +import("Context_lib"); + +/** + * Methods used by for activities (former history). + * Do not create an instance of this! + * + * @class + */ +function ActivityUtils() {} + +/** + * Create a new activity within the database-scope. + * This funciton will insert a complete new activity into the Database + * + * @param {Object} [pDataPreset={}] an object that contains the data for the activity, you do not need to specify any preset data at all, + * but you CAN define the following properties: + * <ul> + * <li>activityId</li> + * <li>responsibleContactId</li> + * <li>categoryKeywordId</li> + * <li>directionKeywordId</li> + * <li>subject</li> + * <li>content</li> + * </ul> + * @param {Array} [pActivityLinks] 2D array where each element is an array of Contextname and objectid, for example: + * <pre>[["Organisation", "2d1e505c-a75a-4fa6-826b-7224a97d5b51"]]</pre> + * @param {Array} [pDocuments] 2D array where each element is an array of: + * <ul> + * <li>document-name</li> + * <li>document-content(base64-string)</li> + * <li>true/false if it's mainDocument or not</li> + * </ul> + * for example: + * <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre> + * @param {String} [pDbAlias=current db alias] database alias where the activity shall be inserted + * + * @return {Object} js object where the following are filled: + * <ul> + * <li>activityId</li> + * </ul> + */ +ActivityUtils.insertNewActivity = function(pDataPreset, pActivityLinks, pDocuments, pDbAlias) +{ + var dataPreset = pDataPreset || {}; + var dbAlias = pDbAlias || db.getCurrentAlias(); + var insertStatements = []; + + var creationUser = vars.get("$sys.user"); + var creationDate = datetime.date(); + + var activityId = dataPreset.activityId || util.getNewUUID(); + var entrydate = pDataPreset.entrydate || creationDate; + + var activityColumns = ["ACTIVITYID", "DATE_NEW", "USER_NEW", "ENTRYDATE"]; + var activityValues = [activityId, creationDate, creationUser, entrydate]; + + _addActivityCol("CATEGORY", dataPreset.categoryKeywordId); + _addActivityCol("DIRECTION", dataPreset.directionKeywordId); + _addActivityCol("INFO", dataPreset.content); + _addActivityCol("RESPONSIBLE", dataPreset.responsibleContactId); + _addActivityCol("SUBJECT", dataPreset.subject); + + insertStatements.push(["ACTIVITY", activityColumns, db.getColumnTypes("ACTIVITY", activityColumns, dbAlias), activityValues]); + + if (pActivityLinks) + { + var activityLinkColumns = ["ACTIVITYLINKID", "ACTIVITY_ID", "DATE_NEW", "USER_NEW", "OBJECT_TYPE", "OBJECT_ROWID"]; + var activityLinkColumnTypes = db.getColumnTypes("ACTIVITYLINK", activityLinkColumns, dbAlias); + var activityLinkValues; + for (var i = 0, l = pActivityLinks.length; i < l; i++) + { + activityLinkValues = [util.getNewUUID(), activityId, creationDate, creationUser, pActivityLinks[i][0], pActivityLinks[i][1]]; + insertStatements.push(["ACTIVITYLINK", activityLinkColumns, activityLinkColumnTypes, activityLinkValues]); + } + } + + db.inserts(insertStatements, dbAlias); + + if (pDocuments) + ActivityUtils.insertDocuments(activityId, pDocuments); + + return { + activityId: activityId + }; + + function _addActivityCol(pColumn, pValue, pDefaultValue) + { + if (pValue || pDefaultValue) + { + activityColumns.push(pColumn); + activityValues.push(pValue || pDefaultValue); + } + } +}; + +/** + * inserts documents for an activity + * + * @param {String} pActivityId activity id + * @param {Array} pDocuments 2D array where each element is an array of: + * <ul> + * <li>document-name</li> + * <li>document-content(base64-string)</li> + * <li>true/false if it's mainDocument or not</li> + * </ul> + * for example: + * <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre> + */ +ActivityUtils.insertDocuments = function (pActivityId, pDocuments) +{ + pDocuments.forEach(function (document) + { + var filename, b64Content, isMainDocument; + [filename, b64Content, isMainDocument] = document; + if (isMainDocument) + SingleBinaryUtils.insertMainDocument("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename); + else + SingleBinaryUtils.insert("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename); + }); +} + +/** + * Create a new activity + */ +ActivityUtils.createNewActivity = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pSubject, pInfo, pDirection, pDocuments) +{ + var params = {}; + if (pDocuments) + params["PresetDocuments_param"] = JSON.stringify(pDocuments); + if (pSubject) + params["Subject_param"] = pSubject; + if (pInfo) + params["Info_param"] = text.text2html(pInfo.trim(), false); + if (pDirection) + params["Direction_param"] = pDirection; + + _ActivityTaskUtils._createNew("Activity", pRowId, pAdditionalLinks, pParentContext, pParentId, params) +} + +/* + * Gets the date of the last activity + * + * @param {String} pRowId the rowid of the dataset + * + * @return {number|null} the date of the last actvity as long + */ +ActivityUtils.getLastActivityDate = function(pRowId) +{ + var context = ContextUtils.getCurrentContextId(); + var sqlUtil = new SqlMaskingUtils(); + var activitySql = "select " + sqlUtil.max("ENTRYDATE") + " from ACTIVITY " + + " join ACTIVITYLINK on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID"; + activitySql = SqlCondition.begin() + .andPrepare("ACTIVITYLINK.OBJECT_TYPE", context) + .andPrepare("ACTIVITYLINK.OBJECT_ROWID", pRowId) + .buildSql(activitySql); + + var entryDate = db.cell(activitySql); + if (entryDate != "") + return parseInt(entryDate); + return null; +} + +/** + * add the links to the link-table in new mode + * + * @return {String} pObjectIdField jdito Field for the objectId + * @return {String} pRowIdField jdito Field for the rowId + * @return {String} pAdditionalLinksField jdito Field for additional links + */ +ActivityUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField) +{ + _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links"); +} + +ActivityUtils.hasActivities = function (pRowId, pObjectType) +{ + if (pRowId && pObjectType) + { + var cond = SqlCondition.begin().andPrepare("ACTIVITYLINK.OBJECT_TYPE", pObjectType) + .andPrepare("ACTIVITYLINK.OBJECT_ROWID", pRowId); + var taskCount = db.cell(cond.buildSql("select count(*) from ACTIVITYLINK")); + if (taskCount != "0") + return true; + return false; + } + return true; +} + +/** + * Methods used by for tasks. + * Do not create an instance of this! + * + * @class + */ +function TaskUtils () {} + + +/** + * Create a new task + */ +TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments) +{ + _ActivityTaskUtils._createNew("Task", pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments) +} + +/** + * Create a new task + */ +TaskUtils.hasTasks = function(pRowId, pObjectType) +{ + if (pRowId != "" && pObjectType != "") + { + var cond = SqlCondition.begin().andPrepare("TASKLINK.OBJECT_TYPE", pObjectType) + .andPrepare("TASKLINK.OBJECT_ROWID", pRowId); + var taskCount = db.cell(cond.buildSql("select count(*) from TASKLINK")); + if (taskCount != "0") + return true; + else + return false; + } + else + return true; +} + +TaskUtils.getStatusIcon = function(pStatus) +{ + return KeywordUtils.getAttributeRelation(pStatus, $KeywordRegistry.taskStatus(), "icon", "NEON:STATUS_NOT_STARTED"); +} + +/** + * add the links to the link-table in new mode + * + * @return {String} pObjectIdField jdito Field for the objectId + * @return {String} pRowIdField jdito Field for the rowId + * @return {String} pAdditionalLinksField jdito Field for additional links + */ +TaskUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField) +{ + _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links"); +} + +/** + * Methods used by for tasks. + * Do not create an instance of this! + * + * @ignore + * @class + */ +function _ActivityTaskUtils() {} + + +/** + * Create a new task + * @ignore + */ +_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId, pParams) +{ + if (pAdditionalLinks == undefined) + pAdditionalLinks = []; + + var params = {}; + + if (pParams) + params = pParams + + if (pRowId) + { + params["ObjectId_param"] = ContextUtils.getCurrentContextId(); + params["RowId_param"] = pRowId; + } + + params["PresetLinks_param"] = JSON.stringify(pAdditionalLinks); + + if (pParentContext && pParentId) + { + + + params["ParentContext_param"] = pParentContext; + params["ParentId_param"] = pParentId; + } + + neon.openContext(pContext, null, null, neon.OPERATINGSTATE_NEW, params); +} + +/** + * add the links to the link-table in new mode + * + * @return {String} pObjectIdField jdito Field for the objectId + * @return {String} pRowIdField jdito Field for the rowId + * @return {String} pAdditionalLinksField jdito Field for additional links + * + * @ignore + */ +_ActivityTaskUtils._addLinkRecords = function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, pConsumerName) +{ + if (vars.exists(pAdditionalLinksField)) + presetLinks = JSON.parse(vars.getString(pAdditionalLinksField)); + + if (!presetLinks) + presetLinks = []; + + if (vars.exists(pRowIdField) && vars.get(pRowIdField) + && vars.exists(pObjectIdField) && vars.get(pObjectIdField)) + presetLinks.push([vars.get(pObjectIdField), vars.get(pRowIdField)]); + + if (vars.exists(pParentContextField) && vars.exists(pParentIdField)) + { + switch (vars.get(pParentContextField)) + { + case "Activity": + presetLinks = presetLinks.concat(db.table(SqlCondition.begin() + .andPrepare("ACTIVITYLINK.ACTIVITY_ID", vars.get(pParentIdField)) + .buildSql("select OBJECT_TYPE, OBJECT_ROWID from ACTIVITYLINK", "1=2"))); + break; + case "Task": + presetLinks = presetLinks.concat(db.table(SqlCondition.begin() + .andPrepare("TASKLINK.TASK_ID", vars.get(pParentIdField)) + .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TASKLINK", "1=2"))); + break; + case "SupportTicket": + presetLinks = presetLinks.concat(db.table(SqlCondition.begin() + .andPrepare("TICKET.TICKETID", vars.get(pParentIdField)) + .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TICKET join TASKLINK on TASKLINK.TASK_ID = TICKET.TASK_ID", "1=2"))); + break; + } + + } + + presetLinks.forEach(function(link) { + neon.addRecord(pConsumerName, { + "OBJECT_TYPE" : link[0], + "OBJECT_ROWID" : link[1] + }); + }); +} + diff --git a/process/Address_lib/process.js b/process/Address_lib/process.js index e757db22e913e3a90f058f33c0ac33e5386b4f9f..47eed7c45e736490630f4601165b32ab7de955ea 100644 --- a/process/Address_lib/process.js +++ b/process/Address_lib/process.js @@ -137,10 +137,10 @@ function fetchAddressData( pCondition, pConfig, AddressID, pPerson ) var addrfields = [ "case when CONTACT.PERSON_ID is null then 1 else case when " + SqlMaskingUtils.prototype.trim("CONTACT.ORGANISATION_ID") + " = '0' then 2 else 3 end end", //0 "ADDRESS.ADDRESS", "ADDRESS.BUILDINGNO", "ADDRESS.ZIP", "ADDRESS.CITY", "ADDRESS.COUNTRY", "ADDRESS.ADDRESSADDITION", // 1-6 - "ADDRESS.ADDRIDENTIFIER", "ADDRESS.DISTRICT", "ADDRESS.REGION", "ADDRESS.STATE", "CONTACT.DEPARTMENT", "CONTACT.CONTACTROLE", // 7-12 - "CONTACT.POSITION", "CONTACT.LETTERSALUTATION", "ORGANISATION.NAME", "PERSON.FIRSTNAME", "PERSON.MIDDLENAME", "PERSON.LASTNAME", // 13-18 + "ADDRESS.ADDRIDENTIFIER", "ADDRESS.DISTRICT", "ADDRESS.REGION", "ADDRESS.PROVINCE", "CONTACT.DEPARTMENT", "CONTACT.CONTACTROLE", // 7-12 + "CONTACT.CONTACTPOSITION", "CONTACT.LETTERSALUTATION", "ORGANISATION.NAME", "PERSON.FIRSTNAME", "PERSON.MIDDLENAME", "PERSON.LASTNAME", // 13-18 "PERSON.SALUTATION", "PERSON.TITLE", "PERSON.TITLESUFFIX", // 19-21 - "coalesce( CONTACT.LANGUAGE, (select C.LANGUAGE from CONTACT C where C.ORGANISATION_ID = CONTACT.ORGANISATION_ID and PERSON_ID is null))", // 22 + "coalesce( CONTACT.ISOLANGUAGE, (select C.ISOLANGUAGE from CONTACT C where C.ORGANISATION_ID = CONTACT.ORGANISATION_ID and PERSON_ID is null))", // 22 "''", "''", "''", "(select ADDR_FORMAT from AB_COUNTRYINFO where ISO2 = ADDRESS.COUNTRY)", "ADDRESS.ADDR_TYPE" // 23-27 ]; @@ -347,7 +347,7 @@ function _getSalutation( pSalutCode ) } else { - var list = db.table("select LANGUAGE, SALUTATION, TITLE, HEADLINE, LETTERSALUTATION from SALUTATION" ); + var list = db.table("select ISOLANGUAGE, SALUTATION, TITLE, HEADLINE, LETTERSALUTATION from SALUTATION" ); for ( var i = 0; i < list.length; i++ ) { salut[list[i][0] + list[i][1] + list[i][2]] = [list[i][3], list[i][4]]; diff --git a/process/Appointment_lib/process.js b/process/Appointment_lib/process.js index 592618f06a988d08923f2df8ed9c66aa8c1d7a1f..7f7dadbbc2485fc8e5f11dcbaf45f79e44a8db89 100644 --- a/process/Appointment_lib/process.js +++ b/process/Appointment_lib/process.js @@ -1,3 +1,6 @@ +import("system.vars"); +import("system.tools"); +import("Calendar_lib"); import("system.calendars"); import("system.neon"); import("system.text"); @@ -90,8 +93,40 @@ AppointmentUtils.sendExchangedAction = function(event, newState) } - jsonEvent = JSON.parse(event); + var jsonEvent = JSON.parse(event); jsonEvent["X-ADITO-STATUSACTION"] = newState; // "ACCEPT", "DECLINE", "" jsonEvent[calendars.AFFECTEDUSERS] = ""; calendars.updateEntry(jsonEvent); +} + +AppointmentUtils.setAppointmentLinkComponentState = function(pSysRecordstate, pAppointmentState, pAppointmentIdParam, pAppointmentIdFieldValue) +{ + var entry; + var newAppointment = false; + + if(pAppointmentState && pAppointmentState == neon.OPERATINGSTATE_NEW) + newAppointment = true; + + else if(pSysRecordstate == neon.OPERATINGSTATE_NEW && pAppointmentIdParam) + entry = calendars.getEntry(pAppointmentIdParam, null, null); + + else if(pSysRecordstate == neon.OPERATINGSTATE_EDIT) + entry = calendars.getEntry(pAppointmentIdFieldValue, null, null); + + + + if(entry) + { + var currentUserId = CalendarUtil.getEffectiveCalendarIdFromUser(tools.getCurrentUser()); + var organzierId = CalendarUtil.getEffectiveCalendarIdFromUser(tools.getUser(entry[calendars.ORGANIZER2]["cn"], tools.PROFILE_DEFAULT)); + + if(currentUserId && currentUserId == organzierId) + return neon.COMPONENTSTATE_EDITABLE; + else + return neon.COMPONENTSTATE_DISABLED; + } + else if(newAppointment) + return neon.COMPONENTSTATE_EDITABLE + else + return neon.COMPONENTSTATE_DISABLED; } \ No newline at end of file diff --git a/process/AttributeFilter_lib/AttributeFilter_lib.aod b/process/AttributeFilter_lib/AttributeFilter_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..57e3edcba2b142a37bc925f7db45a4cbf4006464 --- /dev/null +++ b/process/AttributeFilter_lib/AttributeFilter_lib.aod @@ -0,0 +1,9 @@ +<?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>AttributeFilter_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/AttributeFilter_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/AttributeFilter_lib/process.js b/process/AttributeFilter_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..ed66d3825bb8cd716e99f87b0b8028b6fbf44239 --- /dev/null +++ b/process/AttributeFilter_lib/process.js @@ -0,0 +1,156 @@ +import("system.translate"); +import("Entity_lib"); +import("system.vars"); +import("Context_lib"); +import("system.db"); +import("Sql_lib"); +import("Attribute_lib"); +import("system.entities"); +import("system.util"); + +//TODO: comment lib + +function AttributeSearchNameCoder(){} + +AttributeSearchNameCoder.encode = function (pUid, pAttributeType) +{ + var res = { + id: pUid, + type: pAttributeType.trim() + }; + res = JSON.stringify(res); + res = util.encodeBase64String(res); + return res +}; + +AttributeSearchNameCoder.decode = function (pEncodedString) +{ + var res = pEncodedString.substr(pEncodedString.lastIndexOf(".") + 1); + res = util.decodeBase64String(res); + res = JSON.parse(res); + return res +}; + +function AttributeFilterExtensionMaker() {} + +AttributeFilterExtensionMaker.getFilterFields = function(pObjectType) +{ + var res = []; + + var loadingConfig = entities.createConfigForLoadingRows().entity("Attribute_entity") + .provider("SpecificAttribute") + .fields(["UID", "FULL_ATTRIBUTE_NAME", "ATTRIBUTE_TYPE"]) + .addParameter("ObjectType_param", pObjectType); + + var attributeRows = entities.getRows(loadingConfig); + attributeRows.forEach(function(row){ + var attributeType = row["ATTRIBUTE_TYPE"]; + var contentType = AttributeTypeUtil.getContentType(attributeType); + + if (attributeType.trim() == $AttributeTypes.VOID.toString()) + { + contentType = "BOOLEAN"; + } + + if (contentType) + { + var name = AttributeSearchNameCoder.encode(row["UID"], attributeType); + res.push({ + name: name, + title: row["FULL_ATTRIBUTE_NAME"], + //workaround since we do not have a "UNKNOWN"-contentType in the filter-definition + contentType: contentType == "UNKNOWN" ? "TEXT" : contentType, + hasDropDownValues: contentType == "UNKNOWN" || contentType == "BOOLEAN" ? true : false//TODO: determine this somehow else + }); + } + }); + + res = JSON.stringify(res); + return res; +}; + +AttributeFilterExtensionMaker.makeFilterFields = function() +{ + var objectType = ContextUtils.getCurrentContextId(); + var res = AttributeFilterExtensionMaker.getFilterFields(objectType); + return res; +}; + +AttributeFilterExtensionMaker.getFilterValues = function(pFilter) +{ + var filter = JSON.parse(pFilter); + var name = AttributeSearchNameCoder.decode(filter.name); + + var attributeId = name.id; + var attrType = name.type; + if (attrType == $AttributeTypes.VOID.toString()) + attrType = $AttributeTypes.BOOLEAN.toString(); + var res = AttributeUtil.getPossibleListValues(attributeId, attrType); + if (res == null) + res = []; + return res; +}; + +AttributeFilterExtensionMaker.makeFilterValues = function() +{ + var filter = vars.getString("$local.filter"); + var res = AttributeFilterExtensionMaker.getFilterValues(filter); + return res; +}; + +AttributeFilterExtensionMaker.getFilterCondition = function(pObjectType, pFilterName, pCondition, pRawValue, pOperatorName, pIdTableName, pIdColumnName) +{ + var resSql; + var preparedValues = []; + var name = pFilterName; + name = AttributeSearchNameCoder.decode(name); + var attributeId = name.id; + var attributeType = name.type; + + if (attributeType == $AttributeTypes.VOID.toString()) + { + preparedValues.push([pObjectType, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.OBJECT_TYPE")]); + preparedValues.push([attributeId, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID")]); + + resSql = "(select count(*) \n\ + from AB_ATTRIBUTERELATION \n\ + where OBJECT_ROWID = " + pIdTableName + "." + pIdColumnName +" \n\ + and OBJECT_TYPE = ? \n\ + and AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID = ?)"; + + if (pOperatorName == "IS NOT NULL" || pRawValue == "1" && pOperatorName == "LIKE" || pRawValue == "0" && pOperatorName == "NOT LIKE") + resSql += " > 0 "; + else + resSql += " = 0 "; + } + else + { + var dbField = AttributeTypeUtil.getDatabaseField(name.type); + + var condition = pCondition; + condition = condition.replace("{'table.column'}", dbField, "g"); + preparedValues.push([pObjectType, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.OBJECT_TYPE")]); + preparedValues.push([attributeId, SqlUtils.getSingleColumnType("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID")]); + + resSql = pIdTableName + "." + pIdColumnName + " in (select " + pIdTableName + "." + pIdColumnName + " \n\ + from " + pIdTableName + " \n\ + left join AB_ATTRIBUTERELATION on (AB_ATTRIBUTERELATION.OBJECT_ROWID = " + pIdTableName + "." + pIdColumnName + " \n\ + and AB_ATTRIBUTERELATION.OBJECT_TYPE = ? \n\ + and AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID = ?) \n\ + where " + condition + " )"; + } + resSql = db.translateCondition([resSql, preparedValues]); + return resSql; +}; + +AttributeFilterExtensionMaker.makeFilterConditionSql = function() +{ + var objectType = ContextUtils.getCurrentContextId(); + var filterName = vars.get("$local.name"); + var filterCond = vars.get("$local.condition"); + var filterRawValue = vars.get("$local.rawvalue"); + var filterOpratorName = vars.get("$local.operator2").trim(); + var uidInfo = EntityUtils.parseUidColumn(vars.get("$sys.uidcolumn")); + var res = AttributeFilterExtensionMaker.getFilterCondition(objectType, filterName, filterCond, filterRawValue, filterOpratorName, uidInfo.table, uidInfo.column); + return res; +}; \ No newline at end of file diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index 8e7ff14554340776bf774a386b459216f2473195..0a3b7af1fccdeaca0ea0a10463317ac6c9ce7b80 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -1,923 +1,1086 @@ -import("Context_lib"); -import("system.util"); -import("system.datetime"); -import("system.translate"); -import("system.neon"); -import("system.vars"); -import("system.db"); -import("Sql_lib"); -import("Keyword_lib"); - -/** - * Provides functions for the work with attributes, like - * listing the available attributes for a context. - * Don't instanciate this! - * - * @class - */ -function AttributeUtil () {} - -/** - * Gives an array of all available attributes for a context. This is used in the possibleItems - * process for the attribute id in AttributeRelation - * - * @param {String} pObjectType the object type (= context) - * @param {boolean} [pIncludeGroups=false] - * @param {String[]} [pFilteredAttributeIds=[]] Whitleist of attribute ids - * @param {Object} [pAttributeCount=null] Object with attribute ids and their count - * - * @return {String[]} array of attributeIds - */ -AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups, pFilteredAttributeIds, pAttributeCount) -{ - if (pObjectType == null || (pFilteredAttributeIds && pFilteredAttributeIds.length == 0)) - return []; - - var attrSql = "select AB_ATTRIBUTEID from AB_ATTRIBUTE" - + " join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID"; - var attrCond = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# <> ?") - .and("ATTRIBUTE_ACTIVE = 1"); - - if (pAttributeCount) - { - for (let attributeId in pAttributeCount) - { - attrCond.andSqlCondition( - SqlCondition.begin() - .orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", attributeId, "# != ?") - .orPrepare("AB_ATTRIBUTEUSAGE.MAX_COUNT", pAttributeCount[attributeId], "# > ?") - .or("AB_ATTRIBUTEUSAGE.MAX_COUNT is null") - ); - } - } - - if (pFilteredAttributeIds) - { - var filteredIdsCondition = new SqlCondition(); - var filteredIdChildren = AttributeUtil.getAllChildren(pFilteredAttributeIds); - pFilteredAttributeIds.concat(filteredIdChildren).forEach(function(id) - { - this.orPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", id); - }, filteredIdsCondition); - - attrCond.andSqlCondition(filteredIdsCondition); - } - - if (!pIncludeGroups) - attrCond.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# != ?"); - - attrCond.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?"); - var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)); - - return attributes; -} - -/** - * returns the name of an attribute with all parent attribute names - * - * @param {String} pAttributeId the id of the attribute - * @param {Boolean} [pSimpleName=false] Use only the name of the attribute and not the names of the parents. - * @param {Boolean} [pTranslate=true] translate the name - * - * @return {String} the name of the attribute - */ -AttributeUtil.getFullAttributeName = function (pAttributeId, pSimpleName, pTranslate) -{ - if (pSimpleName === undefined) - pSimpleName = false; - if (pTranslate === undefined) - pTranslate = true; - - if (!pAttributeId) - return ""; - if (pSimpleName) - return AttributeUtil.getSimpleAttributeName(pAttributeId, pTranslate); - var attributeNames = []; - var attribute; - do { - attribute = db.array(db.ROW, SqlCondition.begin() - .andPrepare(["AB_ATTRIBUTE", "AB_ATTRIBUTEID", "ATTRIBUTE"], pAttributeId) - .buildSql("select ATTRIBUTE.ATTRIBUTE_NAME, PARENT1.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_PARENT_ID \n\ - from AB_ATTRIBUTE ATTRIBUTE \n\ - left join AB_ATTRIBUTE PARENT1 on ATTRIBUTE.ATTRIBUTE_PARENT_ID = PARENT1.AB_ATTRIBUTEID \n\ - left join AB_ATTRIBUTE PARENT2 on PARENT1.ATTRIBUTE_PARENT_ID = PARENT2.AB_ATTRIBUTEID") - ); - if (attribute.length > 0) - { - attributeNames.push(attribute[0]); - if (attribute[1]) - attributeNames.push(attribute[1]); - if (attribute[2]) - attributeNames.push(attribute[2]); - pAttributeId = attribute[3]; - } - else - pAttributeId = ""; - } while (pAttributeId); - - if (pTranslate) - { - for (let i = 0; i < attributeNames.length; i++) - { - attributeNames[i] = translate.text(attributeNames[i]); - } - } - return attributeNames.reverse().join(" / "); -} - -/** - * returns the name of an attribute - * - * @param {String} pAttributeId the id of the attribute - * @param {boolean} [pTranslate] if the name should be translated - * - * @return {String} the name of the attribute - */ -AttributeUtil.getSimpleAttributeName = function (pAttributeId, pTranslate) -{ - var attributeName = db.cell(SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) - .buildSql("select ATTRIBUTE_NAME from AB_ATTRIBUTE") - ); - if (pTranslate) - attributeName = translate.text(attributeName); - return attributeName; -} - -/** - * returns the ids of all subordinated attributes of an attribute - * - * @param {String|Array} pAttributeIds the id(s) of the attribute(s) - * - * @result {String[]} array with the ids of every subordinated attribute - */ -AttributeUtil.getAllChildren = function (pAttributeIds) -{ - var childIds = []; - if (typeof(pAttributeIds) == "string") - pAttributeIds = [pAttributeIds]; - - while (pAttributeIds.length > 0) - { - pAttributeIds = db.array(db.COLUMN, SqlCondition.begin() - .andIn("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeIds) - .buildSql("select AB_ATTRIBUTEID from AB_ATTRIBUTE") - ); - if (pAttributeIds.length > 0) - childIds = childIds.concat(pAttributeIds); - } - return childIds; -} - -/** - * checks if an attribute has attribute relations - * - * @param {String} pAttributeId the id of the attribute - * - * @result {boolean} true if it has relations - */ -AttributeUtil.hasRelations = function (pAttributeId) -{ - if (!pAttributeId) - return false; - return db.cell(SqlCondition.begin() - .andPrepare("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", pAttributeId) - .buildSql( - "select count(*) = 0 from AB_ATTRIBUTERELATION", "1=2" - ) - ) != "true"; -} - -/** - * returns the type of an attribute - * - * @param {String} pAttributeId the id of the attribute - * - * @result {String} attribute type - */ -AttributeUtil.getAttributeType = function (pAttributeId) -{ - if (!pAttributeId) - return ""; - var attrTypeSelect = "select ATTRIBUTE_TYPE from AB_ATTRIBUTE"; - attrTypeSelect = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) - .buildSql(attrTypeSelect); - return db.cell(attrTypeSelect).trim(); -} - -/*********************************************************************************************************************/ - -/** - * Provides functions for the work with attributeRelations, getting the value of an attributeRelation for an object. - * Don't instanciate this! - * - * @class - */ -function AttributeRelationUtils () {} - -/** - * gets the value of an attributeRelation for one dataset (e. g. a person) - * - * @param {String} pAttributeId attribute-id - * @param {String} pObjectRowId row-id of the dataset - * @param {String} [pObjectType=null] object-type - * @param {String} [pGetViewValue=false] if true the values are resolved and formatted - * @param {String} [pGetAttrname=false] if true the attributename is also returned - * - * @return {String|String[]|null} the value of the attribute or an array of attrname and value [attrname, value] (if pGetAttrname is true) - */ -AttributeRelationUtils.getAttribute = function (pAttributeId, pObjectRowId, pObjectType, pGetViewValue, pGetAttrname) -{ - var attrCond = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", pObjectRowId) - .andPrepare("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", pAttributeId); - if (pObjectType != null) - attrCond.andPrepare("AB_ATTRIBUTERELATION.OBJECT_TYPE", pObjectType); - - var defaultFields = [ - "AB_ATTRIBUTE.ATTRIBUTE_TYPE", - "AB_ATTRIBUTE.DROPDOWNDEFINITION", - "COMBOVAL.ATTRIBUTE_NAME" - ]; - - if (pGetAttrname) - defaultFields.push("AB_ATTRIBUTE.ATTRIBUTE_NAME"); - - var valueFields = AttributeTypeUtil.getAllDatabaseFields(); - var attributeSql = attrCond.buildSql("select " + defaultFields.join(", ") + ", " + valueFields.join(", ") - + " from AB_ATTRIBUTERELATION join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID" - + " left join AB_ATTRIBUTE COMBOVAL on " + $AttributeTypes.COMBO.databaseField + " = COMBOVAL.AB_ATTRIBUTEID"); - - var attributeValues = db.array(db.ROW, attributeSql); - if (!attributeValues.length) - return null; - - let value = attributeValues[AttributeTypeUtil.getTypeColumnIndex(attributeValues[0]) + defaultFields.length]; - if (pGetViewValue && attributeValues[1].trim() == $AttributeTypes.COMBO) - value = attributeValues[2]; - else if (pGetViewValue) - value = AttributeTypeUtil.getAttributeViewValue(attributeValues[0].trim(), value, attributeValues[1]); - - if (pGetAttrname) - value = [attributeValues[3], value]; - - return value; -} - -/** - * gets all attributes for a dataset - * - * @param {String} pObjectRowId object rowid - * @param {String} [pObjectType=null] object-type - * @param {String} [pUseAttributeIds=0] if 0 the full attribute names are returned - * if 1 the ids are used instead of the full attribute names - * if 2 the ids AND the full attribute name is returned - * @param {String} [pUseIdValues=false] if true the values are not resolved or formatted [attributeId, attributeName, value] - * - * @return {String[][]} two-dimensional array a row is [attributeId|attributeName, value] (or [attributeId, attributeName, value]) - */ -AttributeRelationUtils.getAllAttributes = function (pObjectRowId, pObjectType, pUseAttributeIds, pUseIdValues) -{ - var attrCond = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", pObjectRowId); - if (pObjectType != null) - attrCond.andPrepare("AB_ATTRIBUTERELATION.OBJECT_TYPE", pObjectType); - - var defaultFields = [ - "AB_ATTRIBUTE_ID", - "AB_ATTRIBUTE.ATTRIBUTE_TYPE", - "AB_ATTRIBUTE.DROPDOWNDEFINITION", - "COMBOVAL.ATTRIBUTE_NAME" - ]; - var valueFields = AttributeTypeUtil.getAllDatabaseFields(); - var attributeSql = attrCond.buildSql("select " + defaultFields.join(", ") + ", " + valueFields.join(", ") - + " from AB_ATTRIBUTERELATION join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID" - + " left join AB_ATTRIBUTE COMBOVAL on " + $AttributeTypes.COMBO.databaseField + " = COMBOVAL.AB_ATTRIBUTEID"); - - var attributeNameMap = {}; - var attributeValues = db.table(attributeSql).map(function (row) - { - let attribute = row[0]; - let attrname; - if (pUseAttributeIds == 0 || pUseAttributeIds == 2) - { - var tmpAttrname = ""; - if (!(attribute in attributeNameMap)) - attributeNameMap[attribute] = AttributeUtil.getFullAttributeName(attribute); - tmpAttrname = attributeNameMap[attribute]; - - // if mode 0, return only the name - if (pUseAttributeIds == 0) - attribute = tmpAttrname - - // if mode 2 return both - if (pUseAttributeIds == 2) - attrname = tmpAttrname - } - let value = row[AttributeTypeUtil.getTypeColumnIndex(row[1]) + defaultFields.length]; - if (!pUseIdValues && row[1].trim() == $AttributeTypes.COMBO) - value = row[3]; - else if (!pUseIdValues) - value = AttributeTypeUtil.getAttributeViewValue(row[1].trim(), value, row[2]); - - // add attrname only if id AND attrname is needed - var data = []; - - data.push(attribute); - - if (attrname) - data.push(attrname); - - data.push(value); - return data; - }); - - return attributeValues; -} - -/** - * gets the correct attribute value from a map with values depending on the attribute id - * - * @param {String} pAttributeId the attribute id - * @param {Object} pValueMap a map with the attribute values and the db fields as keys - * @param {Boolean} [pGetViewValue=false] if true, get the view value - * - * @return {String|null} the value of the attribute or null if the attribute doesn't exist - */ -AttributeRelationUtils.selectAttributeValue = function (pAttributeId, pValueMap, pGetViewValue) -{ - var sqlSelect = "select ATTRIBUTE_TYPE, DROPDOWNDEFINITION from AB_ATTRIBUTE"; - var type = db.array(db.ROW, SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) - .buildSql(sqlSelect) - ); - if (!type.length) - return null; - - type[0] = type[0].trim(); - var field = AttributeTypeUtil.getDatabaseField(type[0]); - var value = pValueMap[field]; - if (pGetViewValue && type[0] == $AttributeTypes.COMBO) - { - value = db.cell(SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", value) - .buildSql("select ATTRIBUTE_NAME from AB_ATTRIBUTE") - ); - } - else if (pGetViewValue) - value = AttributeTypeUtil.getAttributeViewValue(type[0], value, type[1]); - - return value; -} - -AttributeRelationUtils.getAttributes = function () -{ - //TODO: implement maybe -} - -/** - * sets the value of an attribute for one dataset (e. g. a person) - */ -AttributeRelationUtils.setAttribute = function () -{ - //TODO: implement -} - -/** - * adds rows for attributes with min_count > 0 - * - * @param {String} pObjectType the object type - * @param {String} pConsumer the name of the attribute relation consumer - */ -AttributeRelationUtils.presetMandatoryAttributes = function (pObjectType, pConsumer) -{ - var mandatoryAttributes = db.table( - SqlCondition.begin() - .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# <> ?") - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# <> ?") - .and("ATTRIBUTE_ACTIVE = 1") - .and("MIN_COUNT > 0") - .buildSql("select AB_ATTRIBUTE_ID, MIN_COUNT from AB_ATTRIBUTEUSAGE " - + "join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTEID") - ); - mandatoryAttributes.forEach(function (usage) - { - //adding an attribute more than 20 times would be too much (having a min_count > 20 is very unlikely) - for (let i = 0; i < usage[1] && i < 20; i++) - neon.addRecord(pConsumer, { - "AB_ATTRIBUTE_ID" : usage[0] - }); - }); -} - -/** - * Checks if the count of the used attributes is valid and returns a message if it's not. - * - * @param {String} pRowId the row id of the entity - * @param {String} [pObjectType=null] the object type - * @param {String} pConsumerField the name of the attribute relation consumer - * - * @return {String} the validation message or an empty string if everything is ok - */ -AttributeRelationUtils.validateAttributeCount = function (pRowId, pObjectType, pConsumerField) -{ - var attributeChanges = {}; - var deletedRows = vars.get("$field." + pConsumerField + ".deletedRows"); - var changedRows = vars.get("$field." + pConsumerField + ".changedRows"); - var insertedRows = vars.get("$field." + pConsumerField + ".insertedRows"); - - if (deletedRows) - { - deletedRows.forEach(function (row) - { - this[row.UID] = ""; - }, attributeChanges); - } - - if (changedRows) - { - changedRows.forEach(function (row) - { - this[row.UID] = row.AB_ATTRIBUTE_ID; - }, attributeChanges); - } - - //get the current count of usages considering the changes - //this will merge the counts of attributeChanges and the already stored attributerelations - var countObj = AttributeRelationUtils.countAttributeRelations(pRowId, pObjectType, attributeChanges); - - if (insertedRows) //append the new rows - { - insertedRows.forEach(function (row) - { - this[row.AB_ATTRIBUTE_ID] = (this[row.AB_ATTRIBUTE_ID] || 0) + 1; - }, countObj); - } - var attributeCondition = SqlCondition.begin(); - AttributeUtil.getPossibleAttributes(pObjectType).forEach(function (attributeId) - { - this.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", attributeId); - }, attributeCondition); - - var usageCondition = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) - .andSqlCondition(attributeCondition, "1=2"); - - //retrieve all min/max counts of the possible attributes - var minMaxCounts = db.table(usageCondition.buildSql( - "select AB_ATTRIBUTEID, ATTRIBUTE_NAME, MIN_COUNT, MAX_COUNT from AB_ATTRIBUTEUSAGE \ - join AB_ATTRIBUTE on AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID", "1=2" - )); - - var validationMessage = []; - minMaxCounts.forEach(function ([attributeId, name, minCount, maxCount]) - { - let count = this[attributeId] || 0; - //compares the actual usage with the min and max count and generates a message if the usage is too low or too high - if (count < minCount) - validationMessage.push(translate.withArguments("Attribute \"%0\" has to be used at least %1.", [name, _getTranslatedCount(minCount)])); - if (maxCount && count > maxCount) - validationMessage.push(translate.withArguments("Attribute \"%0\" can't be used more than %1.", [name, _getTranslatedCount(maxCount)])); - }, countObj); - - return validationMessage.join("\n"); - - //returns the correct count expression by choosing either singular (1 time) or plural (2 times) - function _getTranslatedCount (pCount) - { - if (pCount == 1) - return pCount + " " + translate.text("${COUNT_PREPOSITION_SINGLE}"); - return pCount + " " + translate.text("${COUNT_PREPOSITION_MULTIPLE}"); - } -} - -/** - * counts attribute relations - * - * @param {String} pRowId the row id of the entity - * @param {String} [pObjectType=null] the object type - * @param {Object} [pAttributeChanges=null] object containing changes and deletions of attributes - * structure = {attributeRelationId : new attributeId or "" when deleted} - * - * @return {Object} object with attribute ids and the count of the usage (without new rows) - */ -AttributeRelationUtils.countAttributeRelations = function (pRowId, pObjectType, pAttributeChanges) -{ - //use cases: - //complete new row ==> increase count by 1 for that attribute [this is done in another function] - //row removed ==> decrease count by 1 - //row edit: replace one attribute by another attribute ==> increase the new attribute count and decrease the old attribute count - //row edit: replace attribute with no new value ==> decrease count for the old attribute - //unchanged (already stored) row ==> increase count - var countObj = {}; - - var condition = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", pRowId) - .andPrepareIfSet("AB_ATTRIBUTERELATION.OBJECT_TYPE", pObjectType); - - var storedAttributeRelations = db.table(condition.buildSql( - "select AB_ATTRIBUTERELATIONID, AB_ATTRIBUTE_ID from AB_ATTRIBUTERELATION", - "1=2" - )); - - storedAttributeRelations.forEach(function ([storedAttrRelationId, storedAttributeId]) { - var currentAttributeId = storedAttributeId; - //merging the data that is stored in the DB and the provided changes - if (pAttributeChanges && storedAttrRelationId in pAttributeChanges) - currentAttributeId = pAttributeChanges[storedAttrRelationId]; - - // it doesn't matter if a row has been deleted or if the attribute has been set to "nothing" - if (currentAttributeId == "") - _decrCount(storedAttributeId); - else - { - _incrCount(currentAttributeId); - if (currentAttributeId != storedAttributeId) - _decrCount(storedAttributeId); - } - }); - - function _incrCount(pAttributeId) - { - if (countObj[pAttributeId]) - countObj[pAttributeId]++; - else - countObj[pAttributeId] = 1; - } - - function _decrCount(pAttributeId) - { - if (countObj[pAttributeId]) - countObj[pAttributeId]--; - else - countObj[pAttributeId] = 0; - } - - return countObj; -} - -/*********************************************************************************************************************/ - - -/** - * Object for the enumeration and management of all attribute types. - * This Object is only for the general definition of attribute types and for getting - * data about every type, anything that has to do with a specific attribute (= the function requires an attribute id) - * should be done in AttributeUtils. - * The required values and methods for each type are: - * - * toString = function that should return a unique name - * contentType = the value that is returned in the contentType process for the attribute - * databaseField = the database field that holds values of attributes with the type - * - * optional: - * getViewValue = function that gets the display value for a given value - * isGroup = if true, the attribute can have children - * getDropDownDefinitions = function that returns an array of possible values - * for DROPDOWNDEFINITION - * - * The display name is controlled by the keyword 'AttributeType' - */ -function $AttributeTypes () {} - -$AttributeTypes.TEXT = { - toString : function () {return "TEXT";}, - contentType : "TEXT", - databaseField : "CHAR_VALUE" -}; -$AttributeTypes.DATE = { - toString : function () {return "DATE";}, - contentType : "DATE", - databaseField : "DATE_VALUE", - getViewValue : function (pValue) - { - return datetime.toDate(pValue, translate.text("dd.MM.yyyy")); - } -}; -$AttributeTypes.NUMBER = { - toString : function () {return "NUMBER";}, - contentType : "NUMBER", - databaseField : "NUMBER_VALUE" -}; -$AttributeTypes.BOOLEAN = { - toString : function () {return "BOOLEAN";}, - contentType : "BOOLEAN", - databaseField : "INT_VALUE", - getViewValue : function (pValue) - { - return pValue == "1" ? translate.text("Yes") : translate.text("No"); - } -}; -$AttributeTypes.COMBO = { - toString : function () {return "COMBO";}, - contentType : "UNKNOWN", - databaseField : "ID_VALUE", - isGroup : true -}; -$AttributeTypes.COMBOVALUE = { - toString : function () {return "COMBOVALUE";}, - contentType : null, - databaseField : null -}; -$AttributeTypes.GROUP = { - toString : function () {return "GROUP";}, - contentType : null, - databaseField : null, - isGroup : true -}; -$AttributeTypes.KEYWORD = { - toString : function () {return "KEYWORD";}, - contentType : "UNKNOWN", - databaseField : "ID_VALUE", - getViewValue : function (pValue, pKeyword) - { - return KeywordUtils.getViewValue(pKeyword, pValue); - }, - getDropDownDefinitions : function () - { - return KeywordUtils.getContainerNames().map(function (e) - { - return [e, e];//currently the first column is ID, second view value - which is the same because there is no ID for keyword-containers - }); - } -}; -$AttributeTypes.VOID = { - toString : function () {return "VOID";}, - contentType : null, - databaseField : null, - isGroup : true -}; -$AttributeTypes.MEMO = { - toString : function () {return "MEMO";}, - contentType : "LONG_TEXT", - databaseField : "CHAR_VALUE" -}; -$AttributeTypes.OBJECTSELECTION = { - toString : function () {return "OBJECTSELECTION";}, - contentType : "UNKNOWN", - databaseField : "ID_VALUE", - getViewValue : function (pValue, pModule) - { - return db.cell(ContextUtils.getNameSql(pModule, pValue)); - }, - getDropDownDefinitions : function () - { - return ContextUtils.getContexts(true); - } -}; - - -function AttributeTypeUtil () {} - -/** - * returns the required contentType for the given attribute type - * - * @param {String} pAttributeType the attribute type - * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) - * @return {String} the contentType for the attribute - */ -AttributeTypeUtil.getContentType = function (pAttributeType) -{ - if (pAttributeType in $AttributeTypes) - return $AttributeTypes[pAttributeType].contentType; - return null; -} - -/** - * returns if the type is a group type - * - * @param {String} pAttributeType the attribute type - * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) - * @return {Boolean} if the type is a group type - */ -AttributeTypeUtil.isGroupType = function (pAttributeType) -{ - if (pAttributeType in $AttributeTypes) - return $AttributeTypes[pAttributeType].isGroup || false; - return null; -} - -/** - * returns the database field for the given attribute type that holds the value of the attribute - * - * @param {String} pAttributeType the attribute type - * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) - * @return {String} the database field for the attribute - */ -AttributeTypeUtil.getDatabaseField = function (pAttributeType) -{ - if (pAttributeType in $AttributeTypes) - return $AttributeTypes[pAttributeType].databaseField; - return null; -} - -AttributeTypeUtil.getAttributeViewValue = function (pAttributeType, pValue, pKeyword) -{ - if (pAttributeType in $AttributeTypes && "getViewValue" in $AttributeTypes[pAttributeType]) - return $AttributeTypes[pAttributeType].getViewValue(pValue, pKeyword); - return pValue; -} - -AttributeTypeUtil._initTypeColumnData = function () -{ - var columns = []; - var typeColumnMap = {}; - for (let type in $AttributeTypes) - { - type = $AttributeTypes[type]; - if (type.databaseField) - { - var typeKey = type.toString(); - var colIndex = columns.indexOf(type.databaseField); - if (colIndex == -1) - { - colIndex = columns.length; - columns.push(type.databaseField); - } - typeColumnMap[typeKey] = colIndex; - } - } - this._allDBColumns = columns; - this._typeColumnMap = typeColumnMap; -} - -AttributeTypeUtil.getAllDatabaseFields = function () -{ - if (this._allDBColumns == undefined) - AttributeTypeUtil._initTypeColumnData(); - return this._allDBColumns; -} - -AttributeTypeUtil.getTypeColumnIndex = function (pAttributeType) -{ - if (this._typeColumnMap == undefined) - AttributeTypeUtil._initTypeColumnData(); - return this._typeColumnMap[pAttributeType.trim()]; -} - -/*********************************************************************************************************************/ - -/** - * Functions for AttributeUsages. - * Do not instanciate this! - */ -function AttributeUsageUtil () {} - -/** - * Creates AttributeUsages for all subordinate attributes of an attribute. - * This is required when an usage is added to a superordinate attribute. - * - * @param {String} pAttributeId the id of the superordinate attribute - * @param {String} pObjectType the context - */ -AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType) -{ - var table = "AB_ATTRIBUTEUSAGE"; - var columns = ["AB_ATTRIBUTEUSAGEID", "AB_ATTRIBUTE_ID", "OBJECT_TYPE"]; - var types = db.getColumnTypes(table, columns); - - var sqlSelect = "select AB_ATTRIBUTEID, " - + " (select count(*) from AB_ATTRIBUTEUSAGE where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID and OBJECT_TYPE = '" - + pObjectType + "') = 0 from AB_ATTRIBUTE"; - - var inserts = []; - _addInserts(pAttributeId, pObjectType); - db.inserts(inserts); - - function _addInserts (pAttributeId, pObjectType) - { - var condition = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeId); - var attributes = db.table(condition.buildSql(sqlSelect)); - - attributes.forEach(function (row) - { - if (row[1] == "true") - { - let values = [util.getNewUUID(), row[0], pObjectType]; - inserts.push([table, columns, types, values]); - } - _addInserts(row[0], pObjectType); - }); - } -} - -/** - * Updates AttributeUsages for all subordinate attributes of an attribute. - * This is required when an usage of a superordinate attribute is changed. - * - * @param {String} pAttributeId the id of the superordinate attribute - * @param {String} pOldObjectType ye olde context - * @param {String} pNewObjectType the new context - */ -AttributeUsageUtil.updateChildrenUsages = function (pAttributeId, pOldObjectType, pNewObjectType) -{ - if (!pNewObjectType) - return; - - var table = "AB_ATTRIBUTEUSAGE"; - - var sqlSelect = "select AB_ATTRIBUTEID, AB_ATTRIBUTEUSAGEID, " - + " (select count(*) from AB_ATTRIBUTEUSAGE where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID and OBJECT_TYPE = '" - + pNewObjectType + "') = 0" - + " from AB_ATTRIBUTE left join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID and OBJECT_TYPE = '" + pOldObjectType + "'"; - - var updateCond = SqlCondition.begin(); - - //it is possible that the new objectType is already in a subordinate attribute - //and an update could cause a duplicate entry so one has to be deleted - var deleteCond = SqlCondition.begin(); - - _addUpdateIds(pAttributeId, pOldObjectType); - - if (updateCond.isSet()) - db.updateData(table, ["OBJECT_TYPE"], null, [pNewObjectType], updateCond.build("1=2")); - if (deleteCond.isSet()) - db.deleteData(table, deleteCond.build("1=2")); - - function _addUpdateIds (pAttributeId) - { - var condition = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeId); - var attributes = db.table(condition.buildSql(sqlSelect)); - - attributes.forEach(function (row) - { - if (row[1] && row[2] != "true") - deleteCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[1]); - else if (row[1]) - updateCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[1]); - _addUpdateIds(row[0]); - }); - } -} - -/** - * Deletes AttributeUsages for all subordinate attributes of an attribute. - * This is required when an usage is removed from a superordinate attribute. - * - * @param {String} pAttributeId the id of the superordinate attribute - * @param {String} pObjectType the context - */ -AttributeUsageUtil.deleteChildrenUsages = function (pAttributeId, pObjectType) -{ - var table = "AB_ATTRIBUTEUSAGE"; - - var sqlSelect = "select AB_ATTRIBUTEID, AB_ATTRIBUTEUSAGEID " - + " from AB_ATTRIBUTE left join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID and OBJECT_TYPE = '" + pObjectType + "'"; - - var deleteCond = SqlCondition.begin(); - _addDeleteIds(pAttributeId, pObjectType); - if (deleteCond.isSet()) - db.deleteData(table, deleteCond.build("1=2")); - - function _addDeleteIds (pAttributeId) - { - var condition = SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") - .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeId); - var attributes = db.table(condition.buildSql(sqlSelect)); - - attributes.forEach(function (row) - { - if (row[1]) - deleteCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[1]) - _addDeleteIds(row[0]); - }); - } -} - -/** - * Deletes duplicate attribute usages. - * - * @param {String} [pAttributeId=null] attribute id, if omitted, all duplicates will be deleted - */ -AttributeUsageUtil.removeDuplicates = function (pAttributeId) -{ - var condition = SqlCondition.begin() - .and("exists (select AB_ATTRIBUTEUSAGEID from AB_ATTRIBUTEUSAGE AU where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AU.AB_ATTRIBUTE_ID " - + "and AB_ATTRIBUTEUSAGE.OBJECT_TYPE = AU.OBJECT_TYPE and AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID != AU.AB_ATTRIBUTEUSAGEID)"); - if (pAttributeId) - condition.andPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", pAttributeId); - - var duplicates = db.table(condition.buildSql("select AB_ATTRIBUTEUSAGEID, AB_ATTRIBUTE_ID, OBJECT_TYPE from AB_ATTRIBUTEUSAGE")); - var usageObj = {}; - var deleteCond = SqlCondition.begin(); - - duplicates.forEach(function (row) - { - if (!(row[1] in this)) - this[row[1]] = {}; - if (row[2] in this[row[1]]) - deleteCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[0]); - this[row[1]][row[2]] = true; - }, usageObj); - if (deleteCond.isSet()) - db.deleteData("AB_ATTRIBUTEUSAGE", deleteCond.build("1=2")); +import("KeywordData_lib"); +import("Context_lib"); +import("system.util"); +import("system.datetime"); +import("system.translate"); +import("system.neon"); +import("system.vars"); +import("system.db"); +import("system.project"); +import("system.entities"); +import("Sql_lib"); +import("Keyword_lib"); + +/** + * Provides functions for the work with attributes, like + * listing the available attributes for a context. + * Don't instanciate this! + * + * @class + */ +function AttributeUtil () {} + +/** + * Gives an array of all available attributes for a context. This is used in the possibleItems + * process for the attribute id in AttributeRelation + * + * @param {String} pObjectType the object type (= context) + * @param {boolean} [pIncludeGroups=false] + * @param {String[]} [pFilteredAttributeIds=[]] Whitleist of attribute ids + * @param {Object} [pAttributeCount=null] Object with attribute ids and their count + * + * @return {String[]} array of attributeIds + */ +AttributeUtil.getPossibleAttributes = function (pObjectType, pIncludeGroups, pFilteredAttributeIds, pAttributeCount) +{ + if (pObjectType == null || (pFilteredAttributeIds && pFilteredAttributeIds.length == 0)) + return []; + + var attrSql = "select AB_ATTRIBUTEID from AB_ATTRIBUTE" + + " join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID"; + var attrCond = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") + .and("ATTRIBUTE_ACTIVE = 1"); + + if (pAttributeCount) + { + for (let attributeId in pAttributeCount) + { + attrCond.andSqlCondition( + SqlCondition.begin() + .orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", attributeId, "# != ?") + .orPrepare("AB_ATTRIBUTEUSAGE.MAX_COUNT", pAttributeCount[attributeId], "# > ?") + .or("AB_ATTRIBUTEUSAGE.MAX_COUNT is null") + ); + } + } + + if (pFilteredAttributeIds) + { + var filteredIdsCondition = new SqlCondition(); + var filteredIdChildren = AttributeUtil.getAllChildren(pFilteredAttributeIds); + pFilteredAttributeIds.concat(filteredIdChildren).forEach(function(id) + { + this.orPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", id); + }, filteredIdsCondition); + + attrCond.andSqlCondition(filteredIdsCondition); + } + + if (!pIncludeGroups) + attrCond.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# != ?"); + + var attributes = db.array(db.COLUMN, attrCond.buildSql(attrSql)); + + return attributes; +} + +/** + * searches for possiblevalues for a atttribute and returns these. The values depend on the attributeType + * + * @param {String} pAttributeId the id of the attribute + * @param {Boolean} pAttributeType type of the attribute that is specified with pAttributeId; + * The type needs to be passed to the function for better performance + * (loading the type via attribute several times would be too slow) + * @param {Boolean} [pIncludeInactives=false] specifies if only active attributevalues or actives + inactives shall be returned, + * this is important when you want to search for attributevalues + * + * @return {Array} 2D-array with [ID, value] als elements if the given attributeType has possible items. if not null is returned + */ +AttributeUtil.getPossibleListValues = function (pAttributeId, pAttributeType, pIncludeInactives) +{ + var attributeId = pAttributeId; + var attrType = pAttributeType.trim(); + var onlyActives = (pIncludeInactives == undefined ? false : pIncludeInactives); + if (attrType == $AttributeTypes.COMBO.toString()) + { + var valueSql = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", attributeId) + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE); + + if (onlyActives) + valueSql.andPrepare("AB_ATTRIBUTE.ATTRIBUTE_ACTIVE", "1"); + + valueSql = valueSql.buildSql("select AB_ATTRIBUTEID, ATTRIBUTE_NAME from AB_ATTRIBUTE", "1=2", "order by SORTING asc"); + var valueList = db.table(valueSql); + for (let i = 0; i < valueList.length; i++) + { + valueList[i][1] = translate.text(valueList[i][1]); + } + return valueList; + } + else if (attrType == $AttributeTypes.BOOLEAN.toString()) + { + return [ + ["1", translate.text("Yes")], + ["0", translate.text("No")] + ]; + } + else if (attrType == $AttributeTypes.KEYWORD.toString()) + { + var attrKeywordSelect = "select DROPDOWNDEFINITION from AB_ATTRIBUTE"; + attrKeywordSelect = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", attributeId) + .buildSql(attrKeywordSelect); + var attrKeyword = db.cell(attrKeywordSelect); + var keywords = KeywordData.getSimpleData(attrKeyword, null, onlyActives); + return keywords; + } + else if (attrType == $AttributeTypes.OBJECTSELECTION) + { + var [module, filter] = db.array(db.ROW, SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", attributeId) + .buildSql("select DROPDOWNDEFINITION, DROPDOWNFILTER from AB_ATTRIBUTE") + ); + var objects = []; + if (module) + { + var uid = "#UID"; + var title = "#CONTENTTITLE"; + var config = entities.createConfigForLoadingRows() + .entity(module) + .fields([uid, title]); + if (filter) + config.filter(filter); + var rows = entities.getRows(config); + for (let i = 0, l = rows.length; i < l; i++) + objects.push([rows[i][uid], rows[i][title]]) + } + return objects; + } + else + return null; +} + +/** + * returns the name of an attribute with all parent attribute names + * + * @param {String} pAttributeId the id of the attribute + * @param {Boolean} [pSimpleName=false] Use only the name of the attribute and not the names of the parents. + * @param {Boolean} [pTranslate=true] translate the name + * + * @return {String} the name of the attribute + */ +AttributeUtil.getFullAttributeName = function (pAttributeId, pSimpleName, pTranslate) +{ + if (pSimpleName === undefined) + pSimpleName = false; + if (pTranslate === undefined) + pTranslate = true; + + if (!pAttributeId) + return ""; + if (pSimpleName) + return AttributeUtil.getSimpleAttributeName(pAttributeId, pTranslate); + var attributeNames = []; + var attribute; + do { + attribute = db.array(db.ROW, SqlCondition.begin() + .andPrepare(["AB_ATTRIBUTE", "AB_ATTRIBUTEID", "ATTRIBUTE"], pAttributeId) + .buildSql("select ATTRIBUTE.ATTRIBUTE_NAME, PARENT1.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_NAME, PARENT2.ATTRIBUTE_PARENT_ID \n\ + from AB_ATTRIBUTE ATTRIBUTE \n\ + left join AB_ATTRIBUTE PARENT1 on ATTRIBUTE.ATTRIBUTE_PARENT_ID = PARENT1.AB_ATTRIBUTEID \n\ + left join AB_ATTRIBUTE PARENT2 on PARENT1.ATTRIBUTE_PARENT_ID = PARENT2.AB_ATTRIBUTEID") + ); + if (attribute.length > 0) + { + attributeNames.push(attribute[0]); + if (attribute[1]) + attributeNames.push(attribute[1]); + if (attribute[2]) + attributeNames.push(attribute[2]); + pAttributeId = attribute[3]; + } + else + pAttributeId = ""; + } while (pAttributeId); + + if (pTranslate) + { + for (let i = 0; i < attributeNames.length; i++) + { + attributeNames[i] = translate.text(attributeNames[i]); + } + } + return attributeNames.reverse().join(" / "); +} + +/** + * returns the name of an attribute + * + * @param {String} pAttributeId the id of the attribute + * @param {boolean} [pTranslate] if the name should be translated + * + * @return {String} the name of the attribute + */ +AttributeUtil.getSimpleAttributeName = function (pAttributeId, pTranslate) +{ + var attributeName = db.cell(SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) + .buildSql("select ATTRIBUTE_NAME from AB_ATTRIBUTE") + ); + if (pTranslate) + attributeName = translate.text(attributeName); + return attributeName; +} + +/** + * returns the ids of all subordinated attributes of an attribute + * + * @param {String|Array} pAttributeIds the id(s) of the attribute(s) + * + * @result {String[]} array with the ids of every subordinated attribute + */ +AttributeUtil.getAllChildren = function (pAttributeIds) +{ + var childIds = []; + if (typeof(pAttributeIds) == "string") + pAttributeIds = [pAttributeIds]; + + while (pAttributeIds.length > 0) + { + pAttributeIds = db.array(db.COLUMN, SqlCondition.begin() + .andIn("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeIds) + .buildSql("select AB_ATTRIBUTEID from AB_ATTRIBUTE") + ); + if (pAttributeIds.length > 0) + childIds = childIds.concat(pAttributeIds); + } + return childIds; +} + +/** + * checks if an attribute has attribute relations + * + * @param {String} pAttributeId the id of the attribute + * + * @result {boolean} true if it has relations + */ +AttributeUtil.hasRelations = function (pAttributeId) +{ + if (!pAttributeId) + return false; + return db.cell(SqlCondition.begin() + .andPrepare("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", pAttributeId) + .buildSql( + "select count(*) from AB_ATTRIBUTERELATION", "1=2" //TODO: is there a way exists could be used? + ) + ) != "0"; +} + +/** + * returns the type of an attribute + * + * @param {String} pAttributeId the id of the attribute + * + * @result {String} attribute type + */ +AttributeUtil.getAttributeType = function (pAttributeId) +{ + if (!pAttributeId) + return ""; + var attrTypeSelect = "select ATTRIBUTE_TYPE from AB_ATTRIBUTE"; + attrTypeSelect = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) + .buildSql(attrTypeSelect); + return db.cell(attrTypeSelect).trim(); +} + +AttributeUtil.hasAttributes = function (pObjectType) +{ + if (!pObjectType) + return false; + return db.cell(SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_ACTIVE", "1") + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# != ?") + .buildSql( + "select count(*) from AB_ATTRIBUTEUSAGE \n\ + join AB_ATTRIBUTE on AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID", "1=2" + ) + ) != "0"; //TODO: is there a way exists could be used? +} + +/*********************************************************************************************************************/ + +/** + * Provides functions for the work with attributeRelations, getting the value of an attributeRelation for an object. + * Don't instanciate this! + * + * @class + */ +function AttributeRelationUtils () {} + +/** + * gets the value of an attributeRelation for one dataset (e. g. a person) + * + * @param {String} pAttributeId attribute-id + * @param {String} pObjectRowId row-id of the dataset + * @param {String} [pObjectType=null] object-type + * @param {String} [pGetViewValue=false] if true the values are resolved and formatted + * @param {String} [pGetAttrname=false] if true the attributename is also returned + * + * @return {String|String[]|null} the value of the attribute or an array of attrname and value [attrname, value] (if pGetAttrname is true) + */ +AttributeRelationUtils.getAttribute = function (pAttributeId, pObjectRowId, pObjectType, pGetViewValue, pGetAttrname) +{ + var attrCond = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", pObjectRowId) + .andPrepare("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", pAttributeId); + if (pObjectType != null) + attrCond.andPrepare("AB_ATTRIBUTERELATION.OBJECT_TYPE", pObjectType); + + var defaultFields = [ + "AB_ATTRIBUTE.ATTRIBUTE_TYPE", + "AB_ATTRIBUTE.DROPDOWNDEFINITION", + "COMBOVAL.ATTRIBUTE_NAME" + ]; + + if (pGetAttrname) + defaultFields.push("AB_ATTRIBUTE.ATTRIBUTE_NAME"); + + var valueFields = AttributeTypeUtil.getAllDatabaseFields(); + var attributeSql = attrCond.buildSql("select " + defaultFields.join(", ") + ", " + valueFields.join(", ") + + " from AB_ATTRIBUTERELATION join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID" + + " left join AB_ATTRIBUTE COMBOVAL on " + $AttributeTypes.COMBO.databaseField + " = COMBOVAL.AB_ATTRIBUTEID"); + + var attributeValues = db.array(db.ROW, attributeSql); + if (!attributeValues.length) + return null; + + let value = attributeValues[AttributeTypeUtil.getTypeColumnIndex(attributeValues[0]) + defaultFields.length]; + if (pGetViewValue && attributeValues[1].trim() == $AttributeTypes.COMBO) + value = attributeValues[2]; + else if (pGetViewValue) + value = AttributeTypeUtil.getAttributeViewValue(attributeValues[0].trim(), value, attributeValues[1]); + + if (pGetAttrname) + value = [attributeValues[3], value]; + + return value; +} + +/** + * gets all attributes for a dataset + * + * @param {String} pObjectRowId object rowid + * @param {String} [pObjectType=null] object-type + * @param {String} [pUseAttributeIds=0] if 0 the full attribute names are returned + * if 1 the ids are used instead of the full attribute names + * if 2 the ids AND the full attribute name is returned + * @param {String} [pUseIdValues=false] if true the values are not resolved or formatted [attributeId, attributeName, value] + * + * @return {String[][]} two-dimensional array a row is [attributeId|attributeName, value] (or [attributeId, attributeName, value]) + */ +AttributeRelationUtils.getAllAttributes = function (pObjectRowId, pObjectType, pUseAttributeIds, pUseIdValues) +{ + var attrCond = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", pObjectRowId); + if (pObjectType != null) + attrCond.andPrepare("AB_ATTRIBUTERELATION.OBJECT_TYPE", pObjectType); + + var defaultFields = [ + "AB_ATTRIBUTE_ID", + "AB_ATTRIBUTE.ATTRIBUTE_TYPE", + "AB_ATTRIBUTE.DROPDOWNDEFINITION", + "COMBOVAL.ATTRIBUTE_NAME" + ]; + var valueFields = AttributeTypeUtil.getAllDatabaseFields(); + var attributeSql = attrCond.buildSql("select " + defaultFields.join(", ") + ", " + valueFields.join(", ") + + " from AB_ATTRIBUTERELATION join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID" + + " left join AB_ATTRIBUTE COMBOVAL on " + $AttributeTypes.COMBO.databaseField + " = COMBOVAL.AB_ATTRIBUTEID"); + + var attributeNameMap = {}; + var attributeValues = db.table(attributeSql).map(function (row) + { + let attribute = row[0]; + let attrname; + if (pUseAttributeIds == 0 || pUseAttributeIds == 2) + { + var tmpAttrname = ""; + if (!(attribute in attributeNameMap)) + attributeNameMap[attribute] = AttributeUtil.getFullAttributeName(attribute); + tmpAttrname = attributeNameMap[attribute]; + + // if mode 0, return only the name + if (pUseAttributeIds == 0) + attribute = tmpAttrname + + // if mode 2 return both + if (pUseAttributeIds == 2) + attrname = tmpAttrname + } + let value = row[AttributeTypeUtil.getTypeColumnIndex(row[1]) + defaultFields.length]; + if (!pUseIdValues && row[1].trim() == $AttributeTypes.COMBO) + value = row[3]; + else if (!pUseIdValues) + value = AttributeTypeUtil.getAttributeViewValue(row[1].trim(), value, row[2]); + + // add attrname only if id AND attrname is needed + var data = []; + + data.push(attribute); + + if (attrname) + data.push(attrname); + + data.push(value); + return data; + }); + + return attributeValues; +} + +/** + * gets the correct attribute value from a map with values depending on the attribute id + * + * @param {String} pAttributeId the attribute id + * @param {Object} pValueMap a map with the attribute values and the db fields as keys + * @param {Boolean} [pGetViewValue=false] if true, get the view value + * + * @return {String|null} the value of the attribute or null if the attribute doesn't exist + */ +AttributeRelationUtils.selectAttributeValue = function (pAttributeId, pValueMap, pGetViewValue) +{ + var sqlSelect = "select ATTRIBUTE_TYPE, DROPDOWNDEFINITION from AB_ATTRIBUTE"; + var type = db.array(db.ROW, SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", pAttributeId) + .buildSql(sqlSelect) + ); + if (!type.length) + return null; + + type[0] = type[0].trim(); + var field = AttributeTypeUtil.getDatabaseField(type[0]); + var value = pValueMap[field]; + if (pGetViewValue && type[0] == $AttributeTypes.COMBO) + { + value = db.cell(SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", value) + .buildSql("select ATTRIBUTE_NAME from AB_ATTRIBUTE") + ); + } + else if (pGetViewValue) + value = AttributeTypeUtil.getAttributeViewValue(type[0], value, type[1]); + + return value; +} + +AttributeRelationUtils.getAttributes = function () +{ + //TODO: implement maybe +} + +/** + * sets the value of an attribute for one dataset (e. g. a person) + */ +AttributeRelationUtils.setAttribute = function () +{ + //TODO: implement +} + +/** + * adds rows for attributes with min_count > 0 + * + * @param {String} pObjectType the object type + * @param {String} pConsumer the name of the attribute relation consumer + */ +AttributeRelationUtils.presetMandatoryAttributes = function (pObjectType, pConsumer) +{ + var mandatoryAttributes = db.table( + SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# <> ?") + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.GROUP, "# <> ?") + .and("ATTRIBUTE_ACTIVE = 1") + .and("MIN_COUNT > 0") + .buildSql("select AB_ATTRIBUTE_ID, MIN_COUNT from AB_ATTRIBUTEUSAGE " + + "join AB_ATTRIBUTE on AB_ATTRIBUTE_ID = AB_ATTRIBUTEID") + ); + mandatoryAttributes.forEach(function (usage) + { + //adding an attribute more than 20 times would be too much (having a min_count > 20 is very unlikely) + for (let i = 0; i < usage[1] && i < 20; i++) + neon.addRecord(pConsumer, { + "AB_ATTRIBUTE_ID" : usage[0] + }); + }); +} + +/** + * Checks if the count of the used attributes is valid and returns a message if it's not. + * + * @param {String} pRowId the row id of the entity + * @param {String} [pObjectType=null] the object type + * @param {String} pConsumerField the name of the attribute relation consumer + * + * @return {String} the validation message or an empty string if everything is ok + */ +AttributeRelationUtils.validateAttributeCount = function (pRowId, pObjectType, pConsumerField) +{ + var attributeChanges = {}; + var deletedRows = vars.get("$field." + pConsumerField + ".deletedRows"); + var changedRows = vars.get("$field." + pConsumerField + ".changedRows"); + var insertedRows = vars.get("$field." + pConsumerField + ".insertedRows"); + + if (deletedRows) + { + deletedRows.forEach(function (row) + { + this[row.UID] = ""; + }, attributeChanges); + } + + if (changedRows) + { + changedRows.forEach(function (row) + { + this[row.UID] = row.AB_ATTRIBUTE_ID; + }, attributeChanges); + } + + //get the current count of usages considering the changes + //this will merge the counts of attributeChanges and the already stored attributerelations + var countObj = AttributeRelationUtils.countAttributeRelations(pRowId, pObjectType, attributeChanges); + + if (insertedRows) //append the new rows + { + insertedRows.forEach(function (row) + { + this[row.AB_ATTRIBUTE_ID] = (this[row.AB_ATTRIBUTE_ID] || 0) + 1; + }, countObj); + } + var attributeCondition = SqlCondition.begin(); + AttributeUtil.getPossibleAttributes(pObjectType).forEach(function (attributeId) + { + this.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", attributeId); + }, attributeCondition); + + var usageCondition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pObjectType) + .andSqlCondition(attributeCondition, "1=2"); + + //retrieve all min/max counts of the possible attributes + var minMaxCounts = db.table(usageCondition.buildSql( + "select AB_ATTRIBUTEID, ATTRIBUTE_NAME, MIN_COUNT, MAX_COUNT from AB_ATTRIBUTEUSAGE \ + join AB_ATTRIBUTE on AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID", "1=2" + )); + + var validationMessage = []; + minMaxCounts.forEach(function ([attributeId, name, minCount, maxCount]) + { + let count = this[attributeId] || 0; + //compares the actual usage with the min and max count and generates a message if the usage is too low or too high + if (count < minCount) + validationMessage.push(translate.withArguments("Attribute \"%0\" has to be used at least %1.", [name, _getTranslatedCount(minCount)])); + if (maxCount && count > maxCount) + validationMessage.push(translate.withArguments("Attribute \"%0\" can't be used more than %1.", [name, _getTranslatedCount(maxCount)])); + }, countObj); + + return validationMessage.join("\n"); + + //returns the correct count expression by choosing either singular (1 time) or plural (2 times) + function _getTranslatedCount (pCount) + { + if (pCount == 1) + return pCount + " " + translate.text("${COUNT_PREPOSITION_SINGLE}"); + return pCount + " " + translate.text("${COUNT_PREPOSITION_MULTIPLE}"); + } +} + +/** + * counts attribute relations + * + * @param {String} pRowId the row id of the entity + * @param {String} [pObjectType=null] the object type + * @param {Object} [pAttributeChanges=null] object containing changes and deletions of attributes + * structure = {attributeRelationId : new attributeId or "" when deleted} + * + * @return {Object} object with attribute ids and the count of the usage (without new rows) + */ +AttributeRelationUtils.countAttributeRelations = function (pRowId, pObjectType, pAttributeChanges) +{ + //use cases: + //complete new row ==> increase count by 1 for that attribute [this is done in another function] + //row removed ==> decrease count by 1 + //row edit: replace one attribute by another attribute ==> increase the new attribute count and decrease the old attribute count + //row edit: replace attribute with no new value ==> decrease count for the old attribute + //unchanged (already stored) row ==> increase count + var countObj = {}; + + var condition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTERELATION.OBJECT_ROWID", pRowId) + .andPrepareIfSet("AB_ATTRIBUTERELATION.OBJECT_TYPE", pObjectType); + + var storedAttributeRelations = db.table(condition.buildSql( + "select AB_ATTRIBUTERELATIONID, AB_ATTRIBUTE_ID from AB_ATTRIBUTERELATION", + "1=2" + )); + + storedAttributeRelations.forEach(function ([storedAttrRelationId, storedAttributeId]) { + var currentAttributeId = storedAttributeId; + //merging the data that is stored in the DB and the provided changes + if (pAttributeChanges && storedAttrRelationId in pAttributeChanges) + currentAttributeId = pAttributeChanges[storedAttrRelationId]; + + // it doesn't matter if a row has been deleted or if the attribute has been set to "nothing" + if (currentAttributeId == "") + _decrCount(storedAttributeId); + else + { + _incrCount(currentAttributeId); + if (currentAttributeId != storedAttributeId) + _decrCount(storedAttributeId); + } + }); + + function _incrCount(pAttributeId) + { + if (countObj[pAttributeId]) + countObj[pAttributeId]++; + else + countObj[pAttributeId] = 1; + } + + function _decrCount(pAttributeId) + { + if (countObj[pAttributeId]) + countObj[pAttributeId]--; + else + countObj[pAttributeId] = 0; + } + + return countObj; +} + +/*********************************************************************************************************************/ + + +/** + * Object for the enumeration and management of all attribute types. + * This Object is only for the general definition of attribute types and for getting + * data about every type, anything that has to do with a specific attribute (= the function requires an attribute id) + * should be done in AttributeUtils. + * The required values and methods for each type are: + * + * toString = function that should return a unique name + * contentType = the value that is returned in the contentType process for the attribute + * databaseField = the database field that holds values of attributes with the type + * + * optional: + * getViewValue = function that gets the display value for a given value + * isGroup = if true, the attribute can have children + * getDropDownDefinitions = function that returns an array of possible values + * for DROPDOWNDEFINITION + * + * The display name is controlled by the keyword 'AttributeType' + */ +function $AttributeTypes () {} + +$AttributeTypes.TEXT = { + toString : function () {return "TEXT";}, + contentType : "TEXT", + databaseField : "CHAR_VALUE" +}; +$AttributeTypes.DATE = { + toString : function () {return "DATE";}, + contentType : "DATE", + databaseField : "DATE_VALUE", + getViewValue : function (pValue) + { + return datetime.toDate(pValue, translate.text("dd.MM.yyyy")); + } +}; +$AttributeTypes.NUMBER = { + toString : function () {return "NUMBER";}, + contentType : "NUMBER", + databaseField : "NUMBER_VALUE" +}; +$AttributeTypes.BOOLEAN = { + toString : function () {return "BOOLEAN";}, + contentType : "BOOLEAN", + databaseField : "INT_VALUE", + getViewValue : function (pValue) + { + return pValue == "1" ? translate.text("Yes") : translate.text("No"); + } +}; +$AttributeTypes.COMBO = { + toString : function () {return "COMBO";}, + contentType : "UNKNOWN", + databaseField : "ID_VALUE", + isGroup : true, + possibleChildren : ["COMBOVALUE"] +}; +$AttributeTypes.COMBOVALUE = { + toString : function () {return "COMBOVALUE";}, + contentType : null, + databaseField : null +}; +$AttributeTypes.GROUP = { + toString : function () {return "GROUP";}, + contentType : null, + databaseField : null, + isGroup : true +}; +$AttributeTypes.KEYWORD = { + toString : function () {return "KEYWORD";}, + contentType : "UNKNOWN", + databaseField : "ID_VALUE", + getViewValue : function (pValue, pKeyword) + { + return KeywordUtils.getViewValue(pKeyword, pValue); + }, + getDropDownDefinitions : function () + { + return KeywordUtils.getContainerNames().map(function (e) + { + return [e, e];//currently the first column is ID, second view value - which is the same because there is no ID for keyword-containers + }); + } +}; +$AttributeTypes.VOID = { + toString : function () {return "VOID";}, + contentType : null, + databaseField : null, + isGroup : true, + possibleChildren : ["VOID"] +}; +$AttributeTypes.MEMO = { + toString : function () {return "MEMO";}, + contentType : "LONG_TEXT", + databaseField : "CHAR_VALUE" +}; +$AttributeTypes.OBJECTSELECTION = { + toString : function () {return "OBJECTSELECTION";}, + contentType : "UNKNOWN", + databaseField : "ID_VALUE", + getViewValue : function (pValue, pModule) + { + if (pValue) + { + var title = "#CONTENTTITLE"; + var config = entities.createConfigForLoadingRows() + .entity(pModule) + .fields([title]) + .uid(pValue); + var rows = entities.getRow(config); + pValue = rows ? rows[title] : pValue; + } + return pValue; + }, + getDropDownDefinitions : function () + { + var dropDownList = []; + //TODO filter entities + project.getDataModels(project.DATAMODEL_KIND_ENTITY).forEach( + function (entity) + { + if (entity[1]) + dropDownList.push([entity[0], translate.text(entity[1])]); + } + ); + return dropDownList; + } +}; +$AttributeTypes.THEME = { + toString : function () {return "THEME";}, + contentType : "LONG_TEXT", + databaseField : "CHAR_VALUE", + isGroup : true, + possibleChildren : ["THEME"] +}; + +function AttributeTypeUtil () {} + +/** + * returns the required contentType for the given attribute type + * + * @param {String} pAttributeType the attribute type + * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) + * @return {String} the contentType for the attribute + */ +AttributeTypeUtil.getContentType = function (pAttributeType) +{ + if (pAttributeType) + { + pAttributeType = pAttributeType.trim(); + + if (pAttributeType in $AttributeTypes) + return $AttributeTypes[pAttributeType].contentType; + } + return null; +} + +/** + * returns if the type is a group type + * + * @param {String} pAttributeType the attribute type + * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) + * @return {Boolean} if the type is a group type + */ +AttributeTypeUtil.isGroupType = function (pAttributeType) +{ + if (pAttributeType) + { + pAttributeType = pAttributeType.trim(); + if (pAttributeType in $AttributeTypes) + return $AttributeTypes[pAttributeType].isGroup || false; + } + return null; +} + +/** + * returns the database field for the given attribute type that holds the value of the attribute + * + * @param {String} pAttributeType the attribute type + * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) + * @return {String} the database field for the attribute + */ +AttributeTypeUtil.getDatabaseField = function (pAttributeType) +{ + if (pAttributeType) + { + pAttributeType = pAttributeType.trim(); + if (pAttributeType in $AttributeTypes) + return $AttributeTypes[pAttributeType].databaseField; + } + return null; +} + +/** + * returns the possible children types for the given attribute type + * + * @param {String} pAttributeType the attribute type + * (use the values of the AttributeTypes object, e. g. AttributeTypes.TEXT) + * @return {String[]} the possible children types + */ +AttributeTypeUtil.getPossibleChildren = function (pAttributeType) +{ + if (pAttributeType) + { + pAttributeType = pAttributeType.trim(); + if (pAttributeType in $AttributeTypes) + return $AttributeTypes[pAttributeType].possibleChildren; + } + return null; +} + +AttributeTypeUtil.getAttributeViewValue = function (pAttributeType, pValue, pKeyword) +{ + if (pAttributeType in $AttributeTypes && $AttributeTypes[pAttributeType].getViewValue) + return $AttributeTypes[pAttributeType].getViewValue(pValue, pKeyword); + return pValue; +} + +AttributeTypeUtil._initTypeColumnData = function () +{ + var columns = []; + var typeColumnMap = {}; + for (let type in $AttributeTypes) + { + type = $AttributeTypes[type]; + if (type.databaseField) + { + var typeKey = type.toString(); + var colIndex = columns.indexOf(type.databaseField); + if (colIndex == -1) + { + colIndex = columns.length; + columns.push(type.databaseField); + } + typeColumnMap[typeKey] = colIndex; + } + } + this._allDBColumns = columns; + this._typeColumnMap = typeColumnMap; +} + +AttributeTypeUtil.getAllDatabaseFields = function () +{ + if (this._allDBColumns == undefined) + AttributeTypeUtil._initTypeColumnData(); + return this._allDBColumns; +} + +AttributeTypeUtil.getTypeColumnIndex = function (pAttributeType) +{ + if (this._typeColumnMap == undefined) + AttributeTypeUtil._initTypeColumnData(); + return this._typeColumnMap[pAttributeType.trim()]; +} + +/*********************************************************************************************************************/ + +/** + * Functions for AttributeUsages. + * Do not instanciate this! + */ +function AttributeUsageUtil () {} + +/** + * Creates AttributeUsages for all subordinate attributes of an attribute. + * This is required when an usage is added to a superordinate attribute. + * + * @param {String} pAttributeId the id of the superordinate attribute + * @param {String} pObjectType the context + */ +AttributeUsageUtil.insertChildrenUsages = function (pAttributeId, pObjectType) +{ + if (!pAttributeId) + return; + var table = "AB_ATTRIBUTEUSAGE"; + var columns = ["AB_ATTRIBUTEUSAGEID", "AB_ATTRIBUTE_ID", "OBJECT_TYPE"]; + var types = db.getColumnTypes(table, columns); + + var sqlSelect = "select AB_ATTRIBUTEID, " + + " (select count(*) from AB_ATTRIBUTEUSAGE where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID and OBJECT_TYPE = '" + + pObjectType + "') = 0 from AB_ATTRIBUTE"; + + var inserts = []; + _addInserts(pAttributeId, pObjectType); + db.inserts(inserts); + + function _addInserts (pAttributeId, pObjectType) + { + var condition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeId); + var attributes = db.table(condition.buildSql(sqlSelect)); + + attributes.forEach(function (row) + { + if (row[1] == "true") + { + let values = [util.getNewUUID(), row[0], pObjectType]; + inserts.push([table, columns, types, values]); + } + _addInserts(row[0], pObjectType); + }); + } +} + +/** + * Updates AttributeUsages for all subordinate attributes of an attribute. + * This is required when an usage of a superordinate attribute is changed. + * + * @param {String} pAttributeId the id of the superordinate attribute + * @param {String} pOldObjectType ye olde context + * @param {String} pNewObjectType the new context + */ +AttributeUsageUtil.updateChildrenUsages = function (pAttributeId, pOldObjectType, pNewObjectType) +{ + if (!pNewObjectType || !pAttributeId) + return; + + var table = "AB_ATTRIBUTEUSAGE"; + + var countSubQuery = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pNewObjectType) + .and("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AB_ATTRIBUTE.AB_ATTRIBUTEID") + .buildSql("select count(*) from AB_ATTRIBUTEUSAGE"); + + var sqlSelect = SqlBuilder.begin() + .select(["AB_ATTRIBUTEID", "AB_ATTRIBUTEUSAGEID", countSubQuery]) + .from("AB_ATTRIBUTE") + .leftJoin("AB_ATTRIBUTEUSAGE", SqlCondition.begin() + .andPrepare("AB_ATTRIBUTEUSAGE.OBJECT_TYPE", pOldObjectType) + .and("AB_ATTRIBUTEID = AB_ATTRIBUTE_ID")); + + var updateCond = SqlCondition.begin(); + + //it is possible that the new objectType is already in a subordinate attribute + //and an update could cause a duplicate entry so one has to be deleted + var deleteCond = SqlCondition.begin(); + + _addUpdateIds(pAttributeId, pOldObjectType); + + if (updateCond.isSet()) + db.updateData(table, ["OBJECT_TYPE"], null, [pNewObjectType], updateCond.build("1=2")); + if (deleteCond.isSet()) + db.deleteData(table, deleteCond.build("1=2")); + + function _addUpdateIds (pAttributeId) + { + var condition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeId); + var query = sqlSelect.where(condition); + var attributes = db.table(query.build()); + + attributes.forEach(function (row) + { + if (row[1] && row[2] != "0") + deleteCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[1]); + else if (row[1]) + updateCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[1]); + _addUpdateIds(row[0]); + }); + } +} + +/** + * Deletes AttributeUsages for all subordinate attributes of an attribute. + * This is required when an usage is removed from a superordinate attribute. + * + * @param {String} pAttributeId the id of the superordinate attribute + * @param {String} pObjectType the context + */ +AttributeUsageUtil.deleteChildrenUsages = function (pAttributeId, pObjectType) +{ + var table = "AB_ATTRIBUTEUSAGE"; + + var sqlSelect = "select AB_ATTRIBUTEID, AB_ATTRIBUTEUSAGEID " + + " from AB_ATTRIBUTE left join AB_ATTRIBUTEUSAGE on AB_ATTRIBUTEID = AB_ATTRIBUTE_ID and OBJECT_TYPE = '" + pObjectType + "'"; + + var deleteCond = SqlCondition.begin(); + _addDeleteIds(pAttributeId, pObjectType); + if (deleteCond.isSet()) + db.deleteData(table, deleteCond.build("1=2")); + + function _addDeleteIds (pAttributeId) + { + var condition = SqlCondition.begin() + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_TYPE", $AttributeTypes.COMBOVALUE, "# != ?") + .andPrepare("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", pAttributeId); + var attributes = db.table(condition.buildSql(sqlSelect)); + + attributes.forEach(function (row) + { + if (row[1]) + deleteCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[1]) + _addDeleteIds(row[0]); + }); + } +} + +/** + * Deletes duplicate attribute usages. + * + * @param {String} [pAttributeId=null] attribute id, if omitted, all duplicates will be deleted + */ +AttributeUsageUtil.removeDuplicates = function (pAttributeId) +{ + var condition = SqlCondition.begin() + .and("exists (select AB_ATTRIBUTEUSAGEID from AB_ATTRIBUTEUSAGE AU where AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID = AU.AB_ATTRIBUTE_ID " + + "and AB_ATTRIBUTEUSAGE.OBJECT_TYPE = AU.OBJECT_TYPE and AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID != AU.AB_ATTRIBUTEUSAGEID)"); + if (pAttributeId) + condition.andPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID", pAttributeId); + + var duplicates = db.table(condition.buildSql("select AB_ATTRIBUTEUSAGEID, AB_ATTRIBUTE_ID, OBJECT_TYPE from AB_ATTRIBUTEUSAGE")); + var usageObj = {}; + var deleteCond = SqlCondition.begin(); + + duplicates.forEach(function (row) + { + if (!(row[1] in this)) + this[row[1]] = {}; + if (row[2] in this[row[1]]) + deleteCond.orPrepare("AB_ATTRIBUTEUSAGE.AB_ATTRIBUTEUSAGEID", row[0]); + this[row[1]][row[2]] = true; + }, usageObj); + if (deleteCond.isSet()) + db.deleteData("AB_ATTRIBUTEUSAGE", deleteCond.build("1=2")); } \ No newline at end of file diff --git a/process/Bulkmail_lib/process.js b/process/Bulkmail_lib/process.js index 3d6b154a63e39982a379206d50d456d7909f260f..f784794a61a7b00394284e69fc4bbf9ce1b59a0d 100644 --- a/process/Bulkmail_lib/process.js +++ b/process/Bulkmail_lib/process.js @@ -1,3 +1,5 @@ +import("system.translate"); +import("ActivityTask_lib"); import("system.util"); import("Contact_lib"); import("system.datetime"); @@ -8,6 +10,7 @@ import("KeywordRegistry_basic"); import("Sql_lib"); import("system.db"); import("DocumentTemplate_lib"); +import("Communication_lib"); import("Email_lib"); import("system.process"); import("system.notification"); @@ -21,16 +24,18 @@ function BulkMailUtils () {} * Executes a process to send bulk mails on the server and creates a notification when finished. * * @param {String} pBulkMailId id of the bulk mail + * @param {Array} [pTestRecipients] overwrite the recipients (e.g. for testing) * @param {String} [pUser=currentUser] User that will get the notification, if null (not undefined!), no notification * will be created. */ -BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pUser) +BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pTestRecipients, pUser) { if (pUser === undefined) pUser = EmployeeUtils.getCurrentUserId(); process.execute("sendBulkMail_serverProcess", { bulkMailId : pBulkMailId, + testRecipients : JSON.stringify(pTestRecipients), user : pUser || "" } ); @@ -41,26 +46,39 @@ BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pUser) * can take some time to execute, use BulkMailUtils.sendBulkMailOnServer instead. * * @param {String} pBulkMailId id of the bulk mail + * @param {Array} [pTestRecipients] overwrite the recipients (e.g. for testing) * * @return {Object} count of sucessful and failed mails */ -BulkMailUtils.sendBulkMail = function (pBulkMailId) +BulkMailUtils.sendBulkMail = function (pBulkMailId, pTestRecipients) { - //TODO: Mailbridge, Werbesperre beachten - - var [templateId, subject, emailSender] = db.array(db.ROW, SqlCondition.begin() + var [templateId, subject, emailSender, createActivity, bulkMailName] = db.array(db.ROW, SqlCondition.begin() .andPrepare("BULKMAIL.BULKMAILID", pBulkMailId) - .buildSql("select DOCUMENTTEMPLATE_ID, SUBJECT, SENDER from BULKMAIL", "1=2") + .buildSql("select DOCUMENTTEMPLATE_ID, SUBJECT, SENDER, CREATEACTIVITIES, NAME from BULKMAIL", "1=2") ); var template = BulkMailUtils.getBulkMailTemplate(pBulkMailId, templateId); - var recipientData = db.table(SqlCondition.begin() - .andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", pBulkMailId) - .andPrepare("BULKMAILRECIPIENT.STATUS", $KeywordRegistry.bulkMailRecipientStatus$sent(), "# != ?") - .andSqlCondition(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail(), true)) - .buildSql("select BULKMAILRECIPIENTID, BULKMAILRECIPIENT.CONTACT_ID, '' from BULKMAILRECIPIENT \n\ - join CONTACT on BULKMAILRECIPIENT.CONTACT_ID = CONTACT.CONTACTID", "1=2") - ); + var recipientData; + if (pTestRecipients) + { + recipientData = pTestRecipients.map(function (row) + { + return ["", row[0], row[1], "", ""]; + }); + } + else + { + recipientData = db.table(SqlBuilder.begin() + .select("BULKMAILRECIPIENTID, BULKMAILRECIPIENT.CONTACT_ID, (" + CommUtil.getStandardSubSqlMail() + "), PERSON_ID, ORGANISATION_ID") + .from("CONTACT") + .join("BULKMAILRECIPIENT", "BULKMAILRECIPIENT.CONTACT_ID = CONTACT.CONTACTID") + .where(SqlCondition.begin() + .andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", pBulkMailId) + .andPrepare("BULKMAILRECIPIENT.STATUS", $KeywordRegistry.bulkMailRecipientStatus$sent(), "# != ?") + .andSqlCondition(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail(), true))) + .build() + ); + } var contactIds = recipientData.map(function (e) {return e[1];}); var successIds = []; var failedIds = []; @@ -70,6 +88,9 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId) var subjectTemplate = new DocumentTemplate(subject, DocumentTemplate.types.PLAIN); var subjects = subjectTemplate.getReplacedContentByContactIds(contactIds); + var bulkMailLink = [["BulkMail", pBulkMailId]]; + var activitySubject = translate.withArguments("Bulk mail \"%0\" sent", [bulkMailName]); + for (let i = 0, l = recipientData.length; i < l; i++) { let isSuccess = false; @@ -77,30 +98,44 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId) let email = mails[contactId]; if (email !== undefined && recipientData[i][2]) { - email.toRecipients = [recipientData[i][2]]; //TODO: email address missing + email.toRecipients = [recipientData[i][2]]; email.sender = emailSender; email.subject = subjects[contactId]; isSuccess = email.send(); } - if (isSuccess) - successIds.push(recipientData[i][0]); //set the recipient status to 'sent' - else - failedIds.push(recipientData[i][0]); //set the recipient status to 'failed' + if (recipientData[i][0]) //set the recipient status to 'sent' or 'failed' + { + Array.prototype.push.call(isSuccess ? successIds : failedIds, recipientData[i][0]); + if (isSuccess && createActivity == "1") + { + let activityData = { + categoryKeywordId : $KeywordRegistry.activityCategory$mail(), + directionKeywordId : $KeywordRegistry.activityDirection$outgoing(), + subject : activitySubject, + content : email.body + }; + let contactLink = [[ContactUtils.getContextByPersOrg(recipientData[i][3], recipientData[i][4]), recipientData[i][1]]]; + ActivityUtils.insertNewActivity(activityData, bulkMailLink.concat(contactLink)); + } + } } - db.updateData("BULKMAILRECIPIENT", ["STATUS", "SENTDATE"], null, [$KeywordRegistry.bulkMailRecipientStatus$sent(), sentDate], - SqlCondition.begin() - .andIn("BULKMAILRECIPIENT.BULKMAILRECIPIENTID", successIds) - .build("1=2") - ); - db.updateData("BULKMAILRECIPIENT", ["STATUS", "SENTDATE"], null, [$KeywordRegistry.bulkMailRecipientStatus$failed(), sentDate], - SqlCondition.begin() - .andIn("BULKMAILRECIPIENT.BULKMAILRECIPIENTID", failedIds) - .build("1=2") - ); - - db.updateData("BULKMAIL", ["STATUS"], null, [$KeywordRegistry.bulkMailStatus$sent()], - SqlCondition.equals("BULKMAIL.BULKMAILID", pBulkMailId, "1=2")); + if (successIds.length > 0) + db.updateData("BULKMAILRECIPIENT", ["STATUS", "SENTDATE"], null, [$KeywordRegistry.bulkMailRecipientStatus$sent(), sentDate], + SqlCondition.begin() + .andIn("BULKMAILRECIPIENT.BULKMAILRECIPIENTID", successIds) + .build("1=2") + ); + if (failedIds.length > 0) + db.updateData("BULKMAILRECIPIENT", ["STATUS", "SENTDATE"], null, [$KeywordRegistry.bulkMailRecipientStatus$failed(), sentDate], + SqlCondition.begin() + .andIn("BULKMAILRECIPIENT.BULKMAILRECIPIENTID", failedIds) + .build("1=2") + ); + + if (!pTestRecipients) //if its just a test run, don't set the status to sent + db.updateData("BULKMAIL", ["STATUS"], null, [$KeywordRegistry.bulkMailStatus$sent()], + SqlCondition.equals("BULKMAIL.BULKMAILID", pBulkMailId, "1=2")); return { sucessful : successIds.length, @@ -108,6 +143,11 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId) }; } +/** + * opens a context to select a bulk mail to add recipients to + * + * @param {String[]} pContactIds recipients that should be added + */ BulkMailUtils.openAddRecipientView = function (pContactIds) { var params = { @@ -116,6 +156,11 @@ BulkMailUtils.openAddRecipientView = function (pContactIds) neon.openContext("BulkMailAddRecipients", "BulkMailAddRecipientsEdit_view", null, neon.OPERATINGSTATE_NEW, params); } +/** + * deletes all bulk mail recipients that have a commrestriction for emails + * + * @param {String} pBulkMailId + */ BulkMailUtils.removeCommRestrictionRecipients = function (pBulkMailId) { var recipientIds = db.array(db.COLUMN, SqlBuilder.begin() @@ -136,6 +181,12 @@ BulkMailUtils.removeCommRestrictionRecipients = function (pBulkMailId) } } +/** + * adds recipients to a bulkmail + * + * @param {String} pBulkMailId bulk mail id + * @param {String[]} pContactIds contact ids of the recipients + */ BulkMailUtils.addRecipients = function (pBulkMailId, pContactIds) { var columns = [ @@ -164,14 +215,79 @@ BulkMailUtils.addRecipients = function (pBulkMailId, pContactIds) BulkMailUtils.getBulkMailTemplate = function (pBulkMailId, pDocumentTemplateId) { var template = DocumentTemplate.loadTemplate(pBulkMailId, "BULKMAIL"); - if (template === null) + if (!template.type) template = DocumentTemplate.loadTemplate(pDocumentTemplateId); return template; } +/** + * checks if a contact is a recipient of a bulk mail + * + * @param {String} pBulkMailId bulkmail id + * @param {String} pContactId contact id + * @param {String} pRecipientId bulkmailrecipient id + * @return {boolean} true, if the contact is a recipient + */ +BulkMailUtils.isRecipient = function (pBulkMailId, pContactId, pRecipientId) +{ + return db.cell(SqlCondition.begin() + .andPrepare("BULKMAILRECIPIENT.CONTACT_ID", pContactId) + .andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", pBulkMailId) + .andPrepareIfSet("BULKMAILRECIPIENT.BULKMAILRECIPIENTID", pRecipientId, "# != ?") + .buildSql("select count(*) from BULKMAILRECIPIENT") //TODO: is there a way exists could be used? + ) != "0"; +} + +/** + * opens the BulkMail context in new mode + * + * @param {String[]} [pRecipients] recipients that should be added after creation + */ +BulkMailUtils.newBulkMail = function (pRecipients) +{ + var params = { + "PresetRecipients_param" : JSON.stringify(pRecipients) + }; + neon.openContext("BulkMail", "BulkMailEdit_view", null, neon.OPERATINGSTATE_NEW, params); +} + +/** + * Filters the given contactIds if they can be added as new recipients. + * Checks if a contact is already a recipient or if there is a advertising ban. + * + * @param {String} pBulkMailId id of the bulk mail the contacts should be added to + * @param {String[]} pContactIds contacts to filter + * @return {String[]} contacts that can be added as recipients + */ +BulkMailUtils.filterNewRecipients = function (pBulkMailId, pContactIds) +{ + var existsQuery = "not exists(select BULKMAILRECIPIENTID from BULKMAILRECIPIENT where BULKMAILRECIPIENT.CONTACT_ID = CONTACT.CONTACTID and # = ?)"; + var query = SqlCondition.begin() + .andIn("CONTACT.CONTACTID", pContactIds) + .andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", pBulkMailId, existsQuery) //only add contacts that aren't already recipients + .andSqlCondition(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail(), true)) //check if there's a commrestriction + .buildSql("select CONTACTID from CONTACT"); + + return db.array(db.COLUMN, query); +} + +/** + * opens the given bulk mail + */ +BulkMailUtils.openBulkMail = function (pBulkMailId) +{ + neon.openContext("BulkMail", "BulkMailMain_view", [pBulkMailId], neon.OPERATINGSTATE_VIEW, null); +} + function SerialLetterUtils () {} -SerialLetterUtils.addRecipients = function (pBulkMailId, pContactIds) +/** + * adds recipients to a serial letter + * + * @param {String} pSerialLetterId serial letter id + * @param {String[]} pContactIds contact ids of the recipients + */ +SerialLetterUtils.addRecipients = function (pSerialLetterId, pContactIds) { var columns = [ "LETTERRECIPIENTID", @@ -181,12 +297,16 @@ SerialLetterUtils.addRecipients = function (pBulkMailId, pContactIds) var inserts = []; for (let i = 0, l = pContactIds.length; i < l; i++) { - inserts.push(["LETTERRECIPIENT", columns, null, [util.getNewUUID(), pBulkMailId, pContactIds[i]]]); + inserts.push(["LETTERRECIPIENT", columns, null, [util.getNewUUID(), pSerialLetterId, pContactIds[i]]]); } db.inserts(inserts); } - +/** + * opens a context to select a serial letter to add recipients to + * + * @param {String[]} pContactIds recipients that should be added + */ SerialLetterUtils.openAddRecipientView = function (pContactIds) { var params = { @@ -195,6 +315,13 @@ SerialLetterUtils.openAddRecipientView = function (pContactIds) neon.openContext("SerialLetterAddRecipients", "SerialLetterAddRecipientsEdit_view", null, neon.OPERATINGSTATE_NEW, params); } +/** + * executes a server process that builds a serial letter + * + * @param {String} pSerialLetterId serial letter id + * @param {String[]} [pRecipientIds] Letter recipient ids of that should be used. + * If omitted, all recipients of the letter will be used. + */ SerialLetterUtils.buildSerialLetter = function (pSerialLetterId, pRecipientIds) { process.execute("buildSerialLetter_serverProcess", { @@ -203,7 +330,42 @@ SerialLetterUtils.buildSerialLetter = function (pSerialLetterId, pRecipientIds) }); } -SerialLetterUtils.makeDownloadNotification = function (pTitle, pBinaryId, pUser) +/** + * checks if a contact is a recipient of a serial letter + * + * @param {String} pSerialLetterId serial letter id + * @param {String} pContactId contact id + * @param {String} [pRecipientId] letter recipient id + * @return {boolean} true, if the contact is a recipient + */ +SerialLetterUtils.isRecipient = function (pSerialLetterId, pContactId, pRecipientId) +{ + return db.cell(SqlCondition.begin() + .andPrepare("LETTERRECIPIENT.CONTACT_ID", pContactId) + .andPrepare("LETTERRECIPIENT.SERIALLETTER_ID", pSerialLetterId) + .andPrepareIfSet("LETTERRECIPIENT.LETTERRECIPIENTID", pRecipientId, "# != ?") + .buildSql("select count(*) from LETTERRECIPIENT") //TODO: is there a way exists could be used? + ) != "0"; +} + +SerialLetterUtils.openSerialLetter = function (pSerialLetterId) { - notification.addNotification(pContentId, pLinkInfo, pImageInfo, pOriginatorName, pType, pForcedPriority, pDaysToLive, pState, pUser, pCaption, pDescription) + neon.openContext("SerialLetter", "SerialLetterMain_view", [pSerialLetterId], neon.OPERATINGSTATE_VIEW, null); +} + +/** + * Loads the document template of a serial letter. If the serial letter itself has a + * template, it is preferred over the documentTemplate-id. + * + * @param {String} pLetterId serial letter id + * @param {String} pDocumentTemplateId documentTemplate id + * + * @return {DocumentTemplate} the document template + */ +SerialLetterUtils.getSerialLetterTemplate = function (pLetterId, pDocumentTemplateId) +{ + var template = DocumentTemplate.loadTemplate(pLetterId, "SERIALLETTER"); + if (!template.type) + template = DocumentTemplate.loadTemplate(pDocumentTemplateId); + return template; } \ No newline at end of file diff --git a/process/Calendar_lib/process.js b/process/Calendar_lib/process.js index 9e2f42f747062eecc0d1b07064c8236f92e3b185..fddc0663aa181607e49b22260d9d67d504705686 100644 --- a/process/Calendar_lib/process.js +++ b/process/Calendar_lib/process.js @@ -67,6 +67,33 @@ CalendarUtil.newTodo = function(pSummary, pDescription, pWithLink, pUser, pAffec } } + +/** + * Finds the effective calendarId of an user in the same attribute order like the ADITO core, which is exchangeEmail -> calendarID -> email + * DO NOT CHANGE THIS ORDER + * + * @param {String} user to check + * @return effective calendar id + */ +CalendarUtil.getEffectiveCalendarIdFromUser = function(pUser) +{ + var userParams = pUser["params"]; + + var resolvedCurrentUser; + var exchangeEmail = userParams["exchangeEMail"]; + var calendarId = userParams["calendarID"]; + var email = userParams["email"]; + + if(exchangeEmail) + return exhangeEmail; + else if(calendarId) + return calendarId; + else if(email) + return email; + else + return ""; +} + /* * Erzeugt eine neue Aufgabe (mit einem Link). * @@ -254,6 +281,7 @@ CalendarUtil.createEntry = function( pType, pSummary, pDescription, pWithLink, p Entry[calendars.STATUS] = pStatus; Entry[calendars.CLASSIFICATION] = calendars.CLASSIFICATION_PUBLIC; Entry[calendars.CATEGORIES] = pCategory; + Entry[calendars.TRANSPARENCY] = "OPAQUE"; if( pPriority != undefined ) @@ -337,24 +365,24 @@ function getCalendarStatus( pStatus, pLanguage, pKind) switch ( pStatus ) { case calendars.STATUS_BUSY: - return translate.text("Gebucht", pLanguage) + return translate.text("Gebucht", pLanguage); case calendars.STATUS_CANCELLED: if(pKind == "ToDo" && pKind != undefined) return translate.text("Zurückgestellt", pLanguage) - return translate.text("Abgesagt", pLanguage) + return translate.text("Abgesagt", pLanguage); case calendars.STATUS_COMPLETED: - return translate.text("Erledigt", pLanguage) + return translate.text("Erledigt", pLanguage); case calendars.STATUS_CONFIRMED: - return translate.text("Bestätigt", pLanguage) + return translate.text("Bestätigt", pLanguage); case calendars.STATUS_FREE: - return translate.text("frei", pLanguage) + return translate.text("frei", pLanguage); case calendars.STATUS_INPROCESS: - return translate.text("In Bearbeitung", pLanguage) + return translate.text("In Bearbeitung", pLanguage); case calendars.STATUS_NEEDSACTION: - return translate.text("Nicht begonnen", pLanguage) + return translate.text("Nicht begonnen", pLanguage); case calendars.STATUS_OOF: - return translate.text("Außer Haus", pLanguage) + return translate.text("Außer Haus", pLanguage); case calendars.STATUS_TENTATIVE: - return translate.text("Vorläufig", pLanguage) + return translate.text("Vorläufig", pLanguage); default: return ""; } @@ -1694,8 +1722,8 @@ function moveCalendarData ( pNewlogin, pOldlogin, pNewCalendarID, pOldCalendarID if(pNewCalendarID != pOldCalendarID) //Nur wenn sich die E-Mailadresse geändert hat { //Messenger-Historien - db.runStatement("update ASYS_XMPP_HISTORY set JID_FROM = '" + pNewCalendarID +"' where JID_FROM = '" + pOldCalendarID +"'", "_____SYSTEMALIAS"); - db.runStatement("update ASYS_XMPP_HISTORY set JID_TO = '" + pNewCalendarID +"' where JID_TO = '" + pOldCalendarID +"'", "_____SYSTEMALIAS"); + db.runStatement("update ASYS_XMPP_HISTORY set JID_FROM = '" + pNewCalendarID +"' where JID_FROM = '" + pOldCalendarID +"'", SqlUtils.getSystemAlias()); + db.runStatement("update ASYS_XMPP_HISTORY set JID_TO = '" + pNewCalendarID +"' where JID_TO = '" + pOldCalendarID +"'", SqlUtils.getSystemAlias()); } } diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js index 873f2b92835c55dfba0a4be3566eb75d23af2971..0cce037c488c4c68225355a8649dea1f20c83021 100644 --- a/process/Campaign_lib/process.js +++ b/process/Campaign_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.translate"); import("system.vars"); import("system.db"); @@ -6,6 +5,7 @@ import("system.neon"); import("Sql_lib"); import("Keyword_lib"); import("KeywordRegistry_basic"); +import("Neon_lib"); /** * Methods for campaignmanagement. @@ -123,7 +123,7 @@ CampaignUtils.getStepCount = function(pCampaignId) CampaignUtils.getCampaignStatusByCampaignId = function(pCampaignId) { - let selectQuery = "select CAMPAIGN.STATE from CAMPAIGN"; + let selectQuery = "select CAMPAIGN.STATUS from CAMPAIGN"; let conditionField = "CAMPAIGN.CAMPAIGNID"; let defaultValue = ""; @@ -132,11 +132,11 @@ CampaignUtils.getCampaignStatusByCampaignId = function(pCampaignId) return KeywordUtils.getViewValue(campaignState, statusId); } -CampaignUtils.createLogEntry = function(pCampaignId, pCampaignStepId, pContactId, pCampaignParticipantId) +CampaignUtils.createLogEntry = function(pCampaignId, pCampaignStepId, pContactId, pCampaignParticipantId, pPreviousCampaignstepId) { let colsCampaignParticipantLog = CampaignUtils.getParticipantLogInsertColumnNames(); - let valsCampaignParticipantLog = new Array(pCampaignId, pCampaignStepId, pContactId, pCampaignParticipantId, vars.get("$sys.user"), vars.get("$sys.date")); + let valsCampaignParticipantLog = new Array(pCampaignId, pCampaignStepId, pContactId, pCampaignParticipantId, vars.get("$sys.user"), vars.get("$sys.date"), pPreviousCampaignstepId); let rows = db.insertData("CAMPAIGNPARTICIPANTLOG", colsCampaignParticipantLog, null, valsCampaignParticipantLog); return (rows == 1); @@ -144,7 +144,7 @@ CampaignUtils.createLogEntry = function(pCampaignId, pCampaignStepId, pContactId CampaignUtils.getParticipantLogInsertColumnNames = function() { - return ["CAMPAIGNPARTICIPANT_ID", "CAMPAIGN_ID", "CAMPAIGNSTEP_ID", "CAMPAIGNPARTICIPANTLOGID", "USER_NEW", "DATE_NEW"]; + return ["CAMPAIGNPARTICIPANT_ID", "CAMPAIGN_ID", "CAMPAIGNSTEP_ID", "CAMPAIGNPARTICIPANTLOGID", "USER_NEW", "DATE_NEW", "PREVIOUS_CAMPAIGNSTEP_ID"]; } CampaignUtils.openSetCampaignStepViewByRowIds = function(pParticipantIds, pCampaignId, pCampaignStepId) @@ -396,6 +396,48 @@ CampaignUtils.GetContactCountByCondition = function(pCondition, pLookInCampaignO return db.cell(query); } +/** + * opens an campaign in NEW mode with values from root campaign + * + * @param {String} pCampaignid + * @param {String} pDescription + * @param {String} pEmplContactId + * @param {String} pName + * @param {String} pState + */ +CampaignUtils.copyCampaign = function(pCampaignid, pDescription, pEmplContactId, pName, pState) +{ + var params = { + "originalCampaignIdCopy_param" : pCampaignid, + "description_param" : pDescription, + "emplContactId_param" : pEmplContactId, + "name_param" : pName || "", + "state_param" : pState || "" + }; + neon.openContext("Campaign", null, null, neon.OPERATINGSTATE_NEW, params); +} + +/** + * copies all campaign steps from one campaign to another + * + * @param {String} pSourceCampaignId + * @param {String} pTargetCampaignId + */ +CampaignUtils.copyCampaignSteps = function(pSourceCampaignId, pTargetCampaignId) +{ + var InputMapping = { + "CAMPAIGNSTEP": { + condition: db.translateCondition(SqlCondition().begin() + .andPrepare("CAMPAIGN.CAMPAIGN_ID", pSourceCampaignId) + .buildSql("", "1=2", "order by SORTING", false)), + ValueMapping: { + "CAMPAIGN_ID" : pTargetCampaignId + } + } + }; + CopyModuleUtils.copyModule(InputMapping); +} + /** * Methods for campaignmanagement. * Do not create an instance of this! diff --git a/process/Classification_lib/process.js b/process/Classification_lib/process.js index 40778a43d2f04f90f496c5edf6f682bb97815550..c5d7ddc74389fdf028a22ecb112f53f1b4c0c024 100644 --- a/process/Classification_lib/process.js +++ b/process/Classification_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.db"); import("Sql_lib"); diff --git a/process/Communication_lib/process.js b/process/Communication_lib/process.js index a22c886fc5f2c8c30ad92dc1c01f14e2011a0b7c..440720e427970d7df18bbf14c4a47b17f97e5d2b 100644 --- a/process/Communication_lib/process.js +++ b/process/Communication_lib/process.js @@ -41,8 +41,8 @@ CommUtil.getMediumIdsByCategory = function (pCategory) * sets the standard address for COMMUNICATION entries for a specific category; * does not verify if the COMMUNICATIONID you provide has the given category * @param {String} pAffectedRowId a refencial ID whoes COMMs should be modified (a CONTACTID) - * @param {String} pNewStandardCommId COMMUNICATIONID of the new STANDARD comm-entry; can be an empty string if no new standard adress shall be set but the old standard removed - * @param {String} pCategory value of the keyword "COMMUNICATION.MEDIUM" custom.category; e.g. "PHONE"; the STANDARD of this category is set + * @param {String} pNewStandardCommId COMMUNICATIONID of the new ISSTANDARD comm-entry; can be an empty string if no new standard adress shall be set but the old standard removed + * @param {String} pCategory value of the keyword "COMMUNICATION.MEDIUM" custom.category; e.g. "PHONE"; the ISSTANDARD of this category is set * @return {null} currently returns always null; reserved for future */ CommUtil.setStandardForCategory = function(pAffectedRowId, pNewStandardCommId, pCategory) @@ -55,11 +55,11 @@ CommUtil.setStandardForCategory = function(pAffectedRowId, pNewStandardCommId, p return null; var statements = []; - var cols = ["STANDARD"]; + var cols = ["ISSTANDARD"]; var types = db.getColumnTypes("COMMUNICATION", cols); //set current standard comm-record as non-standard - var cond = SqlCondition.begin().and("STANDARD = 1").andPrepare("COMMUNICATION.CONTACT_ID", pAffectedRowId); + var cond = SqlCondition.begin().and("ISSTANDARD = 1").andPrepare("COMMUNICATION.CONTACT_ID", pAffectedRowId); //mediumIds cannot be empty so no need to do further checks (this is checked above) cond.and("MEDIUM_ID in ('" + mediumIds.join("', '") + "')"); statements.push(["COMMUNICATION", cols, types, ["0"], cond.build()]); @@ -83,7 +83,7 @@ CommUtil.setStandardForCategory = function(pAffectedRowId, pNewStandardCommId, p * sets the standard PHONE-entry for COMMUNICATION * does not verify if the COMMUNICATIONID you provide is actually PHONE-COMMUNICATION * @param {String} pAffectedRowId a refencial ID whoes COMMs should be modified (a CONTACTID) - * @param {String} pNewStandardCommId COMMUNICATIONID of the new STANDARD comm-entry + * @param {String} pNewStandardCommId COMMUNICATIONID of the new ISSTANDARD comm-entry * @return {null} currently returns always null; reserved for future */ CommUtil.setStandardPhone = function(pAffectedRowId, pNewStandardCommId) @@ -95,7 +95,7 @@ CommUtil.setStandardPhone = function(pAffectedRowId, pNewStandardCommId) * sets the standard EMAIL-entry for COMMUNICATION * does not verify if the COMMUNICATIONID you provide is actually EMAIL-COMMUNICATION * @param {String} pAffectedRowId a refencial ID whoes COMMs should be modified (a CONTACTID) - * @param {String} pNewStandardCommId COMMUNICATIONID of the new STANDARD comm-entry + * @param {String} pNewStandardCommId COMMUNICATIONID of the new ISSTANDARD comm-entry * @return {null} currently returns always null; reserved for future */ CommUtil.setStandardMail = function(pAffectedRowId, pNewStandardCommId) @@ -138,7 +138,7 @@ CommUtil.getStandardSubSqlForCategory = function(pCategory, pContactField) }); cond.andSqlCondition(anyMediumIdCond, "1=0"); - cond.and("COMMUNICATION.STANDARD = 1"); + cond.and("COMMUNICATION.ISSTANDARD = 1"); var res = db.translateStatement(cond.buildSql("select max(COMMUNICATION.ADDR) from COMMUNICATION", "1=0")); return res; @@ -198,8 +198,8 @@ function CommValidationUtil() {} CommValidationUtil.makeValidationFn = function (commCategory) { var callbackFn; - - switch (commCategory) { + + switch (commCategory.trim()) { case "EMAIL": callbackFn = function (addrValue){ if (!mail.isValidMailAddress(addrValue, true)) @@ -216,11 +216,12 @@ CommValidationUtil.makeValidationFn = function (commCategory) break; case "TELEPHONE": callbackFn = function (addrValue, ext){ - var country = null; - if (addrValue[0] != "+") //if the number starts with a country-identifier (e.g. +49) no country needs to be specified - country = ext.countryCode; -// if (!cti.isValidPhoneNumber(addrValue, country))//TODO: enable JDito-methods -// return translate.text("no valid phone number"); + var country = ext.countryCode; + + if (!cti.isValidPhoneNumber(addrValue, false, country)) { + return translate.text("no valid phone number"); + } + return null; } break; diff --git a/process/Contact_lib/process.js b/process/Contact_lib/process.js index 63a47219b9f5b47f3d95e6dceae2970d9ad83cfd..2a024cfb4fd130ca010a34fd7c25fc35192bd3d7 100644 --- a/process/Contact_lib/process.js +++ b/process/Contact_lib/process.js @@ -1,5 +1,4 @@ import("system.datetime"); -import("system.logging"); import("system.translate"); import("system.neon"); import("system.vars"); @@ -456,9 +455,9 @@ ContactUtils.hasCommRestriction = function (pContactId, pMedium, pStartDate) var query = SqlCondition.begin() .andPrepare("CONTACT.CONTACTID", pContactId) .andSqlCondition(ContactUtils.getCommRestrictionCondition(pMedium, false, pStartDate)) - .buildSql("select count(*) = 0 from CONTACT", "1=2"); + .buildSql("select count(*) from CONTACT", "1=2"); //TODO: is there a way exists could be used? - return db.cell(query) != "true"; + return db.cell(query) != "0"; } /** diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 179cb9b79349b7cb53a988ddf70736b9e22ef544..50aeb817ca2cba8bd9604ed246ab80156b866aed 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -1,6 +1,5 @@ import("system.tools"); import("system.neon"); -import("system.logging"); import("system.db"); import("system.translate"); import("system.project"); @@ -407,7 +406,7 @@ ContextUtils.getSelectMap = function() ], "", false)) .setContactIdField("CONTACT_ID") .setCreationDateField("STARTDATE") - .setStateField("STATE") + .setStateField("STATUS") .setActiveStates([$KeywordRegistry.salesprojectState$open(), $KeywordRegistry.salesprojectState$postponed()]) ,"Contract": ContextSelector.create("CONTRACT", "CONTRACTID") .setTitleExpression(maskingUtils.concat([ @@ -429,7 +428,7 @@ ContextUtils.getSelectMap = function() .setContactIdField("CONTACT_ID") .setCreationDateField("OFFERDATE") .setStateField("STATUS") - .setActiveStates(["70d27a1b-7233-481d-826f-01a13a4bb0b2", "5134153d-2e18-452f-ab35-7a52f1aee7d1", "e5d6b5a4-7576-440f-8332-bc40147c0335"]) + .setActiveStates([$KeywordRegistry.offerStatus$open, $KeywordRegistry.offerStatus$checked, $KeywordRegistry.offerStatus$sent]) ,"Order": ContextSelector.create("SALESORDER", "SALESORDERID") .setTitleExpression(maskingUtils.concat([ "'" + translate.text("Order") + "'", @@ -441,7 +440,7 @@ ContextUtils.getSelectMap = function() .setContactIdField("CONTACT_ID") .setCreationDateField("SALESORDERDATE") .setStateField("STATUS") - .setActiveStates([]) + .setActiveStates([$KeywordRegistry.salesorderState$checked, $KeywordRegistry.salesorderState$sent]) ,"Product": ContextSelector.create("PRODUCT", "PRODUCTID") .setTitleExpression(maskingUtils.concat([ "PRODUCTCODE", @@ -455,7 +454,7 @@ ContextUtils.getSelectMap = function() .setJoinExpression("left join CAMPAIGNPARTICIPANT on CAMPAIGNPARTICIPANT.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID " + "left join CAMPAIGNSTEP on CAMPAIGNSTEP.CAMPAIGNSTEPID = CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID") .setCreationDateField("CAMPAIGNSTEP.DATE_START") - .setStateField("CAMPAIGN.STATE") + .setStateField("CAMPAIGN.STATUS") .setActiveStates([$KeywordRegistry.campaignState$planning(), $KeywordRegistry.campaignState$approved()]) ,"CampaignStep" : ContextSelector.create("CAMPAIGNSTEP", "CAMPAIGNSTEPID", "NAME") ,"SupportTicket": ContextSelector.create("TICKET", "TICKETID", "TASK.SUBJECT") @@ -537,7 +536,6 @@ ContextUtils.getContextDataSql = function(pContextId, pContactId, pWithDate, pAc var cond = SqlCondition.begin(); if (pContactId) { - logging.log(JSON.stringify(ownContextSelector, null, "\t")) cond.andPrepare(ownContextSelector.getFullField(ownContextSelector.contactIdField), pContactId) } @@ -592,13 +590,10 @@ ContextUtils.getCountByContactId = function(pContextId, pContactId) var tableName = contextObject.tableName; var contactField = contextObject.getFullField(contextObject.contactIdField) var join = contextObject.joinExpression; - logging.log(tableName + " " + contactField) if (tableName && contactField) { var sql = "select count(*) from " + tableName + (join ? join : ""); - logging.log(sql + " " + pContactId); var count = db.cell(SqlCondition.begin().andPrepare(contactField, pContactId).buildSql(sql, "1=2")); - logging.log(count); return count; } return 0; diff --git a/process/CountryInfoData_lib/CountryInfoData_lib.aod b/process/CountryInfoData_lib/CountryInfoData_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..d1612a9f77a923a06489237005292a2055f0cd74 --- /dev/null +++ b/process/CountryInfoData_lib/CountryInfoData_lib.aod @@ -0,0 +1,9 @@ +<?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>CountryInfoData_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/CountryInfoData_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/CountryInfoData_lib/process.js b/process/CountryInfoData_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..76f43422f42143217f5ccebec593f0e73f552570 --- /dev/null +++ b/process/CountryInfoData_lib/process.js @@ -0,0 +1,39 @@ +import("system.entities"); +import("system.logging"); +import("system.translate"); +import("system.db"); +import("DataCaching_lib"); +import("Sql_lib"); + +/* +This is a experimental library. +The code will definetly change in the future while not keeping the same functionparameters and calls. You should not use this except you excatly know what you're doing. +Since the functions will change, comments are written for the future functions. + +The idea behind this is to maintain data in cached form (client-context-side)) for various keyword-constructs. +*/ + +function CountryInfoData(){} + +CountryInfoData.getMainData = function (pLocale) +{ + var cache = new CachedData("CountryInfoData.getMainData", true, pLocale); + return cache.load(function (pTranslationNecessary, pLocale){ + var loadingConfig = entities.createConfigForLoadingRows().entity("Countries_Entity").fields(["ISO2", "NAME_TRANSLATED"]);//TODO: into cachedDatalib + var countryData = entities.getRows(loadingConfig);//TODO: ignore grants? + return countryData; + }); +}; + +CountryInfoData.getIso2NameData = function (pLocale) +{ + var cache = new CachedData("CountryInfoData.getIso2NameData", true, pLocale); + return cache.load(function (pTranslationNecessary, pLocale){ + var countryData = CountryInfoData.getMainData(pLocale); + countryData = countryData.map(function (row){ + return [row["ISO2"], row["NAME_TRANSLATED"]]; + }); + return countryData; + }); +}; + diff --git a/process/CountryInfo_lib/process.js b/process/CountryInfo_lib/process.js index 1bd84270bc4173346b5a54a4721ddc54bcb81b37..4625fbc4971edbd7e6b6f05dee1a7a2816a984d1 100644 --- a/process/CountryInfo_lib/process.js +++ b/process/CountryInfo_lib/process.js @@ -1,3 +1,5 @@ +import("CountryInfoData_lib"); +import("system.entities"); import("system.db"); import("system.translate"); import("Sql_lib"); @@ -29,4 +31,21 @@ CountryUtils.getLatinNameByIso2 = function(pIso2, pLocale) .buildSql("select AB_COUNTRYINFO.NAME_LATIN from AB_COUNTRYINFO")); countryName = pLocale ? translate.text(countryName, pLocale) : translate.text(countryName); return countryName; +}; + +//SqlUtils.getResolvingCaseWhen(keywordData, pDbFieldName, pLocale); + +/** +* resolves ISO2 codes of countries to the translated name +* +* @param {String} pDbFieldName name fo the database field where the KEYID-value is stored +* @param {String} [pLocale=current client language] specifies the locale for translating the title; can be false if nothing shalle be translated +* +* @return {String} a SQL-expression (case-when-statement) that resolves the ISO2-code into the name (=title) +*/ +CountryUtils.getResolvedNameFromIso2Sql = function(pDbFieldName, pLocale) +{ + var countryData = CountryInfoData.getIso2NameData(); + var resSql = SqlUtils.getResolvingCaseWhen(countryData, pDbFieldName, pLocale); + return db.translateStatement(resSql); }; \ No newline at end of file diff --git a/process/CustomPlaceholder_lib/CustomPlaceholder_lib.aod b/process/CustomPlaceholder_lib/CustomPlaceholder_lib.aod index 6b446aa3dfe92abe130304977abaa8fe86af3201..8e915687a2ad2cdd2fcdcc75bb67e37635191fdc 100644 --- a/process/CustomPlaceholder_lib/CustomPlaceholder_lib.aod +++ b/process/CustomPlaceholder_lib/CustomPlaceholder_lib.aod @@ -1,9 +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>CustomPlaceholder_lib</name> - <majorModelMode>DISTRIBUTED</majorModelMode> - <process>%aditoprj%/process/CustomPlaceholder_lib/process.js</process> - <variants> - <element>LIBRARY</element> - </variants> -</process> +<?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>CustomPlaceholder_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/CustomPlaceholder_lib/process.js</process> + <alias>Data_alias</alias> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/DataCaching_lib/process.js b/process/DataCaching_lib/process.js index 03cb0d54a4410f6b78a5c339bba7534f0687b1c1..967f3fe35dc6ff0d672e080312e771a3aa4e3062 100644 --- a/process/DataCaching_lib/process.js +++ b/process/DataCaching_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.project"); @@ -8,12 +7,12 @@ import("system.project"); * * on client side it's done with the helb of a $global.***-variable * - * @class * * @param {String} pIdentifiyingName name to identify the DataCache. This MUST be unique for one data representation (e.g. key-value pair for all Languages with key ISO2-code and value the ISO3-Code). this will affect the storage-name (=name of the global variable on the client for example) * @param {bool} [pKeepPerLanguage=false] if true the data is kept per locale (different storing for each requested language), false when not (every language is sharing the same stoarge because only untranslated data is kept) * @param {String} [pLocaleOverride=current language] sometimes a special locale is required, use this parameter to specify it * + * @class */ function CachedData(pIdentifiyingName, pKeepPerLanguage, pLocaleOverride) { diff --git a/process/DataPrivacy_lib/process.js b/process/DataPrivacy_lib/process.js index fc346ec79514df986c04287f19d801887d494947..0fedbf88b8f857f220eb0e42d12b88b1bee3c840 100644 --- a/process/DataPrivacy_lib/process.js +++ b/process/DataPrivacy_lib/process.js @@ -1,6 +1,5 @@ import("system.project"); import("system.project"); -import("system.logging"); import("Util_lib"); import("PostalAddress_lib"); import("system.text"); @@ -21,6 +20,27 @@ import("Report_lib"); import("Contact_lib"); import("Address_lib"); +/************************************************ + ******************READ CAREFULLY**************** + ************************************************ + * + * Steps for adding a privacy field: + * - create Keyword Containername: "DSGVOType" + * - Add to list in DataPrivacyType.get - function with the same name as the keyword keyid. (see DataPrivacyType for all possible parameters) + * e.g. if keyword-keyid is "TYPE_HOBBY" then add: + * TYPE_HOBBY: new DataPrivacyType("TYPE_HOBBY", _getHobby), + * - create a function for collecting the data (in this example _getHobby(...)) and put it inside of DataPrivacyType.get() {...} + * like the other ones + * - the function takes two parameters: + * * pContactId: The contact for which the data should be selected. + * This param is always provided. + * * pUid: A uid for your type. If the DSGVO-entity just needs the data for one dataset it calls the function with this param. + * In most cases it is undefined. + * - the function can use any way to load the data. It has to return an array of objects which contain a "value" and a "id". + * (take the already provided functions as reference) + * - add the DataPrivacyUtils.notifyNeedDataPrivacyUpdate() function everywhere where your datasource is updated. + */ + /** * * Do not create new instances anywhere else than inside of the get-function! @@ -37,7 +57,7 @@ function DataPrivacyType(pKeyId, pGetValuesCallback, pFormatAsDate) /** * NOTE: The Key in the cache has to be the same as the first argument (pKeyId) - * NOTE2: These Types have to exist also as Keyord! + * NOTE2: These Types have to exist also as Keyword! * * get all possible DataPrivacyTypes or one specific * @param {String} [pKey=undefined] if provided, this function returns only the DataPrivacyTypes with this key @@ -123,7 +143,7 @@ DataPrivacyType.get = function(pKey) var entityConfig = entities.createConfigForLoadingRows() .entity("Address_entity") - .fields(["ADDRESSID", "ADDRESS", "ADDRESSADDITION", "ADDRIDENTIFIER", "BUILDINGNO", "ZIP", "CITY", "COUNTRY", "DISTRICT", "REGION", "STATE"]); + .fields(["ADDRESSID", "ADDRESS", "ADDRESSADDITION", "ADDRIDENTIFIER", "BUILDINGNO", "ZIP", "CITY", "COUNTRY", "DISTRICT", "REGION", "PROVINCE"]); if (pAddressId) { @@ -137,7 +157,7 @@ DataPrivacyType.get = function(pKey) } var addrData = entities.getRows(entityConfig).map(function(addr) { - var addrVal = StringUtils.concat(", ", [addr.ADDRESS, addr.ADDRESSADDITION, addr.ADDRIDENTIFIER, addr.BUILDINGNO, addr.ZIP, addr.CITY, addr.COUNTRY, addr.DISTRICT, addr.REGION, addr.STATE]); + var addrVal = StringUtils.concat(", ", [addr.ADDRESS, addr.ADDRESSADDITION, addr.ADDRIDENTIFIER, addr.BUILDINGNO, addr.ZIP, addr.CITY, addr.COUNTRY, addr.DISTRICT, addr.REGION, addr.PROVINCE]); return { value: addrVal, @@ -190,7 +210,7 @@ DataPrivacyType.get = function(pKey) return attributeData.map(function(pAttr) { return { - value: pAttr[1] + ": " + pAttr[2], + value: pAttr[1] + ": " + translate.text(pAttr[2]), id: pAttr[0] } }); @@ -212,7 +232,7 @@ DataPrivacyUtils.getDSGVO = function(pContactId, pFilterCond) var select = "DSGVOID," + // 0 "CONTACT_ID," + // 1 - "DSGVOTYPE," + // 2 + "DSGVOTYPE," + // 2 "ROW_ID," + // 3 "''," + // 4 - dummy for value "STATUORITYSOURCE," + // 5 @@ -222,7 +242,7 @@ DataPrivacyUtils.getDSGVO = function(pContactId, pFilterCond) "DATE_EDIT," + // 9 "USER_NEW," + // 10 "USER_EDIT, " + // 11 - KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOType(), "DSGVOTYPE") // 12 - dsgvotype-displayvalue + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.dsgvoType(), "DSGVOTYPE") // 12 - dsgvotype-displayvalue var data = db.table(cond.buildSql("select " + select + " from DSGVO", "1 = 2")); @@ -296,7 +316,7 @@ DataPrivacyUtils.collectAll = function(pContactId, pFilterCond) "", // "DATE_EDIT," + // 9 currentUser, // "USER_NEW," + // 10 "", // "USER_EDIT " // 11 - KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), StringUtils.toChar36(dsgvotype.key)), // 12 + KeywordUtils.getViewValue($KeywordRegistry.dsgvoType(), StringUtils.pad36(dsgvotype.key)), // 12 ]) } }); @@ -354,10 +374,10 @@ DataPrivacyUtils.dataForExport = function(pContactId, pLocale) var dsgvotype = DataPrivacyType.get(pRow.DSGVOTYPE); var newRow = [ - KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), pRow.DSGVOTYPE, pLocale), + KeywordUtils.getViewValue($KeywordRegistry.dsgvoType(), pRow.DSGVOTYPE, pLocale), (dsgvotype.formatAsDate ? datetime.toDate(pRow.VALUE, translate.text("dd.MM.yyyy", pLocale), "UTC") : pRow.VALUE), - KeywordUtils.getViewValue($KeywordRegistry.DSGVOStatuoritysource(), pRow.STATUORITYSOURCE, pLocale), - KeywordUtils.getViewValue($KeywordRegistry.DSGVOPurpose(), pRow.PURPOSE, pLocale), + KeywordUtils.getViewValue($KeywordRegistry.dsgvoStatuoritysource(), pRow.STATUORITYSOURCE, pLocale), + KeywordUtils.getViewValue($KeywordRegistry.dsgvoPurpose(), pRow.PURPOSE, pLocale), datetime.toDate(pRow.VALID_TO, translate.text("dd.MM.yyyy", pLocale), "UTC"), ]; @@ -414,7 +434,7 @@ DataPrivacyUtils.openReport = function(pContactId, pReportName, pDSGVOInfo, pLoc // text for transmission var transmission = ""; - if (pDSGVOInfo.transmission != $KeywordRegistry.DSGVOTransmission$none()) + if (pDSGVOInfo.transmission != $KeywordRegistry.dsgvoTransmission$none()) { // load recipient // TODO: evtl. put this load entity into lib and use it in all display value processes var recipientConfig = entities.createConfigForLoadingRows() @@ -426,9 +446,9 @@ DataPrivacyUtils.openReport = function(pContactId, pReportName, pDSGVOInfo, pLoc transmission = translate.text("The data is transmitted to the following recipients:", pLocale); transmission += " " + pDSGVOInfo.recipient; - if (pDSGVOInfo.transmission == $KeywordRegistry.DSGVOTransmission$foreign()) + if (pDSGVOInfo.transmission == $KeywordRegistry.dsgvoTransmission$foreign()) { - pDSGVOInfo.garantees = KeywordUtils.getViewValue($KeywordRegistry.DSGVOGuarantee(), pDSGVOInfo.garantees, pLocale), + pDSGVOInfo.garantees = KeywordUtils.getViewValue($KeywordRegistry.dsgvoGuarantee(), pDSGVOInfo.garantees, pLocale), transmission += "\n" + translate.text("The transfer of data to recipients located in a third country is based on the following guarantees:", pLocale) + "\n" + pDSGVOInfo.garantees; @@ -452,15 +472,15 @@ DataPrivacyUtils.openReport = function(pContactId, pReportName, pDSGVOInfo, pLoc // text for deadline var deadline = ""; - if(pDSGVOInfo.deadline == $KeywordRegistry.DSGVODeadline$onTime()) + if(pDSGVOInfo.deadline == $KeywordRegistry.dsgvoDeadline$onTime()) deadline = translate.text("We hereby comply with your request within the statutory period of one month.", pLocale); else { deadline = translate.withArguments("As stated in our letter of %0, we have made use of the possibility to extend the deadline to three months due to %1.", [datetime.toDate(pDSGVOInfo.deadlineDate, translate.text("dd.MM.yyyy", pLocale)), - (pDSGVOInfo.deadline == $KeywordRegistry.DSGVODeadline$complex() ? translate.text("the high complexity of your application", pLocale) + (pDSGVOInfo.deadline == $KeywordRegistry.dsgvoDeadline$complex() ? translate.text("the high complexity of your application", pLocale) : - (pDSGVOInfo.deadline == $KeywordRegistry.DSGVODeadline$count() ? translate.text("the number of your applications", pLocale) : "")) + (pDSGVOInfo.deadline == $KeywordRegistry.dsgvoDeadline$count() ? translate.text("the number of your applications", pLocale) : "")) ], pLocale) } @@ -588,14 +608,14 @@ DataPrivacyUtils.dsgvoMkDataAnonymous = function(pPersId, pContactId) { data = db.table(SqlCondition.begin() .andPrepare("CONTACT_ID", pContactId) - .build("select ADDRESS, STATE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " + .build("select ADDRESS, PROVINCE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " + " from ADDRESS ", "1=2" )); - /*" select ADDRESS, STATE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " + /*" select ADDRESS, PROVINCE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " + " from ADDRESS " + " where RELATION_ID = '" + pContactId + "' "); */ - columns = ["ADDRESS", "STATE", "CITY", "COUNTRY", "REGION", "BUILDINGNO", "ADDRESSADDITION", "ZIP", "DISTRICT"]; + columns = ["ADDRESS", "PROVINCE", "CITY", "COUNTRY", "REGION", "BUILDINGNO", "ADDRESSADDITION", "ZIP", "DISTRICT"]; columnTypes = db.getColumnTypes("ADDRESS", columns); //Jede Addresse muss separat anonymisiert werden @@ -613,7 +633,7 @@ DataPrivacyUtils.dsgvoMkDataAnonymous = function(pPersId, pContactId) //condition = " CONTACT_ID = '" + pContactId + "' and ADDRESSID = '" + data[i][9] + "' "; updArray.push(["ADDRESS", columns, columnTypes, values, condition]); } - newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), $KeywordRegistry.DSGVOTablename$address())); + newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTablename(), $KeywordRegistry.dsgvoTablename$address())); } //Kommunikationsdaten @@ -637,7 +657,7 @@ DataPrivacyUtils.dsgvoMkDataAnonymous = function(pPersId, pContactId) updArray.push(["COMM", columns, columnTypes, values, condition]); } - newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), $KeywordRegistry.DSGVOTablename$communication())); + newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTablename(), $KeywordRegistry.dsgvoTablename$communication())); } if (updArray.length > 0) diff --git a/process/Date_lib/process.js b/process/Date_lib/process.js index 5e157445c3a5c69fd054929d7c210f8d7505422f..60a391e0f50071c1c2390d35d5a2b0874de60ba6 100644 --- a/process/Date_lib/process.js +++ b/process/Date_lib/process.js @@ -1,3 +1,4 @@ +import("system.vars"); import("system.eMath"); import("system.translate"); import("system.datetime"); @@ -142,4 +143,16 @@ DateUtils.formatDurationFromStartTillEnd = function(pStartTime, pEndTime, pLocal var duration = eMath.subInt(pEndTime , pStartTime); duration = Math.max(0, Number(duration)); return DateUtils.formatDuration(duration, pLocale); -}; \ No newline at end of file +}; + +/** + * validates if the given date is not in the future + * + * @param {string|number} pDate + * + * @return {boolean} true if the date is today or before today + */ +DateUtils.validateNotInFuture = function (pDate) +{ + return Number(datetime.clearTime(pDate)) <= Number(vars.get("$sys.today")); +} \ No newline at end of file diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index a9294bcec2d42ed5e546ff7ab868b1954ef1e08b..f5c4c3a2d2e4e50acdb563adc90836129952799c 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -26,6 +26,16 @@ import("Email_lib"); * * @class */ +var DocumentTemplate = (function () +{ + +/** + * constructor for DocumentTemplate + * + * @param {String} pTemplateContent content, as base64 string (except for DocumentTemplate.types.PLAIN, then it's a normal string) + * @param {String} pType type of the template, use the DocumentTemplate.types constants here + * @param {String} [pFilename] file name of the template + */ function DocumentTemplate (pTemplateContent, pType, pFilename) { this.content = pTemplateContent; @@ -33,6 +43,9 @@ function DocumentTemplate (pTemplateContent, pType, pFilename) this.filename = pFilename; } +/** + * @return {String} the text of the content + */ DocumentTemplate.prototype.toString = function () { if (this.type == DocumentTemplate.types.PLAIN) @@ -52,7 +65,42 @@ DocumentTemplate.types = { EML : "eml", ODT : "odt", DOCX : "docx", - PLAIN : "plain" //for simple strings + PLAIN : "plain", //for simple strings + fromFileExtension : function (pFileExtension) + { + switch (pFileExtension) + { + case "html": + case "htm": + return this.HTML; + case "eml": + return this.EML; + case "odt": + return this.ODT; + case "docx": + return this.DOCX; + case "txt": + default: + return this.TXT; + } + }, + fromMimeType : function (pMimetype) + { + switch (pMimetype) + { + case "text/html": + return this.HTML; + case "message/rfc822": + return this.EML; + case "application/vnd.oasis.opendocument.text": + return this.ODT; + case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": + return this.DOCX; + case "text/plain": + default: + return this.TXT; + } + } }; /** @@ -62,12 +110,10 @@ DocumentTemplate.types = { * @param {String} [pAssignmentTable="DOCUMENTTEMPLATE"] the LOB assignment table * * @return {DocumentTemplate} template object - * - * @throws {Error} if the type can't be used */ DocumentTemplate.loadTemplate = function (pAssignmentRowId, pAssignmentTable) { - var alias = "_____SYSTEMALIAS"; + var alias = SqlUtils.getSystemAlias(); if (!pAssignmentTable) pAssignmentTable = "DOCUMENTTEMPLATE"; var templateDocument = db.getBinaryMetadata(pAssignmentTable, "DOCUMENT", pAssignmentRowId, false, alias, null); @@ -76,60 +122,68 @@ DocumentTemplate.loadTemplate = function (pAssignmentRowId, pAssignmentTable) var binaryId = templateDocument[0][db.BINARY_ID]; var filename = templateDocument[0][db.BINARY_FILENAME]; var mimetype = templateDocument[0][db.BINARY_MIMETYPE]; - var typeMap = { - "text/plain" : DocumentTemplate.types.TXT, - "text/html" : DocumentTemplate.types.HTML, - "message/rfc822" : DocumentTemplate.types.EML, - "application/vnd.oasis.opendocument.text" : DocumentTemplate.types.ODT, - "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : DocumentTemplate.types.DOCX - }; - var type = typeMap[mimetype]; - if (type === undefined) - throw new Error("Invalid mime type for document template"); + var type = DocumentTemplate.types.fromMimeType(mimetype); return new DocumentTemplate(db.getBinaryContent(binaryId, alias), type, filename); } /** - * Replace function that works with strings instead of regular expressions - * so that control characters (for example '{', '}') don't have to be escaped. + * makes a DocumentTemplate from a upload value * - * @private + * @param {String} pUploadValue the value you get from a file field + * @return {DocumentTemplate} a document template */ -DocumentTemplate._replaceText = function (pText, pReplacements) +DocumentTemplate.fromUpload = function (pUploadValue) { - for (let placeholder in pReplacements) - pText = pText.replace(placeholder, pReplacements[placeholder], "ig"); - return pText; + var bindata = DocumentUtil.getBindataFromUpload(pUploadValue); + var mimeType = DocumentUtil.getMimeTypeFromUpload(pUploadValue); + var filename = DocumentUtil.getFilenameFromUpload(pUploadValue); + var type; + + //if the mimetype couldn't be determined, check the file extension + if (mimeType == "application/octet-stream") + type = DocumentTemplate.types.fromFileExtension(DocumentUtil.getFileExtensionFromUpload(filename)); + else + type = DocumentTemplate.types.fromMimeType(mimeType); + + return new DocumentTemplate(bindata, type, filename); } /** - * returns the 'simpleName' of all placeholders that are used in the template - * - * @private + * Function that helps to get the correct template when editing a bulk mail. + * pUploadValue is preferred over pTemplateId, and if pEditedContent is provided, + * it will overwrite the content of the template (but the type will remain the same as + * defined by the upload or templateId, if both are empty, pDefaultType is used) */ -DocumentTemplate.prototype._getRequiredPlaceholders = function () +DocumentTemplate.getSelectedTemplate = function (pTemplateId, pUpladValue, pEditedContent, pDefaultType) { - var allPlaceholders = PlaceholderUtils.getPlaceholders(); - var plainText = this.toString(); - var usedPlaceholders = []; - for (let i = 0, l = allPlaceholders.length; i < l; i++) + if (pUpladValue) + template = DocumentTemplate.fromUpload(pUpladValue); + else if (pTemplateId) + template = DocumentTemplate.loadTemplate(pTemplateId); + else + template = new DocumentTemplate(null, pDefaultType || DocumentTemplate.types.TXT, null); + + if (pEditedContent) { - if (plainText.indexOf(allPlaceholders[i]) !== -1) - usedPlaceholders.push(allPlaceholders[i]); + if (template.type == DocumentTemplate.types.EML || template.type == DocumentTemplate.types.HTML) + pEditedContent = "<html>" + pEditedContent + "</html>"; + template.content = util.encodeBase64String(pEditedContent); } - return usedPlaceholders; + return template; } -/** +/** * Returns the template content with replaced placeholders by choosing the right * replace function for the type. * * @param {Object} pReplacements map, the structure is {placeholder : value} + * @param {boolean} pEncoded if the replaced content should be base64 encoded + * (doesn't affect odt/docx) * * @return {String} the replaced content */ -DocumentTemplate.prototype.getReplacedContent = function (pReplacements) +DocumentTemplate.prototype.getReplacedContent = function (pReplacements, pEncoded) { switch (this.type) { @@ -137,16 +191,25 @@ DocumentTemplate.prototype.getReplacedContent = function (pReplacements) for (let i in pReplacements) pReplacements[i] = text.text2html(pReplacements[i], false); case DocumentTemplate.types.TXT: - let decodedContent = util.decodeBase64String(this.content) - return DocumentTemplate._replaceText(decodedContent, pReplacements); + let decodedContent = util.decodeBase64String(this.content); + let encodedContent = TemplateHelper._replaceText(decodedContent, pReplacements); + if (pEncoded) + encodedContent = util.encodeBase64String(encodedContent); + return encodedContent; case DocumentTemplate.types.EML: - return this._getReplacedEML(pReplacements); + let content = TemplateHelper._getReplacedEML(this, pReplacements); + if (pEncoded) + content = util.encodeBase64String(content); + return content; case DocumentTemplate.types.ODT: - return this._getReplacedODT(pReplacements); + return TemplateHelper._getReplacedODT(this, pReplacements); case DocumentTemplate.types.DOCX: - return this._getReplacedDOCX(pReplacements); + return TemplateHelper._getReplacedDOCX(this, pReplacements); case DocumentTemplate.types.PLAIN: - return DocumentTemplate._replaceText(this.content, pReplacements); + let plainText = TemplateHelper._replaceText(this.content, pReplacements); + if (pEncoded) + plainText = util.encodeBase64String(plainText); + return plainText; default: return null; } @@ -155,26 +218,29 @@ DocumentTemplate.prototype.getReplacedContent = function (pReplacements) /** * replaces the placeholders with data from one contact and returns the result */ -DocumentTemplate.prototype.getReplacedContentByContactId = function (pContactId) +DocumentTemplate.prototype.getReplacedContentByContactId = function (pContactId, pEncoded) { - var replacements = this._getReplacementsByContactIds([pContactId]); - return this.getReplacedContent(replacements[pContactId]); + var replacements = TemplateHelper._getReplacementsByContactIds(this, [pContactId]); + var content = this.getReplacedContent(replacements[pContactId], pEncoded); + + return content; } /** * replaces the placeholders with data from the contacts and returns the result * * @param {Array} pContactIds contact ids + * @param {boolean} pEncoded if the replaced content should be base64 encoded * * @return {Object} replaced content for every contactId */ -DocumentTemplate.prototype.getReplacedContentByContactIds = function (pContactIds) +DocumentTemplate.prototype.getReplacedContentByContactIds = function (pContactIds, pEncoded) { - var replacements = this._getReplacementsByContactIds(pContactIds); + var replacements = TemplateHelper._getReplacementsByContactIds(this, pContactIds); var contents = {}; for (let contactId in replacements) { - contents[contactId] = this.getReplacedContent(replacements[contactId]); + contents[contactId] = this.getReplacedContent(replacements[contactId], pEncoded); } return contents; } @@ -184,7 +250,30 @@ DocumentTemplate.prototype.getReplacedContentByContactIds = function (pContactId * only for ODT * * @param {Array} pContactIds contact ids - * @param {Array} pTableData + * @param {Object[][][]} pTableData Table data for the document, as a three-dimensional array + * of objects (dimensions are: document, table in that document, rows of the table). For the format, see example. + * + * @example + * var contactSql = SqlCondition.begin() + * .andPrepare("CONTACT.ORGANISATION_ID", orgId) + * .buildSql("select FIRSTNAME, LASTNAME from CONTACT join PERSON on CONTACT.PERSON_ID = PERSON.PERSONID"); + * + * var contacts = db.table(contactSql); + * var tblRows = []; + * fnamePlaceholder = PlaceholderUtils.formatPlaceholder("fname"); + * lnamePlaceholder = PlaceholderUtils.formatPlaceholder("lname"); + * + * for (let i = 0; i < contacts.length; i++) + * { + * let names = {}; + * names[fnamePlaceholder] = contacts[i][0]; + * names[lnamePlaceholder] = contacts[i][1]; + * tblRows.push(names); + * } + * + * var tables = [tblRows]; + * var template = DocumentTemplate.loadTEmplate(templateId); + * var letter = template.getSerialLetterByContactIds([contactId], [tables]); * * @return {Object} the content of the replaced ODT */ @@ -192,11 +281,11 @@ DocumentTemplate.prototype.getSerialLetterByContactIds = function (pContactIds, { if (this.type == DocumentTemplate.types.ODT) { - let replacements = this._getReplacementsByContactIds(pContactIds); + let replacements = TemplateHelper._getReplacementsByContactIds(this, pContactIds); let replaceArray = []; for (let i = 0, l = pContactIds.length; i < l; i++) replaceArray.push(replacements[pContactIds[i]]); - return this._getReplacedODT(replaceArray, pTableData); + return TemplateHelper._getReplacedODT(this, replaceArray, pTableData); } return null; } @@ -211,14 +300,14 @@ DocumentTemplate.prototype.getSerialLetterByContactIds = function (pContactIds, */ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds) { - var replacements = this._getReplacementsByContactIds(pContactIds); + var replacements = TemplateHelper._getReplacementsByContactIds(this, pContactIds); var emailObj = {}; for (let contactId in replacements) { if (this.type == DocumentTemplate.types.EML) { //use the special function for EML to also fill subject and sender - emailObj[contactId] = this._getReplacedEML(replacements[contactId], true); + emailObj[contactId] = TemplateHelper._getReplacedEML(this, replacements[contactId], true); } else { @@ -231,18 +320,52 @@ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds return emailObj; } +/** + * Provides functions for the DocumentTemplate object that aren't accessible from outside + */ +function TemplateHelper () {} +/** + * Replace function that works with strings instead of regular expressions + * so that control characters (for example '{', '}') don't have to be escaped. + */ +TemplateHelper._replaceText = function (pText, pReplacements) +{ + for (let placeholder in pReplacements) + pText = pText.replace(placeholder, pReplacements[placeholder], "ig"); + return pText; +} + +/** + * returns the 'simpleName' of all placeholders that are used in the template + * + * @private + */ +TemplateHelper._getRequiredPlaceholders = function (pTemplate) +{ + var allPlaceholders = PlaceholderUtils.getPlaceholders(); + var plainText = pTemplate.toString(); + var usedPlaceholders = []; + for (let i = 0, l = allPlaceholders.length; i < l; i++) + { + if (plainText.indexOf(allPlaceholders[i]) !== -1) + usedPlaceholders.push(allPlaceholders[i]); + } + return usedPlaceholders; +} + /** * Builds an object with the placeholder data for multiple contacts * + * @param {DocumentTemplate} pTemplate document template * @param {Array} pContactIds contact ids * * @return {Object} Object containing the data. The structure is like {contactId : {placeholderName : replacementValue, ...}, ...} * * @private */ -DocumentTemplate.prototype._getReplacementsByContactIds = function (pContactIds) +TemplateHelper._getReplacementsByContactIds = function (pTemplate, pContactIds) { - var config = this._getRequiredPlaceholders(); + var config = TemplateHelper._getRequiredPlaceholders(pTemplate); var contactIdPlaceholder = new Placeholder("contactId", Placeholder.types.SQLPART, "CONTACT.CONTACTID"); config = [contactIdPlaceholder].concat(config); var addressData = getAddressesData(pContactIds, config, EmployeeUtils.getCurrentContactId()); //TODO: add sender selection @@ -265,6 +388,7 @@ DocumentTemplate.prototype._getReplacementsByContactIds = function (pContactIds) /** * Replaces placeholders for EML * + * @param {DocumentTemplate} pTemplate document template * @param {Object} pReplacements mapping with replacements for every placeholder * @param {boolean} [pGetEmail] if true, return an Email object (use this if the sender and subject are required) * @@ -272,25 +396,23 @@ DocumentTemplate.prototype._getReplacementsByContactIds = function (pContactIds) * * @private */ -DocumentTemplate.prototype._getReplacedEML = function (pReplacements, pGetEmail) +TemplateHelper._getReplacedEML = function (pTemplate, pReplacements, pGetEmail) { - var mailData = mail.parseRFC(util.decodeBase64String(this.content)); - var email; - var body = DocumentTemplate._replaceText(mailData[mail.MAIL_HTMLTEXT], pReplacements); - if (pGetEmail) - { - var sender = DocumentTemplate._replaceText(mailData[mail.MAIL_SENDER], pReplacements); - var subject = DocumentTemplate._replaceText(mailData[mail.MAIL_SUBJECT], pReplacements); - email = new Email(null, sender, subject, body); - } - else - email = body; + var email = Email.fromRFC(pTemplate.content); + email.body = TemplateHelper._replaceText(email.body, pReplacements); + if (!pGetEmail) + return email.body; + + email.sender = TemplateHelper._replaceText(email.sender, pReplacements); + email.subject = TemplateHelper._replaceText(email.subject, pReplacements); + return email; } /* * replaces a given Odt-File on the server and returns the replaced base64-file * + * @param {DocumentTemplate} pTemplate document template * @param {Object} pReplacements map of placeholders and replacements * @param {Array} pTableData * @@ -298,14 +420,14 @@ DocumentTemplate.prototype._getReplacedEML = function (pReplacements, pGetEmail) * * @private */ -DocumentTemplate.prototype._getReplacedODT = function (pReplacements, pTableData) +TemplateHelper._getReplacedODT = function (pTemplate, pReplacements, pTableData) { //save the file on the server so it can be unzipped via pack.getFromZip var serverFilePath = vars.get("$sys.servertemp") + "/clientid_" + vars.get("$sys.clientid") - + "/" + util.getNewUUID() + "/" + this.filename.replace(/\\/g, "/"); + + "/" + util.getNewUUID() + "/" + pTemplate.filename.replace(/\\/g, "/"); - fileIO.storeData(serverFilePath, this.content, util.DATA_BINARY, false); - if (!_replaceODTFile(pReplacements, serverFilePath)) + fileIO.storeData(serverFilePath, pTemplate.content, util.DATA_BINARY, false); + if (!_replaceODTFile(pReplacements, serverFilePath, pTableData)) return null; var replacedFileData = fileIO.getData(serverFilePath, util.DATA_BINARY); @@ -329,6 +451,9 @@ DocumentTemplate.prototype._getReplacedODT = function (pReplacements, pTableData return false; if (pReplacements.length === undefined) pReplacements = [pReplacements]; + if (!pTableData) + pTableData = []; + if (pReplacements.length !== 0) { //replace placeholders in content.xml @@ -350,38 +475,40 @@ DocumentTemplate.prototype._getReplacedODT = function (pReplacements, pTableData * If you edit the odt and change a placeholder (for example: you change '{@addres@}' to '{@address@}'), * the text is saved in different XML tags and won't be replaced correctly. */ - for (let placeholder in replacements) { currentBody = currentBody.replace(placeholder, replacements[placeholder].replace(/\n/ig, "<text:line-break/>").replace(/&/ig, "&"), "ig"); } - fullBody += currentBody; - - //TODO: TableData -// for (ti = 0; ti < pTableData.length; ti++) -// { -// var tablepos = bulkbody.indexOf( getDefaultODTplaceholer(pTableData[ti].Table, true)); -// if ( tablepos != -1 ) -// { -// var tablebegin = bulkbody.lastIndexOf("<table:table-row", tablepos); -// var tableend = bulkbody.indexOf("</table:table-row>", tablepos ) + 18; -// var lasttable = bulkbody.substr( tableend ); -// var tablerow = bulkbody.substring( tablebegin, tableend ); -// bulkbody = bulkbody.substring( 0, tablebegin ); -// var tabledata = pTableData[ti].TableData[addrdata[i][0]]; -// if ( tabledata != undefined ) -// { -// for (var tz = 0; tz < tabledata.length; tz++) -// { -// var table = tablerow; -// bulkbody += relaceAdditionValues( table, pTableData[ti].Fields, tabledata[tz], pTableData[ti].Table + "." ); -// } -// } -// bulkbody += lasttable; -// } + let tables = pTableData[i] || []; + let fromIndex = 0; + for (let tblIndex = 0; tblIndex < tables.length; tblIndex++) //iterate over all tables in the document + { + let tableData = tables[tblIndex]; + if (tableData && tableData.length > 0) + { + fromIndex = currentBody.indexOf("</table:table>", fromIndex) + 14; + if (fromIndex === -1) //stop if there is no table + break; + + let rowBegin = currentBody.lastIndexOf("<table:table-row", fromIndex); + let rowEnd = currentBody.indexOf("</table:table-row>", rowBegin) + 18; + + let afterTable = currentBody.substr(rowEnd); + let tableRow = currentBody.substring(rowBegin, rowEnd); + currentBody = currentBody.substring(0, rowBegin); + + for (let rowIndex = 0; rowIndex < tableData.length; rowIndex++) + { + let tableRowData = tableData[rowIndex]; + currentBody += TemplateHelper._replaceText(tableRow, tableRowData); + } + currentBody += afterTable; + } + } + fullBody += currentBody; } contentXml = beforeBody + fullBody + afterBody; pack.addToZip(pODTFileName, "content.xml", util.encodeBase64String(contentXml)); @@ -403,32 +530,42 @@ DocumentTemplate.prototype._getReplacedODT = function (pReplacements, pTableData /* * This function is used to replace placeholders via DocXTemplater * + * @param {DocumentTemplate} pTemplate document template * @param {Object} pReplacements - Must contain an object, which holds the placeholders * * @return {String} returns the modified document in a BASE64 coded string * * @private */ -DocumentTemplate.prototype._getReplacedDOCX = function (pReplacements) +TemplateHelper._getReplacedDOCX = function (pTemplate, pReplacements) { var replacements = {}; for (let placeholder in pReplacements) //removes the prefix and postfix, the process needs it like this - replacements[placeholder.slice(3, -3)] = pReplacements[placeholder]; - + replacements[placeholder.slice(2, -2)] = pReplacements[placeholder]; + //this is executed as a process because of better performance var documentData = process.execute("getDocxDocument_serverProcess", { - templateb64: this.content, + templateb64: pTemplate.content, placeholderConfig: JSON.stringify(replacements) //process.execute is only able to handle strings }); return documentData; } + return DocumentTemplate; + +})(); + /** * functions for working with letters (mails) */ function LetterUtils () {} +/** + * opens a new letter + * + * @param {String} pContactId id of the contact to fetch the data from + */ LetterUtils.openNewLetter = function (pContactId) { var params = { diff --git a/process/Document_lib/process.js b/process/Document_lib/process.js index 11766b67485c48e60f1056721516e73be8fdd4f3..4049cfa963c6a9fcfffec8f70256686731840481 100644 --- a/process/Document_lib/process.js +++ b/process/Document_lib/process.js @@ -99,4 +99,23 @@ DocumentUtil.getFileExtensionFromUpload = function(pFileName) { } else return ''; +} + +/** + * Utility function to retrieve the mime type from an uploadcomponent value. + * + * @param {String} pUploadValue the value of the uploadcomponent + * @return {String} the mime type or empty String + */ +DocumentUtil.getMimeTypeFromUpload = function(pUploadValue) { + var res = pUploadValue.split(";"); + if(res.length > 1) + return res[2]; + else + return ''; +} + +DocumentUtil.hasDocuments = function (pAssignmentTable, pAssignmentName, pAssignmentRowId) +{ + return db.getBinaryCount(pAssignmentTable, pAssignmentName, pAssignmentRowId, SqlUtils.getSystemAlias()) > 0; } \ No newline at end of file diff --git a/process/EmailUtil_lib/EmailUtil_lib.aod b/process/EmailUtil_lib/EmailUtil_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..04b24ec7e102599577d29f2cea0cc85e7c4f048d --- /dev/null +++ b/process/EmailUtil_lib/EmailUtil_lib.aod @@ -0,0 +1,9 @@ +<?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>EmailUtil_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/EmailUtil_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/EmailUtil_lib/process.js b/process/EmailUtil_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..8e1269bf616fa353c04235520f88279cba7a9996 --- /dev/null +++ b/process/EmailUtil_lib/process.js @@ -0,0 +1,25 @@ +import("system.mail"); + +/** + * functions for various emailing-functionalities + * Do not create an instance of this! + * + * @static + */ +function EmailUtils () {} + +/** + * Extracts the email address (x[at]x.x) from a complete address that may contain a readable part. + * Does some additional checkings on top of the extractAddress-method + * + * @param {String} pFullMailAddress the complete address. + * + * @return {String} addr-spec part of the mail, e.g. "info@adito.de" + */ +EmailUtils.extractAddress = function (pFullMailAddress) +{ + //special treatment for crazy illegal addresses which can be sent in Outlook + var mailAddress = pFullMailAddress.replace("<'", "<").replace("'>", ">").replace(/^'|'$/g, ""); + mailAddress = mail.extractAddress(mailAddress); + return mailAddress; +}; \ No newline at end of file diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 21cb91c014e71c349257327bf497391fdae9f689..5bb71a3a699572a3336cd6913155d7c9eb7852b9 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -8,7 +8,7 @@ import("DocumentTemplate_lib"); import("system.neon"); import("system.mail"); -function EmailUtils () {} +function EmailWritingUtils () {} /** * creates a new E-Mail-Object and ask for a download of a eml where all fields are prefilled @@ -20,15 +20,16 @@ function EmailUtils () {} * @param {String} pSenderContactId contactId of the sender. the standard mailadress of the contact is used as sender-address * @param {String} [pTemplateId] if a document-template shall be used, give the templateId here * @param {String} [pRecipientContactId] contactId of the recipient, required to fill placeholders + * @return {Array} the eml document as array with [filename, base64] */ -EmailUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId) +EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId) { var email = new Email(pToRecipients); if (pTemplateId) email.setTemplate(pTemplateId, pRecipientContactId); email.setSender(pSenderContactId); - email.downloadEML(); + return email.downloadEML(); } /** @@ -37,7 +38,7 @@ EmailUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTempla * @param {String} pToContactId contactId with contacts to filter the communication-addresses * @param {String} [pToEmailAddress] email address as string that shall be used as recipient-preset */ -EmailUtils.openNewMail = function (pToContactId, pToEmailAddress) +EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress) { var params = { "ContactId_param" : pToContactId @@ -57,7 +58,6 @@ EmailUtils.openNewMail = function (pToContactId, pToEmailAddress) * @param {String} [pBody=null] mail body * @param {Array} [pCcRecipients=[]] array of recipient cc addresses * @param {Array} [pBccRecipients=[]] array of recipient bcc addresses - * * @class */ function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccRecipients) @@ -73,6 +73,22 @@ function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccReci this.bccRecipients = pBccRecipients || []; } +/** + * makes an Email object from a RFC + * + * @param {String} pBase64RFC the RFC mail, base64 encoded + * @return {Email} a new Email object + */ +Email.fromRFC = function (pBase64RFC) +{ + var mailData = mail.parseRFC(util.decodeBase64String(pBase64RFC)); + var body = mailData[mail.MAIL_HTMLTEXT]; + var sender = mailData[mail.MAIL_SENDER]; + var subject = mailData[mail.MAIL_SUBJECT]; + + return new Email(null, sender, subject, body); +} + /** * loads a document template into the mail body * @@ -155,7 +171,7 @@ Email.prototype.getRFCmail = function () if (this.subject) mail.setSubject(mailId, this.subject, ENCODING); - + if (this.body) mail.addText(mailId, this.body, "text/html", ENCODING, null); else @@ -171,7 +187,6 @@ Email.prototype.getRFCmail = function () //X-Uniform-Type-Identifier: com.apple.mail-draft //this could be added later if needed - var mailObj = mail.getCachedMail(mailId); return mail.toRFC(mailObj); } @@ -186,10 +201,23 @@ Email.prototype.openMail = function () /** * ask for a download of the email + * + * @return {Array} array of [filename, EML (base64)] + */ +Email.prototype.downloadEML = function () +{ + var eml = this.getEML(); + var filename = (this.subject || translate.text("Email Template")) + ".eml"; + neon.download(eml, filename); + return [filename, eml]; +} + +/** + * @return {String} RFC mail (base64 encoded) */ -Email.prototype.downloadEML = function() +Email.prototype.getEML = function() { - neon.download(util.encodeBase64String(this.getRFCmail(), null), (this.subject || translate.text("Email Template")) + ".eml"); + return util.encodeBase64String(this.getRFCmail(), null); } /** @@ -197,7 +225,7 @@ Email.prototype.downloadEML = function() * * @return {boolean} true, if the mail was sent sucessfully */ -Email.prototype.send = function () +Email.prototype.send = function (pUser) { var ENCODING = "UTF-8"; var mailId; @@ -214,7 +242,10 @@ Email.prototype.send = function () util.sleep(1500); mailId = mail.newMail(); } - + + if (this.sender) + mail.setSender(mailId, this.sender); + if (this.toRecipients.length) mail.addRecipients(mailId, mail.RECIPIENT_TO, this.toRecipients); @@ -232,11 +263,11 @@ Email.prototype.send = function () else mail.addText(mailId, "", "text/html", ENCODING, null); - mail.sendMail(mailId); - return true; + return mail.sendMailAs(pUser || "mailbridge", mailId) > 0; } catch (ex) { + logging.log(ex); return false; } } \ No newline at end of file diff --git a/process/Entity_lib/process.js b/process/Entity_lib/process.js index 6db3b2deba0ad67d82b693ba8cd5e421a7f547d0..e186510fadbb0ec51885d3e6cc7614715c3b294a 100644 --- a/process/Entity_lib/process.js +++ b/process/Entity_lib/process.js @@ -8,25 +8,47 @@ import("system.vars"); * * @class */ -function ProcessHandlingUtils() {} +function EntityUtils(){} /** -* In onValidation-Process a local variable called "$local.value" is made available from kernel. -* It contains the entered value - the field contains the value only after successfull validation (vars.get("$field.Fieldname")). -* The onValidation-Process is running again before saving the entity, at this point there's "$local.value" varialbe no longer available, -* but the entered value now is the present one because the field has already been validated before. -* Otherwise a "variable not found" error would occur. -* -* @param {String} [fieldValue=current field value] value of the field onValidation-Process is executed ( e.g. vars.get("$field.Fieldname") ) -* -* @return {String} Field value for onValidation-Process + * parses a full-databnase-uid-name into a table and a column identifier + * + * @param {String} pFullUidName full-databnase-uid-name like "ORGANISATION.ORGANISATIONID", the variable "$sys.uidcolumn" returns this for example + * + * @return {Object} new object with 2 properties: - table: contains the tablename, - column: contains the columnname + */ +EntityUtils.parseUidColumn = function(pFullUidName) +{ + var pos = pFullUidName.lastIndexOf("."); + return { + table: pFullUidName.substring(0, pos), + column: pFullUidName.substring(++pos) + }; +}; + +/** +* provides static methods for special handling of entities in JDito-Processes +* do not create an instance of this +* +* @class */ +function ProcessHandlingUtils() {} + +/** + * @deprecated THIS ERROR IS FIXED. YOU SHOULD USE vars.get("$local.value") DIRECTLY NOW + * + * In onValidation-Process a local variable called "$local.value" is made available from kernel. + * It contains the entered value - the field contains the value only after successfull validation (vars.get("$field.Fieldname")). + * The onValidation-Process is running again before saving the entity, at this point there's "$local.value" varialbe no longer available, + * but the entered value now is the present one because the field has already been validated before. + * Otherwise a "variable not found" error would occur. + * + * @param {String} [fieldValue=current field value] value of the field onValidation-Process is executed ( e.g. vars.get("$field.Fieldname") ) + * + * @return {String} Field value for onValidation-Process + */ ProcessHandlingUtils.getOnValidationValue = function(fieldValue) { - if (fieldValue == undefined) { - fieldValue = vars.get("$this.value"); - } - - return (vars.exists("$local.value") && vars.get("$local.value") != null) ? vars.get("$local.value") : fieldValue; + return vars.get("$local.value"); } /** @@ -117,14 +139,13 @@ FieldChanges.assimilateChangeAndDispose = function (pFieldName, pAssimilatorFn) /** * Call this if the field changed. */ -FieldChanges.setChange = function(pFieldName) +FieldChanges.setChange = function(pFieldName, pValue) { var allChanges = FieldChanges._getStorage(); if (allChanges[pFieldName] == undefined) allChanges[pFieldName] = {}; - var value = vars.get(pFieldName); - if (!value) + if (!pValue) allChanges[pFieldName].state = FieldChanges.STATE_DELETED(); else allChanges[pFieldName].state = FieldChanges.STATE_CHANGED(); diff --git a/process/IncomingCallExecutor_lib/process.js b/process/IncomingCallExecutor_lib/process.js index 73b5e9adbc13f2fee70b5f317be79a4b153c8b82..ac21567d19fc3c9d4f98f7e425cb82031ef82ffa 100644 --- a/process/IncomingCallExecutor_lib/process.js +++ b/process/IncomingCallExecutor_lib/process.js @@ -165,7 +165,7 @@ IncomingCallExecutor._getContactsFromNumber = function(pNumber) }); config = entities.createConfigForLoadingRows().entity("AnyContact_entity") - .fields(["CONTACTID", "ORGANISATION_ID", "ORGANISATION_NAME", "PERSON_ID", "LANGUAGE", "PERSON_FULL_NAME"]) + .fields(["CONTACTID", "ORGANISATION_ID", "ORGANISATION_NAME", "PERSON_ID", "ISOLANGUAGE", "PERSON_FULL_NAME"]) .uids(contactIds); rows = entities.getRows(); return rows; @@ -174,7 +174,7 @@ IncomingCallExecutor._getContactsFromNumber = function(pNumber) var contactSql = SqlCondition.begin() .andPrepare("COMMUNICATION.ADDR", phoneNumber) .andPrepare("CONTACT.STATUS", $KeywordRegistry.contactStatus$active()) - .buildSql("select CONTACT.CONTACTID, CONTACT.ORGANISATION_ID, ORGANISATION.NAME, CONTACT.PERSON_ID, CONTACT.LANGUAGE, PERSON.LASTNAME, PERSON.FIRSTNAME from CONTACT \n\ + .buildSql("select CONTACT.CONTACTID, CONTACT.ORGANISATION_ID, ORGANISATION.NAME, CONTACT.PERSON_ID, CONTACT.ISOLANGUAGE, PERSON.LASTNAME, PERSON.FIRSTNAME from CONTACT \n\ join ORGANISATION on ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID \n\ left join PERSON on CONTACT.PERSON_ID = PERSON.PERSONID \n\ join COMMUNICATION on COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID"); @@ -212,7 +212,7 @@ IncomingCallExecutor.prototype.getLocaleFromUser = function(pUserObject) }); //language for output like notifications, this is most likely used within the callback-functions (action handlers): if (contact && contact.LANGUAGE) - return contact.LANGUAGE; + return contact.ISOLANGUAGE; else return null; }; diff --git a/process/IncomingEmailExecutor_lib/process.js b/process/IncomingEmailExecutor_lib/process.js index 783a4a805ee1d103fec4e804f77747da8cb87c83..096ef3111e2f05371f5de193cb0a165db89d412b 100644 --- a/process/IncomingEmailExecutor_lib/process.js +++ b/process/IncomingEmailExecutor_lib/process.js @@ -1,4 +1,5 @@ -import("system.logging"); +import("EmailUtil_lib"); +import("Util_lib"); import("system.question"); import("system.datetime"); import("system.vars"); @@ -14,144 +15,193 @@ import("KeywordRegistry_basic"); //TODO: comment library -function IncomingEmailExecutor(){ } - -IncomingEmailExecutor._getContactDataByEmail = function (pMailAddress, pAlias) -{ - var sql = SqlCondition.begin(pAlias) - .andPrepare("COMMUNICATION.ADDR", mail.extractAddress(pMailAddress).toUpperCase(), "upper(#) = ?") - .buildSql("select CONTACT.CONTACTID, CONTACT.STATUS, CONTACT.PERSON_ID \n\ - from COMMUNICATION \n\ - join CONTACT on (COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID)"); - var res = db.table(sql, pAlias); - return res; -}; - -IncomingEmailExecutor.mailToActivity = function(pMail, pUnlinkedMailId, pAlias) +function IncomingEmailExecutor(pMail) { //whenver this function is called it may not be in a context where a alias is given: the mail-importing-entity for example has no alias. //therefore set it here manually - var alias = pAlias || db.getCurrentAlias(); - var mailObj = pMail; + this._alias = null; + this.setAlias(); + this.rawMail = pMail; + this.mailSubject = this.rawMail[mail.MAIL_SUBJECT] || ""; + this.mailSender = this.rawMail[mail.MAIL_SENDER]; + this.mailSentDate = this.rawMail[mail.MAIL_SENTDATE]; + this.mailSender = this.rawMail[mail.MAIL_SENDER]; - var subject = mailObj[mail.MAIL_SUBJECT] || ""; - var sender = mailObj[mail.MAIL_SENDER]; - var recipientsTo = mailObj[mail.RECIPIENT_TO].split(";"); - var recipientsCc = mailObj[mail.RECIPIENT_CC].split(";"); - var recipientsBcc = mailObj[mail.RECIPIENT_BCC].split(";"); - var recipients = recipientsTo.concat(recipientsCc, recipientsBcc).filter(function (elem){ + var mailRecipientsTo = this.rawMail[mail.RECIPIENT_TO].split(";"); + var mailRecipientsCc = this.rawMail[mail.RECIPIENT_CC].split(";"); + var mailRecipientsBcc = this.rawMail[mail.RECIPIENT_BCC].split(";"); + this.mailRecipients = mailRecipientsTo.concat(mailRecipientsCc, mailRecipientsBcc).filter(function (elem){ return elem != "" && elem != null; }); - - var htmlMailText = mailObj[mail.MAIL_ATTACHMENTCOUNT] + " Attachement(s)<br/><br/>\n"; - //since the activity has always and only a HTML-content-field we need to ensure that there will be always a HTML-content - if (mailObj[mail.MAIL_HTMLTEXT]) - htmlMailText += mailObj[mail.MAIL_HTMLTEXT]; - else - htmlMailText += text.text2html(mailObj[mail.MAIL_TEXT], true); - - var sentdate = mailObj[mail.MAIL_SENTDATE]; - var senderInfo = sender ? IncomingEmailExecutor._getContactDataByEmail(sender, alias) : []; - - if (senderInfo.length == 0) - { - if (!pUnlinkedMailId) - { - var unlinkedMailId = util.getNewUUID(); - var cols = ["AB_UNLINKEDMAILID", "SUBJECT", "SENTDATE", "SENDER", "RECIPIENTS", "MAIL", "USER_NEW", "DATE_NEW"]; - var vals = [unlinkedMailId, subject, sentdate, sender, recipients.join(", "), mail.toRFC(mailObj), vars.get("$sys.user"), datetime.date()]; - db.insertData("AB_UNLINKEDMAIL", cols, null, vals, alias); - } - - return { - unlinkedMailId: unlinkedMailId - }; - } - + + this._senderInfo = null; + //activity data and failbackActivityData will be merged later to get all the data we need //we always want to prefer contacts that are active to those who are inactive (that applies to the sender and to the recipients) - var activityData = { + this.activityData = { links: [] }; - var failbackActivityData = { + this.failbackActivityData = { employeeContactId: "", direction: $KeywordRegistry.activityDirection$incoming() }; +} + +IncomingEmailExecutor.prototype.setActivityEmployeeContactId = function (pId) +{ + this.activityData.employeeContactId = pId; +}; + +IncomingEmailExecutor.prototype.setAlias = function(pAlias) +{ + this._alias = pAlias || db.getCurrentAlias(); +}; + +IncomingEmailExecutor.prototype.getMailtextAsHtml = function() +{ + var htmlMailText = this.rawMail[mail.MAIL_ATTACHMENTCOUNT] + " Attachement(s)<br/><br/>\n"; + //since the activity has always and only a HTML-content-field we need to ensure that there will be always a HTML-content + if (this.rawMail[mail.MAIL_HTMLTEXT]) + htmlMailText += this.rawMail[mail.MAIL_HTMLTEXT]; + else + htmlMailText += text.text2html(this.rawMail[mail.MAIL_TEXT], true); + return htmlMailText; +}; + +IncomingEmailExecutor.prototype.getSenderInfo = function() +{ + if (this._senderInfo == null) + this._senderInfo = this.mailSender ? IncomingEmailExecutor.getContactDataByEmail(this.mailSender, this._alias) : []; + return this._senderInfo; +} + +IncomingEmailExecutor.prototype.insertUnlinkedMail = function () +{ + var unlinkedMailId = util.getNewUUID(); + var cols = ["AB_UNLINKEDMAILID", "SUBJECT", "SENTDATE", "SENDER", "RECIPIENTS", "MAIL", "USER_NEW", "DATE_NEW"]; + var vals = [unlinkedMailId, this.mailSubject, this.mailSentDate, this.mailSender, this.mailRecipients.join(", "), mail.toRFC(this.rawMail), vars.get("$sys.user"), datetime.date()]; + db.insertData("AB_UNLINKEDMAIL", cols, null, vals, this._alias); + + return { + unlinkedMailId: unlinkedMailId + }; +}; + +IncomingEmailExecutor.prototype.isUnlinkable = function () +{ + return this.getSenderInfo().length == 0; +} +IncomingEmailExecutor.getContactDataByEmail = function (pMailAddress, pAlias) +{ + var mailAddress = EmailUtils.extractAddress(pMailAddress).toUpperCase(); + var sql = SqlCondition.begin(pAlias) + .andPrepare("COMMUNICATION.ADDR", mailAddress, "upper(#) = ?") + .buildSql("select CONTACT.CONTACTID, CONTACT.STATUS, CONTACT.PERSON_ID \n\ + from COMMUNICATION \n\ + join CONTACT on (COMMUNICATION.CONTACT_ID = CONTACT.CONTACTID)"); + var res = db.table(sql, pAlias); + return res; +}; + +IncomingEmailExecutor.prototype.createActivity = function(pAdditionalLinks) +{ var senderContacts = { prefered: [], failback: [] }; - senderInfo.forEach(_getProcessingFunction(true), senderContacts); - activityData.links = activityData.links.concat(senderContacts.prefered.length > 0 ? senderContacts.prefered : senderContacts.failback); + this.getSenderInfo().forEach(this._getProcessingFunction(true, senderContacts), this); + this.activityData.links = this.activityData.links.concat(senderContacts.prefered.length > 0 ? senderContacts.prefered : senderContacts.failback); - var contactInfoProcessingFn = _getProcessingFunction(false); - for (var i = 0, l = recipients.length; i < l; i++) + for (var i = 0, l = this.mailRecipients.length; i < l; i++) { - var recipientsInfo = IncomingEmailExecutor._getContactDataByEmail(recipients[i], alias); + var recipientsInfo = IncomingEmailExecutor.getContactDataByEmail(this.mailRecipients[i], this._alias); var recipientContacts = { prefered: [], failback: [] }; - recipientsInfo.forEach(contactInfoProcessingFn, recipientContacts); - activityData.links = activityData.links.concat(recipientContacts.prefered.length > 0 ? recipientContacts.prefered : recipientContacts.failback); + recipientsInfo.forEach(this._getProcessingFunction(false, recipientContacts), this); + this.activityData.links = this.activityData.links.concat(recipientContacts.prefered.length > 0 ? recipientContacts.prefered : recipientContacts.failback); } - + //collecting all the information and combine it for the creation var activityDataForInsert = { - subject: subject, - content: htmlMailText, + subject: this.mailSubject, + content: this.getMailtextAsHtml(), categoryKeywordId: $KeywordRegistry.activityCategory$mail(), - directionKeywordId: activityData.direction || failbackActivityData.direction, - responsibleContactId: activityData.employeeContactId || failbackActivityData.employeeContactId + directionKeywordId: this.activityData.direction || this.failbackActivityData.direction, + responsibleContactId: this.activityData.employeeContactId || this.failbackActivityData.employeeContactId }; - var activityLinks = activityData.links || failbackActivityData.links; - var activityDocs = [["mail.eml", util.encodeBase64String(mail.toRFC(pMail)), true]]; - var activityRes = ActivityUtils.insertNewActivity(activityDataForInsert, activityLinks, activityDocs, pAlias); + var activityLinks = this.activityData.links || this.failbackActivityData.links; + if (pAdditionalLinks) + activityLinks = activityLinks.concat(pAdditionalLinks); + activityLinks = ArrayUtils.distinct2d(activityLinks);//TODO: better check before adding the elements into the array if it already exists there + var activityDocs = [["mail.eml", util.encodeBase64String(mail.toRFC(this.rawMail)), true]]; + var activityRes = ActivityUtils.insertNewActivity(activityDataForInsert, activityLinks, activityDocs, this._alias); + return activityRes; +}; + +IncomingEmailExecutor.prototype.deleteUnlinkedMail = function (pUnlinkedMailId) +{ if (pUnlinkedMailId) { - db.deleteData("AB_UNLINKEDMAIL", SqlCondition.begin().andPrepare("AB_UNLINKEDMAIL.AB_UNLINKEDMAILID", pUnlinkedMailId).build(), alias); + db.deleteData("AB_UNLINKEDMAIL", SqlCondition.begin().andPrepare("AB_UNLINKEDMAIL.AB_UNLINKEDMAILID", pUnlinkedMailId).build(), this._alias); } - - return activityRes; +}; - function _getProcessingFunction(pIsSender) +IncomingEmailExecutor.prototype.autoProcess = function(pUnlinkedMailId) +{ + if (this.isUnlinkable()) { - return function(contactInfoRow) { - var contactId, contactStatus, contactPersonId; - [contactId, contactStatus, contactPersonId] = contactInfoRow; + if (pUnlinkedMailId) + return { + unlinkedMailId: pUnlinkedMailId + }; + else + return this.insertUnlinkedMail(); + } - //there *should* only exist no or one user per contactid, never two or more - so getUser (not getUsers) should be fine - var user = tools.getUserByAttribute(tools.CONTACTID, [contactId]); - var isEmployee = user != null; - var isContactActive = contactStatus == $KeywordRegistry.contactStatus$active(); + var activityRes = this.createActivity(); + this.deleteUnlinkedMail(pUnlinkedMailId); + return activityRes; +}; - //if a user was already found we can skip determining the correct user since only one user can be set as "RESPONSIBLE" in the activity - if (isEmployee && !activityData.employeeContactId) +IncomingEmailExecutor.prototype._getProcessingFunction = function (pIsSender, pTargetArray) +{ + return function(contactInfoRow) { + var contactId, contactStatus, contactPersonId; + [contactId, contactStatus, contactPersonId] = contactInfoRow; + + //there *should* only exist no or one user per contactid, never two or more - so getUser (not getUsers) should be fine + var user = tools.getUserByAttribute(tools.CONTACTID, [contactId]); + var isEmployee = user != null; + var isContactActive = contactStatus == $KeywordRegistry.contactStatus$active(); + + //if a user was already found we can skip determining the correct user since only one user can be set as "RESPONSIBLE" in the activity + if (isEmployee && !this.activityData.employeeContactId) + { + var direction = pIsSender ? $KeywordRegistry.activityDirection$outgoing() : $KeywordRegistry.activityDirection$incoming(); + if (isContactActive) { - var direction = pIsSender ? $KeywordRegistry.activityDirection$outgoing() : $KeywordRegistry.activityDirection$incoming(); - if (isContactActive) - { - activityData.employeeContactId = contactId; - activityData.direction = direction; - } - else - { - //if the user is inactive, we may find a better (=active) user later - failbackActivityData.employeeContactId = contactId; - failbackActivityData.direction = direction; - } + this.activityData.employeeContactId = contactId; + this.activityData.direction = direction; } else { - var link = [(contactPersonId == "" ? "Organisation" : "Person"), contactId]; - if (isContactActive) - this["prefered"].push(link); - else - this["failback"].push(link); - } - }; - } + //if the user is inactive, we may find a better (=active) user later + this.failbackActivityData.employeeContactId = contactId; + this.failbackActivityData.direction = direction; + } + } + else + { + var link = [(contactPersonId == "" ? "Organisation" : "Person"), contactId]; + if (isContactActive) + pTargetArray["prefered"].push(link); + else + pTargetArray["failback"].push(link); + } + }; }; \ No newline at end of file diff --git a/process/JditoFilter_lib/process.js b/process/JditoFilter_lib/process.js index 75d84b59c61ce1cbdf111641aa19ba4da5863c17..077e6c10ae51501eea5da69c6bf9aff375ad5715 100644 --- a/process/JditoFilter_lib/process.js +++ b/process/JditoFilter_lib/process.js @@ -1,11 +1,16 @@ -import("system.logging"); import("Sql_lib"); +//private scope to make only JditoFilterUtils public +var JditoFilterUtils = (function () +{ + /** * object for filtering records * * @param {Array} pColumns the column names * @param {Object} pFilter the filter object + * + * @private */ function JditoFilterHelper (pColumns, pFilter) { @@ -231,4 +236,7 @@ JditoFilterUtils.getSqlCondition = function (pFilter, pTable, pTableAlias, pColu return "# is not null"; } } -} \ No newline at end of file +} + return JditoFilterUtils; //return only functions that should be public + +})(); \ No newline at end of file diff --git a/process/KeywordData_lib/process.js b/process/KeywordData_lib/process.js index f1102303109f2398aac93b1d92b558973a4be6e6..930d056393a8989f28842af3307d707754773264 100644 --- a/process/KeywordData_lib/process.js +++ b/process/KeywordData_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.translate"); import("system.db"); import("DataCaching_lib"); @@ -14,11 +13,18 @@ The idea behind this is to maintain data in cached form (client-context-side)) f function KeywordData(){} -KeywordData.getSimpleData = function (pKeywordContainer, pLocale) +KeywordData.getSimpleData = function (pKeywordContainer, pLocale, pOnlyActives) { - var cache = new CachedData("KeywordSimpleData_" + pKeywordContainer, true, pLocale); + var onlyActives = (pOnlyActives == undefined ? true : pOnlyActives); + var flags = "#" + (onlyActives ? "1" : "0"); + var identifier = "KeywordSimpleData_" + pKeywordContainer + flags; + var cache = new CachedData(identifier, true, pLocale); return cache.load(function (pTranslationNecessary, pLocale){ var cond = SqlCondition.begin().andPrepare("AB_KEYWORD_ENTRY.CONTAINER", pKeywordContainer); + + if (onlyActives) + cond.andPrepare("AB_KEYWORD_ENTRY.ISACTIVE", "1"); + var keywordData = db.table(cond.buildSql("select AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ENTRY.TITLE from AB_KEYWORD_ENTRY", null, "order by AB_KEYWORD_ENTRY.SORTING asc, AB_KEYWORD_ENTRY.TITLE asc")); @@ -52,7 +58,7 @@ KeywordData.getKeywordAttributeRelations = function (pKeywordContainer) var cond = SqlCondition.begin() .andPrepare("AB_KEYWORD_ENTRY.CONTAINER", pKeywordContainer); - var sql = cond.buildSql("select AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ATTRIBUTE.NAME, AB_KEYWORD_ATTRIBUTE.TYPE, \n\ + var sql = cond.buildSql("select AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ATTRIBUTE.NAME, AB_KEYWORD_ATTRIBUTE.KIND, \n\ AB_KEYWORD_ATTRIBUTERELATION.CHAR_VALUE, AB_KEYWORD_ATTRIBUTERELATION.LONG_CHAR_VALUE, AB_KEYWORD_ATTRIBUTERELATION.NUMBER_VALUE, AB_KEYWORD_ATTRIBUTERELATION.BOOL_VALUE \n\ from AB_KEYWORD_ENTRY \n\ join AB_KEYWORD_ATTRIBUTE on (AB_KEYWORD_ATTRIBUTE.CONTAINER = AB_KEYWORD_ENTRY.CONTAINER) \n\ diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js index d29cde2eb883c4518c6a6e7ee6dd8b0c61c6dd07..dc11d8a098008e549a1fd82b93da0ebbf791ec37 100644 --- a/process/KeywordRegistry_basic/process.js +++ b/process/KeywordRegistry_basic/process.js @@ -16,16 +16,17 @@ * $KeywordRegistry.activityDirection() */ function $KeywordRegistry(){} -$KeywordRegistry._autoPad = function(pKey){return pKey + " ".repeat(Math.max(0, 36-pKey.length))}; +// this function can also be found as StringUtils.pad36() in Util_lib and is just here to avoid an import because this registry is heavily used. +$KeywordRegistry._autoPad = function(pKey){return (pKey + " ").slice(0, 36)}; $KeywordRegistry.attributeType = function(){return "AttributeType";}; $KeywordRegistry.keywordAttributeType = function(){return "KeywordAttributeType";}; $KeywordRegistry.contractPayment = function(){return "ContractPayment";}; $KeywordRegistry.contractStatus = function(){return "ContractStatus";}; -$KeywordRegistry.contractState$validLimited = function(){return "CONTRACTSTATVALIDLI ";}; -$KeywordRegistry.contractState$validUnlimited = function(){return "CONTRACTSTATVALIDUNLI ";}; -$KeywordRegistry.contractState$notSigned = function(){return "CONTRACTSTATSIGN ";}; +$KeywordRegistry.contractState$validLimited = function(){return $KeywordRegistry._autoPad("CONTRACTSTATVALIDLI");}; +$KeywordRegistry.contractState$validUnlimited = function(){return $KeywordRegistry._autoPad("CONTRACTSTATVALIDUNLI");}; +$KeywordRegistry.contractState$notSigned = function(){return $KeywordRegistry._autoPad("CONTRACTSTATSIGN");}; $KeywordRegistry.contractType = function(){return "ContractType";}; @@ -37,86 +38,96 @@ $KeywordRegistry.contactStatus = function(){return "ContactStatus";}; $KeywordRegistry.contactStatus$active = function(){return $KeywordRegistry._autoPad("CONTACTSTATACTIVE");}; $KeywordRegistry.currency = function(){return "Currency";}; -$KeywordRegistry.currency$eur = function(){return "EUR ";}; +$KeywordRegistry.currency$eur = function(){return $KeywordRegistry._autoPad("EUR");}; $KeywordRegistry.productGroupcode = function(){return "ProductGroupcode";}; $KeywordRegistry.offerStatus = function(){return "OfferStatus";}; -$KeywordRegistry.offerStatus$open = function(){return "OFFERSTATOPEN ";}; -$KeywordRegistry.offerStatus$checked = function(){return "OFFERSTATCHECK ";}; -$KeywordRegistry.offerStatus$sent = function(){return "OFFERSTATSENT ";}; -$KeywordRegistry.offerStatus$won = function(){return "OFFERSTATWON ";}; -$KeywordRegistry.offerStatus$lost = function(){return "OFFERSTATLOST ";}; +$KeywordRegistry.offerStatus$open = function(){return $KeywordRegistry._autoPad("OFFERSTATOPEN");}; +$KeywordRegistry.offerStatus$checked = function(){return $KeywordRegistry._autoPad("OFFERSTATCHECK");}; +$KeywordRegistry.offerStatus$sent = function(){return $KeywordRegistry._autoPad("OFFERSTATSENT");}; +$KeywordRegistry.offerStatus$won = function(){return $KeywordRegistry._autoPad("OFFERSTATWON");}; +$KeywordRegistry.offerStatus$lost = function(){return $KeywordRegistry._autoPad("OFFERSTATLOST");}; $KeywordRegistry.organisationType = function(){return "OrganisationType";}; -$KeywordRegistry.organisationType$manufacturer = function(){return "ORGMANUF";}; -$KeywordRegistry.organisationType$competitor = function(){return "ORGCOMP";}; +$KeywordRegistry.organisationType$manufacturer = function(){return $KeywordRegistry._autoPad("ORGMANUF");}; +$KeywordRegistry.organisationType$competitor = function(){return $KeywordRegistry._autoPad("ORGCOMP");}; $KeywordRegistry.personGender = function(){return "PersonGender";}; $KeywordRegistry.taskStatus = function(){return "TaskStatus";}; -$KeywordRegistry.taskStatus$new = function(){return "NEW ";}; -$KeywordRegistry.taskStatus$unassigned = function(){return "UNASSIGNED ";}; -$KeywordRegistry.taskStatus$assigned = function(){return "ASSIGNED ";}; -$KeywordRegistry.taskStatus$inProgress = function(){return "IN-PROGRESS ";}; -$KeywordRegistry.taskStatus$waiting = function(){return "WAITING ";}; -$KeywordRegistry.taskStatus$ended = function(){return "ENDED ";}; -$KeywordRegistry.taskStatus$customerChecks = function(){return "CUSTOMER-CHECKS ";}; +$KeywordRegistry.taskStatus$new = function(){return $KeywordRegistry._autoPad("NEW");}; +$KeywordRegistry.taskStatus$unassigned = function(){return $KeywordRegistry._autoPad("UNASSIGNED");}; +$KeywordRegistry.taskStatus$assigned = function(){return $KeywordRegistry._autoPad("ASSIGNED");}; +$KeywordRegistry.taskStatus$inProgress = function(){return $KeywordRegistry._autoPad("IN-PROGRESS");}; +$KeywordRegistry.taskStatus$waiting = function(){return $KeywordRegistry._autoPad("WAITING");}; +$KeywordRegistry.taskStatus$ended = function(){return $KeywordRegistry._autoPad("ENDED");}; +$KeywordRegistry.taskStatus$customerChecks = function(){return $KeywordRegistry._autoPad("CUSTOMER-CHECKS");}; $KeywordRegistry.taskType = function(){return "TaskType";}; -$KeywordRegistry.taskType$task = function(){return "TASK ";}; -$KeywordRegistry.taskType$ticket = function(){return "TICKET ";}; +$KeywordRegistry.taskType$task = function(){return $KeywordRegistry._autoPad("TASK");}; +$KeywordRegistry.taskType$ticket = function(){return $KeywordRegistry._autoPad("TICKET");}; $KeywordRegistry.ticketType = function(){return "TicketType";}; -$KeywordRegistry.ticketType$supportTicket = function(){return "SUPPORTTICKET ";}; +$KeywordRegistry.ticketType$supportTicket = function(){return $KeywordRegistry._autoPad("SUPPORTTICKET");}; $KeywordRegistry.productPricelist = function(){return "ProductPricelist";}; -$KeywordRegistry.productPricelist$standardList = function(){return "PRICELISTDEFAULT ";}; +$KeywordRegistry.productPricelist$standardList = function(){return $KeywordRegistry._autoPad("PRICELISTDEFAULT");}; $KeywordRegistry.quantityUnit = function(){return "QuantityUnit";}; -$KeywordRegistry.quantityUnit$pieces = function(){return "QUANTITYPIECES";}; +$KeywordRegistry.quantityUnit$pieces = function(){return $KeywordRegistry._autoPad("QUANTITYPIECES");}; $KeywordRegistry.MemberRole = function(){return "MemberRole";}; $KeywordRegistry.salesprojectSource = function(){return "SalesprojectSource";}; + $KeywordRegistry.salesorderState = function(){return "SalesorderState";}; +$KeywordRegistry.salesorderState$checked = function(){return $KeywordRegistry._autoPad("SALORDERSTATCHECK");}; +$KeywordRegistry.salesorderState$sent = function(){return $KeywordRegistry._autoPad("SALORDERSTATSENT");}; +$KeywordRegistry.salesorderState$won = function(){return $KeywordRegistry._autoPad("SALORDERSTATWON");}; +$KeywordRegistry.salesorderState$lost = function(){return $KeywordRegistry._autoPad("SALORDERSTATLOST");}; + $KeywordRegistry.salesprojectWonLost = function(){return "SalesprojectWonLost";}; $KeywordRegistry.stockWarehouse = function(){return "StockWarehouse";}; $KeywordRegistry.salesprojectProbability = function(){return "SalesprojectProbability";}; $KeywordRegistry.activityCategory = function(){return "ActivityCategory";}; -$KeywordRegistry.activityCategory$mail = function(){return "MAIL ";}; +$KeywordRegistry.activityCategory$mail = function(){return $KeywordRegistry._autoPad("MAIL");}; $KeywordRegistry.addressType = function(){return "AddressType";}; -$KeywordRegistry.addressType$private = function(){return "HOMEADDR";}; -$KeywordRegistry.addressType$office = function(){return "OFFICEADDR";}; +$KeywordRegistry.addressType$private = function(){return $KeywordRegistry._autoPad("HOMEADDR");}; +$KeywordRegistry.addressType$office = function(){return $KeywordRegistry._autoPad("OFFICEADDR");}; $KeywordRegistry.offerProbability = function(){return "OfferProbability";}; + $KeywordRegistry.communicationMedium = function(){return "CommunicationMedium";}; +$KeywordRegistry.communicationMedium$mail = function(){return $KeywordRegistry._autoPad("COMMEMAIL");}; + $KeywordRegistry.salesprojectPricePolitics = function(){return "SalesprojectPricePolitics";}; $KeywordRegistry.salesprojectWeakness = function(){return "SalesprojectWeakness";}; $KeywordRegistry.salesprojectStrenght = function(){return "SalesprojectStrenght";}; $KeywordRegistry.salesprojectState = function(){return "SalesprojectState";}; -$KeywordRegistry.salesprojectState$open = function(){return "SALPROJSTATOPEN ";}; -$KeywordRegistry.salesprojectState$postponed = function(){return "SALPROJSTATPOSTPONED ";}; -$KeywordRegistry.salesprojectState$aborted = function(){return "SALPROJSTATABORT ";}; -$KeywordRegistry.salesprojectState$partialOrder = function(){return "SALPROJSTATPARTIAL ";}; -$KeywordRegistry.salesprojectState$order = function(){return "SALPROJSTATORDER ";}; -$KeywordRegistry.salesprojectState$lost = function(){return "SALPROJSTATLOST ";}; +$KeywordRegistry.salesprojectState$open = function(){return $KeywordRegistry._autoPad("SALPROJSTATOPEN");}; +$KeywordRegistry.salesprojectState$postponed = function(){return $KeywordRegistry._autoPad("SALPROJSTATPOSTPONED");}; +$KeywordRegistry.salesprojectState$aborted = function(){return $KeywordRegistry._autoPad("SALPROJSTATABORT");}; +$KeywordRegistry.salesprojectState$partialOrder = function(){return $KeywordRegistry._autoPad("SALPROJSTATPARTIAL");}; +$KeywordRegistry.salesprojectState$order = function(){return $KeywordRegistry._autoPad("SALPROJSTATORDER");}; +$KeywordRegistry.salesprojectState$lost = function(){return $KeywordRegistry._autoPad("SALPROJSTATLOST");}; $KeywordRegistry.salesprojectPhase = function(){return "SalesprojectPhase";}; -$KeywordRegistry.salesprojectPhase$nqc = function(){return "SALPROJPHASENQC ";}; +$KeywordRegistry.salesprojectPhase$nqc = function(){return $KeywordRegistry._autoPad("SALPROJPHASENQC");}; $KeywordRegistry.taskPriority = function(){return "TaskPriority";}; -$KeywordRegistry.taskPriority$none = function(){return "TASKPRIONONE ";}; -$KeywordRegistry.taskPriority$low = function(){return "TASKPRIOLOW ";}; -$KeywordRegistry.taskPriority$medium = function(){return "TASKPRIOMEDIUM ";}; -$KeywordRegistry.taskPriority$high = function(){return "TASKPRIOHIGH ";}; +$KeywordRegistry.taskPriority$none = function(){return $KeywordRegistry._autoPad("TASKPRIONONE");}; +$KeywordRegistry.taskPriority$low = function(){return $KeywordRegistry._autoPad("TASKPRIOLOW");}; +$KeywordRegistry.taskPriority$medium = function(){return $KeywordRegistry._autoPad("TASKPRIOMEDIUM");}; +$KeywordRegistry.taskPriority$high = function(){return $KeywordRegistry._autoPad("TASKPRIOHIGH");}; $KeywordRegistry.taskProgress = function(){return "TaskProgress";}; -$KeywordRegistry.taskProgress$0 = function(){return "TASKPROG0 ";}; +$KeywordRegistry.taskProgress$0 = function(){return $KeywordRegistry._autoPad("TASKPROG0");}; -$KeywordRegistry.CompetitionState = function(){return "CompetitionState";}; +$KeywordRegistry.competitionState = function(){return "CompetitionState";}; +$KeywordRegistry.competitionState$lost = function(){return $KeywordRegistry._autoPad("COMPSTATELOST");}; $KeywordRegistry.objectRelationType = function(){return "ObjectRelationType";}; $KeywordRegistry.deliveryTerm = function(){return "DeliveryTerm";}; $KeywordRegistry.paymentTerm = function(){return "PaymentTerm";}; @@ -125,63 +136,67 @@ $KeywordRegistry.contactPosition = function(){return "ContactPosition";}; $KeywordRegistry.contactContactrole = function(){return "ContactContactrole";}; $KeywordRegistry.campaignState = function(){return "CampaignManagementStates";}; -$KeywordRegistry.campaignState$planning = function(){return "PLANNING ";}; -$KeywordRegistry.campaignState$approved = function(){return "APPROVED ";}; +$KeywordRegistry.campaignState$planning = function(){return $KeywordRegistry._autoPad("PLANNING");}; +$KeywordRegistry.campaignState$approved = function(){return $KeywordRegistry._autoPad("APPROVED");}; $KeywordRegistry.campaignStepState = function(){return "CampaignManagementStepStates";}; -$KeywordRegistry.campaignStepState$open = function(){return "OPEN ";}; +$KeywordRegistry.campaignStepState$open = function(){return $KeywordRegistry._autoPad("OPEN");}; $KeywordRegistry.campaignStepCostCategory = function(){return "CampaignManagementCostCategory";}; $KeywordRegistry.documentTemplateType = function(){return "DocumentTemplateType";}; -$KeywordRegistry.documentTemplateType$letter = function(){return "LET ";}; -$KeywordRegistry.documentTemplateType$mail = function(){return "MAI ";}; -$KeywordRegistry.documentTemplateType$attachment = function(){return "ATT ";}; +$KeywordRegistry.documentTemplateType$letter = function(){return $KeywordRegistry._autoPad("LET");}; +$KeywordRegistry.documentTemplateType$mail = function(){return $KeywordRegistry._autoPad("MAI");}; +$KeywordRegistry.documentTemplateType$attachment = function(){return $KeywordRegistry._autoPad("ATT");}; $KeywordRegistry.documentTemplateTypeCategory = function(){return "DocumentTemplateTypeCategory";}; -$KeywordRegistry.documentTemplateTypeCategory$single = function(){return "1 ";}; -$KeywordRegistry.documentTemplateTypeCategory$serial = function(){return "2 ";}; +$KeywordRegistry.documentTemplateTypeCategory$single = function(){return $KeywordRegistry._autoPad("1");}; +$KeywordRegistry.documentTemplateTypeCategory$serial = function(){return $KeywordRegistry._autoPad("2");}; $KeywordRegistry.classificationType = function(){return "ClassificationType";}; -$KeywordRegistry.classificationType$salesproject = function(){return "SALESPROJ";}; +$KeywordRegistry.classificationType$salesproject = function(){return $KeywordRegistry._autoPad("SALESPROJ");}; $KeywordRegistry.personGender = function(){return "PersonGender";}; -$KeywordRegistry.personGender$other = function(){return "o";}; +$KeywordRegistry.personGender$other = function(){return $KeywordRegistry._autoPad("o");}; $KeywordRegistry.permissionCondType = function(){return "PermissionCondType";}; $KeywordRegistry.permissionAccessType = function(){return "PermissionAccessType";}; -$KeywordRegistry.DSGVOPurpose = function(){return "DSGVOPurpose";}; -$KeywordRegistry.DSGVOStatuoritysource = function(){return "DSGVOStatuoritysource";}; +$KeywordRegistry.dsgvoPurpose = function(){return "DSGVOPurpose";}; +$KeywordRegistry.dsgvoStatuoritysource = function(){return "DSGVOStatuoritysource";}; -$KeywordRegistry.DSGVOType = function() {return "DSGVOType";}; -$KeywordRegistry.DSGVOType$birth = function() {return "TYPE_BIRTH ";}; +$KeywordRegistry.dsgvoType = function() {return "DSGVOType";}; +$KeywordRegistry.dsgvoType$birth = function(){return $KeywordRegistry._autoPad("TYPE_BIRTH");}; -$KeywordRegistry.DSGVOTransmission = function() {return "DSGVOTransmission";}; -$KeywordRegistry.DSGVOTransmission$none = function() {return "DSGVONONE ";}; -$KeywordRegistry.DSGVOTransmission$inland = function() {return "DSGVOINLAND ";}; -$KeywordRegistry.DSGVOTransmission$foreign = function() {return "DSGVOFOREIGN ";}; +$KeywordRegistry.dsgvoTransmission = function() {return "DSGVOTransmission";}; +$KeywordRegistry.dsgvoTransmission$none = function(){return $KeywordRegistry._autoPad("DSGVONONE");}; +$KeywordRegistry.dsgvoTransmission$inland = function(){return $KeywordRegistry._autoPad("DSGVOINLAND");}; +$KeywordRegistry.dsgvoTransmission$foreign = function(){return $KeywordRegistry._autoPad("DSGVOFOREIGN");}; -$KeywordRegistry.DSGVODeadline = function() {return "DSGVODeadline";}; -$KeywordRegistry.DSGVODeadline$onTime = function() {return "DSGVOONTIME ";}; -$KeywordRegistry.DSGVODeadline$complex = function() {return "DSGVODEADLINECOMPLEX ";}; -$KeywordRegistry.DSGVODeadline$count = function() {return "DSGVODEADLINECOUNT ";}; -$KeywordRegistry.DSGVOGuarantee = function() {return "DSGVOGuarantee";}; +$KeywordRegistry.dsgvoDeadline = function() {return "DSGVODeadline";}; +$KeywordRegistry.dsgvoDeadline$onTime = function(){return $KeywordRegistry._autoPad("DSGVOONTIME");}; +$KeywordRegistry.dsgvoDeadline$complex = function(){return $KeywordRegistry._autoPad("DSGVODEADLINECOMPLEX");}; +$KeywordRegistry.dsgvoDeadline$count = function(){return $KeywordRegistry._autoPad("DSGVODEADLINECOUNT");}; +$KeywordRegistry.dsgvoGuarantee = function() {return "DSGVOGuarantee";}; $KeywordRegistry.textPlaceholder = function(){return "textPlaceholder";}; $KeywordRegistry.communicationMediumCampaign = function(){return "CommunicationMediumCampaign";}; -$KeywordRegistry.communicationMediumCampaign$mail = function(){return "CAMPAIGNEMAIL ";}; -$KeywordRegistry.communicationMediumCampaign$letter = function(){return "CAMPAIGNLETTER ";}; +$KeywordRegistry.communicationMediumCampaign$mail = function(){return $KeywordRegistry._autoPad("CAMPAIGNEMAIL");}; +$KeywordRegistry.communicationMediumCampaign$letter = function(){return $KeywordRegistry._autoPad("CAMPAIGNLETTER");}; $KeywordRegistry.bulkMailRecipientStatus = function(){return "BulkMailRecipientStatus";}; -$KeywordRegistry.bulkMailRecipientStatus$pending = function(){return "EMAILPENDING ";}; -$KeywordRegistry.bulkMailRecipientStatus$sent = function(){return "EMAILSENT ";}; -$KeywordRegistry.bulkMailRecipientStatus$failed = function(){return "EMAILFAILED ";}; +$KeywordRegistry.bulkMailRecipientStatus$pending = function(){return $KeywordRegistry._autoPad("EMAILPENDING");}; +$KeywordRegistry.bulkMailRecipientStatus$sent = function(){return $KeywordRegistry._autoPad("EMAILSENT");}; +$KeywordRegistry.bulkMailRecipientStatus$failed = function(){return $KeywordRegistry._autoPad("EMAILFAILED");}; $KeywordRegistry.bulkMailStatus = function(){return "BulkMailStatus";}; -$KeywordRegistry.bulkMailStatus$notSent = function(){return "BULKMAILNOTSENT ";}; -$KeywordRegistry.bulkMailStatus$beingSent = function(){return "BULKMAILBEINGSENT ";}; -$KeywordRegistry.bulkMailStatus$sent = function(){return "BULKMAILSENT ";}; +$KeywordRegistry.bulkMailStatus$notSent = function(){return $KeywordRegistry._autoPad("BULKMAILNOTSENT");}; +$KeywordRegistry.bulkMailStatus$beingSent = function(){return $KeywordRegistry._autoPad("BULKMAILBEINGSENT");}; +$KeywordRegistry.bulkMailStatus$sent = function(){return $KeywordRegistry._autoPad("BULKMAILSENT");}; + +$KeywordRegistry.serialLetterStatus = function(){return "SerialLetterStatus";}; +$KeywordRegistry.serialLetterStatus$notSent = function(){return $KeywordRegistry._autoPad("SERIALLETTERNOTSENT");}; +$KeywordRegistry.serialLetterStatus$sent = function(){return $KeywordRegistry._autoPad("SERIALLETTERSENT");}; $KeywordRegistry.callDirection = function(){return "CallDirection";}; $KeywordRegistry.callDirection$incoming = function(){return $KeywordRegistry._autoPad("INC");}; @@ -189,4 +204,12 @@ $KeywordRegistry.callDirection$outgoing = function(){return $KeywordRegistry._au $KeywordRegistry.callAnswerMode = function(){return "CallAnswerMode";}; $KeywordRegistry.callAnswerMode$accepted = function(){return $KeywordRegistry._autoPad("ACCEPTED");}; -$KeywordRegistry.callAnswerMode$missed = function(){return $KeywordRegistry._autoPad("MISSED");}; \ No newline at end of file +$KeywordRegistry.callAnswerMode$missed = function(){return $KeywordRegistry._autoPad("MISSED");}; + +$KeywordRegistry.orderType = function(){return "OrderType";}; +$KeywordRegistry.orderType$confirmation = function(){return $KeywordRegistry._autoPad("ORDTYPECONF");}; +$KeywordRegistry.orderType$deliverynote = function(){return $KeywordRegistry._autoPad("ORDTYPENOTE");}; +$KeywordRegistry.orderType$invoice = function(){return $KeywordRegistry._autoPad("ORDTYPEINVO");}; +$KeywordRegistry.orderType$credit = function(){return $KeywordRegistry._autoPad("ORDTYPECRED");}; +$KeywordRegistry.orderType$cancellation = function(){return $KeywordRegistry._autoPad("ORDTYPECANC");}; +$KeywordRegistry.dunningLevel = function(){return "DunningLevel";}; \ No newline at end of file diff --git a/process/Keyword_lib/process.js b/process/Keyword_lib/process.js index e40c7c2f077d16d91f3b211d89d9714087e72410..f0fd2438cb04e50991413362f85f97be8915c96f 100644 --- a/process/Keyword_lib/process.js +++ b/process/Keyword_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("KeywordRegistry_basic"); import("KeywordData_lib"); import("system.vars"); @@ -229,7 +228,7 @@ function KeywordAttribute(pContainerName, pAttributeName, pDefault) var sql = SqlCondition.begin() .andPrepare("AB_KEYWORD_ATTRIBUTE.CONTAINER", pContainerName) .andPrepare("AB_KEYWORD_ATTRIBUTE.NAME", pAttributeName) - .buildSql("select AB_KEYWORD_ATTRIBUTE.AB_KEYWORD_ATTRIBUTEID, AB_KEYWORD_ATTRIBUTE.TYPE from AB_KEYWORD_ATTRIBUTE"); + .buildSql("select AB_KEYWORD_ATTRIBUTE.AB_KEYWORD_ATTRIBUTEID, AB_KEYWORD_ATTRIBUTE.KIND from AB_KEYWORD_ATTRIBUTE"); var keywordAttrData = db.array(db.ROW, sql); diff --git a/process/OfferOrder_lib/process.js b/process/OfferOrder_lib/process.js index 134d0c80cf3fed4d900d1830b8cc2d5f8f3532d6..bd665cf48f54d85e87eac8f24a3efe1e9cad57a8 100644 --- a/process/OfferOrder_lib/process.js +++ b/process/OfferOrder_lib/process.js @@ -196,7 +196,7 @@ ItemUtils.prototype.roundPrice = function(pPrice) { * @param {String} currency opt currency for price list to use * @param {String} contactId opt contactid for price list to use (custom price list) * @param {String[][]} additionalProductInfo additional product info, which has to be copied from the product. (e.g. INFO field is only used by offer) - * has to be in the form: [[["identifier1", "DESTINATION-DB-SUBSELECT-OR-FIELD"], ["identifier2", "BRODUCT-DB-SUBSELECT-OR-FIELD"]], ...] + * has to be in the form: [[["identifier1", "DESTINATION-DB-FIELD"], ["identifier2", "PRODUCT-DB-SUBSELECT-OR-FIELD"]], ...] * * @return {String[]} Array of inserted ItemIDs * diff --git a/process/Offer_lib/process.js b/process/Offer_lib/process.js index 10328c4da9f2586247b32099f3c6d830bfa2cebf..a15b9b48af33ff0aa6b622c27ea0c98d51e56391 100644 --- a/process/Offer_lib/process.js +++ b/process/Offer_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.vars"); import("system.util"); import("system.datetime"); @@ -106,7 +105,7 @@ OfferUtils.openOfferReport = function (pOfferID) var offerFields = [ "ADDRESS", "CONTACT_ID", - "LANGUAGE", + "ISOLANGUAGE", "PAYMENTTERMS", "DELIVERYTERMS", //4 "OFFERCODE", @@ -305,7 +304,8 @@ OfferUtils.openOfferReport = function (pOfferID) * @param {String} [pFooter=""] * @param {String} [pDeliveryTerm=""] * @param {String} [pPaymentTerm=""] - * @param {String} [pSalesprojectId=""] + * @param {String} [pObjectType=""] + * @param {String} [pRowId=""] */ OfferUtils.copyOffer = function (pOfferId, pContactId, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pObjectType, pRowId) { @@ -355,22 +355,24 @@ OfferUtils.copyOfferItems = function (pSourceOfferId, pTargetOfferId) * opens an order in NEW mode with values from an offer * * @param pOfferId {String} id of the offer - * @param pSalesprojectId {String} salesproject id + * @param pContextId {String} context id + * @param pRowId {String} row id * @param pContactId {String} contact id * @param pLanguage {String} language * @param pCurrency {String} [currency=""] * @param pAddress {String} [address=""] * @param pHeader {String} [header=""] */ -OfferUtils.copyToOrder = function (pOfferId, pSalesprojectId, pContactId, pLanguage, pCurrency, pAddress, pHeader) +OfferUtils.copyToOrder = function (pOfferId, pContextId, pRowId, pContactId, pLanguage, pCurrency, pAddress, pHeader) { var params = { "ContactId_param" : pContactId, - "SalesprojectId_param" : pSalesprojectId, + "ObjectRowId_param" : pRowId, + "ObjectType_param" : pContextId, "OrderLanguage_param" : pLanguage, "OfferId_param" : pOfferId, "OrderCurrency_param" : pCurrency || "", - "OrderAddress_param" : pAddress || "", + "OrderPaymentAddress_param" : pAddress || "", "OrderHeader_param" : pHeader || "" }; neon.openContext("Order", null, null, neon.OPERATINGSTATE_NEW, params); diff --git a/process/Order_lib/process.js b/process/Order_lib/process.js index fe4915c08ac0d696a17e7ffbbc2e4c6de2d41d8f..547a53e14dbe5173c504bc750555c0691e471012 100644 --- a/process/Order_lib/process.js +++ b/process/Order_lib/process.js @@ -1,3 +1,5 @@ +import("Context_lib"); +import("KeywordRegistry_basic"); import("Neon_lib"); import("system.vars"); import("system.util"); @@ -54,30 +56,67 @@ OrderUtils.validateOrderNumber = function(orderNumber) { OrderUtils.getOrderNumberValidationFailString = function() { return translate.text("The order number already exists!"); } - + + OrderUtils.isEditable = function(status) { + + // TODO: Administrator darf immer ändern, warten auf neue Berechtigungslogik? + + // Order should be editable if order state not equals "Sent" + return status != "1"; +} + +OrderUtils.isDeletable = function(status) { // TODO: Administrator darf immer ändern, warten auf neue Berechtigungslogik? - // Order should be editable if order state not equals "Sent", "Won" or "Lost" - return status != "2" && status != "3" && status != "4"; + // Order should be deletable if order state not equals "Sent" + return status != "1"; } /** * Create a new order */ -OrderUtils.createNewOrder = function(pSalesprojectId, pRelationId) +OrderUtils.createNewOrder = function(pContextId, pRowId, pRelationId) { var params = {}; - if (pSalesprojectId) - params["SalesprojectId_param"] = pSalesprojectId; + if (pRowId && pContextId) + { + params["ObjectRowId_param"] = pRowId; + params["ObjectType_param"] = pContextId; + } if (pRelationId) params["ContactId_param"] = pRelationId; - neon.openContext("Order", null, neon.OPERATINGSTATE_NEW, params); + neon.openContext("Order", null, null, neon.OPERATINGSTATE_NEW, params); } +OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus) +{ + var params = { + "ContactId_param" : pContactId, + "OrderType_param" : pOrderType, + "OrderLanguage_param" : pLanguage, + "OfferId_param" : pOfferId, + "OrderCurrency_param" : pCurrency || "", + "OrderHeader_param" : pHeader || "", + "OrderFooter_param" : pFooter || "", + "OrderDeliveryTerm_param" : pDeliveryTerm || "", + "OrderPaymentTerm_param" : pPaymentTerm || "", + "OrderPaymentAddress_param" : pPaymentAddress || "", + "OrderDeliveryAddress_param" : pDeliveryAddress || "", + "ObjectType_param" : pObjectType || "", + "ObjectRowId_param" : pRowId || "", + "OrderDunningDate_param" : pDunningDate || "", + "OrderDunningLevel_param" : pDunningLevel || "", + "OrderCancellation_param" : pCancellation || "", + "OrderStatus_param" : pOrderStatus || "" + }; + neon.openContext("Order", null, null, neon.OPERATINGSTATE_NEW, params); +} + + /** * copies all offerItems of an offer and creates orderItems for an order * @@ -123,6 +162,390 @@ OrderUtils.copyOfferItemsToOrder = function (pOfferId, pOrderId) db.updateData("SALESORDER", cols, null, vals, SqlCondition.equals("SALESORDER.SALESORDERID", pOrderId, "1 = 2")); } +OrderUtils.openOrderReport = function (pOrderID) +{ + var orderReport = new Report("Salesorder_report"); + + var sqlUtil = new SqlMaskingUtils(); + + var orderFields = [ + "PAYMENTADDRESS", + "CONTACT_ID", + "ISOLANGUAGE", + "PAYMENTTERMS", + "DELIVERYTERMS", //4 + "SALESORDERCODE", + "CURRENCY", + "SALESORDERDATE", + "HEADER", //8 + "VAT", + sqlUtil.isNull("VERSNR", "0"), + sqlUtil.isNull("SALESORDERCODE", "0"), + "OBJECT_TYPE", //12 + "OBJECT_ROWID", //13 + "FOOTER", //14 + "ORDERTYPE" // 15 + ]; + + var orderSql = SqlCondition.begin() + .andPrepare("SALESORDER.SALESORDERID", pOrderID) + .buildSql("select " + orderFields.join(", ") + " from SALESORDER", "1 = 0"); + var orderData = db.array(db.ROW, orderSql); + + var language = db.cell(SqlCondition.begin() + .andPrepare("AB_LANGUAGE.ISO3", orderData[2]) + .buildSql("select ISO2 from AB_LANGUAGE", "1=0")); + + orderData[7] = datetime.toDate(orderData[7], translate.text("dd.MM.yyyy", language)); + + var orderItemFields = [ + "SALESORDERITEM.INFO", + "SALESORDERITEM.ASSIGNEDTO", + "SALESORDERITEM.PRODUCT_ID", + "SALESORDERITEM.ITEMNAME" , + "SALESORDERITEM.OPTIONAL", //4 + "SALESORDERITEM.ITEMPOSITION", + "PRODUCT.PRODUCTCODE", + "PRODUCT.PRODUCTID", + "SALESORDERITEM.UNIT", //8 + sqlUtil.isNull("SALESORDERITEM.QUANTITY", "0"), + sqlUtil.isNull("SALESORDERITEM.PRICE", "0"), + sqlUtil.isNull("SALESORDERITEM.DISCOUNT", "0"), + sqlUtil.isNull("SALESORDERITEM.VAT", "0"), //12 + "SALESORDERITEM.SALESORDER_ID", + "SALESORDERITEM.ITEMSORT", + "0", + "''" + ]; + + var orderItemSql = SqlCondition.begin() + .andPrepare("SALESORDERITEM.SALESORDER_ID", pOrderID) + .buildSql( + "select " + orderItemFields.join(", ") + " from SALESORDERITEM left join PRODUCT on PRODUCT.PRODUCTID = SALESORDERITEM.PRODUCT_ID", + "1 = 0" + ); + var itemData = db.table(orderItemSql); + + if (itemData.length == 0) + return; + + var fullPrice = 0; + var itemSum = 0; + var sumItemSum = 0; + var total = 0; + var sums = []; + var vatsum = 0; + var printDiscount = false; + + itemData = itemData.map(function (item) + { + //quantity * price + fullPrice = eMath.mulDec(parseFloat(item[9]), parseFloat(item[10])); //price without discount + + if (item[4] != "1") //optional + { + //itemSum = (fullPrice * (100 - discount)) / 100 + itemSum = eMath.roundDec(eMath.divDec(eMath.mulDec(fullPrice, eMath.subDec(100, item[11])), 100), 2, eMath.ROUND_HALF_EVEN); //sum of the item (with discount) + sumItemSum += itemSum; //total sum (without vat) + } + //vatsum = itemSum * vat / 100 + vatsum = eMath.divDec(eMath.mulDec(itemSum, item[12]), 100); //vat per product + if (item[12] > 0) + sums.push([item[12], vatsum]); //MWSteuerwerte für Map vorbereiten + + // sumItemSum + vat + total = eMath.addDec(sumItemSum, orderData[9]); //total sum with vat + + if (!printDiscount && item[11] > 0) + printDiscount = true; + + return [ + item[7], //productid + orderData[6], //currency + orderData[7], //offerdate + pOrderID, //offerId + item[0], //info + item[1], //assignedTo + item[3], //itemname + item[4], //optional + item[5], //itemposition + item[6], //productcode + orderData[8], //header + orderData[14], //footer + text.formatDouble(item[9], translate.text("#,##0"), true), //quantity + text.formatDouble(item[10], translate.text("#,##0.00"), true), //price + text.formatDouble(item[11], translate.text("0.00"), true), //discount + orderData[10], //versnr + orderData[5], //offercode + text.formatDouble(orderData[9], translate.text("#,##0.00"), true), //vat + text.formatDouble(itemSum, translate.text("#,##0.00"), true), //itemsum + KeywordUtils.getViewValue($KeywordRegistry.quantityUnit(), item[8]), //unittext + item[2], + item[13], + item[8], + item[14], + text.formatDouble(item[12], translate.text("#,##0.00"), true) + ]; + }); + + // TODO: get Images implementieren + var imgData = ["meineFirma | Konrad-Zuse-Straße 4 | DE 84144 Geisenhausen", + "base64:iVBORw0KGgoAAAANSUhEUgAAAM4AAABRCAYAAACaL5lSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDA4QzAyM0IwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDA4QzAyM0MwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowMDhDMDIzOTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowMDhDMDIzQTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhF3nYoAAAlvSURBVHja7J1fjBXVHcfPJQJRoe1urQYJRBYlMUJisqwvGNjY3WgEUtN2CeWBIGb3Ju6LElsW+gA8AHe1UfuwTcBASB/Q7CZNG0tjw2pWU15kNzEBJFnLqmvQBNEbU0pbX+jve+9vlrOzM/fOnTtz78zs95P8cv/MOTPnzJzvnN/5zZ+Tu3XrliGE1MYC7gJCKBxCKBxCKBxCKBxCKBxCCIVDCIVDCIVDCIVDyDzmDq8/d+1/PY5trRB7VGyt2BqxVWLLxe4RW6JpbohdF7sq9qnYpNhFsY/Evoi6QKeOvMAWQKITToQ8LPaEWKfYBrFlVdL/SO1BsU3W/1+JnRMbE3tP7DIPHcmicLrFfia2VWxlBOuD4H6pNi32tthfxM7yEJIsCAc9yw6x7WJLYyozhNgvtlPsLbHT2hMRkjrhYPzynNhu/d4IIMxesafEToqdiGMcREhcwnlKe4AtTaoDhHpArF1sSOwdHlYSN/WGo/Niv2+iaGy2aFnyPKwkqT1OTmyf2pIE1Qdh7t+J/VjsqBgfbyWJEU5OXaMDCa0ThHxYbJHYIYqHJMVV25dg0dgc0LIS0nTh5FPWGPdxzEOaLRxEz/YkbEwTxG3bo2UnpOHCQci3XwffaWONln0FDzdptHBwcXNLiuu5RetASMOE02nKdwSknd1aF0IaIpwdGXFzVmhdCIldOLjLeXuG6rtd60RIrMLBowFLM1TfpVonQmITDh5C25rBOm/VuhESi3Dw5ObKDNZ5pdaNkFiE05nhenfy0JM4hIMI1IYM13uD4QVREoNw8DaaZRmu9zKtIyGh8HusYG3UG/pJ6w/NKy89O/P70j+nzSsn/zTz+5EHV5oHlt9rep58fFa+sQ8vmEtXps35C5/4+12PrTMP3H9v6dMGeZAX6/Cp49tsAiRK4TTsnrS771xsdj3TZTrWPeQrCtiljmnzhzfPmH//538zyyC0/l9tLonSC6wT1tmxzgxJ3q+//a4pdSTzx1Vb1SjR/Hr3L3xFY4MeCWnt3wf7d/iKxgYC+83un7vTruLhJ1H3OMsbsfHnpbdAo0Yv8rcPzpsz74/P6i3QU0AgtgA2b1pvPhQXDHltd+7MB+MzPQrSIa/tukE0mzeuN6f+/O6cOuZyubrr0tvb12bK73nDZ/cbbxwfzWKD2Tnw2l75KIiN/rHwYibvwggyobSfcO6Ju3COINDYX5axjsuNKo1PYLue+eksATy9scN0rF1T6q0AxkkYL9l8dvWaOXX1XfPZl9dK+W23zxJY1HXsUtEANK7RBDf+s1reakyJOFa7/utz6ivr6ZLlmTxBhHXVGvawmsfYYxYjf//HrHENBIMexVnmFs2cwIJr+WO33cKo64gGNKXfBzPcZo479Z2voqnU4zQENGz0DpWAaJAOLpoNxGa7dn6cv/jJbHfv/vtiqYu4ZhDN6pQd/5rdLUk/mPETQ109zo2GCOf8hUDpPr4yHTqvu8exAgQ3DCERC+d63BtGT1Ktt3G45uHK+VybmYPbDbSEc52Hn0QtnKtxb7jSuKZaWojOHvfUkt8JKjSijmT+jXEwqdOmeHuc/4bOe7OOvK46etLb24eoWI8pv4/aHhSP+IWZNRx9RX/mJd3xasvlP2wDUSo7wlUaQ8jyYrUKhClnvewceO2Yltkr4maHq0vLEXkz5SijU8duJ6jgXpf8btPfe937Q5YXNU+LpilYaSY0zUiVsrdrObD+FmsR8o1Uyx+kx5mcByeNSa/GLzauB6XdtRgH66w21rqR9aDRDJu5YWGsf1yF5pe3YeWsU2QoW6DQt6a94hLNzP6AYFRY4y7RGN0Hwypav/UXrLwtrsU91fIHFc7FeSCci67G2KIHGQehqL1CDmbK0TLnbFSQtH11brtPbdDaRqu5Hept82hAzShnveDEgN5ltZzNc2pePaFTJ5S9Fel89sewfs876zPlR+GdywAFFZcX7VYPtj5E/kCuGubcxPSBWb1D+iuto01BDwp2YreGl0vo923SEIf17LTXOqhhaHe7c+qa5VUYJRdOvg94uGxRlhMXMStdJu+u41oNyjgRMNzdoq7SNucPdc3y2pC7rBPJNtulQvkkTd7cnp2vx3iHyydUcFP2nzXkD9TjYIKmcxnubc4ZaxIqbazO2XnQbowunB0KV6m9ju2PusdALn/bfZZsVjnrZTCCtPZ+8hyHqLinLMEajzQDbtG48hcr5Q/a44AxU55zM4uMefi4Xg13FtJQJ6Qh2o16IqxwAi5ri7mcsd5vVsNguyhp/co44fPdzZTur7aQxZ0wwW5DqioczO6Mq4dZfO/Aex5uhcO3VqOr5l6EpVih0RcrbL/R5ayHqSj2RwURhdqeFZWzx5s1i62ScDAlOh706s+gcC4npHHVSoshoRDB9Fjjw7qpdq8apkTH7M5LM75fnTNeUc74rSxn5kTjXFtyGLDHUAhE1HDHeCDhYGWYEr13nginBQPwIBcfWc5UsdcKLmyLYoVB3h192mR/GvRRnwE4y5n+3qbdcnErBSvaoxbOmNjJLO9cRKGsgWehylX7rmZdlU9LOdM2RtS7ClqiFg44IfbXtO6thQvvuBkgWd7auePuRqcN8Zi5faGsWaSlnIlAw9yOS1vQIIEjmDb7frkogwMOcNWGTPnNMGl7O8zknYsX/UA+76p2NpcGB/93WBslzugFn+QTzapMWsqZMPLW/sI9ae7l3ToOChxxq2UO0HfEXjXpegAMZX118aKFNwM2SvjAqzXqUvRohPi/tdkv4khLORPU64yoONxjHNyVsD7MbUU5rzd67Nr/eqU8+8UOp2Sf/VbsiN/CU0deYKsioVgQIs9RsUMpqNshLSshkRPmZR23tFF+L7bPJG/69hsqmKNaVkISIRxHPHCBvhHbk6CAwaSOw47x0JIkCscBDfRzU76frdnTuSNcPqRBDEISLRyjDfWSKUdzMCV6o+edQagcF2hPmOzf4UAyJByn8R405bsMMCU6ZneO+8bQf5nyfXSnzdznawhJhXAcxtQQL8fszpioNurnefCMEB53wJ3bvDpOMiEch7NqGHNgotpOU54+MOw7DPCOgHMqSjyEdpmHjmRROA6X1YZ07IPpAzETGqJwmJ8GU21g1gAnpI1QMt6wiZcF4r1niJLhbTQfcfxCkkQuyFwghJDZLOAuIITCIYTCIYTCIYTCIYTCIYRQOIRQOIRQOIRQOIRQOISQWvi/AAMA9UczDEaG0p8AAAAASUVORK5CYII="] + // getMyASYS_ICONSdata(); + + // TODO: implementieren wenn Attribute möglich sind + var adma = ""; //adma = Aussendienstmitarbeiter + /*var adm = getAddressData( [GetAttributeKey( "Aussendienst", "1", orgrelid, pUser )[0]], + [["Person","function", "concat( ['SALUTATION', 'TITLE', 'FIRSTNAME','LASTNAME'])"], + ["Telefon", "function", "getCommAddrSQL('Telefon', 'CONTACT.CONTACTID')"], + ["Email", "function", "getCommAddrSQL('E-Mail', 'CONTACT.CONTACTID')"] + ] ); + var adma = ""; + if (adm[1] != undefined) adma = adm[1].join("\n");*/ + + var params = { + "PaymentConditions" : translate.text("Conditions of payment", language), + "Articledescription" : translate.text("Articledescription", language), + "DeliveryConditions" : translate.text("Deliveryspecification", language), + "OrderType" : KeywordUtils.getViewValue($KeywordRegistry.orderType(), orderData[15]), + "Articlenumber" : translate.text("Articlenumber", language), + "SALESORDERAddr" : translate.text(orderData[0].trim(), language), + "zzglUMST" : translate.text("Plus Salestax", language), + "Unitprice" : translate.text("Unitprice", language), + "directlyResponsible" : translate.text("Directly responsible:", language), + "Number" : translate.text("Number", language), + "Discount" : translate.text("Discount", language), + "Amount" : translate.text("Amount", language), + "Total" : translate.text("Total", language), + "Date" : translate.text("Date", language), + "VAT" : translate.text("VAT", language), + "Sum" : translate.text("Sum", language), + "Pos" : translate.text("Pos.", language), + "Address" : imgData[0], + "OrderPaymentTerm" : KeywordUtils.getViewValue($KeywordRegistry.paymentTerm(), orderData[3]), + "OrderDeliveryTerm" : KeywordUtils.getViewValue($KeywordRegistry.deliveryTerm(), orderData[4]), + "responsible" : adma, + "SUMITEMSUM" : sumItemSum, + "TOTAL" : text.formatDouble(total, translate.text("#,##0.00"), true), + "printDiscount" : printDiscount ? "1" : "0", + "Person" : db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID"))) + }; + + + + orderReport.addImage("myLogo", imgData[1]); + + orderReport.addSubReportData("subdata", ReportData.begin(["VAT","WERT"]).add(sums)); + orderReport.addReportParams(params); + + orderReport.setReportData(ReportData.begin( + [ + "PRODUCTID", + "CURRENCY", + "ORDERDATE", + "SALESORDERID", + "SALESORDERITEM_INFO", + "SALESORDERITEM_ASSIGNEDTO", //4 + "ITEMNAME" , + "SALESORDERITEM_OPTIONAL", + "SALESORDERITEM_ITEMPOSITION", + "PRODUCTCODE", //8 + "HEADER", + "FOOTER", + "QUANTITY", + "PRICE", + "ORDERITEM.DISCOUNT", //13 + "SALESORDER_VERSNR", + "ORDERCODE", + "SALESORDER.VAT", + "ITEMSUM", // 17 + "UNITTEXT", + "PRODUCT_ID", + "ORDERITEM.SALESORDER_ID", + "ORDERITEM.UNIT", + "ITEMSORT", + "ORDERITEM.VAT" + ]) + .add(itemData)); + orderReport.openReport(); +} + + +OrderUtils.openReminderReport = function (pOrderID) +{ + var reminderReport = new Report("Reminder_report"); + + var sqlUtil = new SqlMaskingUtils(); + + var orderFields = [ + "PAYMENTADDRESS", + "CONTACT_ID", + "ISOLANGUAGE", + "PAYMENTTERMS", + "DELIVERYTERMS", //4 + "SALESORDERCODE", + "CURRENCY", + "SALESORDERDATE", + "HEADER", //8 + "VAT", + sqlUtil.isNull("VERSNR", "0"), + sqlUtil.isNull("SALESORDERCODE", "0"), + "OBJECT_TYPE", //12 + "OBJECT_ROWID", //13 + "FOOTER", //14 + "ORDERTYPE", // 15 + "PAID", //16 + "NET", //17 + "DUNNINGDATE", //18 + "DUNNINGLEVEL",//19 + "DUNNINGTEXT" //20 + ]; + + var orderSql = SqlCondition.begin() + .andPrepare("SALESORDER.SALESORDERID", pOrderID) + .buildSql("select " + orderFields.join(", ") + " from SALESORDER", "1 = 0"); + var orderData = db.array(db.ROW, orderSql); + + var language = db.cell(SqlCondition.begin() + .andPrepare("AB_LANGUAGE.ISO3", orderData[2]) + .buildSql("select ISO2 from AB_LANGUAGE", "1=0")); + + orderData[7] = datetime.toDate(orderData[7], translate.text("dd.MM.yyyy", language)); + orderData[18] = datetime.toDate(orderData[18], translate.text("dd.MM.yyyy", language)); + + var orderItemFields = [ + "SALESORDERITEM.INFO", + "SALESORDERITEM.ASSIGNEDTO", + "SALESORDERITEM.PRODUCT_ID", + "SALESORDERITEM.ITEMNAME" , + "SALESORDERITEM.OPTIONAL", //4 + "SALESORDERITEM.ITEMPOSITION", + "PRODUCT.PRODUCTCODE", + "PRODUCT.PRODUCTID", + "SALESORDERITEM.UNIT", //8 + sqlUtil.isNull("SALESORDERITEM.QUANTITY", "0"), + sqlUtil.isNull("SALESORDERITEM.PRICE", "0"), + sqlUtil.isNull("SALESORDERITEM.DISCOUNT", "0"), + sqlUtil.isNull("SALESORDERITEM.VAT", "0"), //12 + "SALESORDERITEM.SALESORDER_ID", + "SALESORDERITEM.ITEMSORT", + "0", + "''" + ]; + + var orderItemSql = SqlCondition.begin() + .andPrepare("SALESORDERITEM.SALESORDER_ID", pOrderID) + .buildSql( + "select " + orderItemFields.join(", ") + " from SALESORDERITEM left join PRODUCT on PRODUCT.PRODUCTID = SALESORDERITEM.PRODUCT_ID", + "1 = 0" + ); + var itemData = db.table(orderItemSql); + + if (itemData.length == 0) + return; + + var fullPrice = 0; + var itemSum = 0; + var sumItemSum = 0 + var sums = []; + var vatsum = 0; + var printDiscount = false; + var brutto=eMath.addDec(orderData[17], orderData[9]); + var offen=eMath.subDec(brutto, orderData[16]); + itemData = itemData.map(function (item) + { + //quantity * price + fullPrice = eMath.mulDec(parseFloat(item[9]), parseFloat(item[10])); //price without discount + + if (item[4] != "1") //optional + { + //itemSum = (fullPrice * (100 - discount)) / 100 + itemSum = eMath.roundDec(eMath.divDec(eMath.mulDec(fullPrice, eMath.subDec(100, item[11])), 100), 2, eMath.ROUND_HALF_EVEN); //sum of the item (with discount) + sumItemSum += itemSum; //total sum (without vat) + } + //vatsum = itemSum * vat / 100 + vatsum = eMath.divDec(eMath.mulDec(itemSum, item[12]), 100); //vat per product + if (item[12] > 0) + sums.push([item[12], vatsum]); //MWSteuerwerte für Map vorbereiten + + // sumItemSum + vat + total = eMath.addDec(sumItemSum, orderData[9]); //total sum with vat + + if (!printDiscount && item[11] > 0) + printDiscount = true; + + return [ + orderData[16], //payed + pOrderID, //relationid + orderData[6], //currency + orderData[7], //orderdate + text.formatDouble(orderData[9], translate.text("#,##0.00"), true), //vat + orderData[11], //ordercode + orderData[17], //net + text.formatDouble(brutto, translate.text("#,##0.00"), true),//brutto + text.formatDouble(offen, translate.text("#,##0.00"), true),//offen + orderData[18], //due date + orderData[20], //dunning text + orderData[19] //dunninglevel + + ]; + }); + + // TODO: get Images implementieren + var imgData = ["meineFirma | Konrad-Zuse-Straße 4 | DE 84144 Geisenhausen", + "base64:iVBORw0KGgoAAAANSUhEUgAAAM4AAABRCAYAAACaL5lSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDA4QzAyM0IwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDA4QzAyM0MwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowMDhDMDIzOTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowMDhDMDIzQTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhF3nYoAAAlvSURBVHja7J1fjBXVHcfPJQJRoe1urQYJRBYlMUJisqwvGNjY3WgEUtN2CeWBIGb3Ju6LElsW+gA8AHe1UfuwTcBASB/Q7CZNG0tjw2pWU15kNzEBJFnLqmvQBNEbU0pbX+jve+9vlrOzM/fOnTtz78zs95P8cv/MOTPnzJzvnN/5zZ+Tu3XrliGE1MYC7gJCKBxCKBxCKBxCKBxCKBxCCIVDCIVDCIVDCIVDyDzmDq8/d+1/PY5trRB7VGyt2BqxVWLLxe4RW6JpbohdF7sq9qnYpNhFsY/Evoi6QKeOvMAWQKITToQ8LPaEWKfYBrFlVdL/SO1BsU3W/1+JnRMbE3tP7DIPHcmicLrFfia2VWxlBOuD4H6pNi32tthfxM7yEJIsCAc9yw6x7WJLYyozhNgvtlPsLbHT2hMRkjrhYPzynNhu/d4IIMxesafEToqdiGMcREhcwnlKe4AtTaoDhHpArF1sSOwdHlYSN/WGo/Niv2+iaGy2aFnyPKwkqT1OTmyf2pIE1Qdh7t+J/VjsqBgfbyWJEU5OXaMDCa0ThHxYbJHYIYqHJMVV25dg0dgc0LIS0nTh5FPWGPdxzEOaLRxEz/YkbEwTxG3bo2UnpOHCQci3XwffaWONln0FDzdptHBwcXNLiuu5RetASMOE02nKdwSknd1aF0IaIpwdGXFzVmhdCIldOLjLeXuG6rtd60RIrMLBowFLM1TfpVonQmITDh5C25rBOm/VuhESi3Dw5ObKDNZ5pdaNkFiE05nhenfy0JM4hIMI1IYM13uD4QVREoNw8DaaZRmu9zKtIyGh8HusYG3UG/pJ6w/NKy89O/P70j+nzSsn/zTz+5EHV5oHlt9rep58fFa+sQ8vmEtXps35C5/4+12PrTMP3H9v6dMGeZAX6/Cp49tsAiRK4TTsnrS771xsdj3TZTrWPeQrCtiljmnzhzfPmH//538zyyC0/l9tLonSC6wT1tmxzgxJ3q+//a4pdSTzx1Vb1SjR/Hr3L3xFY4MeCWnt3wf7d/iKxgYC+83un7vTruLhJ1H3OMsbsfHnpbdAo0Yv8rcPzpsz74/P6i3QU0AgtgA2b1pvPhQXDHltd+7MB+MzPQrSIa/tukE0mzeuN6f+/O6cOuZyubrr0tvb12bK73nDZ/cbbxwfzWKD2Tnw2l75KIiN/rHwYibvwggyobSfcO6Ju3COINDYX5axjsuNKo1PYLue+eksATy9scN0rF1T6q0AxkkYL9l8dvWaOXX1XfPZl9dK+W23zxJY1HXsUtEANK7RBDf+s1reakyJOFa7/utz6ivr6ZLlmTxBhHXVGvawmsfYYxYjf//HrHENBIMexVnmFs2cwIJr+WO33cKo64gGNKXfBzPcZo479Z2voqnU4zQENGz0DpWAaJAOLpoNxGa7dn6cv/jJbHfv/vtiqYu4ZhDN6pQd/5rdLUk/mPETQ109zo2GCOf8hUDpPr4yHTqvu8exAgQ3DCERC+d63BtGT1Ktt3G45uHK+VybmYPbDbSEc52Hn0QtnKtxb7jSuKZaWojOHvfUkt8JKjSijmT+jXEwqdOmeHuc/4bOe7OOvK46etLb24eoWI8pv4/aHhSP+IWZNRx9RX/mJd3xasvlP2wDUSo7wlUaQ8jyYrUKhClnvewceO2Yltkr4maHq0vLEXkz5SijU8duJ6jgXpf8btPfe937Q5YXNU+LpilYaSY0zUiVsrdrObD+FmsR8o1Uyx+kx5mcByeNSa/GLzauB6XdtRgH66w21rqR9aDRDJu5YWGsf1yF5pe3YeWsU2QoW6DQt6a94hLNzP6AYFRY4y7RGN0Hwypav/UXrLwtrsU91fIHFc7FeSCci67G2KIHGQehqL1CDmbK0TLnbFSQtH11brtPbdDaRqu5Hept82hAzShnveDEgN5ltZzNc2pePaFTJ5S9Fel89sewfs876zPlR+GdywAFFZcX7VYPtj5E/kCuGubcxPSBWb1D+iuto01BDwp2YreGl0vo923SEIf17LTXOqhhaHe7c+qa5VUYJRdOvg94uGxRlhMXMStdJu+u41oNyjgRMNzdoq7SNucPdc3y2pC7rBPJNtulQvkkTd7cnp2vx3iHyydUcFP2nzXkD9TjYIKmcxnubc4ZaxIqbazO2XnQbowunB0KV6m9ju2PusdALn/bfZZsVjnrZTCCtPZ+8hyHqLinLMEajzQDbtG48hcr5Q/a44AxU55zM4uMefi4Xg13FtJQJ6Qh2o16IqxwAi5ri7mcsd5vVsNguyhp/co44fPdzZTur7aQxZ0wwW5DqioczO6Mq4dZfO/Aex5uhcO3VqOr5l6EpVih0RcrbL/R5ayHqSj2RwURhdqeFZWzx5s1i62ScDAlOh706s+gcC4npHHVSoshoRDB9Fjjw7qpdq8apkTH7M5LM75fnTNeUc74rSxn5kTjXFtyGLDHUAhE1HDHeCDhYGWYEr13nginBQPwIBcfWc5UsdcKLmyLYoVB3h192mR/GvRRnwE4y5n+3qbdcnErBSvaoxbOmNjJLO9cRKGsgWehylX7rmZdlU9LOdM2RtS7ClqiFg44IfbXtO6thQvvuBkgWd7auePuRqcN8Zi5faGsWaSlnIlAw9yOS1vQIIEjmDb7frkogwMOcNWGTPnNMGl7O8zknYsX/UA+76p2NpcGB/93WBslzugFn+QTzapMWsqZMPLW/sI9ae7l3ToOChxxq2UO0HfEXjXpegAMZX118aKFNwM2SvjAqzXqUvRohPi/tdkv4khLORPU64yoONxjHNyVsD7MbUU5rzd67Nr/eqU8+8UOp2Sf/VbsiN/CU0deYKsioVgQIs9RsUMpqNshLSshkRPmZR23tFF+L7bPJG/69hsqmKNaVkISIRxHPHCBvhHbk6CAwaSOw47x0JIkCscBDfRzU76frdnTuSNcPqRBDEISLRyjDfWSKUdzMCV6o+edQagcF2hPmOzf4UAyJByn8R405bsMMCU6ZneO+8bQf5nyfXSnzdznawhJhXAcxtQQL8fszpioNurnefCMEB53wJ3bvDpOMiEch7NqGHNgotpOU54+MOw7DPCOgHMqSjyEdpmHjmRROA6X1YZ07IPpAzETGqJwmJ8GU21g1gAnpI1QMt6wiZcF4r1niJLhbTQfcfxCkkQuyFwghJDZLOAuIITCIYTCIYTCIYTCIYTCIYRQOIRQOIRQOIRQOIRQOISQWvi/AAMA9UczDEaG0p8AAAAASUVORK5CYII="] + // getMyASYS_ICONSdata(); + + // TODO: implementieren wenn Attribute möglich sind + var adma = ""; //adma = Aussendienstmitarbeiter + /*var adm = getAddressData( [GetAttributeKey( "Aussendienst", "1", orgrelid, pUser )[0]], + [["Person","function", "concat( ['SALUTATION', 'TITLE', 'FIRSTNAME','LASTNAME'])"], + ["Telefon", "function", "getCommAddrSQL('Telefon', 'CONTACT.CONTACTID')"], + ["Email", "function", "getCommAddrSQL('E-Mail', 'CONTACT.CONTACTID')"] + ] ); + var adma = ""; + if (adm[1] != undefined) adma = adm[1].join("\n");*/ + + var params = { + "Address" : imgData[0], + "ReminderAddress": translate.text(orderData[0].trim(), language), + "Due": translate.text("Due",language), + "DueDate": translate.text("Due date",language), + "Reminder": translate.text("Reminder",language), + "Ordernumber": translate.text("Order number",language), + "Orderdate": translate.text("Order date",language), + "Orderamount": translate.text("Order amount",language), + "Dunninglevel": translate.text("Dunning level",language) + }; + + + + reminderReport.addImage("myLogo", imgData[1]); + + reminderReport.addSubReportData("subdata", ReportData.begin(["VAT","WERT"]).add(sums)); + reminderReport.addReportParams(params); + + reminderReport.setReportData(ReportData.begin( + [ + "PAYED", + "RELATION_ID", + "CURRENCY", + "ORDERDATE", + "VAT", + "ORDERCODE", //4 + "NET" , + "BRUTTO", + "OFFEN", + "DUEDATE", + "DUNNINGTEXT", + "DUNNINGLEVEL" + + ]) + .add(itemData)); + reminderReport.openReport(); +} + + /******************************************************************************/ diff --git a/process/Organisation_lib/process.js b/process/Organisation_lib/process.js index d510de69cb12a4505a04faabc0740167729326d8..f80c70ad5e6d59ac7454b930a4de74a19b4ebea7 100644 --- a/process/Organisation_lib/process.js +++ b/process/Organisation_lib/process.js @@ -1,181 +1,188 @@ -import("Util_lib"); -import("system.datetime"); -import("system.translate"); -import("system.db"); -import("Binary_lib"); -import("Report_lib"); -import("Sql_lib"); -import("Keyword_lib"); -import("Attribute_lib"); -import("PostalAddress_lib"); -import("Communication_lib"); -import("KeywordRegistry_basic"); - -/** - * a static Utility class for the Org context. - * - * Do not create an instance of this! - * @class - */ -function OrgUtils() {} - -/** - * returns the image for a organisation - * - * @param {String} pOrgId the id of the organisation. - * @param {String} pDefaultText the text, to use for default image generation. - * @return {String} base64 coded String of the image. If none existed, the given String is used to create an image. - */ -OrgUtils.getImage = function(pOrgId, pDefaultText) -{ - return ImageUtils.get("ORGANISATION", "IMAGE", pOrgId, pDefaultText); -} - -/** - * sets the image of a organisation - * - * @param {String} pOrgId the id of the organisation. - * @param {String} pImageDateBase64 base64 coded String of the image. - * @return {Boolean} if image could be set - */ -OrgUtils.setImage = function(pOrgId, pImageDateBase64) -{ - return ImageUtils.set("ORGANISATION", "IMAGE", pOrgId, pImageDateBase64, "OrgImage", "Image of the organisation"); -} - -/** - * deletes the image of a organisation - * - * @param {String} pOrgId the id of the organisation. - * @return {Boolean} if image could be removed - */ -OrgUtils.removeImage = function(pOrgId) -{ - return ImageUtils.remove("ORGANISATION", "IMAGE", pOrgId); -} - -/** - * opens the org-report - * - * @param {String} pOrgId the id of the organization - */ -OrgUtils.openOrgReport = function(pOrgId) -{ - var relationId = pOrgId; - - //org info - var info = db.cell(SqlCondition.begin() - .andPrepare("ORGANISATION.ORGANISATIONID", pOrgId) - .buildSql("select ORGANISATION.INFO from ORGANISATION")); - - //communication data of the organization - var commSql = "select MEDIUM_ID, ADDR from COMMUNICATION"; - commSql = SqlCondition.begin() - .andPrepare("COMMUNICATION.CONTACT_ID", relationId) - .and("STANDARD = 1") - .buildSql(commSql); - var commData = db.table(commSql); - - //resolve keyword - commData.forEach(function (row) - { - row[0] = KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), row[0]); - }); - commData = ReportData.begin(["KINDOFCOMM", "COMMVALUE"]).add(commData); - - //select people from the organization - - var persSql = "select SALUTATION, TITLE, FIRSTNAME, LASTNAME " - + ",CONTACTROLE as PERSFUNCITON, DEPARTMENT as PERSDEPARTMENT " - + ",(" + CommUtil.getStandardSubSqlMail() + ")" - + ",(" + CommUtil.getStandardSubSqlPhone() + ")" - + ",ORGANISATION_ID, CONTACTID " - + "from PERSON join CONTACT on PERSONID = PERSON_ID"; - persSql = SqlCondition.begin() - .andPrepare("CONTACT.ORGANISATION_ID", pOrgId) - .and("CONTACT.STATUS = '" + $KeywordRegistry.contactStatus$active() + "'") //TODO: replace this with something that isn't a hard coded id - .buildSql(persSql, "", " order by PERSON.LASTNAME asc"); - var persData = db.table(persSql); - - for (let i = 0; i < persData.length; i++) - { - _joinArrayVals(persData[i], 0, 4); //join the full name together - _joinArrayVals(persData[i], 3, 2, "\n"); //join communication together - } - persData = ReportData.begin(["PERSNAMECOMPLETE", "PERSFUNCTION", "PERSDEPARTMENT", "PERSCOMM", "ORGANISATION_ID", "CONTACT_ID"]).add(persData); - - var histSql = "select ENTRYDATE, CATEGORY, FIRSTNAME, LASTNAME, INFO from ACTIVITY " - + " join ACTIVITYLINK on ACTIVITYLINK.ACTIVITY_ID = ACTIVITYID " - + " join CONTACT on ACTIVITYLINK.OBJECT_ROWID = CONTACTID" - + " left join PERSON on CONTACT.PERSON_ID = PERSONID"; - histSql = SqlCondition.begin() - .andPrepare("CONTACT.ORGANISATION_ID", pOrgId) //= all activities linked to the organization or an employee - .buildSql(histSql, "", "order by ENTRYDATE desc"); - var histData = db.table(histSql); - - var dateFormat = translate.text("dd.MM.yyyy"); - histData.forEach(function (row) - { - row[0] = datetime.toDate(row[0], dateFormat); - row[1] = KeywordUtils.getViewValue($KeywordRegistry.activityCategory(), row[1]); - _joinArrayVals(row, 2, 2); - }); - histData = ReportData.begin(["ENTRYDATE", "MEDIUM", "LOGIN", "INFO"]).add(histData); - - var attr = AttributeRelationUtils.getAllAttributes(pOrgId) - .map(function (row) {return row[1] ? row.join(": ") : row[0]}) - .join("\n"); - - //tasks - var taskSql = "select TASK.SUBJECT, TASK.DESCRIPTION, TASK.STATUS, FIRSTNAME, LASTNAME from TASK" - + " join CONTACT on EDITOR_CONTACT_ID = CONTACTID" - + " left join PERSON on CONTACT.PERSON_ID = PERSONID"; - taskSql = SqlCondition.begin() - .andPrepare("CONTACT.ORGANISATION_ID", pOrgId) - .buildSql(taskSql); - var taskData = db.table(taskSql); - - taskData.forEach(function (row) - { - row[2] = KeywordUtils.getViewValue($KeywordRegistry.taskStatus(), row[2]); - _joinArrayVals(row, 3, 2); //join FIRSTNAME and LASTNAME together - }); - taskData = ReportData.begin(["SUBJECT", "INFOTEXT", "STATUS", "RESPONSIBLE"]).add(taskData); - - var params = { - "ORGAddr" : AddressUtils.getAddress(relationId).toString(), //TODO: use new address logic when available - "ORGAttr" : attr, - "INFO" : info - }; - - var orgReport = new Report("Organisation_report", params); - - //add subreport data - orgReport.addSubReportData("subdataComm", commData); - orgReport.addSubReportData("subdataPers", persData); - orgReport.addSubReportData("subdataHist", histData); - orgReport.addSubReportData("subdataTask", taskData); - - //add logo - //TODO: use an function to get the image when available - var imgData = [ - "meineFirma | Konrad-Zuse-Straße 4 | DE 84144 Geisenhausen", - "base64:iVBORw0KGgoAAAANSUhEUgAAAM4AAABRCAYAAACaL5lSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDA4QzAyM0IwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDA4QzAyM0MwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowMDhDMDIzOTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowMDhDMDIzQTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhF3nYoAAAlvSURBVHja7J1fjBXVHcfPJQJRoe1urQYJRBYlMUJisqwvGNjY3WgEUtN2CeWBIGb3Ju6LElsW+gA8AHe1UfuwTcBASB/Q7CZNG0tjw2pWU15kNzEBJFnLqmvQBNEbU0pbX+jve+9vlrOzM/fOnTtz78zs95P8cv/MOTPnzJzvnN/5zZ+Tu3XrliGE1MYC7gJCKBxCKBxCKBxCKBxCKBxCCIVDCIVDCIVDCIVDyDzmDq8/d+1/PY5trRB7VGyt2BqxVWLLxe4RW6JpbohdF7sq9qnYpNhFsY/Evoi6QKeOvMAWQKITToQ8LPaEWKfYBrFlVdL/SO1BsU3W/1+JnRMbE3tP7DIPHcmicLrFfia2VWxlBOuD4H6pNi32tthfxM7yEJIsCAc9yw6x7WJLYyozhNgvtlPsLbHT2hMRkjrhYPzynNhu/d4IIMxesafEToqdiGMcREhcwnlKe4AtTaoDhHpArF1sSOwdHlYSN/WGo/Niv2+iaGy2aFnyPKwkqT1OTmyf2pIE1Qdh7t+J/VjsqBgfbyWJEU5OXaMDCa0ThHxYbJHYIYqHJMVV25dg0dgc0LIS0nTh5FPWGPdxzEOaLRxEz/YkbEwTxG3bo2UnpOHCQci3XwffaWONln0FDzdptHBwcXNLiuu5RetASMOE02nKdwSknd1aF0IaIpwdGXFzVmhdCIldOLjLeXuG6rtd60RIrMLBowFLM1TfpVonQmITDh5C25rBOm/VuhESi3Dw5ObKDNZ5pdaNkFiE05nhenfy0JM4hIMI1IYM13uD4QVREoNw8DaaZRmu9zKtIyGh8HusYG3UG/pJ6w/NKy89O/P70j+nzSsn/zTz+5EHV5oHlt9rep58fFa+sQ8vmEtXps35C5/4+12PrTMP3H9v6dMGeZAX6/Cp49tsAiRK4TTsnrS771xsdj3TZTrWPeQrCtiljmnzhzfPmH//538zyyC0/l9tLonSC6wT1tmxzgxJ3q+//a4pdSTzx1Vb1SjR/Hr3L3xFY4MeCWnt3wf7d/iKxgYC+83un7vTruLhJ1H3OMsbsfHnpbdAo0Yv8rcPzpsz74/P6i3QU0AgtgA2b1pvPhQXDHltd+7MB+MzPQrSIa/tukE0mzeuN6f+/O6cOuZyubrr0tvb12bK73nDZ/cbbxwfzWKD2Tnw2l75KIiN/rHwYibvwggyobSfcO6Ju3COINDYX5axjsuNKo1PYLue+eksATy9scN0rF1T6q0AxkkYL9l8dvWaOXX1XfPZl9dK+W23zxJY1HXsUtEANK7RBDf+s1reakyJOFa7/utz6ivr6ZLlmTxBhHXVGvawmsfYYxYjf//HrHENBIMexVnmFs2cwIJr+WO33cKo64gGNKXfBzPcZo479Z2voqnU4zQENGz0DpWAaJAOLpoNxGa7dn6cv/jJbHfv/vtiqYu4ZhDN6pQd/5rdLUk/mPETQ109zo2GCOf8hUDpPr4yHTqvu8exAgQ3DCERC+d63BtGT1Ktt3G45uHK+VybmYPbDbSEc52Hn0QtnKtxb7jSuKZaWojOHvfUkt8JKjSijmT+jXEwqdOmeHuc/4bOe7OOvK46etLb24eoWI8pv4/aHhSP+IWZNRx9RX/mJd3xasvlP2wDUSo7wlUaQ8jyYrUKhClnvewceO2Yltkr4maHq0vLEXkz5SijU8duJ6jgXpf8btPfe937Q5YXNU+LpilYaSY0zUiVsrdrObD+FmsR8o1Uyx+kx5mcByeNSa/GLzauB6XdtRgH66w21rqR9aDRDJu5YWGsf1yF5pe3YeWsU2QoW6DQt6a94hLNzP6AYFRY4y7RGN0Hwypav/UXrLwtrsU91fIHFc7FeSCci67G2KIHGQehqL1CDmbK0TLnbFSQtH11brtPbdDaRqu5Hept82hAzShnveDEgN5ltZzNc2pePaFTJ5S9Fel89sewfs876zPlR+GdywAFFZcX7VYPtj5E/kCuGubcxPSBWb1D+iuto01BDwp2YreGl0vo923SEIf17LTXOqhhaHe7c+qa5VUYJRdOvg94uGxRlhMXMStdJu+u41oNyjgRMNzdoq7SNucPdc3y2pC7rBPJNtulQvkkTd7cnp2vx3iHyydUcFP2nzXkD9TjYIKmcxnubc4ZaxIqbazO2XnQbowunB0KV6m9ju2PusdALn/bfZZsVjnrZTCCtPZ+8hyHqLinLMEajzQDbtG48hcr5Q/a44AxU55zM4uMefi4Xg13FtJQJ6Qh2o16IqxwAi5ri7mcsd5vVsNguyhp/co44fPdzZTur7aQxZ0wwW5DqioczO6Mq4dZfO/Aex5uhcO3VqOr5l6EpVih0RcrbL/R5ayHqSj2RwURhdqeFZWzx5s1i62ScDAlOh706s+gcC4npHHVSoshoRDB9Fjjw7qpdq8apkTH7M5LM75fnTNeUc74rSxn5kTjXFtyGLDHUAhE1HDHeCDhYGWYEr13nginBQPwIBcfWc5UsdcKLmyLYoVB3h192mR/GvRRnwE4y5n+3qbdcnErBSvaoxbOmNjJLO9cRKGsgWehylX7rmZdlU9LOdM2RtS7ClqiFg44IfbXtO6thQvvuBkgWd7auePuRqcN8Zi5faGsWaSlnIlAw9yOS1vQIIEjmDb7frkogwMOcNWGTPnNMGl7O8zknYsX/UA+76p2NpcGB/93WBslzugFn+QTzapMWsqZMPLW/sI9ae7l3ToOChxxq2UO0HfEXjXpegAMZX118aKFNwM2SvjAqzXqUvRohPi/tdkv4khLORPU64yoONxjHNyVsD7MbUU5rzd67Nr/eqU8+8UOp2Sf/VbsiN/CU0deYKsioVgQIs9RsUMpqNshLSshkRPmZR23tFF+L7bPJG/69hsqmKNaVkISIRxHPHCBvhHbk6CAwaSOw47x0JIkCscBDfRzU76frdnTuSNcPqRBDEISLRyjDfWSKUdzMCV6o+edQagcF2hPmOzf4UAyJByn8R405bsMMCU6ZneO+8bQf5nyfXSnzdznawhJhXAcxtQQL8fszpioNurnefCMEB53wJ3bvDpOMiEch7NqGHNgotpOU54+MOw7DPCOgHMqSjyEdpmHjmRROA6X1YZ07IPpAzETGqJwmJ8GU21g1gAnpI1QMt6wiZcF4r1niJLhbTQfcfxCkkQuyFwghJDZLOAuIITCIYTCIYTCIYTCIYTCIYRQOIRQOIRQOIRQOIRQOISQWvi/AAMA9UczDEaG0p8AAAAASUVORK5CYII=" - ]; - params["myAddr"] = imgData[0]; - orgReport.addImage("myLogo", imgData[1]); - - orgReport.openReport(); - - /* - * merges multiple columns in an two-dimensional array into one - */ - function _joinArrayVals (pArr, pIndex, pHowMany, pJoinSeparator) - { - if (pJoinSeparator == undefined) - pJoinSeparator = " "; - pArr.splice(pIndex, pHowMany, ArrayUtils.joinNonEmptyFields( - pArr.slice(pIndex, pIndex + pHowMany), pJoinSeparator) - ); - } +import("Util_lib"); +import("system.datetime"); +import("system.translate"); +import("system.db"); +import("system.text"); +import("Binary_lib"); +import("Report_lib"); +import("Sql_lib"); +import("Keyword_lib"); +import("Attribute_lib"); +import("PostalAddress_lib"); +import("Communication_lib"); +import("KeywordRegistry_basic"); + +/** + * a static Utility class for the Org context. + * + * Do not create an instance of this! + * @class + */ +function OrgUtils() {} + +/** + * returns the image for a organisation + * + * @param {String} pOrgId the id of the organisation. + * @param {String} pDefaultText the text, to use for default image generation. + * @return {String} base64 coded String of the image. If none existed, the given String is used to create an image. + */ +OrgUtils.getImage = function(pOrgId, pDefaultText) +{ + return ImageUtils.get("ORGANISATION", "IMAGE", pOrgId, pDefaultText); +} + +/** + * sets the image of a organisation + * + * @param {String} pOrgId the id of the organisation. + * @param {String} pImageDateBase64 base64 coded String of the image. + * @return {Boolean} if image could be set + */ +OrgUtils.setImage = function(pOrgId, pImageDateBase64) +{ + return ImageUtils.set("ORGANISATION", "IMAGE", pOrgId, pImageDateBase64, "OrgImage", "Image of the organisation"); +} + +/** + * deletes the image of a organisation + * + * @param {String} pOrgId the id of the organisation. + * @return {Boolean} if image could be removed + */ +OrgUtils.removeImage = function(pOrgId) +{ + return ImageUtils.remove("ORGANISATION", "IMAGE", pOrgId); +} + +/** + * opens the org-report + * + * @param {String} pOrgId the id of the organization + */ +OrgUtils.openOrgReport = function(pOrgId) +{ + var relationId = pOrgId; + + //org info + var info = db.cell(SqlCondition.begin() + .andPrepare("ORGANISATION.ORGANISATIONID", pOrgId) + .buildSql("select ORGANISATION.INFO from ORGANISATION")); + + //communication data of the organization + var commSql = "select MEDIUM_ID, ADDR from COMMUNICATION"; + commSql = SqlCondition.begin() + .andPrepare("COMMUNICATION.CONTACT_ID", relationId) + .and("ISSTANDARD = 1") + .buildSql(commSql); + var commData = db.table(commSql); + + //resolve keyword + commData.forEach(function (row) + { + row[0] = KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), row[0]); + }); + commData = ReportData.begin(["KINDOFCOMM", "COMMVALUE"]).add(commData); + + //select people from the organization + + var persSql = "select SALUTATION, TITLE, FIRSTNAME, LASTNAME " + + ",CONTACTROLE as PERSFUNCITON, DEPARTMENT as PERSDEPARTMENT " + + ",(" + CommUtil.getStandardSubSqlMail() + ")" + + ",(" + CommUtil.getStandardSubSqlPhone() + ")" + + ",ORGANISATION_ID, CONTACTID " + + "from PERSON join CONTACT on PERSONID = PERSON_ID"; + persSql = SqlCondition.begin() + .andPrepare("CONTACT.ORGANISATION_ID", pOrgId) + .and("CONTACT.STATUS = '" + $KeywordRegistry.contactStatus$active() + "'") //TODO: replace this with something that isn't a hard coded id + .buildSql(persSql, "", " order by PERSON.LASTNAME asc"); + var persData = db.table(persSql); + + for (let i = 0; i < persData.length; i++) + { + _joinArrayVals(persData[i], 0, 4); //join the full name together + _joinArrayVals(persData[i], 3, 2, "\n"); //join communication together + } + persData = ReportData.begin(["PERSNAMECOMPLETE", "PERSFUNCTION", "PERSDEPARTMENT", "PERSCOMM", "ORGANISATION_ID", "CONTACT_ID"]).add(persData); + + var histSql = "select ENTRYDATE, CATEGORY, FIRSTNAME, LASTNAME, INFO from ACTIVITY " + + " join ACTIVITYLINK on ACTIVITYLINK.ACTIVITY_ID = ACTIVITYID " + + " join CONTACT on ACTIVITYLINK.OBJECT_ROWID = CONTACTID" + + " left join PERSON on CONTACT.PERSON_ID = PERSONID"; + histSql = SqlCondition.begin() + .andPrepare("CONTACT.ORGANISATION_ID", pOrgId) //= all activities linked to the organization or an employee + .buildSql(histSql, "", "order by ENTRYDATE desc"); + var histData = db.table(histSql); + + var dateFormat = translate.text("dd.MM.yyyy"); + histData.forEach(function (row) + { + row[0] = datetime.toDate(row[0], dateFormat); + // convert html to text + if (row[1] == $KeywordRegistry.activityCategory$mail()) + { + row[4] = text.html2text(row[4]); + } + + row[1] = KeywordUtils.getViewValue($KeywordRegistry.activityCategory(), row[1]); + _joinArrayVals(row, 2, 2); + }); + histData = ReportData.begin(["ENTRYDATE", "MEDIUM", "LOGIN", "INFO"]).add(histData); + + var attr = AttributeRelationUtils.getAllAttributes(pOrgId) + .map(function (row) {return row[1] ? row.join(": ") : row[0]}) + .join("\n"); + + //tasks + var taskSql = "select TASK.SUBJECT, TASK.DESCRIPTION, TASK.STATUS, FIRSTNAME, LASTNAME from TASK" + + " join CONTACT on EDITOR_CONTACT_ID = CONTACTID" + + " left join PERSON on CONTACT.PERSON_ID = PERSONID"; + taskSql = SqlCondition.begin() + .andPrepare("CONTACT.ORGANISATION_ID", pOrgId) + .buildSql(taskSql); + var taskData = db.table(taskSql); + + taskData.forEach(function (row) + { + row[2] = KeywordUtils.getViewValue($KeywordRegistry.taskStatus(), row[2]); + _joinArrayVals(row, 3, 2); //join FIRSTNAME and LASTNAME together + }); + taskData = ReportData.begin(["SUBJECT", "INFOTEXT", "STATUS", "RESPONSIBLE"]).add(taskData); + + var params = { + "ORGAddr" : AddressUtils.getAddress(relationId).toString(), //TODO: use new address logic when available + "ORGAttr" : attr, + "INFO" : info + }; + + var orgReport = new Report("Organisation_report", params); + + //add subreport data + orgReport.addSubReportData("subdataComm", commData); + orgReport.addSubReportData("subdataPers", persData); + orgReport.addSubReportData("subdataHist", histData); + orgReport.addSubReportData("subdataTask", taskData); + + //add logo + //TODO: use an function to get the image when available + var imgData = [ + "meineFirma | Konrad-Zuse-Straße 4 | DE 84144 Geisenhausen", + "base64:iVBORw0KGgoAAAANSUhEUgAAAM4AAABRCAYAAACaL5lSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDA4QzAyM0IwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDA4QzAyM0MwREIwMTFFNEFGMDREM0VEMjExRjlBRTIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowMDhDMDIzOTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowMDhDMDIzQTBEQjAxMUU0QUYwNEQzRUQyMTFGOUFFMiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhF3nYoAAAlvSURBVHja7J1fjBXVHcfPJQJRoe1urQYJRBYlMUJisqwvGNjY3WgEUtN2CeWBIGb3Ju6LElsW+gA8AHe1UfuwTcBASB/Q7CZNG0tjw2pWU15kNzEBJFnLqmvQBNEbU0pbX+jve+9vlrOzM/fOnTtz78zs95P8cv/MOTPnzJzvnN/5zZ+Tu3XrliGE1MYC7gJCKBxCKBxCKBxCKBxCKBxCCIVDCIVDCIVDCIVDyDzmDq8/d+1/PY5trRB7VGyt2BqxVWLLxe4RW6JpbohdF7sq9qnYpNhFsY/Evoi6QKeOvMAWQKITToQ8LPaEWKfYBrFlVdL/SO1BsU3W/1+JnRMbE3tP7DIPHcmicLrFfia2VWxlBOuD4H6pNi32tthfxM7yEJIsCAc9yw6x7WJLYyozhNgvtlPsLbHT2hMRkjrhYPzynNhu/d4IIMxesafEToqdiGMcREhcwnlKe4AtTaoDhHpArF1sSOwdHlYSN/WGo/Niv2+iaGy2aFnyPKwkqT1OTmyf2pIE1Qdh7t+J/VjsqBgfbyWJEU5OXaMDCa0ThHxYbJHYIYqHJMVV25dg0dgc0LIS0nTh5FPWGPdxzEOaLRxEz/YkbEwTxG3bo2UnpOHCQci3XwffaWONln0FDzdptHBwcXNLiuu5RetASMOE02nKdwSknd1aF0IaIpwdGXFzVmhdCIldOLjLeXuG6rtd60RIrMLBowFLM1TfpVonQmITDh5C25rBOm/VuhESi3Dw5ObKDNZ5pdaNkFiE05nhenfy0JM4hIMI1IYM13uD4QVREoNw8DaaZRmu9zKtIyGh8HusYG3UG/pJ6w/NKy89O/P70j+nzSsn/zTz+5EHV5oHlt9rep58fFa+sQ8vmEtXps35C5/4+12PrTMP3H9v6dMGeZAX6/Cp49tsAiRK4TTsnrS771xsdj3TZTrWPeQrCtiljmnzhzfPmH//538zyyC0/l9tLonSC6wT1tmxzgxJ3q+//a4pdSTzx1Vb1SjR/Hr3L3xFY4MeCWnt3wf7d/iKxgYC+83un7vTruLhJ1H3OMsbsfHnpbdAo0Yv8rcPzpsz74/P6i3QU0AgtgA2b1pvPhQXDHltd+7MB+MzPQrSIa/tukE0mzeuN6f+/O6cOuZyubrr0tvb12bK73nDZ/cbbxwfzWKD2Tnw2l75KIiN/rHwYibvwggyobSfcO6Ju3COINDYX5axjsuNKo1PYLue+eksATy9scN0rF1T6q0AxkkYL9l8dvWaOXX1XfPZl9dK+W23zxJY1HXsUtEANK7RBDf+s1reakyJOFa7/utz6ivr6ZLlmTxBhHXVGvawmsfYYxYjf//HrHENBIMexVnmFs2cwIJr+WO33cKo64gGNKXfBzPcZo479Z2voqnU4zQENGz0DpWAaJAOLpoNxGa7dn6cv/jJbHfv/vtiqYu4ZhDN6pQd/5rdLUk/mPETQ109zo2GCOf8hUDpPr4yHTqvu8exAgQ3DCERC+d63BtGT1Ktt3G45uHK+VybmYPbDbSEc52Hn0QtnKtxb7jSuKZaWojOHvfUkt8JKjSijmT+jXEwqdOmeHuc/4bOe7OOvK46etLb24eoWI8pv4/aHhSP+IWZNRx9RX/mJd3xasvlP2wDUSo7wlUaQ8jyYrUKhClnvewceO2Yltkr4maHq0vLEXkz5SijU8duJ6jgXpf8btPfe937Q5YXNU+LpilYaSY0zUiVsrdrObD+FmsR8o1Uyx+kx5mcByeNSa/GLzauB6XdtRgH66w21rqR9aDRDJu5YWGsf1yF5pe3YeWsU2QoW6DQt6a94hLNzP6AYFRY4y7RGN0Hwypav/UXrLwtrsU91fIHFc7FeSCci67G2KIHGQehqL1CDmbK0TLnbFSQtH11brtPbdDaRqu5Hept82hAzShnveDEgN5ltZzNc2pePaFTJ5S9Fel89sewfs876zPlR+GdywAFFZcX7VYPtj5E/kCuGubcxPSBWb1D+iuto01BDwp2YreGl0vo923SEIf17LTXOqhhaHe7c+qa5VUYJRdOvg94uGxRlhMXMStdJu+u41oNyjgRMNzdoq7SNucPdc3y2pC7rBPJNtulQvkkTd7cnp2vx3iHyydUcFP2nzXkD9TjYIKmcxnubc4ZaxIqbazO2XnQbowunB0KV6m9ju2PusdALn/bfZZsVjnrZTCCtPZ+8hyHqLinLMEajzQDbtG48hcr5Q/a44AxU55zM4uMefi4Xg13FtJQJ6Qh2o16IqxwAi5ri7mcsd5vVsNguyhp/co44fPdzZTur7aQxZ0wwW5DqioczO6Mq4dZfO/Aex5uhcO3VqOr5l6EpVih0RcrbL/R5ayHqSj2RwURhdqeFZWzx5s1i62ScDAlOh706s+gcC4npHHVSoshoRDB9Fjjw7qpdq8apkTH7M5LM75fnTNeUc74rSxn5kTjXFtyGLDHUAhE1HDHeCDhYGWYEr13nginBQPwIBcfWc5UsdcKLmyLYoVB3h192mR/GvRRnwE4y5n+3qbdcnErBSvaoxbOmNjJLO9cRKGsgWehylX7rmZdlU9LOdM2RtS7ClqiFg44IfbXtO6thQvvuBkgWd7auePuRqcN8Zi5faGsWaSlnIlAw9yOS1vQIIEjmDb7frkogwMOcNWGTPnNMGl7O8zknYsX/UA+76p2NpcGB/93WBslzugFn+QTzapMWsqZMPLW/sI9ae7l3ToOChxxq2UO0HfEXjXpegAMZX118aKFNwM2SvjAqzXqUvRohPi/tdkv4khLORPU64yoONxjHNyVsD7MbUU5rzd67Nr/eqU8+8UOp2Sf/VbsiN/CU0deYKsioVgQIs9RsUMpqNshLSshkRPmZR23tFF+L7bPJG/69hsqmKNaVkISIRxHPHCBvhHbk6CAwaSOw47x0JIkCscBDfRzU76frdnTuSNcPqRBDEISLRyjDfWSKUdzMCV6o+edQagcF2hPmOzf4UAyJByn8R405bsMMCU6ZneO+8bQf5nyfXSnzdznawhJhXAcxtQQL8fszpioNurnefCMEB53wJ3bvDpOMiEch7NqGHNgotpOU54+MOw7DPCOgHMqSjyEdpmHjmRROA6X1YZ07IPpAzETGqJwmJ8GU21g1gAnpI1QMt6wiZcF4r1niJLhbTQfcfxCkkQuyFwghJDZLOAuIITCIYTCIYTCIYTCIYTCIYRQOIRQOIRQOIRQOIRQOISQWvi/AAMA9UczDEaG0p8AAAAASUVORK5CYII=" + ]; + params["myAddr"] = imgData[0]; + orgReport.addImage("myLogo", imgData[1]); + + orgReport.openReport(); + + /* + * merges multiple columns in an two-dimensional array into one + */ + function _joinArrayVals (pArr, pIndex, pHowMany, pJoinSeparator) + { + if (pJoinSeparator == undefined) + pJoinSeparator = " "; + pArr.splice(pIndex, pHowMany, ArrayUtils.joinNonEmptyFields( + pArr.slice(pIndex, pIndex + pHowMany), pJoinSeparator) + ); + } } \ No newline at end of file diff --git a/process/Permission_lib/process.js b/process/Permission_lib/process.js index 999846f31bde5082d5b45cdd0f75ec7247317011..bfe618882b42cfbdb8510f15b31f3051c89116d9 100644 --- a/process/Permission_lib/process.js +++ b/process/Permission_lib/process.js @@ -10,143 +10,109 @@ import("Sql_lib"); */ function PermissionUtil () {} -var alias = "_____SYSTEMALIAS"; +{ //block where variables declared with let are available to avoid unexpected side-effects -/** + let alias = SqlUtils.getSystemAlias(); + + /** * Returns the ids of all subordinated permission sets of a given parent permission set. * - * @param {String} pPermissionSetId the id of the parent permission set + * @param {String} pSetId id of the parent permission set * * @result {String[]} array with the ids of every subordinated permission set. The result can never be null. */ -PermissionUtil.getAllChildPermissionSets = function (pPermissionSetId) -{ - return db.array(db.COLUMN, SqlCondition.begin() - .and("ASYS_PERMISSIONSET_ID = '" + pPermissionSetId + "'") - .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET") - , alias); -} - -/** - * Returns the id of the subordinated permission set with accesstype 'record' of a given permission set. - * - * @param {String} pPermissionSetId the id of the parent permission set - * - * @result {String} id of subordinated permission set. The result can never be null. - */ -PermissionUtil.getChildRecordPermissionSet = function (pPermissionSetId) -{ - return db.array(db.COLUMN, SqlCondition.begin() - .and("ASYS_PERMISSIONSET_ID = '" + pPermissionSetId + "'") - .and("ACCESSTYPE = 'R'") - .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET") - , alias); -} - -/** - * Returns all subordinated permissions of a given permission set. - * - * @param {String} pPermissionSetId the id of the parent permission set - * - * @result {String[]} array with the ids of every subordinated permission. The result can never be null. - */ -PermissionUtil.getAllChildPermissions = function (pPermissionSetId) -{ - return db.array(db.COLUMN, SqlCondition.begin() - .and("ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID = '" + pPermissionSetId + "'") - .buildSql("select ASYS_PERMISSION.ASYS_PERMISSIONID from ASYS_PERMISSION" - + " join ASYS_PERMISSIONSET on ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID = ASYS_PERMISSION.ASYS_PERMISSIONSET_ID") - , alias); -} + PermissionUtil.getChildSetsOfSet = function (pSetId) + { + return db.array(db.COLUMN, SqlCondition.begin() + .and("ASYS_PERMISSIONSET_ID = '" + pSetId + "'") + .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET") + , alias); + } -/** + /** * Returns all subordinated permission actions of a given permission set. * - * @param {String} pPermissionSetId the id of the parent permission set + * @param {String} pSetId id of the parent permission set * * @result {String[]} array with the ids of every subordinated permission action. The result can never be null. */ -PermissionUtil.getAllChildPermissionActions = function (pPermissionSetId) -{ - return db.array(db.COLUMN, SqlCondition.begin() - .and("ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = '" + pPermissionSetId + "'") - .buildSql("select ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION" - + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONID = ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID") - , alias); -} - -/** - * Returns all subordinated permission actions of a given permission. + PermissionUtil.getActionsOfSet = function (pSetId) + { + return db.array(db.COLUMN, SqlCondition.begin() + .and("ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = '" + pSetId + "'") + .buildSql("select ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION" + + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONID = ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID") + , alias); + } + + /** + * Returns all permission actions of the given permissions. * - * @param {String} pPermissionId the id of the parent permission + * @param {String[]} pPermIds the ids of the permissions * - * @result {String[]} array with the ids of every subordinated permission action. The result can never be null. + * @result {String[]} returns ids of all permission actions. The result can never be null. */ -PermissionUtil.getAllChildPermissionActions = function (pPermissionId) -{ - return db.array(db.COLUMN, SqlCondition.begin() - .and("ASYS_PERMISSION_ID = '" + pPermissionId + "'") - .buildSql("select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION") - , alias); -} + PermissionUtil.getActions = function(pPermIds) { + return db.table("select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID in ('" + pPermIds.join("','") + "')", alias); + } -/** + /** * Returns the action a given permission action id. * - * @param {String} pPermissionActionId the id of the action + * @param {String} pActionId id of the action * - * @result {String} action name as readable string of the given permission action id. Never 'null', empty string if there is no result. + * @result {String} title of action as readable string of the given action id. Never 'null', empty string if there is no result. */ -PermissionUtil.resolvePermissionActionId = function (pPermissionActionId) -{ - return db.cell(SqlCondition.begin() - .and("ASYS_PERMISSIONACTIONID = '" + pPermissionActionId + "'") - .buildSql("select ASYS_PERMISSIONACTION.ACTION from ASYS_PERMISSIONACTION") - , alias); -} + PermissionUtil.resolveActionId = function (pActionId) + { + return db.cell(SqlCondition.begin() + .and("ASYS_PERMISSIONACTIONID = '" + pActionId + "'") + .buildSql("select ASYS_PERMISSIONACTION.ACTION from ASYS_PERMISSIONACTION") + , alias); + } -/** + /** * Converts a given array to an object with properties permissionid, entity, role, field, cond, action, accesstype. * * @param {String[]} pArr the array which should be converted to an object. * * @result {{}} converted object */ -PermissionUtil.convertArrToObj = function(pArr) { - var ret = pArr.map(function(x) { - return { - "permissionid": x[0], - "entity": x[1], - "role": x[2], - "field": x[3], - "cond": x[4], - "action": x[5], - "accesstype": x[6], - "condtype": x[7] - } - }); - return ret; -} + PermissionUtil.convertArrToObj = function(pArr) { + var ret = pArr.map(function(x) { + return { + "permissionid": x[0], + "entity": x[1], + "role": x[2], + "field": x[3], + "cond": x[4], + "action": x[5], + "accesstype": x[6], + "condtype": x[7] + } + }); + return ret; + } -/** - * Returns the first index at which a given permissionid can be found in the array, or -1 if it is not present. - * - * @param {String} pPermId the id of the permission + /** + * Returns the first index at which a given permissionid can be found in an array, or -1 if it is not present. * * @param {String[]} pPermTable permission table - * - * @result {int} returns the position (index) of the searched permission in the table, otherwise returns -1 if not found - */ -PermissionUtil.indexOfPermId = function(pPermTable, pPermId) { - var notFound = -1; - for (var i = 0; i < pPermTable.length; i++) { - if(pPermTable[i].permissionid == pPermId) - return i; + * + * @param {String} pPermId id of the permission + * + * @result {int} returns position (index) of the searched permission in the table, otherwise returns -1 if not found + */ + PermissionUtil.indexOfPermId = function(pPermTable, pPermId) { + var notFound = -1; + for (var i = 0; i < pPermTable.length; i++) { + if(pPermTable[i].permissionid == pPermId) + return i; + } + return notFound; } - return notFound; -} -/** + /** * Checks a permission if the given actions are different to the actions in the database. * * @param {String} pPermId permission id to which the actions are linked to @@ -155,17 +121,17 @@ PermissionUtil.indexOfPermId = function(pPermTable, pPermId) { * * @result {String[]} returns the different elements */ -PermissionUtil.getActionDiff = function(pPermId, pActionNew) { - var sqlStr = "select ACTION from ASYS_PERMISSIONACTION where ASYS_PERMISSION_ID = '" + pPermId + "'"; - var actionOld = db.array(db.COLUMN, sqlStr, alias); + PermissionUtil.getActionDiff = function(pPermId, pActionNew) { + var sqlStr = "select ACTION from ASYS_PERMISSIONACTION where ASYS_PERMISSION_ID = '" + pPermId + "'"; + var actionOld = db.array(db.COLUMN, sqlStr, alias); - return arrDiff(actionOld, pActionNew); -} + return arrDiff(actionOld, pActionNew); + } -/** + /** * Checks if the given string is different to the string of a column in the given database table. * - * @param {String} pId the id + * @param {String} pId id of DB entry * * @param {String} pString string which has to be checked if different * @@ -175,16 +141,16 @@ PermissionUtil.getActionDiff = function(pPermId, pActionNew) { * * @result {Boolean} returns true if different, otherwise false */ -PermissionUtil.isDiff = function(pId, pString, pDbCol, pDbTable) { - var sqlStr = "select " + pDbCol + " from " + pDbTable + " where " + pDbTable + "ID = '" + pId + "'"; - var stringDb = db.cell(sqlStr, alias); - return stringDb != pString ? true : false; -} + PermissionUtil.isDiff = function(pId, pString, pDbCol, pDbTable) { + var sqlStr = "select " + pDbCol + " from " + pDbTable + " where " + pDbTable + "ID = '" + pId + "'"; + var stringDb = db.cell(sqlStr, alias); + return stringDb != pString ? true : false; + } -/** + /** * Updates the value of the column in table if the values are different. * - * @param {String} pId the id + * @param {String} pId id of DB entry * * @param {String} pValue string which gets checked if different * @@ -194,329 +160,377 @@ PermissionUtil.isDiff = function(pId, pString, pDbCol, pDbTable) { * * @result {Integer} number of records that were updated */ -PermissionUtil.updateIfDiff = function(pId, pValue, pDbCol, pDbTable) { - if (PermissionUtil.isDiff(pId, pValue, pDbCol, pDbTable)) { - var cols = [pDbCol]; - var vals = [pValue]; - var cond = SqlCondition.begin().and(pDbTable + "ID = '" + pId + "'").build(); - return db.updateData(pDbTable, cols, null, vals, cond, alias); - } - return 0; -} + PermissionUtil.updateIfDiff = function(pId, pValue, pDbCol, pDbTable) { + if (PermissionUtil.isDiff(pId, pValue, pDbCol, pDbTable)) { + var cols = [pDbCol]; + var vals = [pValue]; + var cond = SqlCondition.begin().and(pDbTable + "ID = '" + pId + "'").build(); + return db.updateData(pDbTable, cols, null, vals, cond, alias); + } + return 0; + } -/** + /** * Gets the number of permissions which are linked to the given entity. * - * @param {String} pEntityName The name of the entity + * @param {String} pEntityName name of the entity * - * @result {Integer} returns the number of permissions linked to the entity. + * @result {Integer} returns number of permissions linked to the entity. */ -PermissionUtil.getNumberOfPermissions = function(pEntityName) { - var table = "ASYS_PERMISSIONSET"; - var sqlStr = "select COUNT(*) from " + table + " where ENTITY_ID = '" + pEntityName + "'"; - return db.cell(sqlStr, alias); -} + PermissionUtil.getNumberOfPermissions = function(pEntityName) { + var table = "ASYS_PERMISSIONSET"; + var sqlStr = "select COUNT(*) from " + table + " where ENTITY_ID = '" + pEntityName + "'"; + return db.cell(sqlStr, alias); + } -/** + /** * Gets the default permission of the root permission set. * - * @param {String} pPermId the id of the permission + * @param {String} pPermId id of the permission * - * @result {String} returns the id of the default permission of the root permission set. Never 'null', empty string if there is no result. + * @result {String} returns id of the default permission of the root permission set. Never 'null', empty string if there is no result. */ -PermissionUtil.getRootPermission = function(pPermId) { - var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION where ASYS_PERMISSIONID = '" + pPermId + "'"; - var parentPermSet = db.array(db.ROW, sqlStr, alias); + PermissionUtil.getPermissionRoot = function(pPermId) { + var parentSet = [PermissionUtil.getParentSet(pPermId)]; - while (parentPermSet[0] != "") { - sqlStr = "select ASYS_PERMISSIONSET_ID, ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + parentPermSet[0] + "'"; - parentPermSet = db.array(db.ROW, sqlStr, alias); - } + while (parentSet[0] != "") { + let sqlStr = "select ASYS_PERMISSIONSET_ID, ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + parentSet[0] + "'"; + parentSet = db.array(db.ROW, sqlStr, alias); + } - sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSIONSET_ID = '" + parentPermSet[1] + "'"; - return db.cell(sqlStr, alias); -} + return PermissionUtil.getPermissionWithoutCond(parentSet[1]); + } -/** - * Gets the default field permission of the root field permission set. + /** + * Gets the default permission of a given permission set. * - * @param {String} pPermId the id of the field permission + * @param {String} pSetId id of the permission set * - * @result {String} returns the id of the default field permission of the root field permission set. Never 'null', empty string if there is no result. + * @result {String} returns id of default permission of given set. Never 'null', empty string if there is no result. */ -PermissionUtil.getRootFieldPermission = function(pPermId) { - var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION where ASYS_PERMISSIONID = '" + pPermId + "'"; - var parentFieldPermSet = db.array(db.ROW, sqlStr, alias); + PermissionUtil.getPermissionWithoutCond = function(pSetId) { + var sqlStr = "select ENTITY_ID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + pSetId + "'"; + var entityName = db.cell(sqlStr, alias); + var noCond = "{\"entity\":\"" + entityName + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; - sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSIONSET_ID = '" + parentFieldPermSet + "' and cond is null"; - return db.cell(sqlStr, alias); -} + sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION" + + " where ASYS_PERMISSIONSET_ID = '" + pSetId + "'" + + " and (COND is null or COND like '%" + noCond + "%')"; + return db.cell(sqlStr, alias); + } -/** - * Gets the default permission of a given permission set. + /** + * Gets the permissions with conditions of a given permission set. * - * @param {String} pPermSetId the id of the permission set + * @param {String} pSetId the id of the permission set * - * @result {String} returns the id of the default permission of a given permission set. Never 'null', empty string if there is no result. + * @result {String[]} returns the ids of permissions with conditions of a given permission set. The result can never be null. */ -PermissionUtil.getDefaultPermission = function(pPermSetId) { - var sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION" - + " where ASYS_PERMISSIONSET_ID = '" + pPermSetId + "'" - + " and COND is null" - return db.cell(sqlStr, alias); -} + PermissionUtil.getPermissionWithCond = function(pSetId) { + var sqlStr = "select ENTITY_ID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + pSetId + "'"; + var entityName = db.cell(sqlStr, alias); + var noCond = "{\"entity\":\"" + entityName + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; + + sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION" + + " where ASYS_PERMISSIONSET_ID = '" + pSetId + "'" + + " and COND is not null and COND not like '" + noCond + "'"; + return db.table(sqlStr, alias); + } -/** - * Gets the conditional permissions of a given permission set. + /** + * Gets the permission set id of a given role-entity-accesstype-combination. * - * @param {String} pPermSetId the id of the permission set + * @param {String} pRole name of the role * - * @result {String[]} returns the ids of the conditional permissions of a given permission set. The result can never be null. - */ -PermissionUtil.getConditionalPermission = function(pPermSetId) { - var sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION" - + " where ASYS_PERMISSIONSET_ID = '" + pPermSetId + "'" - + " and COND is not null" - return db.table(sqlStr, alias); -} - -/** - * Gets the permission actions of a given permission. + * @param {String} pEntity name of the entity * - * @param {String} pPermId the id of the permission + * @param {String} pAccessType name of the access type (E,R,F) + * + * @param {String} pField name of the field * - * @result {String[]} returns the ids of linked actions of a given permission. The result can never be null. + * @result {String} returns id of the matching permission set. The result can never be null. */ -PermissionUtil.getPermissionAction = function(pPermId) { - var sqlStr = "select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION" - + " where ASYS_PERMISSION_ID = '" + pPermId + "'" - return db.table(sqlStr, alias); -} + PermissionUtil.getSet = function(pRole, pEntity, pAccessType, pField) { + var sqlStr = "select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET" + + " where ROLE_ID = '" + pRole + "' and ENTITY_ID = '" + pEntity + "' and ACCESSTYPE = '" + pAccessType + "'"; + if (pField != null && pField != "" && pField != undefined) { + sqlStr += " and FIELD_ID = '" + pField + "'"; + } + return db.cell(sqlStr, alias); + } -/** + /** * Gets the root permission set of a entity-role-combination. * - * @param {String} pRole the id of a role + * @param {String} pRole id of a role * - * @param {String} pEntity the id of an entity + * @param {String} pEntity id of an entity * - * @result {String} returns the id of the root permission set of the given entity-role-combination. Never 'null', empty string if there is no result. + * @result {String} returns id of the root permission set of the given entity-role-combination. Never 'null', empty string if there is no result. */ -PermissionUtil.getRootPermissionSet = function(pRole, pEntity) { - var sqlStr = "select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET" - + " where ROLE_ID = '" + pRole + "' and ENTITY_ID = '" + pEntity +"' and ACCESSTYPE = 'E'"; - return db.cell(sqlStr, alias); -} + PermissionUtil.getSetRoot = function(pRole, pEntity) { + var sqlStr = "select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET" + + " where ROLE_ID = '" + pRole + "' and ENTITY_ID = '" + pEntity +"' and ACCESSTYPE = 'E'"; + return db.cell(sqlStr, alias); + } -/** + /** * Gets the parent permission set of a permission. * - * @param {String} pPermId the id of the permission + * @param {String} pPermId id of the permission * - * @result {String} returns the id of the parent permission set of the given permission. Never 'null', empty string if there is no result. + * @result {String} returns id of the parent set of the given permission. Never 'null', empty string if there is no result. */ -PermissionUtil.getParentPermissionSet = function(pPermId) { - var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION" - + " where ASYS_PERMISSIONID = '" + pPermId + "'"; - return db.cell(sqlStr, alias); -} + PermissionUtil.getParentSet = function(pPermId) { + var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION" + + " where ASYS_PERMISSIONID = '" + pPermId + "'"; + return db.cell(sqlStr, alias); + } -/** - * Checks if the given permission has any children left. + /** + * Checks if the given permission set has any children left. * - * @param {String} pPermSetId the id of the permission set + * @param {String} pSetId id of the permission set * * @result {Boolean} returns true if permission set has no children, otherwise false */ -PermissionUtil.permSetIsEmpty = function(pPermSetId) { - var subSets = PermissionUtil.getAllChildPermissionSets(pPermSetId); - var subPerms = PermissionUtil.getAllChildPermissions(pPermSetId); - var subActions = PermissionUtil.getAllChildPermissionActions(pPermSetId); + PermissionUtil.setIsEmpty = function(pSetId) { + var subSets = PermissionUtil.getChildSetsOfSet(pSetId); + var subPerms = PermissionUtil.getPermissions([pSetId]); + var subActions = PermissionUtil.getActionsOfSet(pSetId); - if (subActions.length == 0 && subPerms == 0 && subSets == 0) - return true; - return false; -} - -/** - * Returns all PermissionSets, Permissions and PermissionActions. - * - * @result {String[]) all PermissionSets, Permissions and PermissionActions. The result can never be null. - */ -PermissionUtil.getCompleteStructure = function() { - return db.table("select ASYS_PERMISSIONSET.ENTITY_ID, ASYS_PERMISSIONSET.ROLE_ID, ASYS_PERMISSIONSET.FIELD_ID, ASYS_PERMISSIONSET.ACCESSTYPE, ASYS_PERMISSION.COND, ASYS_PERMISSION.CONDTYPE, ASYS_PERMISSIONACTION.ACTION from ASYS_PERMISSIONSET" - + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID" - + " join ASYS_PERMISSIONACTION on ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID = ASYS_PERMISSION.ASYS_PERMISSIONID", alias); -} + if (subActions.length == 0 && subPerms.length == 0 && subSets.length == 0) + return true; + return false; + } -/** - * Returns all permissions of the given permission sets. + /** + * Returns all subordinated permissions of the given permission sets. * - * @param {String[]} pPermSetIds the ids of the permission sets + * @param {String[]} pSetIds ids of the permission sets * - * @result {String[]} returns ids of all permissions. The result can never be null. + * @result {String[]} array with ids of all subordinated permissions. The result can never be null. */ -PermissionUtil.getAllPermissions = function(pPermSetIds) { - return db.table("select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONSET_ID in ('" + pPermSetIds.join("','") + "')", alias); -} - -/** - * Returns all permission actions of the given permissions. - * - * @param {String[]} pPermIds the ids of the permissions - * - * @result {String[]} returns ids of all permission actions. The result can never be null. - */ -PermissionUtil.getAllPermissionActions = function(pPermIds) { - return db.table("select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID in ('" + pPermIds.join("','") + "')", alias); -} + PermissionUtil.getPermissions = function(pSetIds) { + return db.table("select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONSET_ID in ('" + pSetIds.join("','") + "')", alias); + } -/** + /** * Returns the condition type of the given permissions. * * @param {String} pPermId the id of the permission * * @result {String} returns the value of condition type (true or false). Never 'null', empty string if there is no result. */ -PermissionUtil.getPermissionCondType = function(pPermId) { - return db.cell("select CONDTYPE from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONID = '" + pPermId + "'", alias); -} - -/** - * Checks if the given actions are already linked to the permission. - * - * @param {String} pPermId the id of the permission - * - * @param {String} pActionNew actions which have to be checked if updated - * - * @result {String[]} returns the element which is a duplicate, otherwise null - */ -PermissionUtil.containsDuplicateActions = function(pPermId, pActionNew) { - var sqlStr = "select ACTION from ASYS_PERMISSIONACTION where ASYS_PERMISSION_ID = '" + pPermId + "'"; - var actionsOld = db.array(db.COLUMN, sqlStr, alias); - var actionsNew = pActionNew.split(","); - var res = null - - res = actionsOld.filter(function(val) { - return actionsNew.indexOf(val) != -1; - }); + PermissionUtil.getPermissionCondType = function(pPermId) { + return db.cell("select CONDTYPE from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONID = '" + pPermId + "'", alias); + } - return res; -} - -/** + /** * Inserts a new instance of a permission set into ASYS_PERMISSIONSET. * - * @param {String} pParentPermSet The parent permission set, empty if root node + * @param {String} pParentPermSetId parent permission set, empty if root node * - * @param {String} pEntity The entity to which the PermissionSet is linked, mandatory + * @param {String} pEntity entity to which the PermissionSet is linked, mandatory * - * @param {String} pRole The Role to which the PermissionSet is linked, mandatory + * @param {String} pRole Role to which the PermissionSet is linked, mandatory * - * @param {String} pField The Field to which the PermissionSet is linked, empty if no field permission + * @param {String} pField Field to which the PermissionSet is linked, empty if no field permission * * @param {String} pAccessType Entity, Record or Field (E, R, F), mandatory * - * @result {Integer} returns the id of the inserted permission set + * @result {Integer} returns id of the inserted permission set */ -PermissionUtil.insertNewPermissionSet = function(pParentPermSet, pEntity, pRole, pField, pAccessType) { - var table = "ASYS_PERMISSIONSET"; - var cols = db.getColumns(table, alias); - var permsetid = util.getNewUUID(); - var vals = [pAccessType, permsetid, pParentPermSet, pEntity, pField, pRole]; - db.insertData(table, cols, null, vals, alias); - return permsetid; -} + PermissionUtil.insertSet = function(pParentPermSetId, pEntity, pRole, pField, pAccessType) { + var table = "ASYS_PERMISSIONSET"; + var cols = db.getColumns(table, alias); + var setId = util.getNewUUID(); + var vals = [pAccessType, setId, pParentPermSetId, pEntity, pField, pRole]; + db.insertData(table, cols, null, vals, alias); + return setId; + } -/** + /** * Inserts a new instance of a permission into ASYS_PERMISSION. * - * @param {String} pParentPermSet The parent permission set, mandatory + * @param {String} pParentSetId parent permission set, mandatory + * + * @param {String} pCond condition of the permission, empty if no condition * - * @param {String} pCond The condition of the permission, empty if no condition + * @param {String} pCondType condition Type of the permission, should nearly always be "true" * - * @param {String} pCondType The Condition Type of the permission, should nearly always be "true" + * @param {String} pPermId id of the new permission (can be empty/null) * - * @result {Integer} returns the id of the inserted permission + * @result {Integer} returns id of the inserted permission */ -PermissionUtil.insertNewPermission = function(pParentPermSet, pCond, pCondType) { - var table = "ASYS_PERMISSION"; - var cols = db.getColumns(table, alias); - var permid = util.getNewUUID(); - var vals = [permid, pParentPermSet, pCond, pCondType]; - db.insertData(table, cols, null, vals, alias); - return permid; -} + PermissionUtil.insertPermission = function(pParentSetId, pCond, pCondType, pPermId) { + var table = "ASYS_PERMISSION"; + var cols = db.getColumns(table, alias); + var permId; + if (pPermId != null && pPermId != "" && pPermId != undefined) { + permId = pPermId; + } else { + permId = util.getNewUUID(); + } + var vals = [permId, pParentSetId, pCond, pCondType]; + db.insertData(table, cols, null, vals, alias); + return permId; + } -/** + /** * Inserts a new instance of a permission action into ASYS_PERMISSIONACTION. * - * @param {String} pParentPerm The parent permission, mandatory + * @param {String} pParentPermId parent permission, mandatory * - * @param {String} pAction Action (view, create,...), mandatory - * - * @result {Integer} returns the id of the inserted permission action - */ -PermissionUtil.insertNewPermissionAction = function(pParentPerm, pAction) { - var table = "ASYS_PERMISSIONACTION"; - var cols = db.getColumns(table, alias); - var permactionid = util.getNewUUID(); - var vals = [pAction, permactionid, pParentPerm]; - db.insertData(table, cols, null, vals, alias); - return permactionid; -} - -/** - * Returns the cond type of a permission. + * @param {String} pAction title of action (view, create,...), mandatory * - * @param {String} pPerm The permission, mandatory + * @param {String} pActionId id of the new permission action * - * @result {Integer} returns the cond type of a permission + * @result {Integer} returns id of the inserted permission action, returns null if insert was not possible */ -PermissionUtil.getCondType = function(pPerm) { - var table = "ASYS_PERMISSION"; - var sqlStr = "select CONDTYPE from " + table + " where ASYS_PERMISSIONID = '" + pPerm + "'"; - return db.cell(sqlStr, alias); -} + PermissionUtil.insertAction = function(pParentPermId, pAction, pActionId) { + var table = "ASYS_PERMISSIONACTION"; + var cols = db.getColumns(table, alias); + var actionId; + var sqlStr = "select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTIONID = '" + pActionId + "'"; -/** - * Deletes a permissionset from ASYS_PERMISSIONSET. - * - * @param {String} pPermSetId The permission set id which should be deleted, mandatory - * - * @result {Integer} returns the number of deleted records - */ -PermissionUtil.deletePermissionSet = function(pPermSetId) { - var table = "ASYS_PERMISSIONSET"; - var cond = " ASYS_PERMISSIONSETID = '" + pPermSetId + "'"; - return db.deleteData(table, cond, alias); -} + if (pActionId != null & pActionId != "" && pActionId != undefined && db.cell(sqlStr, alias) == "") { + actionId = pActionId; + } else { + actionId = util.getNewUUID(); // if same id is already in db -> create new UID + } + var vals = [pAction, actionId, pParentPermId]; + if (db.insertData(table, cols, null, vals, alias) == 0) { + return null; + } + return actionId; + } -/** - * Deletes a permission from ASYS_PERMISSION. - * - * @param {String} pPermId The permission id which should be deleted, mandatory - * - * @result {Integer} returns the number of deleted records - */ -PermissionUtil.deletePermission = function(pPermId) { - var table = "ASYS_PERMISSION"; - var cond = " ASYS_PERMISSIONID = '" + pPermId + "'"; - return db.deleteData(table, cond, alias); -} + /** + * Returns the cond type of a permission. + * + * @param {String} pPermId id of the permission which condition type should be returned, mandatory + * + * @result {Integer} returns the cond type of a permission + */ + PermissionUtil.getCondType = function(pPermId) { + var table = "ASYS_PERMISSION"; + var sqlStr = "select CONDTYPE from " + table + " where ASYS_PERMISSIONID = '" + pPermId + "'"; + return db.cell(sqlStr, alias); + } + + /** + * Returns true if the permission exists, otherwise false. + * + * @param {String} pPermId The permission id + * + * @result {Boolean} true if permission exists, otherwise false + */ + PermissionUtil.permissionExists = function(pPermId) { + var table = "ASYS_PERMISSION"; + var sqlStr = "select COUNT(*) from " + table + " where ASYS_PERMISSIONID = '" + pPermId + "'"; + if (db.cell(sqlStr, alias) != "0") { + return true; + } + return false; + } + + /** + * Returns true if the action exists, otherwise false. + * + * @param {String} pActionId The id of the action + * + * @result {Boolean} true if action exists, otherwise false + */ + PermissionUtil.actionExists = function(pActionId) { + var table = "ASYS_PERMISSIONACTION"; + var sqlStr = "select COUNT(*) from " + table + " where ASYS_PERMISSION_ID = '" + pActionId + "'"; + if (db.cell(sqlStr, alias) != "0") { + return true; + } + return false; + } + + /** + * Returns true if the action exists, otherwise false. + * + * @param {String} pAction The title of the action (e.g. view, create, read, update, delete) + * + * @param {String} pPermId The ID of the permission to which the action is linked + * + * @result {Boolean} true if action exists, otherwise false + */ + PermissionUtil.actionExists = function(pAction, pPermId) { + var table = "ASYS_PERMISSIONACTION"; + var sqlStr = "select COUNT(*) from " + table + " where ACTION = '" + pAction + "' and ASYS_PERMISSION_ID = '" + pPermId + "'"; + if (db.cell(sqlStr, alias) != "0") { + return true; + } + return false; + } + + /** + * Returns permissionid of the permission with fitting parameters, otherwise returns empty string + * + * @param {String} pRole name of the role + * + * @param {String} pEntity name of the entity + * + * @param {String} pField name of the field + * + * @param {String} pAccesstype accesstype (E,F,R) + * + * @param {String} pCondition condition (Filter in JSON-format) + * + * @param {String} pCondtype type of the condition (true/false) + * + * @result {String} Returns the id of the permission with fitting parameters, otherwise returns empty string, can never be null + * + */ + PermissionUtil.getPermission = function(pRole, pEntity, pField, pAccesstype, pCondition, pCondtype) { + var sqlStr = ""; + var sqlExt = ""; + var noCond = "{\"entity\":\"" + pEntity + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}"; + + if (checkInput([pCondition])) { + if (pCondition == noCond) { + sqlExt += " and (COND like '%" + pCondition + "%' or COND is null)"; + } else { + sqlExt += " and COND like '%" + pCondition + "%'"; + } + } + + if (checkInput([pField])) { + sqlExt += " and FIELD_ID = '" + pField + "'"; + } + + if (checkInput([pCondtype])) { + sqlExt += " and CONDTYPE = '" + pCondtype + "'"; + } + + sqlStr = "select ASYS_PERMISSION.ASYS_PERMISSIONID from ASYS_PERMISSIONSET" + + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID" + + " where ENTITY_ID = '" + pEntity + "' and ROLE_ID = '" + pRole + "'" + + " and ACCESSTYPE = '" + pAccesstype + "'" + sqlExt; + var permId = db.cell(sqlStr, alias); + return permId; + } + + /** + * Deletes a permission action from ASYS_PERMISSIONACTION. + * + * @param {String} pActionId permission action id which should be deleted, mandatory + * + * @result {Integer} returns number of deleted records + */ + PermissionUtil.deleteAction = function(pActionId) { + var table = "ASYS_PERMISSIONACTION"; + var cond = " ASYS_PERMISSIONACTIONID = '" + pActionId + "'"; + return db.deleteData(table, cond, alias); + } + +} //end of block -/** - * Deletes a permission action from ASYS_PERMISSIONACTION. - * - * @param {String} pPermActionId The permission action id which should be deleted, mandatory - * - * @result {Integer} returns the number of deleted records - */ -PermissionUtil.deletePermissionAction = function(pPermActionId) { - var table = "ASYS_PERMISSIONACTION"; - var cond = " ASYS_PERMISSIONACTIONID = '" + pPermActionId + "'"; - return db.deleteData(table, cond, alias); -} // arrDiff calculates different elements of two arrays and returns them as array, otherwise empty array function arrDiff (arr1, arr2) { @@ -540,4 +554,13 @@ function arrDiff (arr1, arr2) { } return diff; +} + +// checks input array if each element is a valid input, returns true if valid, otherwise false +function checkInput(pInputArr) { + for each (var input in pInputArr) { + if (input == undefined || input == null || input == "") + return false; + } + return true; } \ No newline at end of file diff --git a/process/Product_lib/process.js b/process/Product_lib/process.js index 8f96db44736d2078070910d37bef26cead064c05..979fa29aa2c359791721559fd5afc0fa55206b5c 100644 --- a/process/Product_lib/process.js +++ b/process/Product_lib/process.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.util"); import("system.SQLTYPES"); import("system.datetime"); @@ -29,7 +28,7 @@ function ProductUtils() {} * * @example productUtils.getCurrentProductPrice(vars.get("$field.PRODUCTID"), "PP") * - * @return {Array[]} currently valid product price with currency: [price, "CURRENCY"] or [] if no price found + * @return {Array[]} currently valid product price with currency: [price, "CURRENCY", "VAT"] or [] if no price found */ ProductUtils.getCurrentProductPrice = function(pid, buySell, onlyStandard) { if (pid != undefined && pid != "" && buySell != undefined && buySell != "") @@ -49,10 +48,10 @@ ProductUtils.getCurrentProductPrice = function(pid, buySell, onlyStandard) { .orPrepare("PRODUCTPRICE.VALID_TO", today, "# >= ?") .or("PRODUCTPRICE.VALID_TO is null"), "1 = 2"); - var productPriceData = db.array(db.ROW, actualPriceCondition.buildSql("select PRICE, CURRENCY from PRODUCTPRICE", "1 = 2", "order by VALID_FROM desc")); + var productPriceData = db.array(db.ROW, actualPriceCondition.buildSql("select PRICE, CURRENCY, VAT from PRODUCTPRICE", "1 = 2", "order by VALID_FROM desc")); if (productPriceData[0] && productPriceData[1]) - return [productPriceData[0], KeywordUtils.getViewValue($KeywordRegistry.currency(), productPriceData[1])]; + return [productPriceData[0], KeywordUtils.getViewValue($KeywordRegistry.currency(), productPriceData[1]), productPriceData[2]]; else return []; } else { @@ -100,7 +99,7 @@ ProductUtils.getStockCount = function(pid) { * (Subqueries are also possible) * * @example //Product_entity, Field: PRODUCT_ID, Process: onValueChange - * var pid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCT_ID")); + * var pid = vars.get("local.value"); * var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; * var contactid = vars.exists("$param.ContactId_param") ? vars.get("$param.ContactId_param") : ""; * var pUtils = new ProductUtils(); diff --git a/process/Salesproject_lib/process.js b/process/Salesproject_lib/process.js index c2258732e3551f554af14495792969ae98735cdc..981f58e59787e82ee5ad4be9b7a4cd41cc69c659 100644 --- a/process/Salesproject_lib/process.js +++ b/process/Salesproject_lib/process.js @@ -1,117 +1,115 @@ -import("system.logging"); -import("Sql_lib"); -import("system.neon"); -import("system.vars"); -import("system.util"); -import("system.translate"); -import("system.db"); -import("system.eMath"); -import("system.question"); -import("Util_lib"); -import("Keyword_lib"); -import("system.neonTools"); -/** - * Methods used by the Salesproject. - * Do not create an instance of this! - * - * @class - */ -function Salesproject() {} - -/** - * Delivers the next valid project number (has to be unique) - * - * @result {String} next valid project number - */ -Salesproject.getNextProjectNumber = function() { - return NumberSequencingUtils.getNextUniqueNumber("PROJECTCODE", "SALESPROJECT"); -} - -/** - * Checks if the passed project number is valid (has to be unique) - * - * @param {String} projectNumber project number to check - * - * @result {Boolean} passed number is valid - */ -Salesproject.validateProjectNumber = function(projectNumber) { - return NumberSequencingUtils.validateUniqueNumber(projectNumber, "PROJECTCODE", "SALESPROJECT"); -} - -/** - * Insert a new milestone. - * - * @param {String} salesprojectId of the salesproject - * @param {Integer} type can be any value of the keyword SALESPROJECT.MILESTONE.TYPE - * @param {Integer} value value of the phase or state - * @param {Boolean} [notifyForecast=false] if true, notify user to update the forecast - * - * @result {Boolean} true if inserted, else false - */ -Salesproject.insertMilestone = function(salesprojectId, type, value, notifyForecast) { - if (KeywordUtils.exists(value, type)) { - var id= db.cell(SqlCondition.begin() - .andPrepare("SALESPROJECT_MILESTONE.SALESPROJECT_ID", salesprojectId) - .andPrepare("SALESPROJECT_MILESTONE.TYPE", type) - .and("SALESPROJECT_MILESTONE.DATE_END is null") - .buildSql("select SALESPROJECT_MILESTONE.SALESPROJECT_MILESTONEID from SALESPROJECT_MILESTONE ")); - - logging.log("id = " + id) - - db.updateData( - "SALESPROJECT_MILESTONE", - ["DATE_END"], - null, - [vars.get("$sys.date")], - SqlCondition.begin() - .andPrepare("SALESPROJECT_MILESTONE.SALESPROJECT_ID", salesprojectId) - .andPrepare("SALESPROJECT_MILESTONE.TYPE", type) - .and("SALESPROJECT_MILESTONE.DATE_END is null") - .build("1=2")); - - db.insertData( - "SALESPROJECT_MILESTONE", - ["SALESPROJECT_MILESTONEID", "SALESPROJECT_ID", "TYPE", "VALUE", "DATE_START", "PARENT_ID"], - null, - [util.getNewUUID(), salesprojectId, type, value, vars.get("$sys.date"), id]); - if (notifyForecast) { - Salesproject.notifyToUpdateForecast() - } - return true; - } - return false; -} - -/** - * Notify the user to update the forecast - */ -Salesproject.notifyToUpdateForecast = function() { - if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) - question.showMessage(translate.text("Please update the ${FORECAST_ENGLISH}."), question.INFORMATION, translate.text("${FORECAST_ENGLISH}")); -} - -/** - * get the title of a salesproject by id - * @param {String} pSalesProjectId - * <br> - * @return {String} title of the salesproject - */ -Salesproject.getSalesProjectTitleById = function(pSalesProjectId) -{ - return db.cell( SqlCondition.begin() - .andPrepare("SALESPROJECT.SALESPROJECTID", pSalesProjectId) - .buildSql("select PROJECTTITLE from SALESPROJECT", "1=0")); -} - -/** - * Create a new Salesproject and open the Salesproject context in NEW-mode - */ -Salesproject.createNewSalesproject= function(pRelationId) -{ - var params = {}; - - if (pRelationId) - params["ContactId_param"] = pRelationId; - - neon.openContext("Salesproject", null, null, neon.OPERATINGSTATE_NEW, params); +import("Sql_lib"); +import("system.neon"); +import("system.vars"); +import("system.util"); +import("system.translate"); +import("system.db"); +import("system.eMath"); +import("system.question"); +import("Util_lib"); +import("Keyword_lib"); +import("system.neonTools"); +/** + * Methods used by the Salesproject. + * Do not create an instance of this! + * + * @class + */ +function Salesproject() {} + +/** + * Delivers the next valid project number (has to be unique) + * + * @result {String} next valid project number + */ +Salesproject.getNextProjectNumber = function() { + return NumberSequencingUtils.getNextUniqueNumber("PROJECTCODE", "SALESPROJECT"); +} + +/** + * Checks if the passed project number is valid (has to be unique) + * + * @param {String} projectNumber project number to check + * + * @result {Boolean} passed number is valid + */ +Salesproject.validateProjectNumber = function(projectNumber) { + return NumberSequencingUtils.validateUniqueNumber(projectNumber, "PROJECTCODE", "SALESPROJECT"); +} + +/** + * Insert a new milestone. + * + * @param {String} salesprojectId of the salesproject + * @param {Integer} type can be any value of the keyword SALESPROJECT.MILESTONE.KIND + * @param {Integer} value value of the phase or state + * @param {Boolean} [notifyForecast=false] if true, notify user to update the forecast + * + * @result {Boolean} true if inserted, else false + */ +Salesproject.insertMilestone = function(salesprojectId, type, value, notifyForecast) { + if (KeywordUtils.exists(value, type)) { + var id= db.cell(SqlCondition.begin() + .andPrepare("SALESPROJECT_MILESTONE.SALESPROJECT_ID", salesprojectId) + .andPrepare("SALESPROJECT_MILESTONE.KIND", type) + .and("SALESPROJECT_MILESTONE.DATE_END is null") + .buildSql("select SALESPROJECT_MILESTONE.SALESPROJECT_MILESTONEID from SALESPROJECT_MILESTONE ")); + + + db.updateData( + "SALESPROJECT_MILESTONE", + ["DATE_END"], + null, + [vars.get("$sys.date")], + SqlCondition.begin() + .andPrepare("SALESPROJECT_MILESTONE.SALESPROJECT_ID", salesprojectId) + .andPrepare("SALESPROJECT_MILESTONE.KIND", type) + .and("SALESPROJECT_MILESTONE.DATE_END is null") + .build("1=2")); + + db.insertData( + "SALESPROJECT_MILESTONE", + ["SALESPROJECT_MILESTONEID", "SALESPROJECT_ID", "KIND", "MILESTONEVALUE", "DATE_START", "PARENT_ID"], + null, + [util.getNewUUID(), salesprojectId, type, value, vars.get("$sys.date"), id]); + if (notifyForecast) { + Salesproject.notifyToUpdateForecast() + } + return true; + } + return false; +} + +/** + * Notify the user to update the forecast + */ +Salesproject.notifyToUpdateForecast = function() { + if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) + question.showMessage(translate.text("Please update the ${FORECAST_ENGLISH}."), question.INFORMATION, translate.text("${FORECAST_ENGLISH}")); +} + +/** + * get the title of a salesproject by id + * @param {String} pSalesProjectId + * <br> + * @return {String} title of the salesproject + */ +Salesproject.getSalesProjectTitleById = function(pSalesProjectId) +{ + return db.cell( SqlCondition.begin() + .andPrepare("SALESPROJECT.SALESPROJECTID", pSalesProjectId) + .buildSql("select PROJECTTITLE from SALESPROJECT", "1=0")); +} + +/** + * Create a new Salesproject and open the Salesproject context in NEW-mode + */ +Salesproject.createNewSalesproject= function(pRelationId) +{ + var params = {}; + + if (pRelationId) + params["ContactId_param"] = pRelationId; + + neon.openContext("Salesproject", null, null, neon.OPERATINGSTATE_NEW, params); } \ No newline at end of file diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index bc8e3cdaff76696243e3ef8095277694f70b33c8..12b84dc591b54f10fd9f8f3326697eb7353b17fa 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -317,13 +317,6 @@ SqlCondition.prototype.andPrepareVars = function(field, variable, cond, fieldTyp return this; } -SqlCondition.prototype.andPrepareValue = function(field, value) { - if (value) { - return this.andPrepare(field, value, null, null); - } - return this; -} - /** * same as the "orPrepare"-function but with validation of adito-variables functionality * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"] @@ -400,7 +393,7 @@ SqlCondition.prototype.orIn = function(field, values, fieldType, not) { * @return {SqlCondition} current SqlCondition-object */ SqlCondition.prototype._in = function(field, values, fieldType, not) { - if (values.length > 0) + if (values && values.length > 0) { if (fieldType == undefined) fieldType = SqlUtils.getSingleColumnType(field, undefined, this.alias); @@ -842,38 +835,34 @@ SqlBuilder.prototype.having = function (pCondition) SqlBuilder.prototype._getClause = function (pElement, pPrefix, pAutoJoin) { var preparedValues = []; - if (pElement instanceof SqlBuilder || pElement instanceof SqlCondition) + if (typeof pElement !== "string") { - pElement = _getElement(pElement); - } - else if (typeof pElement !== "string" && pElement.length !== undefined) //array - { - if (pAutoJoin) + if (pElement.length !== undefined && pAutoJoin) //array of fields { for (let i = 0, l = pElement.length; i < l; i++) { - if (pElement[i] instanceof SqlBuilder) - pElement[i] = _getElement(pElement); + if (typeof pElement[i] !== "string") + pElement[i] = _getElement(pElement[i]); } pElement = pElement.join(", "); } else { - preparedValues = preparedValues.concat(pElement[1]); - pElement = pElement[0]; + pElement = _getElement(pElement); } } - - if (pPrefix) + + if (pPrefix && pElement) pElement = pPrefix + " " + pElement; return [pElement.toString(), preparedValues]; function _getElement (element) { - element = element.build(); + if (element instanceof SqlBuilder || element instanceof SqlCondition) + element = element.build(); preparedValues = preparedValues.concat(element[1]); - if (element instanceof SqlBuilder) + if (element instanceof SqlBuilder || pAutoJoin) return "(" + element[0] + ")"; return element[0]; } @@ -900,8 +889,7 @@ SqlBuilder.prototype.build = function () this._where, this._groupBy, this._having, - this._orderBy, - this._unions + this._orderBy ]).concat(this._unions); for (let i = 0, l = allParts.length; i < l; i++) @@ -1298,6 +1286,7 @@ SqlMaskingUtils.prototype.concat = function(fields, separatorCharacter, autoTrim { case db.DBTYPE_MYSQL4: case db.DBTYPE_MARIADB10: + case db.DBTYPE_POSTGRESQL8: retSql = " concat_ws( '" + separatorSql + "'"; for (i = 0; i < fields.length; i++) { retSql += ", " + fields[i]; diff --git a/process/StandardObject_lib/process.js b/process/StandardObject_lib/process.js index 366abe06bc90995fd1e8fb2ecd60bcf3904f9f0a..772d1e21ee1a13df0cbed76d5b8c837ec682e8ef 100644 --- a/process/StandardObject_lib/process.js +++ b/process/StandardObject_lib/process.js @@ -249,7 +249,7 @@ StandardObject.prototype._hasStandardCommunicationByMedium = function (pContactI var dbResult = db.array(db.COLUMN, "select CHAR_VALUE from COMMUNICATION" + " left join AB_KEYWORD_ENTRY on KEYID = MEDIUM_ID" + " left join AB_KEYWORD_ATTRIBUTERELATION on AB_KEYWORD_ENTRY_ID = AB_KEYWORD_ENTRYID" - + " where STANDARD = 1 and CONTACT_ID = '" + pContactID + "' and KEYID in ('" + CommUtil.getMediumIdsByCategory(pMediumCategory).join("', '") + "')"); + + " where ISSTANDARD = 1 and CONTACT_ID = '" + pContactID + "' and KEYID in ('" + CommUtil.getMediumIdsByCategory(pMediumCategory).join("', '") + "')"); return dbResult.indexOf(pMediumCategory) !== -1; } @@ -267,7 +267,7 @@ StandardObject.prototype._getMediumCategory = function (pMediumID) { } /** - * Will set the given communication ID as standard. (Will update the `STANDARD` + * Will set the given communication ID as standard. (Will update the `ISSTANDARD` * column.) * * @param {String} pCommunicationID The communication ID to set as standard. @@ -280,8 +280,8 @@ StandardObject.prototype._setStandardCommunication = function (pCommunicationID, // Update data. db.updateData( "COMMUNICATION", - ["STANDARD"], - db.getColumnTypes("COMMUNICATION", ["STANDARD"]), + ["ISSTANDARD"], + db.getColumnTypes("COMMUNICATION", ["ISSTANDARD"]), [pValue], "COMMUNICATIONID = '" + pCommunicationID + "'"); } diff --git a/process/Ticket_lib/process.js b/process/Ticket_lib/process.js index 33462056aca919ed342ba0490604ecacb1d2ec7f..489382722ae4ddbef7c253c161e6e08d31e56af7 100644 --- a/process/Ticket_lib/process.js +++ b/process/Ticket_lib/process.js @@ -1,5 +1,4 @@ import("Util_lib"); -import("system.logging"); import("ActivityTask_lib"); import("KeywordRegistry_basic"); import("Keyword_lib"); @@ -55,8 +54,7 @@ TicketUtils.getStatusIcon = function(pStatus) */ TicketUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField) { - throw Error("Not implemented yet"); - //TaskUtils.addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links"); + TaskUtils.addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links"); } /** @@ -123,7 +121,7 @@ TicketUtils.prototype.getAvailableStatus = function() if (states == null) return states; - return states.map(StringUtils.toChar36); + return states.map(StringUtils.pad36); } /** @@ -133,7 +131,7 @@ TicketUtils.prototype.getAvailableStatus = function() */ TicketUtils.prototype.getDefaultStatus = function() { - return StringUtils.toChar36(KeywordUtils.getAttributeRelation(this.type, $KeywordRegistry.ticketType(), "defaultStatus", "")); + return StringUtils.pad36(KeywordUtils.getAttributeRelation(this.type, $KeywordRegistry.ticketType(), "defaultStatus", "")); } /** diff --git a/process/Timetracking_lib/process.js b/process/Timetracking_lib/process.js index 9cefd34b87c6f7bc5f432d4f084158fd36b288f3..0a6ef6264e03313ebc8d2c4d0533ab9ae04fdb81 100644 --- a/process/Timetracking_lib/process.js +++ b/process/Timetracking_lib/process.js @@ -1,63 +1,63 @@ -import("Sql_lib"); -import("system.db"); -import("system.neon"); -import("Context_lib"); - -/** - * Methods used for time tracking. - * Do not create an instance of this! - * - * @class - */ -function Timetracking() {} - -/** - * calculates the total time of all time trackings of the object - * - * @param {String} pRowId the rowId - * - * @return {Number} total time in minutes - */ -Timetracking.getTotalTrackingTime = function (pRowId) -{ - var objectId = ContextUtils.getCurrentContextId(); - var totalMinutes = db.cell(SqlCondition.begin() - .andPrepare("TIMETRACKING.OBJECT_ID", objectId) - .andPrepare("TIMETRACKING.ROW_ID", pRowId) - .buildSql("select sum(MINUTES) from TIMETRACKING", "1=0")); - - return Number(totalMinutes); -} - -/** - * Create a new time tracking - * - * @param {String} pRowId the rowId - * - * @return {Number} total time in minutes - */ -Timetracking.createNewTimeTracking = function (pRowId) -{ - var objectId = ContextUtils.getCurrentContextId(); - var params = { - "ObjectId_param" : objectId, - "RowId_param" : pRowId - }; - - neon.openContext("Timetracking", null, null, neon.OPERATINGSTATE_NEW, params); -} - -/* - * converts minutes tho hours and minuets. e.g. 105 to 1:45 - * - * @param {integer} pMinutes req - * - * @return {String} Hours:Minutes - */ -Timetracking.minutesToReadableHour = function(pMinutes) -{ - var timeHour = parseInt(pMinutes / 60); - var minutes = parseInt(pMinutes % 60); - - return "" + timeHour + ":" + ((minutes <= 9) ? "0" + minutes : minutes); +import("Sql_lib"); +import("system.db"); +import("system.neon"); +import("Context_lib"); + +/** + * Methods used for time tracking. + * Do not create an instance of this! + * + * @class + */ +function Timetracking() {} + +/** + * calculates the total time of all time trackings of the object + * + * @param {String} pRowId the rowId + * + * @return {Number} total time in minutes + */ +Timetracking.getTotalTrackingTime = function (pRowId) +{ + var objectId = ContextUtils.getCurrentContextId(); + var totalMinutes = db.cell(SqlCondition.begin() + .andPrepare("TIMETRACKING.OBJECT_ID", objectId) + .andPrepare("TIMETRACKING.ROW_ID", pRowId) + .buildSql("select sum(TRACKINGMINUTES) from TIMETRACKING", "1=0")); + + return Number(totalMinutes); +} + +/** + * Create a new time tracking + * + * @param {String} pRowId the rowId + * + * @return {Number} total time in minutes + */ +Timetracking.createNewTimeTracking = function (pRowId) +{ + var objectId = ContextUtils.getCurrentContextId(); + var params = { + "ObjectId_param" : objectId, + "RowId_param" : pRowId + }; + + neon.openContext("Timetracking", null, null, neon.OPERATINGSTATE_NEW, params); +} + +/* + * converts minutes tho hours and minuets. e.g. 105 to 1:45 + * + * @param {integer} pMinutes req + * + * @return {String} Hours:Minutes + */ +Timetracking.minutesToReadableHour = function(pMinutes) +{ + var timeHour = parseInt(pMinutes / 60); + var minutes = parseInt(pMinutes % 60); + + return "" + timeHour + ":" + ((minutes <= 9) ? "0" + minutes : minutes); } \ No newline at end of file diff --git a/process/Turnover_lib/process.js b/process/Turnover_lib/process.js index 4310d902ba79b79c8159bf0509f4c90989fdc2d8..a38c64f62c4960defc71568d15d0b72373491380 100644 --- a/process/Turnover_lib/process.js +++ b/process/Turnover_lib/process.js @@ -32,6 +32,9 @@ TurnoverUtil.getTurnoverData = function (pMaxYear, pYearCount, pSalesprojectId) // load data var data = db.table(SqlCondition.begin() + .and("SALESORDER.ORDERTYPE = 'ORDTYPEINVO'") + .and("SALESORDER.ORDERSTATUS = 1") + .and("SALESORDER.CANCELLATION <> 1") .and("SALESORDERITEM.OPTIONAL <> 1") .andPrepare("SALESORDER.SALESORDERDATE", pMaxYear, "year(#) <= ?", SQLTYPES.INTEGER) .andPrepare("SALESORDER.SALESORDERDATE", minYear, "year(#) >= ?", SQLTYPES.INTEGER) diff --git a/process/Util_lib/process.js b/process/Util_lib/process.js index 75e04839b348358a042d57788a757b7de53c9107..250a95ee13ddaee794ae0aee7592e8c6a8bbff6e 100644 --- a/process/Util_lib/process.js +++ b/process/Util_lib/process.js @@ -1,615 +1,615 @@ -import("Sql_lib"); -import("system.neon"); -import("system.project"); -import("system.process"); -import("system.db"); -import("system.util"); -import("system.translate"); -import("system.text"); -import("system.vars"); -import("system.swing"); -import("system.question"); -import("system.eMath"); -import("system.datetime"); -import("Offer_lib"); -import("Date_lib"); - -/** - * Class containing static utility functions for string-actions - * Do not create an instance of this - * - * @class - */ -function StringUtils(){} - -/** - * concats severel elements by a separator; the separator is only applied if a element is not null and not an empty string ""; - * - * @param {String} pSeparator specifies how the not empty elements shall be concatenated - * @param {String[]} pElements elements that shall be joined by the separator - * - * @return {String} concatenated string; if all elements are empty an emtpy string is returned - * - */ -StringUtils.concat = function(pSeparator, pElements) -{ - var res = pElements.filter(function(e){ - return e != null && e != ""; - }).join(pSeparator); - return res; -}; - - -/** - * converts a string to a string of always 36 chars. Whitespaces are added at the end if needed. - */ -StringUtils.toChar36 = function(pValue) -{ - return (pValue + " ").slice(0, 36); -} - -/** - * Class containing static utility functions for numbers - * Do not create an instance of this - * - * @class - */ -function NumberUtils(){} - -/** - * Check iv the value is inside of the min / max values. - * INCLUDING min / max - * - * @param {Number} pValue value to check - * @param {Number} pMin min value INCLUSIVE - * @param {Number} pMax max value INCLUSIVE - * @param {Boolean} [pIgnoreNull=true] return True if pValue is null - * - * @return {Boolean} - */ -NumberUtils.isInside = function(pValue, pMin, pMax, pIgnoreNull) -{ - if (pIgnoreNull == undefined) - pIgnoreNull = true; - - return pValue >= pMin && pValue <= pMax || pIgnoreNull && (pValue == null || isNaN(pValue)); -}; - -/** - * For use in validationProcess. Calls result.string(...) with error message, if number is not inside of the given values - * INCLUDING min / max. - * - * @param {Number} pTitle title to display in error message. Should be the name of the field and it will be translated. - * @param {Number} pValue value to check - * @param {Number} pMin min value INCLUSIVE - * @param {Number} pMax max value INCLUSIVE - * @param {Boolean} [pIgnoreNull=true] return True if pValue is null - * - * @return {String|False} returns the error message or false - * - * @example - * var value = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.DISCOUNT")); <br> - * <br> - * var validationResult = NumberUtils.validateIsBetweenFloat("Discount", value, 0, 100); <br> - * <br> - * if (validationResult) <br> - * { <br> - * result.string(validationResult); <br> - * } <br> - */ -NumberUtils.validateIsBetweenFloat = function(pTitle, pValue, pMin, pMax, pIgnoreNull) -{ - if(pValue.includes(",")) - pValue = pValue.replace(",", "."); - - var discount = parseFloat(pValue); - - if(isNaN(discount)) - return false; - - if (!NumberUtils.isInside(discount, 0, 100, pIgnoreNull)) - { - return (translate.withArguments("${MIN_MAX_ERROR} field: %0, value: %1, min: %2, max: %3", [translate.text(pTitle), discount, pMin, pMax])); - } - return false; -} - -/** - * format Numbers with currency - */ -NumberUtils.formatWithCurrency = function(pNumber, pPattern, pCurrency) -{ - if (pNumber && pPattern) - return text.formatDouble(pNumber, pPattern + " " + pCurrency); - return "0 " + pCurrency; -} - -/** - * Class containing static utility functions for use with arrays - * Do not create an instance of this! - * - * @class - */ -function ArrayUtils() {} - -/** - * returns a distinct list of a two dimensional array - * - * @param {Array} p2dArray the Array where duplicate keys shall be removed - * - * @return 2D-Array that only contains unique entries - */ -ArrayUtils.distinct2d = function(p2dArray) -{ - var tempKeys = {}; - return p2dArray.filter(function(row){ - var key = row.join("-"); - return !(tempKeys[key] = ++tempKeys[key]|0) - }); -}; - -/** - * sorts a two dimensional array by the given index - * - * @param {Array} targetArray the Array to be sorted - * @param {String} index the index of the field to sort by - * @param {Boolean} [sortAsc=false] TRUE sorts ascending, FALSE sorts decending - * @param {Boolean} [isNumber=false] TRUE sorts numerical, FALSE or undefined sorts alphanumerical - * - * @return targetArray - * - * @throws {RangeError} if index is outside pArray.length - */ -ArrayUtils.sort2d = function(targetArray, index, sortAsc, isNumber) { - if (targetArray.length == 0) - return targetArray; - if (targetArray[0].length == 0) - return targetArray; - if (index >= targetArray[0].length) - throw new RangeError("Index Out Of Bounds: " + index + " >= " + targetArray[0].length); - - var sortFn = function (x, y) { - if ( isNumber ) { - xx = Number(x[index]); - yy = Number(y[index]); - } - else { - xx = x[index]; - yy = y[index]; - - xx = xx.toLowerCase(); - xx = xx.replace(/ä/g,"ae"); - xx = xx.replace(/ö/g,"oe"); - xx = xx.replace(/ü/g,"ue"); - xx = xx.replace(/ß/g,"ss"); - - yy = yy.toLowerCase(); - yy = yy.replace(/ä/g,"ae"); - yy = yy.replace(/ö/g,"oe"); - yy = yy.replace(/ü/g,"ue"); - yy = yy.replace(/ß/g,"ss"); - } - if (xx == yy) - return 0; - if (xx < yy) - return (sortAsc ? -1 : 1); - return (sortAsc ? 1 : -1); - } - - targetArray.sort(sortFn); - return targetArray -} - -/** -* sorts an array with columns -* -* @param {Array} targetArray the array with data -* @param {Array} sortOrder array with the format [columnIndex1, sortDescending1, columnIndex2, sortDescending2, ...], -* the columnIndex must be an integer, sortDescending must be boolean (true -> descending, just like db.DESCENDING) -* @example -* ArrayUtils.sortMulti(rows, [1, true, 2, true, 5, false]); -* -* @return {void} -*/ -ArrayUtils.sortMulti = function(targetArray, sortOrder) { - /* - * @param {String} a req value 1, first compared element - * @param {String} b req value 2, sencond compared element - * - * @return {Integer} -1 - set a below b, 0 - equal, 1 - set b below a - */ - var sortFn = function(a, b) { - var stringComparison = function(a, b) { - a = a.toLowerCase(); - a = a.replace(/ä/g,"ae"); - a = a.replace(/ö/g,"oe"); - a = a.replace(/ü/g,"ue"); - a = a.replace(/ß/g,"ss"); - - b = b.toLowerCase(); - b = b.replace(/ä/g,"ae"); - b = b.replace(/ö/g,"oe"); - b = b.replace(/ü/g,"ue"); - b = b.replace(/ß/g,"ss"); - - return( a == b ) ? 0 : ( a > b ) ? 1 : -1; - } - - var swap = 0; - - for (let i = 0, l = sortOrder.length; i < l; i += 2) - { - let colIndex = sortOrder[i]; - let sortDesc = sortOrder[i+1]; - if (swap || colIndex == undefined || sortDesc == undefined) - return swap; - - if (isNaN(a[colIndex] - b[colIndex])) - if ((isNaN(a[colIndex])) && (isNaN(b[colIndex]))) - swap = stringComparison(a[colIndex], b[colIndex]); - else - swap = (isNaN(a[colIndex]) ? 1 : -1); - else - swap = (a[colIndex] - b[colIndex]); - - swap *= (sortDesc ? -1 : 1); - } - return swap; - } - - targetArray.sort(sortFn); - return targetArray; -} - -/** -* removes an specific element from an array -* -* @param {Array} targetArray Array from which the element should be removed -* @param {String} elementPos index of the element which should be removed -* -* @return {Array} array containing the deleted element -*/ -ArrayUtils.removeElement = function(targetArray, elementPos) { - return targetArray.splice(elementPos, 1); -} - -/** - * concats arrays column by column; - * see example for more details - * - * @param {Array} array1 you have to pass at least 2 Arrays that shall be concated but you can pass as many as you want - * @param {Array} arrayN you have to pass at least 2 Arrays that shall be concated but you can pass as many as you want - * - * @return {Array} concatenated array - * - * @example - * var a = ["a", "b", "c"]; - * var b = ["A", "B", "C"]; - * logging.show(JSON.stringify(concatArrayColumns(a, b))); - * //[["a","A"],["b","B"],["c","C"]] - * - * logging.show(JSON.stringify(a.concat(b))); - * //["a","b","c","A","B","C"] - */ -ArrayUtils.concatColumns = function(array1, arrayN) { - var res, i, ii, l, ll, inpArr; - res = []; - - for (i = 0, l = arguments.length; i < l; i++) {//this function can handle an "unlimited" amount of functionparams - inpArr = arguments[i]; - for (ii = 0, ll = inpArr.length; ii < ll; ii++) { - if (res[ii] == undefined) - res[ii] = []; - - res[ii] = res[ii].concat(inpArr[ii]); - } - } - return res; -} - - -/** - * returns if an element is in an array; - * this is needed because there is currently no support for Array.prototype.includes() and we cannot easily use a polyfill and extend the Array.prototype - * - * @param {Array} targetArray array where the element should be searched in - * @param {AnyPrimitiveType} element the element which should be looked for - * @param {Boolean} [ignoreStringCase=false] if you've got a string array y - * - * @return {Boolean} true if it has the element - */ -ArrayUtils.hasElement = function(targetArray, element, ignoreStringCase) { - var i, l; - if (ignoreStringCase)//do only once to save ressources and not for every array element - element = element.toString().toLowerCase(); - for (i = 0, l = targetArray.length; i < l; i++) { - if (ignoreStringCase) { - if (targetArray[i].toString().toLowerCase() == element) - return true; - } - else { - if (targetArray[i] == element) - return true; - } - } - return false; -} - -/** - * joins an array but skips empty elements (null, undefined, "") - * - * @param {Array} pArray the array to join - * @param {String} [pSeparator=", "] the separator - * - * @return {String} the resulting string - */ -ArrayUtils.joinNonEmptyFields = function (pArray, pSeparator) -{ - return pArray.filter(function (element) - { - return element !== null && element !== undefined && element !== ""; - }).join(pSeparator); -} - -/** - * Class containing utility functions for use with JSON - * @class - */ -function JSONUtils() { -} - -/** - * A custom JSON.stringify() to - * - keep the functions as string - * - stringify JavaArrays - * - stringify undefined as undefined and not as null - * - * @param {Object} obj the object to stringify - * - * @return {String} the stringified object as string representation - */ -JSONUtils.customStringify = function(obj) { - //stringify part from JSON polyfill: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON - var toString = Object.prototype.toString; - var escMap = { - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t' - }; - var escFunc = function (m) { - return escMap[m] || '\\u' + (m.charCodeAt(0) + 0x10000).toString(16).substr(1); - }; - var escRE = /[\\"\u0000-\u001F\u2028\u2029]/g; - - var stringify = function (value){ - //because: "undefined == null" is true - if (value === undefined) { - return 'undefined'; - } else if (value == null) { - return 'null'; - } else if (typeof value === 'number') { - return isFinite(value) ? value.toString() : 'null'; - } else if (typeof value === 'boolean') { - return value.toString(); - } else if (typeof value === 'object') -{ - //check with "hasOwnProperty" because in JavaArrays using value.toJSON would cause an exception - if (toString.call(value) != '[object Map]' && value.hasOwnProperty("toJSON") && typeof value.toJSON === 'function') { - return value.toString(); - } else if (toString.call(value) === '[object Array]') { - var res = '['; - for (var i = 0; i < value.length; i++) - res += (i ? ', ' : '') + stringify(value[i]); - return res + ']'; - } else if (toString.call(value) === '[object Object]' || toString.call(value) === '[object Map]') { - var tmp = []; - for (var k in value) { - if (hasOwnProperty.call(value, k)) - tmp.push(stringify(k) + ': ' + stringify(value[k])); - } - return '{' + tmp.join(', ') + '}'; - //custom addition to stringify Rhino JavaArrays - } else if (toString.call(value) === '[object JavaArray]') { - return value.toSource().toString(); - } - } - //custom addition for function transform - //JSON.stringify returns null on functions (default) - //instead return source code of funciton for callback-functions - else if (typeof value === 'function') - { - return value.toString(); - } - - return '"' + value.toString().replace(escRE, escFunc) + '"'; - } - - return stringify(obj); -} - -/** - * Class containing functions for Javascript-Objects - * Do not create an instance of this - * - * @class - */ -function ObjectUtils(){} - -/** - * checks if a value exists in the object - * mostly usefull for primitve datatypes - * - * @param pObject {Object} the object where the value is searched - * @param pValue {Boolean|Number|String} the value that is searched - * - * @return {Boolean} true if the value was found, false if not - */ -ObjectUtils.existsValue = function(pObject, pValue) -{ - for (var key in pObject) - { - if (pObject[key] === pValue) - return true; - } - return false; -}; - -/** - * Class containing functions for sequential numbers - * Do not create an instance of this! - * - * @class - */ -function NumberSequencingUtils() {} - -/** - * Delivers the next unique number - * - * @param {String} pColumn database column that contains unique numbers - * @param {String} pTable database table - * @param {Number} [pStartNumber=1000] number to start numeration - * @param {String} [pCondition=no condition] SQL Where Conditon - * - * @result {String} next valid number - */ -NumberSequencingUtils.getNextUniqueNumber = function(pColumn, pTable, pStartNumber, pCondition) { - var maxNum = NumberSequencingUtils.getMaxUniqueNumber(pColumn, pTable, pCondition); - if(maxNum == "0") { - if(pStartNumber == undefined) pStartNumber = 1000; - return pStartNumber; - } - return eMath.addInt(maxNum, "1");//increment currently highest number -} - -/** - * Checks if the passed number is valid (has to be unique) - * - * @param {String} pNumber number to check - * @param {String} pColumn req database column that contains unique numbers - * @param {String} pTable req database table - * @param {String} pCondition opt SQL Where Conditon - * - * @result {boolean} passed number is valid - */ -NumberSequencingUtils.validateUniqueNumber = function(pNumber, pColumn, pTable, pCondition) { - var maxNum = NumberSequencingUtils.getMaxUniqueNumber(pColumn, pTable, pCondition); - return Number(pNumber) > Number(maxNum); -} - -/** - * Delivers the hightest number currently stored in database - * - * @param {String} pColumn req database column that contains unique numbers - * @param {String} pTable req database table - * @param {String} pCondition opt SQL Where Conditon - * - * @result {String} hightest number - */ -NumberSequencingUtils.getMaxUniqueNumber = function(pColumn, pTable, pCondition) { - var condition = ""; - if(pCondition != undefined) - condition += " where " + pCondition; - var maxNum = db.cell("select max(" + pColumn + ") from " + pTable + condition); - return maxNum == "" ? "0" : maxNum; -} - -/** - * functions for trees - * Do not create an instance of this! - * - * @class - */ -function TreeUtils () {} - -/** - * sorts an array in a way that a tree(-table) can be built (parents are added before children) - * This function does not garantee that the order of the children stays the same. If you need this, use TreeUtils.treeOrderBy - * - * consider the use of TreeUtils.treeOrderBy as it may be more performant, but it needs the layernumber of each row. - * - * @param {Array} pArray two-dimensional array to sort - * @param {Number} pUidIndex the index of the uid in a row - * @param {Number} pParentIdIndex the index of the parent id in a row - * - * @return {Array} the sorted array - */ -TreeUtils.sortArrayForTree = function (pArray, pUidIndex, pParentIdIndex) -{ - if (pArray.length <= 1) - return pArray; - var rows = {}; - var allIds = {}; - - pArray.forEach(function (row) {allIds[row[pUidIndex]] = true;}); - var index = 0; - - do { - var oldIndex = index; - pArray.forEach(function (row) - { - if (!(row[pUidIndex] in this) && (row[pParentIdIndex] in this || !allIds[row[pParentIdIndex]])) - this[row[pUidIndex]] = { - data : row, - index : index++ - }; - }, rows); - - /* stop if no new items were added, otherwise incorrect data (for instance - an item that is it's own parent) could cause an infinite loop */ - } while (oldIndex != index); - var sortedArray = new Array(index); - for (let i in rows) - sortedArray[rows[i].index] = rows[i].data; - return sortedArray; -} - -/** - * like TreeUtils.sortArrayForTree, this function garantees that parents are added before children - * But it works in a different way based on the layer number. - * - * It can also sort all children based on the given orderBys. For this you can Probvide an array of Indexes and direction (pOrderByIndexes) - * - * @param {Array} pData two-dimensional array to sort - * @param {Number} pLayerIndex The index of the layernumber-Field - * @param {Array[][]} pOrderByIndexes Array containing arrays of [field-index, direction]. The direction can be true (desc) or false (asc). - * - * @return {Array} the sorted array - */ -TreeUtils.treeOrderBy = function(pData, pLayerIndex, pOrderByIndexes) -{ - pOrderByIndexes = [[pLayerIndex, false]].concat(pOrderByIndexes) - - return pData.sort(function(pRow1, pRow2) - { - for (let i = 0; i < pOrderByIndexes.length; i++) { - var orderBy = pOrderByIndexes[i]; - if (pRow1[orderBy[0]] > pRow2[orderBy[0]]) return (orderBy[1] ? -1 : 1); - if (pRow1[orderBy[0]] < pRow2[orderBy[0]]) return (orderBy[1] ? 1 : -1); - } - - return 0; - }) -} - -/** - * functions for numbered codes - * Do not create an instance of this! - * - * @class - */ -function CodeUtils () {} -/** - * Sets the code of the given Table to the current max-code + 1 - */ -CodeUtils.setCode = function(pId, pTable, pIdCol, pCodeCol) -{ - var max = db.cell("select max(" + pCodeCol + ") from " + pTable); - if (!max) - max = -1; - - db.updateData(pTable, [pCodeCol], null, [parseInt(max)+1], SqlCondition.equals(pTable + "." + pIdCol, pId, "1=2")); +import("Sql_lib"); +import("system.neon"); +import("system.project"); +import("system.process"); +import("system.db"); +import("system.util"); +import("system.translate"); +import("system.text"); +import("system.vars"); +import("system.swing"); +import("system.question"); +import("system.eMath"); +import("system.datetime"); +import("Offer_lib"); +import("Date_lib"); + +/** + * Class containing static utility functions for string-actions + * Do not create an instance of this + * + * @class + */ +function StringUtils(){} + +/** + * concats severel elements by a separator; the separator is only applied if a element is not null and not an empty string ""; + * + * @param {String} pSeparator specifies how the not empty elements shall be concatenated + * @param {String[]} pElements elements that shall be joined by the separator + * + * @return {String} concatenated string; if all elements are empty an emtpy string is returned + * + */ +StringUtils.concat = function(pSeparator, pElements) +{ + var res = pElements.filter(function(e){ + return e != null && e != ""; + }).join(pSeparator); + return res; +}; + + +/** + * converts a string to a string of always 36 chars. Whitespaces are added at the end if needed. + */ +StringUtils.pad36 = function(pValue) +{ + return (pValue + " ").slice(0, 36); +} + +/** + * Class containing static utility functions for numbers + * Do not create an instance of this + * + * @class + */ +function NumberUtils(){} + +/** + * Check iv the value is inside of the min / max values. + * INCLUDING min / max + * + * @param {Number} pValue value to check + * @param {Number} pMin min value INCLUSIVE + * @param {Number} pMax max value INCLUSIVE + * @param {Boolean} [pIgnoreNull=true] return True if pValue is null + * + * @return {Boolean} + */ +NumberUtils.isInside = function(pValue, pMin, pMax, pIgnoreNull) +{ + if (pIgnoreNull == undefined) + pIgnoreNull = true; + + return pValue >= pMin && pValue <= pMax || pIgnoreNull && (pValue == null || isNaN(pValue)); +}; + +/** + * For use in validationProcess. Calls result.string(...) with error message, if number is not inside of the given values + * INCLUDING min / max. + * + * @param {Number} pTitle title to display in error message. Should be the name of the field and it will be translated. + * @param {Number} pValue value to check + * @param {Number} pMin min value INCLUSIVE + * @param {Number} pMax max value INCLUSIVE + * @param {Boolean} [pIgnoreNull=true] return True if pValue is null + * + * @return {String|False} returns the error message or false + * + * @example + * var value = vars.get("local.value"); <br> + * <br> + * var validationResult = NumberUtils.validateIsBetweenFloat("Discount", value, 0, 100); <br> + * <br> + * if (validationResult) <br> + * { <br> + * result.string(validationResult); <br> + * } <br> + */ +NumberUtils.validateIsBetweenFloat = function(pTitle, pValue, pMin, pMax, pIgnoreNull) +{ + if(pValue.includes(",")) + pValue = pValue.replace(",", "."); + + var discount = parseFloat(pValue); + + if(isNaN(discount)) + return false; + + if (!NumberUtils.isInside(discount, 0, 100, pIgnoreNull)) + { + return (translate.withArguments("${MIN_MAX_ERROR} field: %0, value: %1, min: %2, max: %3", [translate.text(pTitle), discount, pMin, pMax])); + } + return false; +} + +/** + * format Numbers with currency + */ +NumberUtils.formatWithCurrency = function(pNumber, pPattern, pCurrency) +{ + if (pNumber && pPattern) + return text.formatDouble(pNumber, pPattern + " " + pCurrency); + return "0 " + pCurrency; +} + +/** + * Class containing static utility functions for use with arrays + * Do not create an instance of this! + * + * @class + */ +function ArrayUtils() {} + +/** + * returns a distinct list of a two dimensional array + * + * @param {Array} p2dArray the Array where duplicate keys shall be removed + * + * @return 2D-Array that only contains unique entries + */ +ArrayUtils.distinct2d = function(p2dArray) +{ + var tempKeys = {}; + return p2dArray.filter(function(row){ + var key = row.join("-"); + return !(tempKeys[key] = ++tempKeys[key]|0) + }); +}; + +/** + * sorts a two dimensional array by the given index + * + * @param {Array} targetArray the Array to be sorted + * @param {String} index the index of the field to sort by + * @param {Boolean} [sortAsc=false] TRUE sorts ascending, FALSE sorts decending + * @param {Boolean} [isNumber=false] TRUE sorts numerical, FALSE or undefined sorts alphanumerical + * + * @return targetArray + * + * @throws {RangeError} if index is outside pArray.length + */ +ArrayUtils.sort2d = function(targetArray, index, sortAsc, isNumber) { + if (targetArray.length == 0) + return targetArray; + if (targetArray[0].length == 0) + return targetArray; + if (index >= targetArray[0].length) + throw new RangeError("Index Out Of Bounds: " + index + " >= " + targetArray[0].length); + + var sortFn = function (x, y) { + if ( isNumber ) { + xx = Number(x[index]); + yy = Number(y[index]); + } + else { + xx = x[index]; + yy = y[index]; + + xx = xx.toLowerCase(); + xx = xx.replace(/ä/g,"ae"); + xx = xx.replace(/ö/g,"oe"); + xx = xx.replace(/ü/g,"ue"); + xx = xx.replace(/ß/g,"ss"); + + yy = yy.toLowerCase(); + yy = yy.replace(/ä/g,"ae"); + yy = yy.replace(/ö/g,"oe"); + yy = yy.replace(/ü/g,"ue"); + yy = yy.replace(/ß/g,"ss"); + } + if (xx == yy) + return 0; + if (xx < yy) + return (sortAsc ? -1 : 1); + return (sortAsc ? 1 : -1); + } + + targetArray.sort(sortFn); + return targetArray +} + +/** +* sorts an array with columns +* +* @param {Array} targetArray the array with data +* @param {Array} sortOrder array with the format [columnIndex1, sortDescending1, columnIndex2, sortDescending2, ...], +* the columnIndex must be an integer, sortDescending must be boolean (true -> descending, just like db.DESCENDING) +* @example +* ArrayUtils.sortMulti(rows, [1, true, 2, true, 5, false]); +* +* @return {void} +*/ +ArrayUtils.sortMulti = function(targetArray, sortOrder) { + /* + * @param {String} a req value 1, first compared element + * @param {String} b req value 2, sencond compared element + * + * @return {Integer} -1 - set a below b, 0 - equal, 1 - set b below a + */ + var sortFn = function(a, b) { + var stringComparison = function(a, b) { + a = a.toLowerCase(); + a = a.replace(/ä/g,"ae"); + a = a.replace(/ö/g,"oe"); + a = a.replace(/ü/g,"ue"); + a = a.replace(/ß/g,"ss"); + + b = b.toLowerCase(); + b = b.replace(/ä/g,"ae"); + b = b.replace(/ö/g,"oe"); + b = b.replace(/ü/g,"ue"); + b = b.replace(/ß/g,"ss"); + + return( a == b ) ? 0 : ( a > b ) ? 1 : -1; + } + + var swap = 0; + + for (let i = 0, l = sortOrder.length; i < l; i += 2) + { + let colIndex = sortOrder[i]; + let sortDesc = sortOrder[i+1]; + if (swap || colIndex == undefined || sortDesc == undefined) + return swap; + + if (isNaN(a[colIndex] - b[colIndex])) + if ((isNaN(a[colIndex])) && (isNaN(b[colIndex]))) + swap = stringComparison(a[colIndex], b[colIndex]); + else + swap = (isNaN(a[colIndex]) ? 1 : -1); + else + swap = (a[colIndex] - b[colIndex]); + + swap *= (sortDesc ? -1 : 1); + } + return swap; + } + + targetArray.sort(sortFn); + return targetArray; +} + +/** +* removes an specific element from an array +* +* @param {Array} targetArray Array from which the element should be removed +* @param {String} elementPos index of the element which should be removed +* +* @return {Array} array containing the deleted element +*/ +ArrayUtils.removeElement = function(targetArray, elementPos) { + return targetArray.splice(elementPos, 1); +} + +/** + * concats arrays column by column; + * see example for more details + * + * @param {Array} array1 you have to pass at least 2 Arrays that shall be concated but you can pass as many as you want + * @param {Array} arrayN you have to pass at least 2 Arrays that shall be concated but you can pass as many as you want + * + * @return {Array} concatenated array + * + * @example + * var a = ["a", "b", "c"]; + * var b = ["A", "B", "C"]; + * logging.show(JSON.stringify(concatArrayColumns(a, b))); + * //[["a","A"],["b","B"],["c","C"]] + * + * logging.show(JSON.stringify(a.concat(b))); + * //["a","b","c","A","B","C"] + */ +ArrayUtils.concatColumns = function(array1, arrayN) { + var res, i, ii, l, ll, inpArr; + res = []; + + for (i = 0, l = arguments.length; i < l; i++) {//this function can handle an "unlimited" amount of functionparams + inpArr = arguments[i]; + for (ii = 0, ll = inpArr.length; ii < ll; ii++) { + if (res[ii] == undefined) + res[ii] = []; + + res[ii] = res[ii].concat(inpArr[ii]); + } + } + return res; +} + + +/** + * returns if an element is in an array; + * this is needed because there is currently no support for Array.prototype.includes() and we cannot easily use a polyfill and extend the Array.prototype + * + * @param {Array} targetArray array where the element should be searched in + * @param {AnyPrimitiveType} element the element which should be looked for + * @param {Boolean} [ignoreStringCase=false] if you've got a string array y + * + * @return {Boolean} true if it has the element + */ +ArrayUtils.hasElement = function(targetArray, element, ignoreStringCase) { + var i, l; + if (ignoreStringCase)//do only once to save ressources and not for every array element + element = element.toString().toLowerCase(); + for (i = 0, l = targetArray.length; i < l; i++) { + if (ignoreStringCase) { + if (targetArray[i].toString().toLowerCase() == element) + return true; + } + else { + if (targetArray[i] == element) + return true; + } + } + return false; +} + +/** + * joins an array but skips empty elements (null, undefined, "") + * + * @param {Array} pArray the array to join + * @param {String} [pSeparator=", "] the separator + * + * @return {String} the resulting string + */ +ArrayUtils.joinNonEmptyFields = function (pArray, pSeparator) +{ + return pArray.filter(function (element) + { + return element !== null && element !== undefined && element !== ""; + }).join(pSeparator); +} + +/** + * Class containing utility functions for use with JSON + * @class + */ +function JSONUtils() { +} + +/** + * A custom JSON.stringify() to + * - keep the functions as string + * - stringify JavaArrays + * - stringify undefined as undefined and not as null + * + * @param {Object} obj the object to stringify + * + * @return {String} the stringified object as string representation + */ +JSONUtils.customStringify = function(obj) { + //stringify part from JSON polyfill: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON + var toString = Object.prototype.toString; + var escMap = { + '"': '\\"', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t' + }; + var escFunc = function (m) { + return escMap[m] || '\\u' + (m.charCodeAt(0) + 0x10000).toString(16).substr(1); + }; + var escRE = /[\\"\u0000-\u001F\u2028\u2029]/g; + + var stringify = function (value){ + //because: "undefined == null" is true + if (value === undefined) { + return 'undefined'; + } else if (value == null) { + return 'null'; + } else if (typeof value === 'number') { + return isFinite(value) ? value.toString() : 'null'; + } else if (typeof value === 'boolean') { + return value.toString(); + } else if (typeof value === 'object') +{ + //check with "hasOwnProperty" because in JavaArrays using value.toJSON would cause an exception + if (toString.call(value) != '[object Map]' && value.hasOwnProperty("toJSON") && typeof value.toJSON === 'function') { + return value.toString(); + } else if (toString.call(value) === '[object Array]') { + var res = '['; + for (var i = 0; i < value.length; i++) + res += (i ? ', ' : '') + stringify(value[i]); + return res + ']'; + } else if (toString.call(value) === '[object Object]' || toString.call(value) === '[object Map]') { + var tmp = []; + for (var k in value) { + if (hasOwnProperty.call(value, k)) + tmp.push(stringify(k) + ': ' + stringify(value[k])); + } + return '{' + tmp.join(', ') + '}'; + //custom addition to stringify Rhino JavaArrays + } else if (toString.call(value) === '[object JavaArray]') { + return value.toSource().toString(); + } + } + //custom addition for function transform + //JSON.stringify returns null on functions (default) + //instead return source code of funciton for callback-functions + else if (typeof value === 'function') + { + return value.toString(); + } + + return '"' + value.toString().replace(escRE, escFunc) + '"'; + } + + return stringify(obj); +} + +/** + * Class containing functions for Javascript-Objects + * Do not create an instance of this + * + * @class + */ +function ObjectUtils(){} + +/** + * checks if a value exists in the object + * mostly usefull for primitve datatypes + * + * @param pObject {Object} the object where the value is searched + * @param pValue {Boolean|Number|String} the value that is searched + * + * @return {Boolean} true if the value was found, false if not + */ +ObjectUtils.existsValue = function(pObject, pValue) +{ + for (var key in pObject) + { + if (pObject[key] === pValue) + return true; + } + return false; +}; + +/** + * Class containing functions for sequential numbers + * Do not create an instance of this! + * + * @class + */ +function NumberSequencingUtils() {} + +/** + * Delivers the next unique number + * + * @param {String} pColumn database column that contains unique numbers + * @param {String} pTable database table + * @param {Number} [pStartNumber=1000] number to start numeration + * @param {String} [pCondition=no condition] SQL Where Conditon + * + * @result {String} next valid number + */ +NumberSequencingUtils.getNextUniqueNumber = function(pColumn, pTable, pStartNumber, pCondition) { + var maxNum = NumberSequencingUtils.getMaxUniqueNumber(pColumn, pTable, pCondition); + if(maxNum == "0") { + if(pStartNumber == undefined) pStartNumber = 1000; + return pStartNumber; + } + return eMath.addInt(maxNum, "1");//increment currently highest number +} + +/** + * Checks if the passed number is valid (has to be unique) + * + * @param {String} pNumber number to check + * @param {String} pColumn req database column that contains unique numbers + * @param {String} pTable req database table + * @param {String} pCondition opt SQL Where Conditon + * + * @result {boolean} passed number is valid + */ +NumberSequencingUtils.validateUniqueNumber = function(pNumber, pColumn, pTable, pCondition) { + var maxNum = NumberSequencingUtils.getMaxUniqueNumber(pColumn, pTable, pCondition); + return Number(pNumber) > Number(maxNum); +} + +/** + * Delivers the hightest number currently stored in database + * + * @param {String} pColumn req database column that contains unique numbers + * @param {String} pTable req database table + * @param {String} pCondition opt SQL Where Conditon + * + * @result {String} hightest number + */ +NumberSequencingUtils.getMaxUniqueNumber = function(pColumn, pTable, pCondition) { + var condition = ""; + if(pCondition != undefined) + condition += " where " + pCondition; + var maxNum = db.cell("select max(" + pColumn + ") from " + pTable + condition); + return maxNum == "" ? "0" : maxNum; +} + +/** + * functions for trees + * Do not create an instance of this! + * + * @class + */ +function TreeUtils () {} + +/** + * sorts an array in a way that a tree(-table) can be built (parents are added before children) + * This function does not garantee that the order of the children stays the same. If you need this, use TreeUtils.treeOrderBy + * + * consider the use of TreeUtils.treeOrderBy as it may be more performant, but it needs the layernumber of each row. + * + * @param {Array} pArray two-dimensional array to sort + * @param {Number} pUidIndex the index of the uid in a row + * @param {Number} pParentIdIndex the index of the parent id in a row + * + * @return {Array} the sorted array + */ +TreeUtils.sortArrayForTree = function (pArray, pUidIndex, pParentIdIndex) +{ + if (pArray.length <= 1) + return pArray; + var rows = {}; + var allIds = {}; + + pArray.forEach(function (row) {allIds[row[pUidIndex]] = true;}); + var index = 0; + + do { + var oldIndex = index; + pArray.forEach(function (row) + { + if (!(row[pUidIndex] in this) && (row[pParentIdIndex] in this || !allIds[row[pParentIdIndex]])) + this[row[pUidIndex]] = { + data : row, + index : index++ + }; + }, rows); + + /* stop if no new items were added, otherwise incorrect data (for instance + an item that is it's own parent) could cause an infinite loop */ + } while (oldIndex != index); + var sortedArray = new Array(index); + for (let i in rows) + sortedArray[rows[i].index] = rows[i].data; + return sortedArray; +} + +/** + * like TreeUtils.sortArrayForTree, this function garantees that parents are added before children + * But it works in a different way based on the layer number. + * + * It can also sort all children based on the given orderBys. For this you can Probvide an array of Indexes and direction (pOrderByIndexes) + * + * @param {Array} pData two-dimensional array to sort + * @param {Number} pLayerIndex The index of the layernumber-Field + * @param {Array[][]} pOrderByIndexes Array containing arrays of [field-index, direction]. The direction can be true (desc) or false (asc). + * + * @return {Array} the sorted array + */ +TreeUtils.treeOrderBy = function(pData, pLayerIndex, pOrderByIndexes) +{ + pOrderByIndexes = [[pLayerIndex, false]].concat(pOrderByIndexes) + + return pData.sort(function(pRow1, pRow2) + { + for (let i = 0; i < pOrderByIndexes.length; i++) { + var orderBy = pOrderByIndexes[i]; + if (pRow1[orderBy[0]] > pRow2[orderBy[0]]) return (orderBy[1] ? -1 : 1); + if (pRow1[orderBy[0]] < pRow2[orderBy[0]]) return (orderBy[1] ? 1 : -1); + } + + return 0; + }) +} + +/** + * functions for numbered codes + * Do not create an instance of this! + * + * @class + */ +function ConsecutiveCodeUtils () {} +/** + * Sets the code of the given Table to the current max-code + 1 + */ +ConsecutiveCodeUtils.setCode = function(pId, pTable, pIdCol, pCodeCol) +{ + var max = db.cell("select max(" + pCodeCol + ") from " + pTable); + if (!max) + max = -1; + + db.updateData(pTable, [pCodeCol], null, [parseInt(max)+1], SqlCondition.equals(pTable + "." + pIdCol, pId, "1=2")); } \ No newline at end of file diff --git a/process/WsValidation_lib/process.js b/process/WsValidation_lib/process.js index dfeb7e0835ca991790f377433728af7be78b6f2f..69379c6adf70362e376cd9eeaa411c0817666d38 100644 --- a/process/WsValidation_lib/process.js +++ b/process/WsValidation_lib/process.js @@ -266,47 +266,79 @@ WsValidationUtils.validate = function(pValue, pType, pCountry, pCity) } /** - * set all address-fields by the value of $this.value, which should contain an object of all values as JSON - * @param {String} [pFieldToSetToValue=undefined] the field which should be set to data.value + * parses a json array, but also checks if it is really an array + * @param {String} pJSON the json data + * + * @return {Array|null} the parsed data as array or null if it was no array */ -WsValidationUtils.setAddressFields = function(pFieldToSetToValue) -{ +WsValidationUtils._parseJSONArray = function(pJSON) { try { - var data = JSON.parse(vars.getString("$this.value")); - } catch (exception) { + var data = JSON.parse(pJSON); + } catch (ex) { // if no valid json, it is a direct user input and not a uuid. // ignore error - return + return null } var type = typeof data; // Only an array can be returned by the ws. V-- this check is slow -> check if not object before as its faster if (type != "object" || Object.prototype.toString.call(data) !== '[object Array]') - return - - _setField("$field.ZIP", data[1]); - _setField("$field.CITY", data[2]); - _setField("$field.COUNTRY", data[4]); - //_setField("$field.DISTRICT", data[5]); not needed currently - _setField("$field.REGION", data[6]); - _setField("$field.STATE", data[7]); - _setField("$field.ADDRESS", data[8]); + return null - if (pFieldToSetToValue) - { - _setField(pFieldToSetToValue, data[12]) + return data; +} + +/** + * set all address-fields by pValue, which should contain an array of all values as JSON + * Note: it does not set the current field itself as this sould be done by the value process. Use WsValidationUtils.valueFromJSON for this. + * + * @param {String} pJSON the values as json + */ +WsValidationUtils.setAddressFields = function(pJSON) +{ + var data = WsValidationUtils._parseJSONArray(pJSON); + if (data == null) + return + + var currentField = vars.get("$this.name"); + var toSet = { + "$field.ZIP": data[1], + "$field.CITY": data[2], + "$field.COUNTRY": data[4], + //"$field.DISTRICT": data[5], not needed currently + "$field.REGION": data[6], + "$field.STATE": data[7], + "$field.ADDRESS": data[8] } - function _setField(pField, pValue) + for (field in toSet) { - if (!pValue) - pValue = "" + if (field != currentField) + { + let value = toSet[field]; + if (!value) + value = "" - neon.setFieldValue(pField, pValue); + neon.setFieldValue(field, value); + } } } +/** + * gives you only the value of the json. + * + * @param {String} pJSON the values as json + * @return {String} the value or null if local.value did not contain a valid json array + */ +WsValidationUtils.valueFromJSON = function(pJSON) +{ + var data = WsValidationUtils._parseJSONArray(pJSON); + if (data == null) + return null + + return data[12]; +} /** * check if the Webservice is enabled in the project preferences * @param {Object} pType diff --git a/process/_test_clientProcess/process.js b/process/_test_clientProcess/process.js index 9161a9a2bede588a70ca5152ecd6bf9e7e70bede..273b7362004c369f828a237f97eafb777ee393d7 100644 --- a/process/_test_clientProcess/process.js +++ b/process/_test_clientProcess/process.js @@ -1,20 +1,21 @@ -import("system.datetime"); -import("system.util"); -import("system.logging"); -import("Liquibase_lib"); -import("system.db"); -import("system.fileIO"); - -var alias = "_____SYSTEMALIAS"; -//var alias = "betterDataSys"; -//var alias = "betterData"; -//var alias = db.getCurrentAlias(); -var outFolderPath = "C:\\temp\\generatedData\\" + alias + "\\"; - -var excludedTables = ["AB_COUNTRYINFO", "AB_LANGUAGE"]; -//LiquiUtils.exportAllTablesAsLiquibaseFiles(outFolderPath, null, alias, excludedTables, true); - -alias = "_____SYSTEMALIAS"; -outFolderPath = "C:\\temp\\generatedData\\" + alias + "\\"; -LiquiUtils.exportTableAsLiquibaseFiles(outFolderPath, "ASYS_USERS", null, "PROPKEY in ('mailserverAlias', 'userserverEnabled') ", null, false, alias); +import("Sql_lib"); +import("system.datetime"); +import("system.util"); +import("system.logging"); +import("Liquibase_lib"); +import("system.db"); +import("system.fileIO"); + +var alias = SqlUtils.getSystemAlias(); +//var alias = "betterDataSys"; +//var alias = "betterData"; +//var alias = db.getCurrentAlias(); +var outFolderPath = "C:\\temp\\generatedData\\" + alias + "\\"; + +var excludedTables = ["AB_COUNTRYINFO", "AB_LANGUAGE"]; +//LiquiUtils.exportAllTablesAsLiquibaseFiles(outFolderPath, null, alias, excludedTables, true); + +alias = SqlUtils.getSystemAlias(); +outFolderPath = "C:\\temp\\generatedData\\" + alias + "\\"; +LiquiUtils.exportTableAsLiquibaseFiles(outFolderPath, "ASYS_USERS", null, "PROPKEY in ('mailserverAlias', 'userserverEnabled') ", null, false, alias); logging.log("finish"); \ No newline at end of file diff --git a/process/autostartNeon/process.js b/process/autostartNeon/process.js index aa471725ace0af79aa8fb9b6eddbb99a2be34281..229b95da597a73a897992b3e2bf92d55168c6c19 100644 --- a/process/autostartNeon/process.js +++ b/process/autostartNeon/process.js @@ -1,4 +1,5 @@ -import("system.logging"); +import("Permission_lib"); +import("system.project"); import("system.tools"); import("system.calendars") import("system.notification") @@ -15,3 +16,20 @@ for(var i = 0; i < usersTools.length; i++) calendars.setCalendarUser(users, calendars.RIGHT_READ | calendars.RIGHT_WRITE, false, calendars.SORTSTRATEGY_NATURAL); calendars.setCheckAttendeesOnWrite(false); + +// permissions - creating default permission (with no actions) for role everyone +var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY); +var entitiesUsePermFlagSet = []; // array, which contains ids of entities with usePermission flag set +var roleInternalEveryone = "INTERNAL_EVERYONE"; + +// gets all names of the entites which have the 'usePermission'-flag set (positive list) +for each (let entityMetaData in entitiesMetaData) { + if (entityMetaData[6] == "true") { + entitiesUsePermFlagSet.push(entityMetaData[0]) + if (PermissionUtil.getNumberOfPermissions(entityMetaData[0]) == 0) { + // no permissions found for the given entity -> create permissionset for role INTERNAL_EVERYONE with five X's for view, create, read, update, delete + var noAccessPermissionSetIdEntity = PermissionUtil.insertSet("", entityMetaData[0], roleInternalEveryone, "", "E"); + PermissionUtil.insertPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E" + } + } +} diff --git a/process/buildSerialLetter_serverProcess/process.js b/process/buildSerialLetter_serverProcess/process.js index 2818ac05b845c0a6deab9ec13325254376d2e6df..fd114e183e7396551fd4031865056c8bd1fce14a 100644 --- a/process/buildSerialLetter_serverProcess/process.js +++ b/process/buildSerialLetter_serverProcess/process.js @@ -1,3 +1,4 @@ +import("Bulkmail_lib"); import("system.result"); import("system.vars"); import("KeywordRegistry_basic"); @@ -14,7 +15,7 @@ var templateId = db.cell(SqlCondition.begin() .andPrepare("SERIALLETTER.SERIALLETTERID", letterId) .buildSql("select DOCUMENTTEMPLATE_ID from SERIALLETTER", "1=2")); -var template = DocumentTemplate.loadTemplate(templateId); +var template = SerialLetterUtils.getSerialLetterTemplate(letterId, templateId); var condition = SqlCondition.begin() .andPrepare("LETTERRECIPIENT.SERIALLETTER_ID", letterId) .andSqlCondition(ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$letter(), true)); diff --git a/process/ctiServerEvents/process.js b/process/ctiServerEvents/process.js index 81944a4a3f936190a74d104935f068e5fe0004aa..0375f23402be095c7856026594d7ed536cb87f36 100644 --- a/process/ctiServerEvents/process.js +++ b/process/ctiServerEvents/process.js @@ -57,7 +57,11 @@ var ringingHandlerFn = function() notificationConfig.description(desc).caption(title); if (this.contactsCall.length > 0) - notificationConfig.linkInfo(text.encodeMS(["AnyContact", affectedContactId/*this.contactsCall[0].CONTACTID*/])); + { + var affectedContext = this.contactsCall[0].PERSON_ID.trim() == "" ? "Organisation" : "Person"; + notificationConfig.linkInfo(text.encodeMS([affectedContext, affectedContactId])); + } + notification.addNotificationWith(notificationConfig); return null; @@ -109,7 +113,7 @@ var disconnectingHandlerFn = function() else { var contactTitleMissed = this.contactsCall[0].PERSON_FULL_NAME + ", " + this.contactsCall[0].ORGANISATION_NAME; - title = translate.withArguments("Call from %0", [this.callData.callAddress], targetLocale); + title = translate.withArguments("Call from %0", [contactTitleMissed], targetLocale); desc = translate.withArguments("Missed call from %0 (%1) to %2", [this.getFormattedCallAddress(), contactTitleMissed, this.getFormattedLocalAddress()], targetLocale); } } diff --git a/process/emailWrite/process.js b/process/emailWrite/process.js index b182346d55839c37604dccd5eef31237e210d2ae..d69b5720af1f95d2c213a0ae7c42b94dacc1680b 100644 --- a/process/emailWrite/process.js +++ b/process/emailWrite/process.js @@ -17,7 +17,7 @@ if (entity == "Communication_entity") .andPrepare("COMMUNICATION.COMMUNICATIONID", uid) .buildSql("select COMMUNICATION.CONTACT_ID from COMMUNICATION"); var contactId = db.cell(contactSql) - EmailUtils.openNewMail(contactId, address); + EmailWritingUtils.openNewMail(contactId, address); } else neon.openUrl("mailto:" + encodeURIComponent(address), false); \ No newline at end of file diff --git a/process/getDocxDocument_serverProcess/process.js b/process/getDocxDocument_serverProcess/process.js index ba89d5b72fe127a05af388ffdd0cb0cb3803c612..12ab4e172f914455bd6af4a0eb501fc23d6fcbd2 100644 --- a/process/getDocxDocument_serverProcess/process.js +++ b/process/getDocxDocument_serverProcess/process.js @@ -1,13476 +1,13503 @@ -import("system.res"); -import("system.vars"); -import("system.swing"); -import("system.fileIO"); -import("system.util"); -import("system.result"); - -/* This is a serverprocess to improve the performance - * This Process has 13k lines of code since 2 js-libs are included (ress in about 420KB) - * The maximum size limit for pre-compiling is 64KB. If this process would be a "lib_" it'd cause every process where - * it's imported to be interpreted. As a serverprocess only this sp is interpreted - */ - -initTemplater();//automatically inits zipjs|no customizing is done in these two libraries - -var fileContent; - -if (vars.exists("$local.templateFilePath")) - fileContent = fileIO.getData(vars.get("$local.templateFilePath"), util.DATA_BINARY, "UTF8"); -else - fileContent = vars.get("$local.templateb64"); - -var zip = new JSZip(); -zip = zip.load(fileContent, {base64: true}); -var docx = new Docxtemplater(); -//use ADITO-default delimiters instead of doxtemplater-delimiters -docx.delimiters.start = "{@"; -docx.delimiters.end = "@}"; -docx.attachModule(_getAutoNewLineModule()); -docx = docx.loadZip(zip); - -var phConfig = vars.get("$local.placeholderConfig"); -phConfig = JSON.parse(phConfig); -docx.setData(phConfig);//set the templateVariables -docx.render();//apply them (replace all occurences of {placeholer} by Value, ...) - -var out = docx.getZip().generate({ - type:"base64", - mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" -}); - -result.object(out.toString()); - -//this is a function for replacing newlines with a "<w:br/>"-tag -//prefix "=" by default since this is not used by the docxtemplater right now -//that's necessary because you cannot modify the data before parsing. (data will be escaped) -//so we need to replace onRender with a custom module -function _getAutoNewLineModule() -{ - var moduleName = "AutoNewLineModule"; - - var res = { - name: moduleName, - parse: function parse(placeHolderContent) { - var type = "placeholder"; - if (placeHolderContent[0] !== "=") - { - return null; - } - return { - type: type, - value: placeHolderContent.substr(1), - module: moduleName - }; - - }, - - render: function render(part, options) { - if (part.module !== moduleName) - { - return null; - } - var value = options.scopeManager.getValue(part.value); - if (value == null) - { - value = options.nullGetter(part); - } - else - { - value = value.replace(/(\r\n)|(\n)|(\r)/g, "<w:br/>"); - } - - return { - value: value - }; - } - } - - - return res; -} - - -/* - * do NOT TOUCH the following code. these are js-libraries - */ - - - - -//jszip -/*! - -JSZip - A Javascript class for generating and reading zip files -<http://stuartk.com/jszip> - -(c) 2009-2014 Stuart Knightley <stuart [at] stuartk.com> -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/master/LICENSE - -The MIT License -=============== - -Copyright (c) 2009-2016 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -*/ -function initJsZip() -{ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ -var DataReader = require('./dataReader'); - -function ArrayReader(data) { - if (data) { - this.data = data; - this.length = this.data.length; - this.index = 0; - this.zero = 0; - - for(var i = 0; i < this.data.length; i++) { - data[i] = data[i] & 0xFF; - } - } -} -ArrayReader.prototype = new DataReader(); -/** - * @see DataReader.byteAt - */ -ArrayReader.prototype.byteAt = function(i) { - return this.data[this.zero + i]; -}; -/** - * @see DataReader.lastIndexOfSignature - */ -ArrayReader.prototype.lastIndexOfSignature = function(sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3); - for (var i = this.length - 4; i >= 0; --i) { - if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { - return i - this.zero; - } - } - - return -1; -}; -/** - * @see DataReader.readData - */ -ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if(size === 0) { - return []; - } - var res = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return res; -}; -module.exports = ArrayReader; - -},{"./dataReader":6}],2:[function(require,module,exports){ -// private property -var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - -// public method for encoding -exports.encode = function(input, utf8) { - var output = ""; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0; - - while (i < input.length) { - - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } - else if (isNaN(chr3)) { - enc4 = 64; - } - - output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); - - } - - return output; -}; - -// public method for decoding -exports.decode = function(input, utf8) { - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - while (i < input.length) { - - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output = output + String.fromCharCode(chr1); - - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - - } - - return output; - -}; - -},{}],3:[function(require,module,exports){ -function CompressedObject() { - this.compressedSize = 0; - this.uncompressedSize = 0; - this.crc32 = 0; - this.compressionMethod = null; - this.compressedContent = null; -} - -CompressedObject.prototype = { - /** - * Return the decompressed content in an unspecified format. - * The format will depend on the decompressor. - * @return {Object} the decompressed content. - */ - getContent: function() { - return null; // see implementation - }, - /** - * Return the compressed content in an unspecified format. - * The format will depend on the compressed conten source. - * @return {Object} the compressed content. - */ - getCompressedContent: function() { - return null; // see implementation - } -}; -module.exports = CompressedObject; - -},{}],4:[function(require,module,exports){ -exports.STORE = { - magic: "\x00\x00", - compress: function(content, compressionOptions) { - return content; // no compression - }, - uncompress: function(content) { - return content; // no compression - }, - compressInputType: null, - uncompressInputType: null -}; -exports.DEFLATE = require('./flate'); - -},{"./flate":9}],5:[function(require,module,exports){ - -var utils = require('./utils'); - -var table = [ - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -]; - -/** - * - * Javascript crc32 - * http://www.webtoolkit.info/ - * - */ -module.exports = function crc32(input, crc) { - if (typeof input === "undefined" || !input.length) { - return 0; - } - - var isArray = utils.getTypeOf(input) !== "string"; - - if (typeof(crc) == "undefined") { - crc = 0; - } - var x = 0; - var y = 0; - var b = 0; - - crc = crc ^ (-1); - for (var i = 0, iTop = input.length; i < iTop; i++) { - b = isArray ? input[i] : input.charCodeAt(i); - y = (crc ^ b) & 0xFF; - x = table[y]; - crc = (crc >>> 8) ^ x; - } - - return crc ^ (-1); -}; -// vim: set shiftwidth=4 softtabstop=4: - -},{"./utils":22}],6:[function(require,module,exports){ - -var utils = require('./utils'); - -function DataReader(data) { - this.data = null; // type : see implementation - this.length = 0; - this.index = 0; - this.zero = 0; -} -DataReader.prototype = { - /** - * Check that the offset will not go too far. - * @param {string} offset the additional offset to check. - * @throws {Error} an Error if the offset is out of bounds. - */ - checkOffset: function(offset) { - this.checkIndex(this.index + offset); - }, - /** - * Check that the specifed index will not be too far. - * @param {string} newIndex the index to check. - * @throws {Error} an Error if the index is out of bounds. - */ - checkIndex: function(newIndex) { - if (this.length < this.zero + newIndex || newIndex < 0) { - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); - } - }, - /** - * Change the index. - * @param {number} newIndex The new index. - * @throws {Error} if the new index is out of the data. - */ - setIndex: function(newIndex) { - this.checkIndex(newIndex); - this.index = newIndex; - }, - /** - * Skip the next n bytes. - * @param {number} n the number of bytes to skip. - * @throws {Error} if the new index is out of the data. - */ - skip: function(n) { - this.setIndex(this.index + n); - }, - /** - * Get the byte at the specified index. - * @param {number} i the index to use. - * @return {number} a byte. - */ - byteAt: function(i) { - // see implementations - }, - /** - * Get the next number with a given byte size. - * @param {number} size the number of bytes to read. - * @return {number} the corresponding number. - */ - readInt: function(size) { - var res = 0, - i; - this.checkOffset(size); - for (i = this.index + size - 1; i >= this.index; i--) { - res = (res << 8) + this.byteAt(i); - } - this.index += size; - return res; - }, - /** - * Get the next string with a given byte size. - * @param {number} size the number of bytes to read. - * @return {string} the corresponding string. - */ - readString: function(size) { - return utils.transformTo("string", this.readData(size)); - }, - /** - * Get raw data without conversion, <size> bytes. - * @param {number} size the number of bytes to read. - * @return {Object} the raw data, implementation specific. - */ - readData: function(size) { - // see implementations - }, - /** - * Find the last occurence of a zip signature (4 bytes). - * @param {string} sig the signature to find. - * @return {number} the index of the last occurence, -1 if not found. - */ - lastIndexOfSignature: function(sig) { - // see implementations - }, - /** - * Get the next date. - * @return {Date} the date. - */ - readDate: function() { - var dostime = this.readInt(4); - return new Date( - ((dostime >> 25) & 0x7f) + 1980, // year - ((dostime >> 21) & 0x0f) - 1, // month - (dostime >> 16) & 0x1f, // day - (dostime >> 11) & 0x1f, // hour - (dostime >> 5) & 0x3f, // minute - (dostime & 0x1f) << 1); // second - } -}; -module.exports = DataReader; - -},{"./utils":22}],7:[function(require,module,exports){ -exports.base64 = false; -exports.binary = false; -exports.dir = false; -exports.createFolders = false; -exports.date = null; -exports.compression = null; -exports.compressionOptions = null; -exports.comment = null; -exports.unixPermissions = null; -exports.dosPermissions = null; - -},{}],8:[function(require,module,exports){ -var utils = require('./utils'); - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.string2binary = function(str) { - return utils.string2binary(str); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.string2Uint8Array = function(str) { - return utils.transformTo("uint8array", str); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.uint8Array2String = function(array) { - return utils.transformTo("string", array); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.string2Blob = function(str) { - var buffer = utils.transformTo("arraybuffer", str); - return utils.arrayBuffer2Blob(buffer); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.arrayBuffer2Blob = function(buffer) { - return utils.arrayBuffer2Blob(buffer); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.transformTo = function(outputType, input) { - return utils.transformTo(outputType, input); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.getTypeOf = function(input) { - return utils.getTypeOf(input); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.checkSupport = function(type) { - return utils.checkSupport(type); -}; - -/** - * @deprecated - * This value will be removed in a future version without replacement. - */ -exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; - -/** - * @deprecated - * This value will be removed in a future version without replacement. - */ -exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; - - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.pretty = function(str) { - return utils.pretty(str); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.findCompression = function(compressionMethod) { - return utils.findCompression(compressionMethod); -}; - -/** - * @deprecated - * This function will be removed in a future version without replacement. - */ -exports.isRegExp = function (object) { - return utils.isRegExp(object); -}; - - -},{"./utils":22}],9:[function(require,module,exports){ -var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); - -var pako = require("pako"); -exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; -exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; - -exports.magic = "\x08\x00"; -exports.compress = function(input, compressionOptions) { - return pako.deflateRaw(input, { - level : compressionOptions.level || -1 // default compression - }); -}; -exports.uncompress = function(input) { - return pako.inflateRaw(input); -}; - -},{"pako":25}],10:[function(require,module,exports){ - -var base64 = require('./base64'); - -/** -Usage: - zip = new JSZip(); - zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); - zip.folder("images").file("smile.gif", base64Data, {base64: true}); - zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); - zip.remove("tempfile"); - - base64zip = zip.generate(); - -**/ - -/** - * Representation a of zip file in js - * @constructor - * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional). - * @param {Object=} options the options for creating this objects (optional). - */ -function JSZip(data, options) { - // if this constructor is used without `new`, it adds `new` before itself: - if(!(this instanceof JSZip)) return new JSZip(data, options); - - // object containing the files : - // { - // "folder/" : {...}, - // "folder/data.txt" : {...} - // } - this.files = {}; - - this.comment = null; - - // Where we are in the hierarchy - this.root = ""; - if (data) { - this.load(data, options); - } - this.clone = function() { - var newObj = new JSZip(); - for (var i in this) { - if (typeof this[i] !== "function") { - newObj[i] = this[i]; - } - } - return newObj; - }; -} -JSZip.prototype = require('./object'); -JSZip.prototype.load = require('./load'); -JSZip.support = require('./support'); -JSZip.defaults = require('./defaults'); - -/** - * @deprecated - * This namespace will be removed in a future version without replacement. - */ -JSZip.utils = require('./deprecatedPublicUtils'); - -JSZip.base64 = { - /** - * @deprecated - * This method will be removed in a future version without replacement. - */ - encode : function(input) { - return base64.encode(input); - }, - /** - * @deprecated - * This method will be removed in a future version without replacement. - */ - decode : function(input) { - return base64.decode(input); - } -}; -JSZip.compressions = require('./compressions'); -module.exports = JSZip; - -},{"./base64":2,"./compressions":4,"./defaults":7,"./deprecatedPublicUtils":8,"./load":11,"./object":14,"./support":18}],11:[function(require,module,exports){ -var base64 = require('./base64'); -var utf8 = require('./utf8'); -var utils = require('./utils'); -var ZipEntries = require('./zipEntries'); -module.exports = function(data, options) { - var files, zipEntries, i, input; - options = utils.extend(options || {}, { - base64: false, - checkCRC32: false, - optimizedBinaryString : false, - createFolders: false, - decodeFileName: utf8.utf8decode - }); - if (options.base64) { - data = base64.decode(data); - } - - zipEntries = new ZipEntries(data, options); - files = zipEntries.files; - for (i = 0; i < files.length; i++) { - input = files[i]; - this.file(input.fileNameStr, input.decompressed, { - binary: true, - optimizedBinaryString: true, - date: input.date, - dir: input.dir, - comment : input.fileCommentStr.length ? input.fileCommentStr : null, - unixPermissions : input.unixPermissions, - dosPermissions : input.dosPermissions, - createFolders: options.createFolders - }); - } - if (zipEntries.zipComment.length) { - this.comment = zipEntries.zipComment; - } - - return this; -}; - -},{"./base64":2,"./utf8":21,"./utils":22,"./zipEntries":23}],12:[function(require,module,exports){ -(function (Buffer){ -module.exports = function(data, encoding){ - return new Buffer(data, encoding); -}; -module.exports.test = function(b){ - return Buffer.isBuffer(b); -}; - -}).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) -},{}],13:[function(require,module,exports){ -var Uint8ArrayReader = require('./uint8ArrayReader'); - -function NodeBufferReader(data) { - this.data = data; - this.length = this.data.length; - this.index = 0; - this.zero = 0; -} -NodeBufferReader.prototype = new Uint8ArrayReader(); - -/** - * @see DataReader.readData - */ -NodeBufferReader.prototype.readData = function(size) { - this.checkOffset(size); - var res = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return res; -}; -module.exports = NodeBufferReader; - -},{"./uint8ArrayReader":19}],14:[function(require,module,exports){ - -var support = require('./support'); -var utils = require('./utils'); -var crc32 = require('./crc32'); -var signature = require('./signature'); -var defaults = require('./defaults'); -var base64 = require('./base64'); -var compressions = require('./compressions'); -var CompressedObject = require('./compressedObject'); -var nodeBuffer = require('./nodeBuffer'); -var utf8 = require('./utf8'); -var StringWriter = require('./stringWriter'); -var Uint8ArrayWriter = require('./uint8ArrayWriter'); - -/** - * Returns the raw data of a ZipObject, decompress the content if necessary. - * @param {ZipObject} file the file to use. - * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. - */ -var getRawData = function(file) { - if (file._data instanceof CompressedObject) { - file._data = file._data.getContent(); - file.options.binary = true; - file.options.base64 = false; - - if (utils.getTypeOf(file._data) === "uint8array") { - var copy = file._data; - // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. - // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). - file._data = new Uint8Array(copy.length); - // with an empty Uint8Array, Opera fails with a "Offset larger than array size" - if (copy.length !== 0) { - file._data.set(copy, 0); - } - } - } - return file._data; -}; - -/** - * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it. - * @param {ZipObject} file the file to use. - * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. - */ -var getBinaryData = function(file) { - var res = getRawData(file), - type = utils.getTypeOf(res); - if (type === "string") { - if (!file.options.binary) { - // unicode text ! - // unicode string => binary string is a painful process, check if we can avoid it. - if (support.nodebuffer) { - return nodeBuffer(res, "utf-8"); - } - } - return file.asBinary(); - } - return res; -}; - -/** - * Transform this._data into a string. - * @param {function} filter a function String -> String, applied if not null on the res. - * @return {String} the string representing this._data. - */ -var dataToString = function(asUTF8) { - var res = getRawData(this); - if (res === null || typeof res === "undefined") { - return ""; - } - // if the data is a base64 string, we decode it before checking the encoding ! - if (this.options.base64) { - res = base64.decode(res); - } - if (asUTF8 && this.options.binary) { - // JSZip.prototype.utf8decode supports arrays as input - // skip to array => string step, utf8decode will do it. - res = out.utf8decode(res); - } - else { - // no utf8 transformation, do the array => string step. - res = utils.transformTo("string", res); - } - - if (!asUTF8 && !this.options.binary) { - res = utils.transformTo("string", out.utf8encode(res)); - } - return res; -}; -/** - * A simple object representing a file in the zip file. - * @constructor - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data - * @param {Object} options the options of the file - */ -var ZipObject = function(name, data, options) { - this.name = name; - this.dir = options.dir; - this.date = options.date; - this.comment = options.comment; - this.unixPermissions = options.unixPermissions; - this.dosPermissions = options.dosPermissions; - - this._data = data; - this.options = options; - - /* - * This object contains initial values for dir and date. - * With them, we can check if the user changed the deprecated metadata in - * `ZipObject#options` or not. - */ - this._initialMetadata = { - dir : options.dir, - date : options.date - }; -}; - -ZipObject.prototype = { - /** - * Return the content as UTF8 string. - * @return {string} the UTF8 string. - */ - asText: function() { - return dataToString.call(this, true); - }, - /** - * Returns the binary content. - * @return {string} the content as binary. - */ - asBinary: function() { - return dataToString.call(this, false); - }, - /** - * Returns the content as a nodejs Buffer. - * @return {Buffer} the content as a Buffer. - */ - asNodeBuffer: function() { - var res = getBinaryData(this); - return utils.transformTo("nodebuffer", res); - }, - /** - * Returns the content as an Uint8Array. - * @return {Uint8Array} the content as an Uint8Array. - */ - asUint8Array: function() { - var res = getBinaryData(this); - return utils.transformTo("uint8array", res); - }, - /** - * Returns the content as an ArrayBuffer. - * @return {ArrayBuffer} the content as an ArrayBufer. - */ - asArrayBuffer: function() { - return this.asUint8Array().buffer; - } -}; - -/** - * Transform an integer into a string in hexadecimal. - * @private - * @param {number} dec the number to convert. - * @param {number} bytes the number of bytes to generate. - * @returns {string} the res. - */ -var decToHex = function(dec, bytes) { - var hex = "", - i; - for (i = 0; i < bytes; i++) { - hex += String.fromCharCode(dec & 0xff); - dec = dec >>> 8; - } - return hex; -}; - -/** - * Transforms the (incomplete) options from the user into the complete - * set of options to create a file. - * @private - * @param {Object} o the options from the user. - * @return {Object} the complete set of options. - */ -var prepareFileAttrs = function(o) { - o = o || {}; - if (o.base64 === true && (o.binary === null || o.binary === undefined)) { - o.binary = true; - } - o = utils.extend(o, defaults); - o.date = o.date || new Date(); - if (o.compression !== null) o.compression = o.compression.toUpperCase(); - - return o; -}; - -/** - * Add a file in the current folder. - * @private - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file - * @param {Object} o the options of the file - * @return {Object} the new file. - */ -var fileAdd = function(name, data, o) { - // be sure sub folders exist - var dataType = utils.getTypeOf(data), - parent; - - o = prepareFileAttrs(o); - - if (typeof o.unixPermissions === "string") { - o.unixPermissions = parseInt(o.unixPermissions, 8); - } - - // UNX_IFDIR 0040000 see zipinfo.c - if (o.unixPermissions && (o.unixPermissions & 0x4000)) { - o.dir = true; - } - // Bit 4 Directory - if (o.dosPermissions && (o.dosPermissions & 0x0010)) { - o.dir = true; - } - - if (o.dir) { - name = forceTrailingSlash(name); - } - - if (o.createFolders && (parent = parentFolder(name))) { - folderAdd.call(this, parent, true); - } - - if (o.dir || data === null || typeof data === "undefined") { - o.base64 = false; - o.binary = false; - data = null; - dataType = null; - } - else if (dataType === "string") { - if (o.binary && !o.base64) { - // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask - if (o.optimizedBinaryString !== true) { - // this is a string, not in a base64 format. - // Be sure that this is a correct "binary string" - data = utils.string2binary(data); - } - } - } - else { // arraybuffer, uint8array, ... - o.base64 = false; - o.binary = true; - - if (!dataType && !(data instanceof CompressedObject)) { - throw new Error("The data of '" + name + "' is in an unsupported format !"); - } - - // special case : it's way easier to work with Uint8Array than with ArrayBuffer - if (dataType === "arraybuffer") { - data = utils.transformTo("uint8array", data); - } - } - - var object = new ZipObject(name, data, o); - this.files[name] = object; - return object; -}; - -/** - * Find the parent folder of the path. - * @private - * @param {string} path the path to use - * @return {string} the parent folder, or "" - */ -var parentFolder = function (path) { - if (path.slice(-1) == '/') { - path = path.substring(0, path.length - 1); - } - var lastSlash = path.lastIndexOf('/'); - return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; -}; - - -/** - * Returns the path with a slash at the end. - * @private - * @param {String} path the path to check. - * @return {String} the path with a trailing slash. - */ -var forceTrailingSlash = function(path) { - // Check the name ends with a / - if (path.slice(-1) != "/") { - path += "/"; // IE doesn't like substr(-1) - } - return path; -}; -/** - * Add a (sub) folder in the current folder. - * @private - * @param {string} name the folder's name - * @param {boolean=} [createFolders] If true, automatically create sub - * folders. Defaults to false. - * @return {Object} the new folder. - */ -var folderAdd = function(name, createFolders) { - createFolders = (typeof createFolders !== 'undefined') ? createFolders : false; - - name = forceTrailingSlash(name); - - // Does this folder already exist? - if (!this.files[name]) { - fileAdd.call(this, name, null, { - dir: true, - createFolders: createFolders - }); - } - return this.files[name]; -}; - -/** - * Generate a JSZip.CompressedObject for a given zipOject. - * @param {ZipObject} file the object to read. - * @param {JSZip.compression} compression the compression to use. - * @param {Object} compressionOptions the options to use when compressing. - * @return {JSZip.CompressedObject} the compressed res. - */ -var generateCompressedObjectFrom = function(file, compression, compressionOptions) { - var res = new CompressedObject(), - content; - - // the data has not been decompressed, we might reuse things ! - if (file._data instanceof CompressedObject) { - res.uncompressedSize = file._data.uncompressedSize; - res.crc32 = file._data.crc32; - - if (res.uncompressedSize === 0 || file.dir) { - compression = compressions['STORE']; - res.compressedContent = ""; - res.crc32 = 0; - } - else if (file._data.compressionMethod === compression.magic) { - res.compressedContent = file._data.getCompressedContent(); - } - else { - content = file._data.getContent(); - // need to decompress / recompress - res.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); - } - } - else { - // have uncompressed data - content = getBinaryData(file); - if (!content || content.length === 0 || file.dir) { - compression = compressions['STORE']; - content = ""; - } - res.uncompressedSize = content.length; - res.crc32 = crc32(content); - res.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); - } - - res.compressedSize = res.compressedContent.length; - res.compressionMethod = compression.magic; - - return res; -}; - - - - -/** - * Generate the UNIX part of the external file attributes. - * @param {Object} unixPermissions the unix permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : - * - * TTTTsstrwxrwxrwx0000000000ADVSHR - * ^^^^____________________________ file type, see zipinfo.c (UNX_*) - * ^^^_________________________ setuid, setgid, sticky - * ^^^^^^^^^________________ permissions - * ^^^^^^^^^^______ not used ? - * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only - */ -var generateUnixExternalFileAttr = function (unixPermissions, isDir) { - - var res = unixPermissions; - if (!unixPermissions) { - // I can't use octal values in strict mode, hence the hexa. - // 040775 => 0x41fd - // 0100664 => 0x81b4 - res = isDir ? 0x41fd : 0x81b4; - } - - return (res & 0xFFFF) << 16; -}; - -/** - * Generate the DOS part of the external file attributes. - * @param {Object} dosPermissions the dos permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * Bit 0 Read-Only - * Bit 1 Hidden - * Bit 2 System - * Bit 3 Volume Label - * Bit 4 Directory - * Bit 5 Archive - */ -var generateDosExternalFileAttr = function (dosPermissions, isDir) { - - // the dir flag is already set for compatibility - - return (dosPermissions || 0) & 0x3F; -}; - -/** - * Generate the various parts used in the construction of the final zip file. - * @param {string} name the file name. - * @param {ZipObject} file the file content. - * @param {JSZip.CompressedObject} compressedObject the compressed object. - * @param {number} offset the current offset from the start of the zip file. - * @param {String} platform let's pretend we are this platform (change platform dependents fields) - * @param {Function} encodeFileName the function to encode the file name / comment. - * @return {object} the zip parts. - */ -var generateZipParts = function(name, file, compressedObject, offset, platform, encodeFileName) { - var data = compressedObject.compressedContent, - useCustomEncoding = encodeFileName !== utf8.utf8encode, - encodedFileName = utils.transformTo("string", encodeFileName(file.name)), - utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), - comment = file.comment || "", - encodedComment = utils.transformTo("string", encodeFileName(comment)), - utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), - useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, - useUTF8ForComment = utfEncodedComment.length !== comment.length, - o = file.options, - dosTime, - dosDate, - extraFields = "", - unicodePathExtraField = "", - unicodeCommentExtraField = "", - dir, date; - - - // handle the deprecated options.dir - if (file._initialMetadata.dir !== file.dir) { - dir = file.dir; - } else { - dir = o.dir; - } - - // handle the deprecated options.date - if(file._initialMetadata.date !== file.date) { - date = file.date; - } else { - date = o.date; - } - - var extFileAttr = 0; - var versionMadeBy = 0; - if (dir) { - // dos or unix, we set the dos dir flag - extFileAttr |= 0x00010; - } - if(platform === "UNIX") { - versionMadeBy = 0x031E; // UNIX, version 3.0 - extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); - } else { // DOS or other, fallback to DOS - versionMadeBy = 0x0014; // DOS, version 2.0 - extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); - } - - // date - // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html - - dosTime = date.getHours(); - dosTime = dosTime << 6; - dosTime = dosTime | date.getMinutes(); - dosTime = dosTime << 5; - dosTime = dosTime | date.getSeconds() / 2; - - dosDate = date.getFullYear() - 1980; - dosDate = dosDate << 4; - dosDate = dosDate | (date.getMonth() + 1); - dosDate = dosDate << 5; - dosDate = dosDate | date.getDate(); - - if (useUTF8ForFileName) { - // set the unicode path extra field. unzip needs at least one extra - // field to correctly handle unicode path, so using the path is as good - // as any other information. This could improve the situation with - // other archive managers too. - // This field is usually used without the utf8 flag, with a non - // unicode path in the header (winrar, winzip). This helps (a bit) - // with the messy Windows' default compressed folders feature but - // breaks on p7zip which doesn't seek the unicode path extra field. - // So for now, UTF-8 everywhere ! - unicodePathExtraField = - // Version - decToHex(1, 1) + - // NameCRC32 - decToHex(crc32(encodedFileName), 4) + - // UnicodeName - utfEncodedFileName; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x70" + - // size - decToHex(unicodePathExtraField.length, 2) + - // content - unicodePathExtraField; - } - - if(useUTF8ForComment) { - - unicodeCommentExtraField = - // Version - decToHex(1, 1) + - // CommentCRC32 - decToHex(this.crc32(encodedComment), 4) + - // UnicodeName - utfEncodedComment; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x63" + - // size - decToHex(unicodeCommentExtraField.length, 2) + - // content - unicodeCommentExtraField; - } - - var header = ""; - - // version needed to extract - header += "\x0A\x00"; - // general purpose bit flag - // set bit 11 if utf8 - header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00"; - // compression method - header += compressedObject.compressionMethod; - // last mod file time - header += decToHex(dosTime, 2); - // last mod file date - header += decToHex(dosDate, 2); - // crc-32 - header += decToHex(compressedObject.crc32, 4); - // compressed size - header += decToHex(compressedObject.compressedSize, 4); - // uncompressed size - header += decToHex(compressedObject.uncompressedSize, 4); - // file name length - header += decToHex(encodedFileName.length, 2); - // extra field length - header += decToHex(extraFields.length, 2); - - - var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; - - var dirRecord = signature.CENTRAL_FILE_HEADER + - // version made by (00: DOS) - decToHex(versionMadeBy, 2) + - // file header (common to file and central directory) - header + - // file comment length - decToHex(encodedComment.length, 2) + - // disk number start - "\x00\x00" + - // internal file attributes TODO - "\x00\x00" + - // external file attributes - decToHex(extFileAttr, 4) + - // relative offset of local header - decToHex(offset, 4) + - // file name - encodedFileName + - // extra field - extraFields + - // file comment - encodedComment; - - return { - fileRecord: fileRecord, - dirRecord: dirRecord, - compressedObject: compressedObject - }; -}; - - -// return the actual prototype of JSZip -var out = { - /** - * Read an existing zip and merge the data in the current JSZip object. - * The implementation is in jszip-load.js, don't forget to include it. - * @param {String|ArrayBuffer|Uint8Array|Buffer} stream The stream to load - * @param {Object} options Options for loading the stream. - * options.base64 : is the stream in base64 ? default : false - * @return {JSZip} the current JSZip object - */ - load: function(stream, options) { - throw new Error("Load method is not defined. Is the file jszip-load.js included ?"); - }, - - /** - * Filter nested files/folders with the specified function. - * @param {Function} search the predicate to use : - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - * @return {Array} An array of matching elements. - */ - filter: function(search) { - var res = [], - filename, relativePath, file, fileClone; - for (filename in this.files) { - if (!this.files.hasOwnProperty(filename)) { - continue; - } - file = this.files[filename]; - // return a new object, don't let the user mess with our internal objects :) - fileClone = new ZipObject(file.name, file._data, utils.extend(file.options)); - relativePath = filename.slice(this.root.length, filename.length); - if (filename.slice(0, this.root.length) === this.root && // the file is in the current root - search(relativePath, fileClone)) { // and the file matches the function - res.push(fileClone); - } - } - return res; - }, - - /** - * Add a file to the zip file, or search a file. - * @param {string|RegExp} name The name of the file to add (if data is defined), - * the name of the file to find (if no data) or a regex to match files. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded - * @param {Object} o File options - * @return {JSZip|Object|Array} this JSZip object (when adding a file), - * a file (when searching by string) or an array of files (when searching by regex). - */ - file: function(name, data, o) { - if (arguments.length === 1) { - if (utils.isRegExp(name)) { - var regexp = name; - return this.filter(function(relativePath, file) { - return !file.dir && regexp.test(relativePath); - }); - } - else { // text - return this.filter(function(relativePath, file) { - return !file.dir && relativePath === name; - })[0] || null; - } - } - else { // more than one argument : we have data ! - name = this.root + name; - fileAdd.call(this, name, data, o); - } - return this; - }, - - /** - * Add a directory to the zip file, or search. - * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. - * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. - */ - folder: function(arg) { - if (!arg) { - return this; - } - - if (utils.isRegExp(arg)) { - return this.filter(function(relativePath, file) { - return file.dir && arg.test(relativePath); - }); - } - - // else, name is a new folder - var name = this.root + arg; - var newFolder = folderAdd.call(this, name); - - // Allow chaining by returning a new object with this folder as the root - var ret = this.clone(); - ret.root = newFolder.name; - return ret; - }, - - /** - * Delete a file, or a directory and all sub-files, from the zip - * @param {string} name the name of the file to delete - * @return {JSZip} this JSZip object - */ - remove: function(name) { - name = this.root + name; - var file = this.files[name]; - if (!file) { - // Look for any folders - if (name.slice(-1) != "/") { - name += "/"; - } - file = this.files[name]; - } - - if (file && !file.dir) { - // file - delete this.files[name]; - } else { - // maybe a folder, delete recursively - var kids = this.filter(function(relativePath, file) { - return file.name.slice(0, name.length) === name; - }); - for (var i = 0; i < kids.length; i++) { - delete this.files[kids[i].name]; - } - } - - return this; - }, - - /** - * Generate the complete zip file - * @param {Object} options the options to generate the zip file : - * - base64, (deprecated, use type instead) true to generate base64. - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file - */ - generate: function(options) { - options = utils.extend(options || {}, { - base64: true, - compression: "STORE", - compressionOptions : null, - type: "base64", - platform: "DOS", - comment: null, - mimeType: 'application/zip', - encodeFileName: utf8.utf8encode - }); - - utils.checkSupport(options.type); - - // accept nodejs `process.platform` - if( - options.platform === 'darwin' || - options.platform === 'freebsd' || - options.platform === 'linux' || - options.platform === 'sunos' - ) { - options.platform = "UNIX"; - } - if (options.platform === 'win32') { - options.platform = "DOS"; - } - - var zipData = [], - localDirLength = 0, - centralDirLength = 0, - writer, i, - encodedComment = utils.transformTo("string", options.encodeFileName(options.comment || this.comment || "")); - - // first, generate all the zip parts. - for (var name in this.files) { - if (!this.files.hasOwnProperty(name)) { - continue; - } - var file = this.files[name]; - - var compressionName = file.options.compression || options.compression.toUpperCase(); - var compression = compressions[compressionName]; - if (!compression) { - throw new Error(compressionName + " is not a valid compression method !"); - } - var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; - - var compressedObject = generateCompressedObjectFrom.call(this, file, compression, compressionOptions); - - var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength, options.platform, options.encodeFileName); - localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; - centralDirLength += zipPart.dirRecord.length; - zipData.push(zipPart); - } - - var dirEnd = ""; - - // end of central dir signature - dirEnd = signature.CENTRAL_DIRECTORY_END + - // number of this disk - "\x00\x00" + - // number of the disk with the start of the central directory - "\x00\x00" + - // total number of entries in the central directory on this disk - decToHex(zipData.length, 2) + - // total number of entries in the central directory - decToHex(zipData.length, 2) + - // size of the central directory 4 bytes - decToHex(centralDirLength, 4) + - // offset of start of central directory with respect to the starting disk number - decToHex(localDirLength, 4) + - // .ZIP file comment length - decToHex(encodedComment.length, 2) + - // .ZIP file comment - encodedComment; - - - // we have all the parts (and the total length) - // time to create a writer ! - var typeName = options.type.toLowerCase(); - if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { - writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); - }else{ - writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); - } - - for (i = 0; i < zipData.length; i++) { - writer.append(zipData[i].fileRecord); - writer.append(zipData[i].compressedObject.compressedContent); - } - for (i = 0; i < zipData.length; i++) { - writer.append(zipData[i].dirRecord); - } - - writer.append(dirEnd); - - var zip = writer.finalize(); - - - - switch(options.type.toLowerCase()) { - // case "zip is an Uint8Array" - case "uint8array" : - case "arraybuffer" : - case "nodebuffer" : - return utils.transformTo(options.type.toLowerCase(), zip); - case "blob" : - return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip), options.mimeType); - // case "zip is a string" - case "base64" : - return (options.base64) ? base64.encode(zip) : zip; - default : // case "string" : - return zip; - } - - }, - - /** - * @deprecated - * This method will be removed in a future version without replacement. - */ - crc32: function (input, crc) { - return crc32(input, crc); - }, - - /** - * @deprecated - * This method will be removed in a future version without replacement. - */ - utf8encode: function (string) { - return utils.transformTo("string", utf8.utf8encode(string)); - }, - - /** - * @deprecated - * This method will be removed in a future version without replacement. - */ - utf8decode: function (input) { - return utf8.utf8decode(input); - } -}; -module.exports = out; - -},{"./base64":2,"./compressedObject":3,"./compressions":4,"./crc32":5,"./defaults":7,"./nodeBuffer":12,"./signature":15,"./stringWriter":17,"./support":18,"./uint8ArrayWriter":20,"./utf8":21,"./utils":22}],15:[function(require,module,exports){ - -exports.LOCAL_FILE_HEADER = "PK\x03\x04"; -exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; -exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; -exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; -exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; -exports.DATA_DESCRIPTOR = "PK\x07\x08"; - -},{}],16:[function(require,module,exports){ - -var DataReader = require('./dataReader'); -var utils = require('./utils'); - -function StringReader(data, optimizedBinaryString) { - this.data = data; - if (!optimizedBinaryString) { - this.data = utils.string2binary(this.data); - } - this.length = this.data.length; - this.index = 0; - this.zero = 0; -} -StringReader.prototype = new DataReader(); -/** - * @see DataReader.byteAt - */ -StringReader.prototype.byteAt = function(i) { - return this.data.charCodeAt(this.zero + i); -}; -/** - * @see DataReader.lastIndexOfSignature - */ -StringReader.prototype.lastIndexOfSignature = function(sig) { - return this.data.lastIndexOf(sig) - this.zero; -}; -/** - * @see DataReader.readData - */ -StringReader.prototype.readData = function(size) { - this.checkOffset(size); - // this will work because the constructor applied the "& 0xff" mask. - var res = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return res; -}; -module.exports = StringReader; - -},{"./dataReader":6,"./utils":22}],17:[function(require,module,exports){ - - -var utils = require('./utils'); - -/** - * An object to write any content to a string. - * @constructor - */ -var StringWriter = function() { - this.data = []; -}; -StringWriter.prototype = { - /** - * Append any content to the current string. - * @param {Object} input the content to add. - */ - append: function(input) { - input = utils.transformTo("string", input); - this.data.push(input); - }, - /** - * Finalize the construction an return the res. - * @return {string} the generated string. - */ - finalize: function() { - return this.data.join(""); - } -}; - -module.exports = StringWriter; - -},{"./utils":22}],18:[function(require,module,exports){ -(function (Buffer){ - -exports.base64 = true; -exports.array = true; -exports.string = true; -exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; -// contains true if JSZip can read/generate nodejs Buffer, false otherwise. -// Browserify will provide a Buffer implementation for browsers, which is -// an augmented Uint8Array (i.e., can be used as either Buffer or U8). -exports.nodebuffer = typeof Buffer !== "undefined"; -// contains true if JSZip can read/generate Uint8Array, false otherwise. -exports.uint8array = typeof Uint8Array !== "undefined"; - -if (typeof ArrayBuffer === "undefined") { - exports.blob = false; -} -else { - var buffer = new ArrayBuffer(0); - try { - exports.blob = new Blob([buffer], { - type: "application/zip" - }).size === 0; - } - catch (e) { - try { - var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; - var builder = new Builder(); - builder.append(buffer); - exports.blob = builder.getBlob('application/zip').size === 0; - } - catch (e) { - exports.blob = false; - } - } -} - -}).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) -},{}],19:[function(require,module,exports){ - -var ArrayReader = require('./arrayReader'); - -function Uint8ArrayReader(data) { - if (data) { - this.data = data; - this.length = this.data.length; - this.index = 0; - this.zero = 0; - } -} -Uint8ArrayReader.prototype = new ArrayReader(); -/** - * @see DataReader.readData - */ -Uint8ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if(size === 0) { - // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. - return new Uint8Array(0); - } - var res = this.data.subarray(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return res; -}; -module.exports = Uint8ArrayReader; - -},{"./arrayReader":1}],20:[function(require,module,exports){ - - -var utils = require('./utils'); - -/** - * An object to write any content to an Uint8Array. - * @constructor - * @param {number} length The length of the array. - */ -var Uint8ArrayWriter = function(length) { - this.data = new Uint8Array(length); - this.index = 0; -}; -Uint8ArrayWriter.prototype = { - /** - * Append any content to the current array. - * @param {Object} input the content to add. - */ - append: function(input) { - if (input.length !== 0) { - // with an empty Uint8Array, Opera fails with a "Offset larger than array size" - input = utils.transformTo("uint8array", input); - this.data.set(input, this.index); - this.index += input.length; - } - }, - /** - * Finalize the construction an return the res. - * @return {Uint8Array} the generated array. - */ - finalize: function() { - return this.data; - } -}; - -module.exports = Uint8ArrayWriter; - -},{"./utils":22}],21:[function(require,module,exports){ - - -var utils = require('./utils'); -var support = require('./support'); -var nodeBuffer = require('./nodeBuffer'); - -/** - * The following functions come from pako, from pako/lib/utils/strings - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new Array(256); -for (var i=0; i<256; i++) { - _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); -} -_utf8len[254]=_utf8len[254]=1; // Invalid sequence start - -// convert string to array (typed, when possible) -var string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { - c2 = str.charCodeAt(m_pos+1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - if (support.uint8array) { - buf = new Uint8Array(buf_len); - } else { - buf = new Array(buf_len); - } - - // convert - for (i=0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { - c2 = str.charCodeAt(m_pos+1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -var utf8border = function(buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max-1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Fuckup - very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means vuffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -// convert array to string -var buf2string = function (buf) { - var str, i, out, c, c_len; - var len = buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len*2); - - for (out=0, i=0; i<len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - // shrinkBuf(utf16buf, out) - if (utf16buf.length !== out) { - if(utf16buf.subarray) { - utf16buf = utf16buf.subarray(0, out); - } else { - utf16buf.length = out; - } - } - - // return String.fromCharCode.apply(null, utf16buf); - return utils.applyFromCharCode(utf16buf); -}; - - -// That's all for the pako functions. - - -/** - * Transform a javascript string into an array (typed if possible) of bytes, - * UTF-8 encoded. - * @param {String} str the string to encode - * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. - */ -exports.utf8encode = function utf8encode(str) { - if (support.nodebuffer) { - return nodeBuffer(str, "utf-8"); - } - - return string2buf(str); -}; - - -/** - * Transform a bytes array (or a representation) representing an UTF-8 encoded - * string into a javascript string. - * @param {Array|Uint8Array|Buffer} buf the data de decode - * @return {String} the decoded string. - */ -exports.utf8decode = function utf8decode(buf) { - if (support.nodebuffer) { - return utils.transformTo("nodebuffer", buf).toString("utf-8"); - } - - buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); - - // return buf2string(buf); - // Chrome prefers to work with "small" chunks of data - // for the method buf2string. - // Firefox and Chrome has their own shortcut, IE doesn't seem to really care. - var res = [], k = 0, len = buf.length, chunk = 65536; - while (k < len) { - var nextBoundary = utf8border(buf, Math.min(k + chunk, len)); - if (support.uint8array) { - res.push(buf2string(buf.subarray(k, nextBoundary))); - } else { - res.push(buf2string(buf.slice(k, nextBoundary))); - } - k = nextBoundary; - } - return res.join(""); - -}; -// vim: set shiftwidth=4 softtabstop=4: - -},{"./nodeBuffer":12,"./support":18,"./utils":22}],22:[function(require,module,exports){ - -var support = require('./support'); -var compressions = require('./compressions'); -var nodeBuffer = require('./nodeBuffer'); -/** - * Convert a string to a "binary string" : a string containing only char codes between 0 and 255. - * @param {string} str the string to transform. - * @return {String} the binary string. - */ -exports.string2binary = function(str) { - var res = ""; - for (var i = 0; i < str.length; i++) { - res += String.fromCharCode(str.charCodeAt(i) & 0xff); - } - return res; -}; -exports.arrayBuffer2Blob = function(buffer, mimeType) { - exports.checkSupport("blob"); - mimeType = mimeType || 'application/zip'; - - try { - // Blob constructor - return new Blob([buffer], { - type: mimeType - }); - } - catch (e) { - - try { - // deprecated, browser only, old way - var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; - var builder = new Builder(); - builder.append(buffer); - return builder.getBlob(mimeType); - } - catch (e) { - - // well, fuck ?! - throw new Error("Bug : can't construct the Blob."); - } - } - - -}; -/** - * The identity function. - * @param {Object} input the input. - * @return {Object} the same input. - */ -function identity(input) { - return input; -} - -/** - * Fill in an array with a string. - * @param {String} str the string to use. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. - */ -function stringToArrayLike(str, array) { - for (var i = 0; i < str.length; ++i) { - array[i] = str.charCodeAt(i) & 0xFF; - } - return array; -} - -/** - * Transform an array-like object to a string. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the res. - */ -function arrayLikeToString(array) { - // Performances notes : - // -------------------- - // String.fromCharCode.apply(null, array) is the fastest, see - // see http://jsperf.com/converting-a-uint8array-to-a-string/2 - // but the stack is limited (and we can get huge arrays !). - // - // res += String.fromCharCode(array[i]); generate too many strings ! - // - // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 - var chunk = 65536; - var res = [], - len = array.length, - type = exports.getTypeOf(array), - k = 0, - canUseApply = true; - try { - switch(type) { - case "uint8array": - String.fromCharCode.apply(null, new Uint8Array(0)); - break; - case "nodebuffer": - String.fromCharCode.apply(null, nodeBuffer(0)); - break; - } - } catch(e) { - canUseApply = false; - } - - // no apply : slow and painful algorithm - // default browser on android 4.* - if (!canUseApply) { - var resStr = ""; - for(var i = 0; i < array.length;i++) { - resStr += String.fromCharCode(array[i]); - } - return resStr; - } - while (k < len && chunk > 1) { - try { - if (type === "array" || type === "nodebuffer") { - res.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); - } - else { - res.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); - } - k += chunk; - } - catch (e) { - chunk = Math.floor(chunk / 2); - } - } - return res.join(""); -} - -exports.applyFromCharCode = arrayLikeToString; - - -/** - * Copy the data from an array-like to an other array-like. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. - */ -function arrayLikeToArrayLike(arrayFrom, arrayTo) { - for (var i = 0; i < arrayFrom.length; i++) { - arrayTo[i] = arrayFrom[i]; - } - return arrayTo; -} - -// a matrix containing functions to transform everything into everything. -var transform = {}; - -// string to ? -transform["string"] = { - "string": identity, - "array": function(input) { - return stringToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return transform["string"]["uint8array"](input).buffer; - }, - "uint8array": function(input) { - return stringToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": function(input) { - return stringToArrayLike(input, nodeBuffer(input.length)); - } -}; - -// array to ? -transform["array"] = { - "string": arrayLikeToString, - "array": identity, - "arraybuffer": function(input) { - return (new Uint8Array(input)).buffer; - }, - "uint8array": function(input) { - return new Uint8Array(input); - }, - "nodebuffer": function(input) { - return nodeBuffer(input); - } -}; - -// arraybuffer to ? -transform["arraybuffer"] = { - "string": function(input) { - return arrayLikeToString(new Uint8Array(input)); - }, - "array": function(input) { - return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); - }, - "arraybuffer": identity, - "uint8array": function(input) { - return new Uint8Array(input); - }, - "nodebuffer": function(input) { - return nodeBuffer(new Uint8Array(input)); - } -}; - -// uint8array to ? -transform["uint8array"] = { - "string": arrayLikeToString, - "array": function(input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return input.buffer; - }, - "uint8array": identity, - "nodebuffer": function(input) { - return nodeBuffer(input); - } -}; - -// nodebuffer to ? -transform["nodebuffer"] = { - "string": arrayLikeToString, - "array": function(input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return transform["nodebuffer"]["uint8array"](input).buffer; - }, - "uint8array": function(input) { - return arrayLikeToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": identity -}; - -/** - * Transform an input into any type. - * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. - * If no output type is specified, the unmodified input will be returned. - * @param {String} outputType the output type. - * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. - * @throws {Error} an Error if the browser doesn't support the requested output type. - */ -exports.transformTo = function(outputType, input) { - if (!input) { - // undefined, null, etc - // an empty string won't harm. - input = ""; - } - if (!outputType) { - return input; - } - exports.checkSupport(outputType); - var inputType = exports.getTypeOf(input); - var res = transform[inputType][outputType](input); - return res; -}; - -/** - * Return the type of the input. - * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. - * @param {Object} input the input to identify. - * @return {String} the (lowercase) type of the input. - */ -exports.getTypeOf = function(input) { - if (typeof input === "string") { - return "string"; - } - if (Object.prototype.toString.call(input) === "[object Array]") { - return "array"; - } - if (support.nodebuffer && nodeBuffer.test(input)) { - return "nodebuffer"; - } - if (support.uint8array && input instanceof Uint8Array) { - return "uint8array"; - } - if (support.arraybuffer && input instanceof ArrayBuffer) { - return "arraybuffer"; - } -}; - -/** - * Throw an exception if the type is not supported. - * @param {String} type the type to check. - * @throws {Error} an Error if the browser doesn't support the requested type. - */ -exports.checkSupport = function(type) { - var supported = support[type.toLowerCase()]; - if (!supported) { - throw new Error(type + " is not supported by this browser"); - } -}; -exports.MAX_VALUE_16BITS = 65535; -exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 - -/** - * Prettify a string read as binary. - * @param {string} str the string to prettify. - * @return {string} a pretty string. - */ -exports.pretty = function(str) { - var res = '', - code, i; - for (i = 0; i < (str || "").length; i++) { - code = str.charCodeAt(i); - res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); - } - return res; -}; - -/** - * Find a compression registered in JSZip. - * @param {string} compressionMethod the method magic to find. - * @return {Object|null} the JSZip compression object, null if none found. - */ -exports.findCompression = function(compressionMethod) { - for (var method in compressions) { - if (!compressions.hasOwnProperty(method)) { - continue; - } - if (compressions[method].magic === compressionMethod) { - return compressions[method]; - } - } - return null; -}; -/** -* Cross-window, cross-Node-context regular expression detection -* @param {Object} object Anything -* @return {Boolean} true if the object is a regular expression, -* false otherwise -*/ -exports.isRegExp = function (object) { - return Object.prototype.toString.call(object) === "[object RegExp]"; -}; - -/** - * Merge the objects passed as parameters into a new one. - * @private - * @param {...Object} var_args All objects to merge. - * @return {Object} a new object with the data of the others. - */ -exports.extend = function() { - var res = {}, i, attr; - for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers - for (attr in arguments[i]) { - if (arguments[i].hasOwnProperty(attr) && typeof res[attr] === "undefined") { - res[attr] = arguments[i][attr]; - } - } - } - return res; -}; - - -},{"./compressions":4,"./nodeBuffer":12,"./support":18}],23:[function(require,module,exports){ - -var StringReader = require('./stringReader'); -var NodeBufferReader = require('./nodeBufferReader'); -var Uint8ArrayReader = require('./uint8ArrayReader'); -var ArrayReader = require('./arrayReader'); -var utils = require('./utils'); -var sig = require('./signature'); -var ZipEntry = require('./zipEntry'); -var support = require('./support'); -var jszipProto = require('./object'); -// class ZipEntries {{{ -/** - * All the entries in the zip file. - * @constructor - * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load. - * @param {Object} loadOptions Options for loading the stream. - */ -function ZipEntries(data, loadOptions) { - this.files = []; - this.loadOptions = loadOptions; - if (data) { - this.load(data); - } -} -ZipEntries.prototype = { - /** - * Check that the reader is on the speficied signature. - * @param {string} expectedSignature the expected signature. - * @throws {Error} if it is an other signature. - */ - checkSignature: function(expectedSignature) { - var signature = this.reader.readString(4); - if (signature !== expectedSignature) { - throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); - } - }, - /** - * Check if the given signature is at the given index. - * @param {number} askedIndex the index to check. - * @param {string} expectedSignature the signature to expect. - * @return {boolean} true if the signature is here, false otherwise. - */ - isSignature: function(askedIndex, expectedSignature) { - var currentIndex = this.reader.index; - this.reader.setIndex(askedIndex); - var signature = this.reader.readString(4); - var res = signature === expectedSignature; - this.reader.setIndex(currentIndex); - return res; - }, - /** - * Read the end of the central directory. - */ - readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2); - this.diskWithCentralDirStart = this.reader.readInt(2); - this.centralDirRecordsOnThisDisk = this.reader.readInt(2); - this.centralDirRecords = this.reader.readInt(2); - this.centralDirSize = this.reader.readInt(4); - this.centralDirOffset = this.reader.readInt(4); - - this.zipCommentLength = this.reader.readInt(2); - // warning : the encoding depends of the system locale - // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. - // On a windows machine, this field is encoded with the localized windows code page. - var zipComment = this.reader.readData(this.zipCommentLength); - var decodeParamType = support.uint8array ? "uint8array" : "array"; - // To get consistent behavior with the generation part, we will assume that - // this is utf8 encoded unless specified otherwise. - var decodeContent = utils.transformTo(decodeParamType, zipComment); - this.zipComment = this.loadOptions.decodeFileName(decodeContent); - }, - /** - * Read the end of the Zip 64 central directory. - * Not merged with the method readEndOfCentral : - * The end of central can coexist with its Zip64 brother, - * I don't want to read the wrong number of bytes ! - */ - readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8); - this.versionMadeBy = this.reader.readString(2); - this.versionNeeded = this.reader.readInt(2); - this.diskNumber = this.reader.readInt(4); - this.diskWithCentralDirStart = this.reader.readInt(4); - this.centralDirRecordsOnThisDisk = this.reader.readInt(8); - this.centralDirRecords = this.reader.readInt(8); - this.centralDirSize = this.reader.readInt(8); - this.centralDirOffset = this.reader.readInt(8); - - this.zip64ExtensibleData = {}; - var extraDataSize = this.zip64EndOfCentralSize - 44, - index = 0, - extraFieldId, - extraFieldLength, - extraFieldValue; - while (index < extraDataSize) { - extraFieldId = this.reader.readInt(2); - extraFieldLength = this.reader.readInt(4); - extraFieldValue = this.reader.readString(extraFieldLength); - this.zip64ExtensibleData[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - }, - /** - * Read the end of the Zip 64 central directory locator. - */ - readBlockZip64EndOfCentralLocator: function() { - this.diskWithZip64CentralDirStart = this.reader.readInt(4); - this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); - this.disksCount = this.reader.readInt(4); - if (this.disksCount > 1) { - throw new Error("Multi-volumes zip are not supported"); - } - }, - /** - * Read the local files, based on the offset read in the central part. - */ - readLocalFiles: function() { - var i, file; - for (i = 0; i < this.files.length; i++) { - file = this.files[i]; - this.reader.setIndex(file.localHeaderOffset); - this.checkSignature(sig.LOCAL_FILE_HEADER); - file.readLocalPart(this.reader); - file.handleUTF8(); - file.processAttributes(); - } - }, - /** - * Read the central directory. - */ - readCentralDir: function() { - var file; - - this.reader.setIndex(this.centralDirOffset); - while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) { - file = new ZipEntry({ - zip64: this.zip64 - }, this.loadOptions); - file.readCentralPart(this.reader); - this.files.push(file); - } - - if (this.centralDirRecords !== this.files.length) { - if (this.centralDirRecords !== 0 && this.files.length === 0) { - // We expected some records but couldn't find ANY. - // This is really suspicious, as if something went wrong. - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - } else { - // We found some records but not all. - // Something is wrong but we got something for the user: no error here. - // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); - } - } - }, - /** - * Read the end of central directory. - */ - readEndOfCentral: function() { - var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); - if (offset < 0) { - // Check if the content is a truncated zip or complete garbage. - // A "LOCAL_FILE_HEADER" is not required at the beginning (auto - // extractible zip for example) but it can give a good hint. - // If an ajax request was used without responseType, we will also - // get unreadable data. - var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); - - if (isGarbage) { - throw new Error("Can't find end of central directory : is this a zip file ? " + - "If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"); - } else { - throw new Error("Corrupted zip : can't find end of central directory"); - } - } - this.reader.setIndex(offset); - var endOfCentralDirOffset = offset; - this.checkSignature(sig.CENTRAL_DIRECTORY_END); - this.readBlockEndOfCentral(); - - - /* extract from the zip spec : - 4) If one of the fields in the end of central directory - record is too small to hold required data, the field - should be set to -1 (0xFFFF or 0xFFFFFFFF) and the - ZIP64 format record should be created. - 5) The end of central directory record and the - Zip64 end of central directory locator record must - reside on the same disk when splitting or spanning - an archive. - */ - if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { - this.zip64 = true; - - /* - Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from - the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents - all numbers as 64-bit double precision IEEE 754 floating point numbers. - So, we have 53bits for integers and bitwise operations treat everything as 32bits. - see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators - and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 - */ - - // should look for a zip64 EOCD locator - offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - if (offset < 0) { - throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); - } - this.reader.setIndex(offset); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - this.readBlockZip64EndOfCentralLocator(); - - // now the zip64 EOCD record - if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { - // console.warn("ZIP64 end of central directory not where expected."); - this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - if (this.relativeOffsetEndOfZip64CentralDir < 0) { - throw new Error("Corrupted zip : can't find the ZIP64 end of central directory"); - } - } - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - this.readBlockZip64EndOfCentral(); - } - - var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; - if (this.zip64) { - expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator - expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; - } - - var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; - - if (extraBytes > 0) { - // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); - if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { - // The offsets seem wrong, but we have something at the specified offset. - // So… we keep it. - } else { - // the offset is wrong, update the "zero" of the reader - // this happens if data has been prepended (crx files for example) - this.reader.zero = extraBytes; - } - } else if (extraBytes < 0) { - throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); - } - }, - prepareReader: function(data) { - var type = utils.getTypeOf(data); - utils.checkSupport(type); - if (type === "string" && !support.uint8array) { - this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString); - } - else if (type === "nodebuffer") { - this.reader = new NodeBufferReader(data); - } - else if (support.uint8array) { - this.reader = new Uint8ArrayReader(utils.transformTo("uint8array", data)); - } else if (support.array) { - this.reader = new ArrayReader(utils.transformTo("array", data)); - } else { - throw new Error("Unexpected error: unsupported type '" + type + "'"); - } - }, - /** - * Read a zip file and create ZipEntries. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. - */ - load: function(data) { - this.prepareReader(data); - this.readEndOfCentral(); - this.readCentralDir(); - this.readLocalFiles(); - } -}; -// }}} end of ZipEntries -module.exports = ZipEntries; - -},{"./arrayReader":1,"./nodeBufferReader":13,"./object":14,"./signature":15,"./stringReader":16,"./support":18,"./uint8ArrayReader":19,"./utils":22,"./zipEntry":24}],24:[function(require,module,exports){ - -var StringReader = require('./stringReader'); -var utils = require('./utils'); -var CompressedObject = require('./compressedObject'); -var jszipProto = require('./object'); -var support = require('./support'); - -var MADE_BY_DOS = 0x00; -var MADE_BY_UNIX = 0x03; - -// class ZipEntry {{{ -/** - * An entry in the zip file. - * @constructor - * @param {Object} options Options of the current file. - * @param {Object} loadOptions Options for loading the stream. - */ -function ZipEntry(options, loadOptions) { - this.options = options; - this.loadOptions = loadOptions; -} -ZipEntry.prototype = { - /** - * say if the file is encrypted. - * @return {boolean} true if the file is encrypted, false otherwise. - */ - isEncrypted: function() { - // bit 1 is set - return (this.bitFlag & 0x0001) === 0x0001; - }, - /** - * say if the file has utf-8 filename/comment. - * @return {boolean} true if the filename/comment is in utf-8, false otherwise. - */ - useUTF8: function() { - // bit 11 is set - return (this.bitFlag & 0x0800) === 0x0800; - }, - /** - * Prepare the function used to generate the compressed content from this ZipFile. - * @param {DataReader} reader the reader to use. - * @param {number} from the offset from where we should read the data. - * @param {number} length the length of the data to read. - * @return {Function} the callback to get the compressed content (the type depends of the DataReader class). - */ - prepareCompressedContent: function(reader, from, length) { - return function() { - var previousIndex = reader.index; - reader.setIndex(from); - var compressedFileData = reader.readData(length); - reader.setIndex(previousIndex); - - return compressedFileData; - }; - }, - /** - * Prepare the function used to generate the uncompressed content from this ZipFile. - * @param {DataReader} reader the reader to use. - * @param {number} from the offset from where we should read the data. - * @param {number} length the length of the data to read. - * @param {JSZip.compression} compression the compression used on this file. - * @param {number} uncompressedSize the uncompressed size to expect. - * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class). - */ - prepareContent: function(reader, from, length, compression, uncompressedSize) { - return function() { - - var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); - var uncompressedFileData = compression.uncompress(compressedFileData); - - if (uncompressedFileData.length !== uncompressedSize) { - throw new Error("Bug : uncompressed data size mismatch"); - } - - return uncompressedFileData; - }; - }, - /** - * Read the local part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readLocalPart: function(reader) { - var compression, localExtraFieldsLength; - - // we already know everything from the central dir ! - // If the central dir data are false, we are doomed. - // On the bright side, the local part is scary : zip64, data descriptors, both, etc. - // The less data we get here, the more reliable this should be. - // Let's skip the whole header and dash to the data ! - reader.skip(22); - // in some zip created on windows, the filename stored in the central dir contains \ instead of /. - // Strangely, the filename here is OK. - // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes - // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... - // Search "unzip mismatching "local" filename continuing with "central" filename version" on - // the internet. - // - // I think I see the logic here : the central directory is used to display - // content and the local directory is used to extract the files. Mixing / and \ - // may be used to display \ to windows users and use / when extracting the files. - // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 - this.fileNameLength = reader.readInt(2); - localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir - this.fileName = reader.readData(this.fileNameLength); - reader.skip(localExtraFieldsLength); - - if (this.compressedSize == -1 || this.uncompressedSize == -1) { - throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize == -1 || uncompressedSize == -1)"); - } - - compression = utils.findCompression(this.compressionMethod); - if (compression === null) { // no compression found - throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); - } - this.decompressed = new CompressedObject(); - this.decompressed.compressedSize = this.compressedSize; - this.decompressed.uncompressedSize = this.uncompressedSize; - this.decompressed.crc32 = this.crc32; - this.decompressed.compressionMethod = this.compressionMethod; - this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression); - this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize); - - // we need to compute the crc32... - if (this.loadOptions.checkCRC32) { - this.decompressed = utils.transformTo("string", this.decompressed.getContent()); - if (jszipProto.crc32(this.decompressed) !== this.crc32) { - throw new Error("Corrupted zip : CRC32 mismatch"); - } - } - }, - - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readCentralPart: function(reader) { - this.versionMadeBy = reader.readInt(2); - this.versionNeeded = reader.readInt(2); - this.bitFlag = reader.readInt(2); - this.compressionMethod = reader.readString(2); - this.date = reader.readDate(); - this.crc32 = reader.readInt(4); - this.compressedSize = reader.readInt(4); - this.uncompressedSize = reader.readInt(4); - this.fileNameLength = reader.readInt(2); - this.extraFieldsLength = reader.readInt(2); - this.fileCommentLength = reader.readInt(2); - this.diskNumberStart = reader.readInt(2); - this.internalFileAttributes = reader.readInt(2); - this.externalFileAttributes = reader.readInt(4); - this.localHeaderOffset = reader.readInt(4); - - if (this.isEncrypted()) { - throw new Error("Encrypted zip are not supported"); - } - - this.fileName = reader.readData(this.fileNameLength); - this.readExtraFields(reader); - this.parseZIP64ExtraField(reader); - this.fileComment = reader.readData(this.fileCommentLength); - }, - - /** - * Parse the external file attributes and get the unix/dos permissions. - */ - processAttributes: function () { - this.unixPermissions = null; - this.dosPermissions = null; - var madeBy = this.versionMadeBy >> 8; - - // Check if we have the DOS directory flag set. - // We look for it in the DOS and UNIX permissions - // but some unknown platform could set it as a compatibility flag. - this.dir = this.externalFileAttributes & 0x0010 ? true : false; - - if(madeBy === MADE_BY_DOS) { - // first 6 bits (0 to 5) - this.dosPermissions = this.externalFileAttributes & 0x3F; - } - - if(madeBy === MADE_BY_UNIX) { - this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; - // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); - } - - // fail safe : if the name ends with a / it probably means a folder - if (!this.dir && this.fileNameStr.slice(-1) === '/') { - this.dir = true; - } - }, - - /** - * Parse the ZIP64 extra field and merge the info in the current ZipEntry. - * @param {DataReader} reader the reader to use. - */ - parseZIP64ExtraField: function(reader) { - - if (!this.extraFields[0x0001]) { - return; - } - - // should be something, preparing the extra reader - var extraReader = new StringReader(this.extraFields[0x0001].value); - - // I really hope that these 64bits integer can fit in 32 bits integer, because js - // won't let us have more. - if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { - this.uncompressedSize = extraReader.readInt(8); - } - if (this.compressedSize === utils.MAX_VALUE_32BITS) { - this.compressedSize = extraReader.readInt(8); - } - if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { - this.localHeaderOffset = extraReader.readInt(8); - } - if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { - this.diskNumberStart = extraReader.readInt(4); - } - }, - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readExtraFields: function(reader) { - var start = reader.index, - extraFieldId, - extraFieldLength, - extraFieldValue; - - this.extraFields = this.extraFields || {}; - - while (reader.index < start + this.extraFieldsLength) { - extraFieldId = reader.readInt(2); - extraFieldLength = reader.readInt(2); - extraFieldValue = reader.readString(extraFieldLength); - - this.extraFields[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - }, - /** - * Apply an UTF8 transformation if needed. - */ - handleUTF8: function() { - var decodeParamType = support.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) { - this.fileNameStr = jszipProto.utf8decode(this.fileName); - this.fileCommentStr = jszipProto.utf8decode(this.fileComment); - } else { - var upath = this.findExtraFieldUnicodePath(); - if (upath !== null) { - this.fileNameStr = upath; - } else { - var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); - } - - var ucomment = this.findExtraFieldUnicodeComment(); - if (ucomment !== null) { - this.fileCommentStr = ucomment; - } else { - var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); - } - } - }, - - /** - * Find the unicode path declared in the extra field, if any. - * @return {String} the unicode path, null otherwise. - */ - findExtraFieldUnicodePath: function() { - var upathField = this.extraFields[0x7075]; - if (upathField) { - var extraReader = new StringReader(upathField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the filename changed, this field is out of date. - if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) { - return null; - } - - return jszipProto.utf8decode(extraReader.readString(upathField.length - 5)); - } - return null; - }, - - /** - * Find the unicode comment declared in the extra field, if any. - * @return {String} the unicode comment, null otherwise. - */ - findExtraFieldUnicodeComment: function() { - var ucommentField = this.extraFields[0x6375]; - if (ucommentField) { - var extraReader = new StringReader(ucommentField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the comment changed, this field is out of date. - if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) { - return null; - } - - return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5)); - } - return null; - } -}; -module.exports = ZipEntry; - -},{"./compressedObject":3,"./object":14,"./stringReader":16,"./support":18,"./utils":22}],25:[function(require,module,exports){ -// Top level file is just a mixin of submodules & constants - - -var assign = require('./lib/utils/common').assign; - -var deflate = require('./lib/deflate'); -var inflate = require('./lib/inflate'); -var constants = require('./lib/zlib/constants'); - -var pako = {}; - -assign(pako, deflate, inflate, constants); - -module.exports = pako; - -},{"./lib/deflate":26,"./lib/inflate":27,"./lib/utils/common":28,"./lib/zlib/constants":31}],26:[function(require,module,exports){ - - - -var zlib_deflate = require('./zlib/deflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); - -var toString = Object.prototype.toString; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - -var Z_NO_FLUSH = 0; -var Z_FINISH = 4; - -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_SYNC_FLUSH = 2; - -var Z_DEFAULT_COMPRESSION = -1; - -var Z_DEFAULT_STRATEGY = 0; - -var Z_DEFLATED = 8; - -/* ===========================================================================*/ - - -/** - * class Deflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[deflate]], - * [[deflateRaw]] and [[gzip]]. - **/ - -/* internal - * Deflate.chunks -> Array - * - * Chunks of output data, if [[Deflate#onData]] not overriden. - **/ - -/** - * Deflate.res -> Uint8Array|Array - * - * Compressed res, generated by default [[Deflate#onData]] - * and [[Deflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Deflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Deflate.err -> Number - * - * Error code after deflate finished. 0 (Z_OK) on success. - * You will not need it in real life, because deflate errors - * are possible only on wrong options or bad `onData` / `onEnd` - * custom handlers. - **/ - -/** - * Deflate.msg -> String - * - * Error message, if [[Deflate.err]] != 0 - **/ - - -/** - * new Deflate(options) - * - options (Object): zlib deflate options. - * - * Creates new deflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `level` - * - `windowBits` - * - `memLevel` - * - `strategy` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw deflate - * - `gzip` (Boolean) - create gzip wrapper - * - `to` (String) - if equal to 'string', then res will be "binary string" - * (each char code [0..255]) - * - `header` (Object) - custom header for gzip - * - `text` (Boolean) - true if compressed data believed to be text - * - `time` (Number) - modification time, unix timestamp - * - `os` (Number) - operation system code - * - `extra` (Array) - array of bytes with extra data (max 65536) - * - `name` (String) - file name (binary string) - * - `comment` (String) - comment (binary string) - * - `hcrc` (Boolean) - true if header crc should be added - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var deflate = new pako.Deflate({ level: 3}); - * - * deflate.push(chunk1, false); - * deflate.push(chunk2, true); // true -> last chunk - * - * if (deflate.err) { throw new Error(deflate.err); } - * - * console.log(deflate.res); - * ``` - **/ -function Deflate(options) { - if (!(this instanceof Deflate)) return new Deflate(options); - - this.options = utils.assign({ - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY, - to: '' - }, options || {}); - - var opt = this.options; - - if (opt.raw && (opt.windowBits > 0)) { - opt.windowBits = -opt.windowBits; - } - - else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { - opt.windowBits += 16; - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_deflate.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy - ); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - if (opt.header) { - zlib_deflate.deflateSetHeader(this.strm, opt.header); - } - - if (opt.dictionary) { - var dict; - // Convert data if needed - if (typeof opt.dictionary === 'string') { - // If we need to compress text, change encoding to utf8. - dict = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - - status = zlib_deflate.deflateSetDictionary(this.strm, dict); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - this._dict_set = true; - } -} - -/** - * Deflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be - * converted to utf8 byte sequence. - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. - * - * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with - * new compressed chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the compression context. - * - * On fail call [[Deflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * array format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Deflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var status, _mode; - - if (this.ended) { return false; } - - _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // If we need to compress text, change encoding to utf8. - strm.input = strings.string2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ - - if (status !== Z_STREAM_END && status !== Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { - if (this.options.to === 'string') { - this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); - - // Finalize on the last chunk. - if (_mode === Z_FINISH) { - status = zlib_deflate.deflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === Z_OK; - } - - // callback interim ress if Z_SYNC_FLUSH. - if (_mode === Z_SYNC_FLUSH) { - this.onEnd(Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Deflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): ouput data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Deflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Deflate#onEnd(status) -> Void - * - status (Number): deflate status. 0 (Z_OK) on success, - * other if not. - * - * Called once after you tell deflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `ress` / `err` properties. - **/ -Deflate.prototype.onEnd = function (status) { - // On success - join - if (status === Z_OK) { - if (this.options.to === 'string') { - this.res = this.chunks.join(''); - } else { - this.res = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * deflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * Compress `data` with deflate algorithm and `options`. - * - * Supported options are: - * - * - level - * - windowBits - * - memLevel - * - strategy - * - dictionary - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then res will be "binary string" - * (each char code [0..255]) - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); - * - * console.log(pako.deflate(data)); - * ``` - **/ -function deflate(input, options) { - var deflator = new Deflate(options); - - deflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (deflator.err) { throw deflator.msg; } - - return deflator.res; -} - - -/** - * deflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function deflateRaw(input, options) { - options = options || {}; - options.raw = true; - return deflate(input, options); -} - - -/** - * gzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but create gzip wrapper instead of - * deflate one. - **/ -function gzip(input, options) { - options = options || {}; - options.gzip = true; - return deflate(input, options); -} - - -exports.Deflate = Deflate; -exports.deflate = deflate; -exports.deflateRaw = deflateRaw; -exports.gzip = gzip; - -},{"./utils/common":28,"./utils/strings":29,"./zlib/deflate":33,"./zlib/messages":38,"./zlib/zstream":40}],27:[function(require,module,exports){ - - - -var zlib_inflate = require('./zlib/inflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var c = require('./zlib/constants'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); -var GZheader = require('./zlib/gzheader'); - -var toString = Object.prototype.toString; - -/** - * class Inflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[inflate]] - * and [[inflateRaw]]. - **/ - -/* internal - * inflate.chunks -> Array - * - * Chunks of output data, if [[Inflate#onData]] not overriden. - **/ - -/** - * Inflate.res -> Uint8Array|Array|String - * - * Uncompressed res, generated by default [[Inflate#onData]] - * and [[Inflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Inflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Inflate.err -> Number - * - * Error code after inflate finished. 0 (Z_OK) on success. - * Should be checked if broken data possible. - **/ - -/** - * Inflate.msg -> String - * - * Error message, if [[Inflate.err]] != 0 - **/ - - -/** - * new Inflate(options) - * - options (Object): zlib inflate options. - * - * Creates new inflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `windowBits` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw inflate - * - `to` (String) - if equal to 'string', then res will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * By default, when no options set, autodetect deflate/gzip data format via - * wrapper header. - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var inflate = new pako.Inflate({ level: 3}); - * - * inflate.push(chunk1, false); - * inflate.push(chunk2, true); // true -> last chunk - * - * if (inflate.err) { throw new Error(inflate.err); } - * - * console.log(inflate.res); - * ``` - **/ -function Inflate(options) { - if (!(this instanceof Inflate)) return new Inflate(options); - - this.options = utils.assign({ - chunkSize: 16384, - windowBits: 0, - to: '' - }, options || {}); - - var opt = this.options; - - // Force window size for `raw` data, if not set directly, - // because we have no header for autodetect. - if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { opt.windowBits = -15; } - } - - // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate - if ((opt.windowBits >= 0) && (opt.windowBits < 16) && - !(options && options.windowBits)) { - opt.windowBits += 32; - } - - // Gzip header has no info about windows size, we can do autodetect only - // for deflate. So, if window size not set, force it to max when gzip possible - if ((opt.windowBits > 15) && (opt.windowBits < 48)) { - // bit 3 (16) -> gzipped data - // bit 4 (32) -> autodetect gzip/deflate - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_inflate.inflateInit2( - this.strm, - opt.windowBits - ); - - if (status !== c.Z_OK) { - throw new Error(msg[status]); - } - - this.header = new GZheader(); - - zlib_inflate.inflateGetHeader(this.strm, this.header); -} - -/** - * Inflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. - * - * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with - * new output chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the decompression context. - * - * On fail call [[Inflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Inflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var dictionary = this.options.dictionary; - var status, _mode; - var next_out_utf8, tail, utf8str; - var dict; - - // Flag to properly process Z_BUF_ERROR on testing inflate call - // when we check that all output data was flushed. - var allowBufError = false; - - if (this.ended) { return false; } - _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // Only binary strings can be decompressed on practice - strm.input = strings.binstring2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - - status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ - - if (status === c.Z_NEED_DICT && dictionary) { - // Convert data if needed - if (typeof dictionary === 'string') { - dict = strings.string2buf(dictionary); - } else if (toString.call(dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(dictionary); - } else { - dict = dictionary; - } - - status = zlib_inflate.inflateSetDictionary(this.strm, dict); - - } - - if (status === c.Z_BUF_ERROR && allowBufError === true) { - status = c.Z_OK; - allowBufError = false; - } - - if (status !== c.Z_STREAM_END && status !== c.Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - - if (strm.next_out) { - if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { - - if (this.options.to === 'string') { - - next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - - tail = strm.next_out - next_out_utf8; - utf8str = strings.buf2string(strm.output, next_out_utf8); - - // move tail - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } - - this.onData(utf8str); - - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } - - // When no more input data, we should check that internal inflate buffers - // are flushed. The only way to do it when avail_out = 0 - run one more - // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. - // Here we set flag to process this error properly. - // - // NOTE. Deflate does not return error in this case and does not needs such - // logic. - if (strm.avail_in === 0 && strm.avail_out === 0) { - allowBufError = true; - } - - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); - - if (status === c.Z_STREAM_END) { - _mode = c.Z_FINISH; - } - - // Finalize on the last chunk. - if (_mode === c.Z_FINISH) { - status = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === c.Z_OK; - } - - // callback interim ress if Z_SYNC_FLUSH. - if (_mode === c.Z_SYNC_FLUSH) { - this.onEnd(c.Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Inflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): ouput data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Inflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Inflate#onEnd(status) -> Void - * - status (Number): inflate status. 0 (Z_OK) on success, - * other if not. - * - * Called either after you tell inflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `ress` / `err` properties. - **/ -Inflate.prototype.onEnd = function (status) { - // On success - join - if (status === c.Z_OK) { - if (this.options.to === 'string') { - // Glue & convert here, until we teach pako to send - // utf8 alligned strings to onData - this.res = this.chunks.join(''); - } else { - this.res = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * inflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Decompress `data` with inflate/ungzip and `options`. Autodetect - * format via wrapper header by default. That's why we don't provide - * separate `ungzip` method. - * - * Supported options are: - * - * - windowBits - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then res will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) - * , output; - * - * try { - * output = pako.inflate(input); - * } catch (err) - * console.log(err); - * } - * ``` - **/ -function inflate(input, options) { - var inflator = new Inflate(options); - - inflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (inflator.err) { throw inflator.msg; } - - return inflator.res; -} - - -/** - * inflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * The same as [[inflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function inflateRaw(input, options) { - options = options || {}; - options.raw = true; - return inflate(input, options); -} - - -/** - * ungzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Just shortcut to [[inflate]], because it autodetects format - * by header.content. Done for convenience. - **/ - - -exports.Inflate = Inflate; -exports.inflate = inflate; -exports.inflateRaw = inflateRaw; -exports.ungzip = inflate; - -},{"./utils/common":28,"./utils/strings":29,"./zlib/constants":31,"./zlib/gzheader":34,"./zlib/inflate":36,"./zlib/messages":38,"./zlib/zstream":40}],28:[function(require,module,exports){ - - - -var TYPED_OK = (typeof Uint8Array !== 'undefined') && - (typeof Uint16Array !== 'undefined') && - (typeof Int32Array !== 'undefined'); - - -exports.assign = function (obj /*from1, from2, from3, ...*/) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { continue; } - - if (typeof source !== 'object') { - throw new TypeError(source + 'must be non-object'); - } - - for (var p in source) { - if (source.hasOwnProperty(p)) { - obj[p] = source[p]; - } - } - } - - return obj; -}; - - -// reduce buffer size, avoiding mem copy -exports.shrinkBuf = function (buf, size) { - if (buf.length === size) { return buf; } - if (buf.subarray) { return buf.subarray(0, size); } - buf.length = size; - return buf; -}; - - -var fnTyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - if (src.subarray && dest.subarray) { - dest.set(src.subarray(src_offs, src_offs + len), dest_offs); - return; - } - // Fallback to ordinary array - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - var i, l, len, pos, chunk, res; - - // calculate data length - len = 0; - for (i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - - // join chunks - res = new Uint8Array(len); - pos = 0; - for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - res.set(chunk, pos); - pos += chunk.length; - } - - return res; - } -}; - -var fnUntyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - return [].concat.apply([], chunks); - } -}; - - -// Enable/Disable typed arrays use, for testing -// -exports.setTyped = function (on) { - if (on) { - exports.Buf8 = Uint8Array; - exports.Buf16 = Uint16Array; - exports.Buf32 = Int32Array; - exports.assign(exports, fnTyped); - } else { - exports.Buf8 = Array; - exports.Buf16 = Array; - exports.Buf32 = Array; - exports.assign(exports, fnUntyped); - } -}; - -exports.setTyped(TYPED_OK); - -},{}],29:[function(require,module,exports){ -// String encode/decode helpers - - - -var utils = require('./common'); - - -// Quick check if we can use fast array to bin string conversion -// -// - apply(Array) can fail on Android 2.2 -// - apply(Uint8Array) can fail on iOS 5.1 Safary -// -var STR_APPLY_OK = true; -var STR_APPLY_UIA_OK = true; - -try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } -try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } - - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new utils.Buf8(256); -for (var q = 0; q < 256; q++) { - _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); -} -_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - - -// convert string to array (typed, when possible) -exports.string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - buf = new utils.Buf8(buf_len); - - // convert - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Helper (used in 2 places) -function buf2binstring(buf, len) { - // use fallback for big arrays to avoid stack overflow - if (len < 65537) { - if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { - return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); - } - } - - var res = ''; - for (var i = 0; i < len; i++) { - res += String.fromCharCode(buf[i]); - } - return res; -} - - -// Convert byte array to binary string -exports.buf2binstring = function (buf) { - return buf2binstring(buf, buf.length); -}; - - -// Convert binary string (typed, when possible) -exports.binstring2buf = function (str) { - var buf = new utils.Buf8(str.length); - for (var i = 0, len = buf.length; i < len; i++) { - buf[i] = str.charCodeAt(i); - } - return buf; -}; - - -// convert array to string -exports.buf2string = function (buf, max) { - var i, out, c, c_len; - var len = max || buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len * 2); - - for (out = 0, i = 0; i < len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - return buf2binstring(utf16buf, out); -}; - - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -exports.utf8border = function (buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max - 1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Fuckup - very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means vuffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -},{"./common":28}],30:[function(require,module,exports){ - - -// Note: adler32 takes 12% for level 0 and 2% for level 6. -// It doesn't worth to make additional optimizationa as in original. -// Small size is preferable. - -function adler32(adler, buf, len, pos) { - var s1 = (adler & 0xffff) |0, - s2 = ((adler >>> 16) & 0xffff) |0, - n = 0; - - while (len !== 0) { - // Set limit ~ twice less than 5552, to keep - // s2 in 31-bits, because we force signed ints. - // in other case %= will fail. - n = len > 2000 ? 2000 : len; - len -= n; - - do { - s1 = (s1 + buf[pos++]) |0; - s2 = (s2 + s1) |0; - } while (--n); - - s1 %= 65521; - s2 %= 65521; - } - - return (s1 | (s2 << 16)) |0; -} - - -module.exports = adler32; - -},{}],31:[function(require,module,exports){ - - - -module.exports = { - - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - - - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type -}; - -},{}],32:[function(require,module,exports){ - - -// Note: we can't get significant speed boost here. -// So write code to minimize size - no pregenerated tables -// and array tools dependencies. - - -// Use ordinary array, since untyped makes no boost here -function makeTable() { - var c, table = []; - - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -var crcTable = makeTable(); - - -function crc32(crc, buf, len, pos) { - var t = crcTable, - end = pos + len; - - crc ^= -1; - - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - - -module.exports = crc32; - -},{}],33:[function(require,module,exports){ - - -var utils = require('../utils/common'); -var trees = require('./trees'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var msg = require('./messages'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -//var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -//var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -//var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - - -/* compression levels */ -//var Z_NO_COMPRESSION = 0; -//var Z_BEST_SPEED = 1; -//var Z_BEST_COMPRESSION = 9; -var Z_DEFAULT_COMPRESSION = -1; - - -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_RLE = 3; -var Z_FIXED = 4; -var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//var Z_BINARY = 0; -//var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - - -/* The deflate compression method */ -var Z_DEFLATED = 8; - -/*============================================================================*/ - - -var MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_MEM_LEVEL = 8; - - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -var LITERALS = 256; -/* number of literal bytes 0..255 */ -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -var D_CODES = 30; -/* number of distance codes */ -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var EXTRA_STATE = 69; -var NAME_STATE = 73; -var COMMENT_STATE = 91; -var HCRC_STATE = 103; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ -var BS_BLOCK_DONE = 2; /* block flush performed */ -var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ -var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - -var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - - -function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -} - - -function put_byte(s, b) { - s.pending_buf[s.pending++] = b; -} - - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s, b) { -// put_byte(s, (Byte)(b >> 8)); -// put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the res is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; -//#if MIN_MATCH != 3 -// Call update_hash() MIN_MATCH-3 more times -//#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ -// if (s.high_water < s.window_size) { -// var curr = s.strstart + s.lookahead; -// var init = 0; -// -// if (s.high_water < curr) { -// /* Previous high water mark below current data -- zero WIN_INIT -// * bytes or up to end of window, whichever is less. -// */ -// init = s.window_size - curr; -// if (init > WIN_INIT) -// init = WIN_INIT; -// zmemzero(s->window + curr, (unsigned)init); -// s->high_water = curr + init; -// } -// else if (s->high_water < (ulg)curr + WIN_INIT) { -// /* High water mark at or above current data, but below current data -// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up -// * to end of window, whichever is less. -// */ -// init = (ulg)curr + WIN_INIT - s->high_water; -// if (init > s->window_size - s->high_water) -// init = s->window_size - s->high_water; -// zmemzero(s->window + s->high_water, (unsigned)init); -// s->high_water += init; -// } -// } -// -// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, -// "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); -// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || -// s.block_start >= s.w_size)) { -// throw new Error("slide too late"); -// } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); -// if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - -//#if MIN_MATCH != 3 -// Call UPDATE_HASH() MIN_MATCH-3 more times -//#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} - -var configuration_table; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ -]; - - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - - -function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ -} - - -function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - - -function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - - -function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; -} - - -function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -} - - -function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - -//#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } -//#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; -} - - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} - - -exports.deflateInit = deflateInit; -exports.deflateInit2 = deflateInit2; -exports.deflateReset = deflateReset; -exports.deflateResetKeep = deflateResetKeep; -exports.deflateSetHeader = deflateSetHeader; -exports.deflate = deflate; -exports.deflateEnd = deflateEnd; -exports.deflateSetDictionary = deflateSetDictionary; -exports.deflateInfo = 'pako deflate (from Nodeca project)'; - -/* Not implemented -exports.deflateBound = deflateBound; -exports.deflateCopy = deflateCopy; -exports.deflateParams = deflateParams; -exports.deflatePending = deflatePending; -exports.deflatePrime = deflatePrime; -exports.deflateTune = deflateTune; -*/ - -},{"../utils/common":28,"./adler32":30,"./crc32":32,"./messages":38,"./trees":39}],34:[function(require,module,exports){ - - - -function GZheader() { - /* true if compressed data believed to be text */ - this.text = 0; - /* modification time */ - this.time = 0; - /* extra flags (not used when writing a gzip file) */ - this.xflags = 0; - /* operating system */ - this.os = 0; - /* pointer to extra field or Z_NULL if none */ - this.extra = null; - /* extra field length (valid if extra != Z_NULL) */ - this.extra_len = 0; // Actually, we don't need it in JS, - // but leave for few code modifications - - // - // Setup limits is not necessary because in js we should not preallocate memory - // for inflate use constant limit in 65536 bytes - // - - /* space at extra (only when reading header) */ - // this.extra_max = 0; - /* pointer to zero-terminated file name or Z_NULL */ - this.name = ''; - /* space at name (only when reading header) */ - // this.name_max = 0; - /* pointer to zero-terminated comment or Z_NULL */ - this.comment = ''; - /* space at comment (only when reading header) */ - // this.comm_max = 0; - /* true if there was or will be a header crc */ - this.hcrc = 0; - /* true when done reading gzip header (not used when writing a gzip file) */ - this.done = false; -} - -module.exports = GZheader; - -},{}],35:[function(require,module,exports){ - - -// See state defs from inflate.js -var BAD = 30; /* got a data error -- remain here until reset */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - -/* - Decode literal, length, and distance codes and write out the resing - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state.mode === LEN - strm.avail_in >= 6 - strm.avail_out >= 258 - start >= strm.avail_out - state.bits < 8 - - On return, state.mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm.avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm.avail_out >= 258 for each loop to avoid checking for - output space. - */ -module.exports = function inflate_fast(strm, start) { - var state; - var _in; /* local strm.input */ - var last; /* have enough input while in < last */ - var _out; /* local strm.output */ - var beg; /* inflate()'s initial strm.output */ - var end; /* while out < end, enough space available */ -//#ifdef INFLATE_STRICT - var dmax; /* maximum distance from zlib header */ -//#endif - var wsize; /* window size or zero if not using window */ - var whave; /* valid bytes in the window */ - var wnext; /* window write index */ - // Use `s_window` instead `window`, avoid conflict with instrumentation tools - var s_window; /* allocated sliding window, if wsize != 0 */ - var hold; /* local strm.hold */ - var bits; /* local strm.bits */ - var lcode; /* local strm.lencode */ - var dcode; /* local strm.distcode */ - var lmask; /* mask for first level of length codes */ - var dmask; /* mask for first level of distance codes */ - var here; /* retrieved table entry */ - var op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - var len; /* match length, unused bytes */ - var dist; /* match distance */ - var from; /* where to copy match from */ - var from_source; - - - var input, output; // JS specific, because we have no pointers - - /* copy state to local variables */ - state = strm.state; - //here = state.here; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); -//#ifdef INFLATE_STRICT - dmax = state.dmax; -//#endif - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - - here = lcode[hold & lmask]; - - dolen: - for (;;) { // Goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - if (op === 0) { /* literal */ - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - output[_out++] = here & 0xffff/*here.val*/; - } - else if (op & 16) { /* length base */ - len = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & ((1 << op) - 1); - hold >>>= op; - bits -= op; - } - //Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - - dodist: - for (;;) { // goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - - if (op & 16) { /* distance base */ - dist = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & ((1 << op) - 1); -//#ifdef INFLATE_STRICT - if (dist > dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } -//#endif - hold >>>= op; - bits -= op; - //Tracevv((stderr, "inflate: distance %u\n", dist)); - op = _out - beg; /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } - -// (!) This block is disabled in zlib defailts, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// if (len <= op - whave) { -// do { -// output[_out++] = 0; -// } while (--len); -// continue top; -// } -// len -= op - whave; -// do { -// output[_out++] = 0; -// } while (--op > whave); -// if (op === 0) { -// from = _out - dist; -// do { -// output[_out++] = output[from++]; -// } while (--len); -// continue top; -// } -//#endif - } - from = 0; // window index - from_source = s_window; - if (wnext === 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } - else { - from = _out - dist; /* copy direct from output */ - do { /* minimum length is three */ - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } - else if ((op & 64) === 0) { /* 2nd level distance code */ - here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dodist; - } - else { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } - else if ((op & 64) === 0) { /* 2nd level length code */ - here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dolen; - } - else if (op & 32) { /* end-of-block */ - //Tracevv((stderr, "inflate: end of block\n")); - state.mode = TYPE; - break top; - } - else { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } while (_in < last && _out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - - /* update state and return */ - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); - strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); - state.hold = hold; - state.bits = bits; - return; -}; - -},{}],36:[function(require,module,exports){ - - - -var utils = require('../utils/common'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var inflate_fast = require('./inffast'); -var inflate_table = require('./inftrees'); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -//var Z_NO_FLUSH = 0; -//var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -//var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - -/* The deflate compression method */ -var Z_DEFLATED = 8; - - -/* STATES ====================================================================*/ -/* ===========================================================================*/ - - -var HEAD = 1; /* i: waiting for magic header */ -var FLAGS = 2; /* i: waiting for method and flags (gzip) */ -var TIME = 3; /* i: waiting for modification time (gzip) */ -var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ -var EXLEN = 5; /* i: waiting for extra length (gzip) */ -var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ -var NAME = 7; /* i: waiting for end of file name (gzip) */ -var COMMENT = 8; /* i: waiting for end of comment (gzip) */ -var HCRC = 9; /* i: waiting for header crc (gzip) */ -var DICTID = 10; /* i: waiting for dictionary check value */ -var DICT = 11; /* waiting for inflateSetDictionary() call */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ -var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ -var STORED = 14; /* i: waiting for stored size (length and complement) */ -var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ -var COPY = 16; /* i/o: waiting for input or output to copy stored block */ -var TABLE = 17; /* i: waiting for dynamic block table lengths */ -var LENLENS = 18; /* i: waiting for code length code lengths */ -var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ -var LEN_ = 20; /* i: same as LEN below, but only first time in */ -var LEN = 21; /* i: waiting for length/lit/eob code */ -var LENEXT = 22; /* i: waiting for length extra bits */ -var DIST = 23; /* i: waiting for distance code */ -var DISTEXT = 24; /* i: waiting for distance extra bits */ -var MATCH = 25; /* o: waiting for output space to copy string */ -var LIT = 26; /* o: waiting for output space to write literal */ -var CHECK = 27; /* i: waiting for 32-bit check value */ -var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ -var DONE = 29; /* finished check, done -- remain here until reset */ -var BAD = 30; /* got a data error -- remain here until reset */ -var MEM = 31; /* got an inflate() memory error -- remain here until reset */ -var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - -/* ===========================================================================*/ - - - -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_WBITS = MAX_WBITS; - - -function zswap32(q) { - return (((q >>> 24) & 0xff) + - ((q >>> 8) & 0xff00) + - ((q & 0xff00) << 8) + - ((q & 0xff) << 24)); -} - - -function InflateState() { - this.mode = 0; /* current inflate mode */ - this.last = false; /* true if processing last block */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.havedict = false; /* true if dictionary provided */ - this.flags = 0; /* gzip header method and flags (0 if zlib) */ - this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ - this.check = 0; /* protected copy of check value */ - this.total = 0; /* protected copy of output count */ - // TODO: may be {} - this.head = null; /* where to save gzip header information */ - - /* sliding window */ - this.wbits = 0; /* log base 2 of requested window size */ - this.wsize = 0; /* window size or zero if not using window */ - this.whave = 0; /* valid bytes in the window */ - this.wnext = 0; /* window write index */ - this.window = null; /* allocated sliding window, if needed */ - - /* bit accumulator */ - this.hold = 0; /* input bit accumulator */ - this.bits = 0; /* number of bits in "in" */ - - /* for string and stored block copying */ - this.length = 0; /* literal or length of data to copy */ - this.offset = 0; /* distance back to copy string from */ - - /* for table and code decoding */ - this.extra = 0; /* extra bits needed */ - - /* fixed and dynamic code tables */ - this.lencode = null; /* starting table for length/literal codes */ - this.distcode = null; /* starting table for distance codes */ - this.lenbits = 0; /* index bits for lencode */ - this.distbits = 0; /* index bits for distcode */ - - /* dynamic table building */ - this.ncode = 0; /* number of code length code lengths */ - this.nlen = 0; /* number of length code lengths */ - this.ndist = 0; /* number of distance code lengths */ - this.have = 0; /* number of code lengths in lens[] */ - this.next = null; /* next available space in codes[] */ - - this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ - this.work = new utils.Buf16(288); /* work area for code table building */ - - /* - because we don't have pointers in js, we use lencode and distcode directly - as buffers so we don't need codes - */ - //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ - this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ - this.distdyn = null; /* dynamic table for distance codes (JS specific) */ - this.sane = 0; /* if false, allow invalid distance too far */ - this.back = 0; /* bits back of last unprocessed length/lit */ - this.was = 0; /* initial length of match */ -} - -function inflateResetKeep(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ''; /*Z_NULL*/ - if (state.wrap) { /* to support ill-conceived Java test suite */ - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null/*Z_NULL*/; - state.hold = 0; - state.bits = 0; - //state.lencode = state.distcode = state.next = state.codes; - state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); - state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); - - state.sane = 1; - state.back = -1; - //Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -function inflateReset(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - -} - -function inflateReset2(strm, windowBits) { - var wrap; - var state; - - /* get the state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - - /* update state and reset the rest of it */ - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); -} - -function inflateInit2(strm, windowBits) { - var ret; - var state; - - if (!strm) { return Z_STREAM_ERROR; } - //strm.msg = Z_NULL; /* in case we return an error */ - - state = new InflateState(); - - //if (state === Z_NULL) return Z_MEM_ERROR; - //Tracev((stderr, "inflate: allocated\n")); - strm.state = state; - state.window = null/*Z_NULL*/; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null/*Z_NULL*/; - } - return ret; -} - -function inflateInit(strm) { - return inflateInit2(strm, DEF_WBITS); -} - - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -var virgin = true; - -var lenfix, distfix; // We have no pointers in JS, so keep tables separate - -function fixedtables(state) { - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - var sym; - - lenfix = new utils.Buf32(512); - distfix = new utils.Buf32(32); - - /* literal/length table */ - sym = 0; - while (sym < 144) { state.lens[sym++] = 8; } - while (sym < 256) { state.lens[sym++] = 9; } - while (sym < 280) { state.lens[sym++] = 7; } - while (sym < 288) { state.lens[sym++] = 8; } - - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - - /* distance table */ - sym = 0; - while (sym < 32) { state.lens[sym++] = 5; } - - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - - /* do this just once */ - virgin = false; - } - - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; -} - - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -function updatewindow(strm, src, end, copy) { - var dist; - var state = strm.state; - - /* if it hasn't been done already, allocate space for the window */ - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - - state.window = new utils.Buf8(state.wsize); - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state.wsize) { - utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); - state.wnext = 0; - state.whave = state.wsize; - } - else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - //zmemcpy(state->window + state->wnext, end - copy, dist); - utils.arraySet(state.window, src, end - copy, dist, state.wnext); - copy -= dist; - if (copy) { - //zmemcpy(state->window, end - copy, copy); - utils.arraySet(state.window, src, end - copy, copy, 0); - state.wnext = copy; - state.whave = state.wsize; - } - else { - state.wnext += dist; - if (state.wnext === state.wsize) { state.wnext = 0; } - if (state.whave < state.wsize) { state.whave += dist; } - } - } - return 0; -} - -function inflate(strm, flush) { - var state; - var input, output; // input/output buffers - var next; /* next input INDEX */ - var put; /* next output INDEX */ - var have, left; /* available input and output */ - var hold; /* bit buffer */ - var bits; /* bits in bit buffer */ - var _in, _out; /* save starting available input and output */ - var copy; /* number of stored or match bytes to copy */ - var from; /* where to copy match bytes from */ - var from_source; - var here = 0; /* current decoding table entry */ - var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) - //var last; /* parent table entry */ - var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) - var len; /* length to copy for repeats, bits to drop */ - var ret; /* return code */ - var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ - var opts; - - var n; // temporary var for NEED_BITS - - var order = /* permutation of code lengths */ - [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - - - if (!strm || !strm.state || !strm.output || - (!strm.input && strm.avail_in !== 0)) { - return Z_STREAM_ERROR; - } - - state = strm.state; - if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ - - - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - _in = have; - _out = left; - ret = Z_OK; - - inf_leave: // goto emulation - for (;;) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - //=== NEEDBITS(16); - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ - state.check = 0/*crc32(0L, Z_NULL, 0)*/; - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = FLAGS; - break; - } - state.flags = 0; /* expect zlib header */ - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { - strm.msg = 'incorrect header check'; - state.mode = BAD; - break; - } - if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - len = (hold & 0x0f)/*BITS(4)*/ + 8; - if (state.wbits === 0) { - state.wbits = len; - } - else if (len > state.wbits) { - strm.msg = 'invalid window size'; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - //Tracev((stderr, "inflate: zlib header ok\n")); - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = hold & 0x200 ? DICTID : TYPE; - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - break; - case FLAGS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.flags = hold; - if ((state.flags & 0xff) !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - if (state.flags & 0xe000) { - strm.msg = 'unknown header flags set'; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = ((hold >> 8) & 1); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = TIME; - /* falls through */ - case TIME: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.time = hold; - } - if (state.flags & 0x0200) { - //=== CRC4(state.check, hold) - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - hbuf[2] = (hold >>> 16) & 0xff; - hbuf[3] = (hold >>> 24) & 0xff; - state.check = crc32(state.check, hbuf, 4, 0); - //=== - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = OS; - /* falls through */ - case OS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.xflags = (hold & 0xff); - state.head.os = (hold >> 8); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 0x0400) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - else if (state.head) { - state.head.extra = null/*Z_NULL*/; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 0x0400) { - copy = state.length; - if (copy > have) { copy = have; } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - // Use untyped array for more conveniend processing later - state.head.extra = new Array(state.head.extra_len); - } - utils.arraySet( - state.head.extra, - input, - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - copy, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - //zmemcpy(state.head.extra + len, next, - // len + copy > state.head.extra_max ? - // state.head.extra_max - len : copy); - } - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { break inf_leave; } - } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 0x0800) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - // TODO: 2 or 1 bytes? - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.name_max*/)) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 0x1000) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.comm_max*/)) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 0x0200) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.check & 0xffff)) { - strm.msg = 'header crc mismatch'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - if (state.head) { - state.head.hcrc = ((state.flags >> 9) & 1); - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - strm.adler = state.check = zswap32(hold); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - return Z_NEED_DICT; - } - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } - /* falls through */ - case TYPEDO: - if (state.last) { - //--- BYTEBITS() ---// - hold >>>= bits & 7; - bits -= bits & 7; - //---// - state.mode = CHECK; - break; - } - //=== NEEDBITS(3); */ - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.last = (hold & 0x01)/*BITS(1)*/; - //--- DROPBITS(1) ---// - hold >>>= 1; - bits -= 1; - //---// - - switch ((hold & 0x03)/*BITS(2)*/) { - case 0: /* stored block */ - //Tracev((stderr, "inflate: stored block%s\n", - // state.last ? " (last)" : "")); - state.mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - //Tracev((stderr, "inflate: fixed codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = LEN_; /* decode codes */ - if (flush === Z_TREES) { - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break inf_leave; - } - break; - case 2: /* dynamic block */ - //Tracev((stderr, "inflate: dynamic codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = TABLE; - break; - case 3: - strm.msg = 'invalid block type'; - state.mode = BAD; - } - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break; - case STORED: - //--- BYTEBITS() ---// /* go to byte boundary */ - hold >>>= bits & 7; - bits -= bits & 7; - //---// - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { - strm.msg = 'invalid stored block lengths'; - state.mode = BAD; - break; - } - state.length = hold & 0xffff; - //Tracev((stderr, "inflate: stored length %u\n", - // state.length)); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = COPY_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { copy = have; } - if (copy > left) { copy = left; } - if (copy === 0) { break inf_leave; } - //--- zmemcpy(put, next, copy); --- - utils.arraySet(output, input, next, copy, put); - //---// - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - //Tracev((stderr, "inflate: stored end\n")); - state.mode = TYPE; - break; - case TABLE: - //=== NEEDBITS(14); */ - while (bits < 14) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// -//#ifndef PKZIP_BUG_WORKAROUND - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = 'too many length or distance symbols'; - state.mode = BAD; - break; - } -//#endif - //Tracev((stderr, "inflate: table sizes ok\n")); - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - //=== NEEDBITS(3); - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - // We have separate tables & no pointers. 2 commented lines below not needed. - //state.next = state.codes; - //state.lencode = state.next; - // Switch to use dynamic table - state.lencode = state.lendyn; - state.lenbits = 7; - - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - - if (ret) { - strm.msg = 'invalid code lengths set'; - state.mode = BAD; - break; - } - //Tracev((stderr, "inflate: code lengths ok\n")); - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_val < 16) { - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.lens[state.have++] = here_val; - } - else { - if (here_val === 16) { - //=== NEEDBITS(here.bits + 2); - n = here_bits + 2; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - if (state.have === 0) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 0x03);//BITS(2); - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - } - else if (here_val === 17) { - //=== NEEDBITS(here.bits + 3); - n = here_bits + 3; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 3 + (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - else { - //=== NEEDBITS(here.bits + 7); - n = here_bits + 7; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 11 + (hold & 0x7f);//BITS(7); - //--- DROPBITS(7) ---// - hold >>>= 7; - bits -= 7; - //---// - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - - /* handle error breaks in while */ - if (state.mode === BAD) { break; } - - /* check for end-of-block code (better have one) */ - if (state.lens[256] === 0) { - strm.msg = 'invalid code -- missing end-of-block'; - state.mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state.lenbits = 9; - - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.lenbits = opts.bits; - // state.lencode = state.next; - - if (ret) { - strm.msg = 'invalid literal/lengths set'; - state.mode = BAD; - break; - } - - state.distbits = 6; - //state.distcode.copy(state.codes); - // Switch to use dynamic table - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.distbits = opts.bits; - // state.distcode = state.next; - - if (ret) { - strm.msg = 'invalid distances set'; - state.mode = BAD; - break; - } - //Tracev((stderr, 'inflate: codes ok\n')); - state.mode = LEN_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - inflate_fast(strm, _out); - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if (here_bits <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_op && (here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.lencode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - state.mode = LIT; - break; - } - if (here_op & 32) { - //Tracevv((stderr, "inflate: end of block\n")); - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //Tracevv((stderr, "inflate: length %u\n", state.length)); - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (;;) { - here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if ((here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.distcode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - if (here_op & 64) { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = (here_op) & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } -//#ifdef INFLATE_STRICT - if (state.offset > state.dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -//#endif - //Tracevv((stderr, "inflate: distance %u\n", state.offset)); - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) { break inf_leave; } - copy = _out - left; - if (state.offset > copy) { /* copy from window */ - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -// (!) This block is disabled in zlib defailts, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// Trace((stderr, "inflate.c too far\n")); -// copy -= state.whave; -// if (copy > state.length) { copy = state.length; } -// if (copy > left) { copy = left; } -// left -= copy; -// state.length -= copy; -// do { -// output[put++] = 0; -// } while (--copy); -// if (state.length === 0) { state.mode = LEN; } -// break; -//#endif - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } - else { - from = state.wnext - copy; - } - if (copy > state.length) { copy = state.length; } - from_source = state.window; - } - else { /* copy from output */ - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) { copy = left; } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { state.mode = LEN; } - break; - case LIT: - if (left === 0) { break inf_leave; } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - // Use '|' insdead of '+' to make sure that res is signed - hold |= input[next++] << bits; - bits += 8; - } - //===// - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = - /*UPDATE(state.check, put - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); - - } - _out = left; - // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = 'incorrect data check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: check matches trailer\n")); - } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.total & 0xffffffff)) { - strm.msg = 'incorrect length check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: length matches trailer\n")); - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; - } - } - - // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - - if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH))) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + - (state.mode === TYPE ? 128 : 0) + - (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; -} - -function inflateEnd(strm) { - - if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { - return Z_STREAM_ERROR; - } - - var state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; -} - -function inflateGetHeader(strm, head) { - var state; - - /* check state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } - - /* save header structure */ - state.head = head; - head.done = false; - return Z_OK; -} - -function inflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var state; - var dictid; - var ret; - - /* check state */ - if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } - state = strm.state; - - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - - /* check for correct dictionary identifier */ - if (state.mode === DICT) { - dictid = 1; /* adler32(0, null, 0)*/ - /* dictid = adler32(dictid, dictionary, dictLength); */ - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - // Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -exports.inflateReset = inflateReset; -exports.inflateReset2 = inflateReset2; -exports.inflateResetKeep = inflateResetKeep; -exports.inflateInit = inflateInit; -exports.inflateInit2 = inflateInit2; -exports.inflate = inflate; -exports.inflateEnd = inflateEnd; -exports.inflateGetHeader = inflateGetHeader; -exports.inflateSetDictionary = inflateSetDictionary; -exports.inflateInfo = 'pako inflate (from Nodeca project)'; - -/* Not implemented -exports.inflateCopy = inflateCopy; -exports.inflateGetDictionary = inflateGetDictionary; -exports.inflateMark = inflateMark; -exports.inflatePrime = inflatePrime; -exports.inflateSync = inflateSync; -exports.inflateSyncPoint = inflateSyncPoint; -exports.inflateUndermine = inflateUndermine; -*/ - -},{"../utils/common":28,"./adler32":30,"./crc32":32,"./inffast":35,"./inftrees":37}],37:[function(require,module,exports){ - - - -var utils = require('../utils/common'); - -var MAXBITS = 15; -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -var lbase = [ /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 -]; - -var lext = [ /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 -]; - -var dbase = [ /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0 -]; - -var dext = [ /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64 -]; - -module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) -{ - var bits = opts.bits; - //here = opts.here; /* table entry for duplication */ - - var len = 0; /* a code's length in bits */ - var sym = 0; /* index of code symbols */ - var min = 0, max = 0; /* minimum and maximum code lengths */ - var root = 0; /* number of index bits for root table */ - var curr = 0; /* number of index bits for current table */ - var drop = 0; /* code bits to drop for sub-table */ - var left = 0; /* number of prefix codes available */ - var used = 0; /* code entries in table used */ - var huff = 0; /* Huffman code */ - var incr; /* for incrementing code, index */ - var fill; /* index for replicating entries */ - var low; /* low bits for current root entry */ - var mask; /* mask for low root bits */ - var next; /* next available space in table */ - var base = null; /* base value table to use */ - var base_index = 0; -// var shoextra; /* extra bits table to use */ - var end; /* use base and extra for symbol > end */ - var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ - var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ - var extra = null; - var extra_index = 0; - - var here_bits, here_op, here_val; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - - /* bound code lengths, force root to be within code lengths */ - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { break; } - } - if (root > max) { - root = max; - } - if (max === 0) { /* no symbols to code at all */ - //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ - //table.bits[opts.table_index] = 1; //here.bits = (var char)1; - //table.val[opts.table_index++] = 0; //here.val = (var short)0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - - //table.op[opts.table_index] = 64; - //table.bits[opts.table_index] = 1; - //table.val[opts.table_index++] = 0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - opts.bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { break; } - } - if (root < min) { - root = min; - } - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } /* over-subscribed */ - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; /* incomplete set */ - } - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - // poor man optimization - use if-else instead of switch, - // to avoid deopts in old v8 - if (type === CODES) { - base = extra = work; /* dummy value--not used */ - end = 19; - - } else if (type === LENS) { - base = lbase; - base_index -= 257; - extra = lext; - extra_index -= 257; - end = 256; - - } else { /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize opts for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = table_index; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = -1; /* trigger new sub-table when len > root */ - used = 1 << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - var i = 0; - /* process all codes and make table entries */ - for (;;) { - i++; - /* create table entry */ - here_bits = len - drop; - if (work[sym] < end) { - here_op = 0; - here_val = work[sym]; - } - else if (work[sym] > end) { - here_op = extra[extra_index + work[sym]]; - here_val = base[base_index + work[sym]]; - } - else { - here_op = 32 + 64; /* end of block */ - here_val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1 << (len - drop); - fill = 1 << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; - } while (fill !== 0); - - /* backwards increment the len-bit code huff */ - incr = 1 << (len - 1); - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - - /* go to next symbol, update count, len */ - sym++; - if (--count[len] === 0) { - if (len === max) { break; } - len = lens[lens_index + work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) !== low) { - /* if first time, transition to sub-tables */ - if (drop === 0) { - drop = root; - } - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { break; } - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1 << curr; - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* point entry in root table to sub-table */ - low = huff & mask; - /*table.op[low] = curr; - table.bits[low] = root; - table.val[low] = next - opts.table_index;*/ - table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff !== 0) { - //table.op[next + huff] = 64; /* invalid code marker */ - //table.bits[next + huff] = len - drop; - //table.val[next + huff] = 0; - table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; - } - - /* set return parameters */ - //opts.table_index += used; - opts.bits = root; - return 0; -}; - -},{"../utils/common":28}],38:[function(require,module,exports){ - - -module.exports = { - 2: 'need dictionary', /* Z_NEED_DICT 2 */ - 1: 'stream end', /* Z_STREAM_END 1 */ - 0: '', /* Z_OK 0 */ - '-1': 'file error', /* Z_ERRNO (-1) */ - '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ - '-3': 'data error', /* Z_DATA_ERROR (-3) */ - '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ - '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ - '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ -}; - -},{}],39:[function(require,module,exports){ - - - -var utils = require('../utils/common'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -//var Z_FILTERED = 1; -//var Z_HUFFMAN_ONLY = 2; -//var Z_RLE = 3; -var Z_FIXED = 4; -//var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -var Z_BINARY = 0; -var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - -/*============================================================================*/ - - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - -// From zutil.h - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; -/* The three kinds of block type */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -var LITERALS = 256; -/* number of literal bytes 0..255 */ - -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -var D_CODES = 30; -/* number of distance codes */ - -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var Buf_size = 16; -/* size of bit buffer in bi_buf */ - - -/* =========================================================================== - * Constants - */ - -var MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -var END_BLOCK = 256; -/* end of block literal code */ - -var REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -var REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -var REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - -var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - -var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - -var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 -var static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -var static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -var _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -var base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -var base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - - -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; -} - - -var static_l_desc; -var static_d_desc; -var static_bl_desc; - - -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ -} - - - -function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s, w) { -// put_byte(s, (uch)((w) & 0xff)); -// put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - - -function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); -} - - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } -} - - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree, max_code, bl_count) -// ct_data *tree; /* the tree to decorate */ -// int max_code; /* largest code with non zero frequency */ -// ushf *bl_count; /* number of codes at each bit length */ -{ - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, - // "inconsistent bit counts"); - //Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); - - for (n = 0; n <= max_code; n++) { - var len = tree[n * 2 + 1]/*.Len*/; - if (len === 0) { continue; } - /* Now reverse the bits */ - tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len); - - //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", - // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); - } -} - - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -function tr_static_init() { - var n; /* iterates over tree elements */ - var bits; /* bit counter */ - var length; /* length value */ - var code; /* code value */ - var dist; /* distance index */ - var bl_count = new Array(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - // do check in _tr_init() - //if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ -/*#ifdef NO_INIT_GLOBAL_POINTERS - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; -#endif*/ - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; -} - - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s) -{ - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s, buf, len, header) -//DeflateState *s; -//charf *buf; /* the input data */ -//unsigned len; /* its length */ -//int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } -// while (len--) { -// put_byte(s, *buf++); -// } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s, tree, k) -// deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - - -// inlined manually -// var SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s, ltree, dtree) -// deflate_state *s; -// const ct_data *ltree; /* literal tree */ -// const ct_data *dtree; /* distance tree */ -{ - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s, lcodes, dcodes, blcodes) -// deflate_state *s; -// int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - - -var static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -function _tr_init(s) -{ - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - - -/* =========================================================================== - * Send a stored block - */ -function _tr_stored_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -function _tr_flush_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block, or NULL if too old */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -function _tr_tally(s, dist, lc) -// deflate_state *s; -// unsigned dist; /* distance of matched string */ -// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - -// (!) This block is disabled in zlib defailts, -// don't enable it for binary compatibility - -//#ifdef TRUNCATE_BLOCK -// /* Try to guess if it is profitable to stop the current block here */ -// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { -// /* Compute an upper bound for the compressed length */ -// out_length = s.last_lit*8; -// in_length = s.strstart - s.block_start; -// -// for (dcode = 0; dcode < D_CODES; dcode++) { -// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); -// } -// out_length >>>= 3; -// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", -// // s->last_lit, in_length, out_length, -// // 100L - out_length*100L/in_length)); -// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { -// return true; -// } -// } -//#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -exports._tr_init = _tr_init; -exports._tr_stored_block = _tr_stored_block; -exports._tr_flush_block = _tr_flush_block; -exports._tr_tally = _tr_tally; -exports._tr_align = _tr_align; - -},{"../utils/common":28}],40:[function(require,module,exports){ - - - -function ZStream() { - /* next input byte */ - this.input = null; // JS specific, because we have no pointers - this.next_in = 0; - /* number of bytes available at input */ - this.avail_in = 0; - /* total number of input bytes read so far */ - this.total_in = 0; - /* next output byte should be put there */ - this.output = null; // JS specific, because we have no pointers - this.next_out = 0; - /* remaining free space at output */ - this.avail_out = 0; - /* total number of bytes output so far */ - this.total_out = 0; - /* last error message, NULL if no error */ - this.msg = ''/*Z_NULL*/; - /* not visible by applications */ - this.state = null; - /* best guess about the data type: binary or text */ - this.data_type = 2/*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - this.adler = 0; -} - -module.exports = ZStream; - -},{}]},{},[10])(10) -}); -} - - -//templater -//this is the build version: https://github.com/open-xml-templating/docxtemplater-build -//v3.0.8 (22.03.2017) -//https://github.com/open-xml-templating/docxtemplater -//Generate docx and pptx (microsoft word documents) from templates -/*The MIT License - -Copyright (c) 2013 Edgar HIPP - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -function initTemplater() -{ - initJsZip(); - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Docxtemplater = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ - - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var memoize = require("./memoize"); -var DOMParser = require("xmldom").DOMParser; -var XMLSerializer = require("xmldom").XMLSerializer; -var Errors = require("./errors"); - -var DocUtils = {}; - -function parser(tag) { - return _defineProperty({}, "get", function get(scope) { - if (tag === ".") { - return scope; - } - return scope[tag]; - }); -} - -DocUtils.defaults = { - nullGetter: function nullGetter(part) { - if (!part.module) { - return "undefined"; - } - if (part.module === "rawxml") { - return ""; - } - return ""; - }, - - parser: memoize(parser), - delimiters: { - start: "{", - end: "}" - } -}; - -DocUtils.mergeObjects = function () { - var resObj = {}; - var obj = void 0, - keys = void 0; - for (var i = 0; i < arguments.length; i += 1) { - obj = arguments[i]; - keys = Object.keys(obj); - for (var j = 0; j < keys.length; j += 1) { - resObj[keys[j]] = obj[keys[j]]; - } - } - return resObj; -}; - -DocUtils.xml2str = function (xmlNode) { - var a = new XMLSerializer(); - return a.serializeToString(xmlNode); -}; - -DocUtils.decodeUtf8 = function (s) { - try { - if (s === undefined) { - return undefined; - } - // replace Ascii 160 space by the normal space, Ascii 32 - return decodeURIComponent(escape(DocUtils.convertSpaces(s))); - } catch (e) { - var err = new Error("End"); - err.properties.data = s; - err.properties.explanation = "Could not decode string to UTF8"; - throw err; - } -}; - -DocUtils.encodeUtf8 = function (s) { - return unescape(encodeURIComponent(s)); -}; - -DocUtils.str2xml = function (str, errorHandler) { - var parser = new DOMParser({ errorHandler: errorHandler }); - return parser.parseFromString(str, "text/xml"); -}; - -DocUtils.charMap = { - "&": "&", - "'": "'", - "<": "<", - ">": ">" -}; - -var regexStripRegexp = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; -DocUtils.escapeRegExp = function (str) { - return str.replace(regexStripRegexp, "\\$&"); -}; - -DocUtils.charMapRegexes = Object.keys(DocUtils.charMap).map(function (endChar) { - var startChar = DocUtils.charMap[endChar]; - return { - rstart: new RegExp(DocUtils.escapeRegExp(startChar), "g"), - rend: new RegExp(DocUtils.escapeRegExp(endChar), "g"), - start: startChar, - end: endChar - }; -}); - -DocUtils.wordToUtf8 = function (string) { - var r = void 0; - for (var i = 0, l = DocUtils.charMapRegexes.length; i < l; i++) { - r = DocUtils.charMapRegexes[i]; - string = string.replace(r.rstart, r.end); - } - return string; -}; - -DocUtils.utf8ToWord = function (string) { - if (typeof string !== "string") { - string = string.toString(); - } - var r = void 0; - for (var i = 0, l = DocUtils.charMapRegexes.length; i < l; i++) { - r = DocUtils.charMapRegexes[i]; - string = string.replace(r.rend, r.start); - } - return string; -}; - -DocUtils.cloneDeep = function (obj) { - return JSON.parse(JSON.stringify(obj)); -}; - -DocUtils.concatArrays = function (arrays) { - return arrays.reduce(function (res, array) { - Array.prototype.push.apply(res, array); - return res; - }, []); -}; - -var spaceRegexp = new RegExp(String.fromCharCode(160), "g"); -DocUtils.convertSpaces = function (s) { - return s.replace(spaceRegexp, " "); -}; - -DocUtils.pregMatchAll = function (regex, content) { - /* regex is a string, content is the content. It returns an array of all matches with their offset, for example: - regex=la - content=lolalolilala - returns: [{array: {0: 'la'},offset: 2},{array: {0: 'la'},offset: 8},{array: {0: 'la'} ,offset: 10}] - */ - var matchArray = []; - var match = void 0; - while ((match = regex.exec(content)) != null) { - matchArray.push({ array: match, offset: match.index }); - } - return matchArray; -}; - -DocUtils.sizeOfObject = function (obj) { - return Object.keys(obj).length; -}; - -function throwXmlTagNotFound(options) { - var err = new Errors.XTTemplateError("No tag '" + options.element + "' was found at the " + options.position); - err.properties = { - id: "no_xml_tag_found_at_" + options.position, - explanation: "No tag '" + options.element + "' was found at the " + options.position, - parsed: options.parsed, - index: options.index, - element: options.element - }; - throw err; -} - -DocUtils.getRight = function (parsed, element, index) { - for (var i = index, l = parsed.length; i < l; i++) { - var part = parsed[i]; - if (part.value === "</" + element + ">") { - return i; - } - } - throwXmlTagNotFound({ position: "right", element: element, parsed: parsed, index: index }); -}; - -DocUtils.getLeft = function (parsed, element, index) { - for (var i = index; i >= 0; i--) { - var part = parsed[i]; - if (part.value.indexOf("<" + element) === 0 && [">", " "].indexOf(part.value[element.length + 1]) !== -1) { - return i; - } - } - throwXmlTagNotFound({ position: "left", element: element, parsed: parsed, index: index }); -}; - -module.exports = DocUtils; -},{"./errors":2,"./memoize":5,"xmldom":19}],2:[function(require,module,exports){ - - -function XTError(message) { - this.name = "GenericError"; - this.message = message; - this.stack = new Error(message).stack; -} -XTError.prototype = Error.prototype; - -function XTTemplateError(message) { - this.name = "TemplateError"; - this.message = message; - this.stack = new Error(message).stack; -} -XTTemplateError.prototype = new XTError(); - -function XTScopeParserError(message) { - this.name = "ScopeParserError"; - this.message = message; - this.stack = new Error(message).stack; -} -XTScopeParserError.prototype = new XTError(); - -function XTInternalError(message) { - this.name = "InternalError"; - this.properties = { explanation: "InternalError" }; - this.message = message; - this.stack = new Error(message).stack; -} -XTInternalError.prototype = new XTError(); - -module.exports = { - XTError: XTError, - XTTemplateError: XTTemplateError, - XTInternalError: XTInternalError, - XTScopeParserError: XTScopeParserError -}; -},{}],3:[function(require,module,exports){ - - -var loopModule = require("./modules/loop"); -var spacePreserveModule = require("./modules/space-preserve"); -var rawXmlModule = require("./modules/rawxml"); -var expandPairTrait = require("./modules/expand-pair-trait"); -var render = require("./modules/render"); - -var PptXFileTypeConfig = { - getTemplatedFiles: function getTemplatedFiles(zip) { - var slideTemplates = zip.file(/ppt\/(slides|slideMasters)\/(slide|slideMaster)\d+\.xml/).map(function (file) { - return file.name; - }); - return slideTemplates.concat(["ppt/presentation.xml"]); - }, - - textPath: "ppt/slides/slide1.xml", - tagsXmlTextArray: ["a:t", "m:t"], - tagsXmlLexedArray: ["p:sp", "a:tc", "a:tr", "a:table", "a:p", "a:r"], - tagRawXml: "p:sp", - tagTextXml: "a:t", - baseModules: [render, expandPairTrait, rawXmlModule, loopModule] -}; - -var DocXFileTypeConfig = { - getTemplatedFiles: function getTemplatedFiles(zip) { - var slideTemplates = zip.file(/word\/(header|footer)\d+\.xml/).map(function (file) { - return file.name; - }); - return slideTemplates.concat(["word/document.xml"]); - }, - - textPath: "word/document.xml", - tagsXmlTextArray: ["w:t", "m:t"], - tagsXmlLexedArray: ["w:tc", "w:tr", "w:table", "w:p", "w:r"], - tagRawXml: "w:p", - tagTextXml: "w:t", - baseModules: [render, spacePreserveModule, expandPairTrait, rawXmlModule, loopModule] -}; - -module.exports = { - docx: DocXFileTypeConfig, - pptx: PptXFileTypeConfig -}; -},{"./modules/expand-pair-trait":8,"./modules/loop":9,"./modules/rawxml":10,"./modules/render":11,"./modules/space-preserve":12}],4:[function(require,module,exports){ - - -var Errors = require("./errors"); -var DocUtils = require("./doc-utils"); - -function inRange(range, match) { - return range[0] <= match.offset && match.offset < range[1]; -} - -function updateInTextTag(part, inTextTag) { - if (part.type === "tag" && part.position === "start" && part.text) { - if (inTextTag) { - throw new Error("Malformed xml : Already in text tag"); - } - return true; - } - if (part.type === "tag" && part.position === "end" && part.text) { - if (!inTextTag) { - throw new Error("Malformed xml : Already not in text tag"); - } - return false; - } - return inTextTag; -} - -function offsetSort(a, b) { - return a.offset - b.offset; -} - -function getTag(tag) { - var start = 1; - if (tag[1] === "/") { - start = 2; - } - var index = tag.indexOf(" "); - var end = index === -1 ? tag.length - 1 : index; - return { - tag: tag.slice(start, end), - position: start === 1 ? "start" : "end" - }; -} - -function tagMatcher(content, textMatchArray, othersMatchArray) { - var cursor = 0; - var contentLength = content.length; - var allMatches = DocUtils.concatArrays([textMatchArray.map(function (tag) { - return { tag: tag, text: true }; - }), othersMatchArray.map(function (tag) { - return { tag: tag, text: false }; - })]).reduce(function (allMatches, t) { - allMatches[t.tag] = t.text; - return allMatches; - }, {}); - var totalMatches = []; - - while (cursor < contentLength) { - cursor = content.indexOf("<", cursor); - if (cursor === -1) { - break; - } - var offset = cursor; - cursor = content.indexOf(">", cursor); - var tagText = content.slice(offset, cursor + 1); - - var _getTag = getTag(tagText), - tag = _getTag.tag, - position = _getTag.position; - - var text = allMatches[tag]; - if (text == null) { - continue; - } - totalMatches.push({ type: "tag", position: position, text: text, offset: offset, value: tagText }); - } - - return totalMatches; -} - -function throwUnopenedTagException(options) { - var err = new Errors.XTTemplateError("Unopened tag"); - err.properties = { - xtag: options.xtag.split(" ")[0], - id: "unopened_tag", - context: options.xtag, - explanation: "The tag beginning with '" + options.xtag.substr(0, 10) + "' is unclosed" - }; - throw err; -} - -function throwUnclosedTagException(options) { - var err = new Errors.XTTemplateError("Unclosed tag"); - err.properties = { - xtag: options.xtag.split(" ")[0].substr(1), - id: "unclosed_tag", - context: options.xtag, - explanation: "The tag beginning with '" + options.xtag.substr(0, 10) + "' is unclosed" - }; - throw err; -} - -function assertDelimiterOrdered(delimiterMatches, fullText) { - var inDelimiter = false; - var lastDelimiterMatch = { offset: 0 }; - var xtag = void 0; - delimiterMatches.forEach(function (delimiterMatch) { - xtag = fullText.substr(lastDelimiterMatch.offset, delimiterMatch.offset - lastDelimiterMatch.offset); - if (delimiterMatch.position === "start" && inDelimiter || delimiterMatch.position === "end" && !inDelimiter) { - if (delimiterMatch.position === "start") { - throwUnclosedTagException({ xtag: xtag }); - } else { - throwUnopenedTagException({ xtag: xtag }); - } - } - inDelimiter = !inDelimiter; - lastDelimiterMatch = delimiterMatch; - }); - var delimiterMatch = { offset: fullText.length }; - xtag = fullText.substr(lastDelimiterMatch.offset, delimiterMatch.offset - lastDelimiterMatch.offset); - if (inDelimiter) { - throwUnclosedTagException({ xtag: xtag }); - } -} - -function getAllIndexes(arr, val, position) { - var indexes = []; - var offset = -1; - do { - offset = arr.indexOf(val, offset + 1); - if (offset !== -1) { - indexes.push({ offset: offset, position: position }); - } - } while (offset !== -1); - return indexes; -} - -function Reader(innerContentParts) { - var _this = this; - - this.innerContentParts = innerContentParts; - this.full = ""; - this.parseDelimiters = function (delimiters) { - _this.full = _this.innerContentParts.join(""); - var offset = 0; - _this.ranges = _this.innerContentParts.map(function (part) { - offset += part.length; - return offset - part.length; - }); - - var delimiterMatches = DocUtils.concatArrays([getAllIndexes(_this.full, delimiters.start, "start"), getAllIndexes(_this.full, delimiters.end, "end")]).sort(offsetSort); - assertDelimiterOrdered(delimiterMatches, _this.full); - var delimiterLength = { start: delimiters.start.length, end: delimiters.end.length }; - var cutNext = 0; - var delimiterIndex = 0; - - _this.parsed = _this.ranges.map(function (offset, i) { - var range = [offset, offset + this.innerContentParts[i].length]; - var partContent = this.innerContentParts[i]; - var delimitersInOffset = []; - while (delimiterIndex < delimiterMatches.length && inRange(range, delimiterMatches[delimiterIndex])) { - delimitersInOffset.push(delimiterMatches[delimiterIndex]); - delimiterIndex++; - } - var parts = []; - var cursor = 0; - if (cutNext > 0) { - cursor = cutNext; - cutNext = 0; - } - delimitersInOffset.forEach(function (delimiterInOffset) { - var value = partContent.substr(cursor, delimiterInOffset.offset - offset - cursor); - if (value.length > 0) { - parts.push({ type: "content", value: value }); - } - parts.push({ type: "delimiter", position: delimiterInOffset.position }); - cursor = delimiterInOffset.offset - offset + delimiterLength[delimiterInOffset.position]; - }); - cutNext = cursor - partContent.length; - var value = partContent.substr(cursor); - if (value.length > 0) { - parts.push({ type: "content", value: value }); - } - return parts; - }, _this); - }; -} - -module.exports = { - parse: function parse(xmlparsed, delimiters) { - var inTextTag = false; - var innerContentParts = []; - xmlparsed.forEach(function (part) { - inTextTag = updateInTextTag(part, inTextTag); - if (inTextTag && part.type === "content") { - innerContentParts.push(part.value); - } - }); - var reader = new Reader(innerContentParts); - reader.parseDelimiters(delimiters); - - var newArray = []; - var index = 0; - xmlparsed.forEach(function (part) { - inTextTag = updateInTextTag(part, inTextTag); - if (part.type === "content") { - part.position = inTextTag ? "insidetag" : "outsidetag"; - } - if (inTextTag && part.type === "content") { - Array.prototype.push.apply(newArray, reader.parsed[index].map(function (p) { - if (p.type === "content") { - p.position = "insidetag"; - } - return p; - })); - index++; - } else { - newArray.push(part); - } - }); - return newArray; - }, - xmlparse: function xmlparse(content, xmltags) { - var matches = tagMatcher(content, xmltags.text, xmltags.other); - var cursor = 0; - var parsed = matches.reduce(function (parsed, match) { - var value = content.substr(cursor, match.offset - cursor); - if (value.length > 0) { - parsed.push({ type: "content", value: value }); - } - cursor = match.offset + match.value.length; - delete match.offset; - if (match.value.length > 0) { - parsed.push(match); - } - return parsed; - }, []); - var value = content.substr(cursor); - if (value.length > 0) { - parsed.push({ type: "content", value: value }); - } - return parsed; - } -}; -},{"./doc-utils":1,"./errors":2}],5:[function(require,module,exports){ - - -function memoize(func) { - var stringifyJson = JSON.stringify, - cache = {}; - function cachedfun() { - var hash = stringifyJson(arguments); - return hash in cache ? cache[hash] : cache[hash] = func.apply(this, arguments); - } - return cachedfun; -} - -module.exports = memoize; -},{}],6:[function(require,module,exports){ - - -function getMinFromArrays(arrays, state) { - var minIndex = -1; - for (var i = 0, l = arrays.length; i < l; i++) { - if (state[i] >= arrays[i].length) { - continue; - } - if (minIndex === -1 || arrays[i][state[i]].offset < arrays[minIndex][state[minIndex]].offset) { - minIndex = i; - } - } - if (minIndex === -1) { - throw new Error("minIndex negative"); - } - return minIndex; -} - -module.exports = function (arrays) { - var totalLength = arrays.reduce(function (sum, array) { - return sum + array.length; - }, 0); - arrays = arrays.filter(function (array) { - return array.length > 0; - }); - - var resArray = new Array(totalLength); - - var state = arrays.map(function () { - return 0; - }); - - var i = 0; - - while (i <= totalLength - 1) { - var arrayIndex = getMinFromArrays(arrays, state); - resArray[i] = arrays[arrayIndex][state[arrayIndex]]; - state[arrayIndex]++; - i++; - } - - return resArray; -}; -},{}],7:[function(require,module,exports){ - - -function emptyFun() {} -function identity(i) { - return i; -} -module.exports = function (module) { - var defaults = { - set: emptyFun, - parse: emptyFun, - render: emptyFun, - getTraits: emptyFun, - optionsTransformer: identity, - getRenderedMap: identity, - postparse: identity - }; - if (Object.keys(defaults).every(function (key) { - return !module[key]; - })) { - throw new Error("This module cannot be wrapped, because it doesn't define any of the necessary functions"); - } - Object.keys(defaults).forEach(function (key) { - module[key] = module[key] || defaults[key]; - }); - return module; -}; -},{}],8:[function(require,module,exports){ - - -var traitName = "expandPair"; -var mergeSort = require("../mergesort"); -var DocUtils = require("../doc-utils"); -var wrapper = require("../module-wrapper"); - -var _require = require("../traits"), - getExpandToDefault = _require.getExpandToDefault; - -var Errors = require("../errors"); - -function throwUnmatchedLoopException(options) { - var location = options.location; - var t = location === "start" ? "unclosed" : "unopened"; - var T = location === "start" ? "Unclosed" : "Unopened"; - - var err = new Errors.XTTemplateError(T + " loop"); - var tag = options.part.value; - err.properties = { - id: t + "_loop", - explanation: "The loop with tag " + tag + " is " + t, - xtag: tag - }; - throw err; -} - -function throwClosingTagNotMatchOpeningTag(options) { - var tags = options.tags; - - var err = new Errors.XTTemplateError("Closing tag does not match opening tag"); - err.properties = { - id: "closing_tag_does_not_match_opening_tag", - explanation: "The tag \"" + tags[0].value + "\" is closed by the tag \"" + tags[1].value + "\"", - openingtag: tags[0].value, - closingtag: tags[1].value - }; - throw err; -} - -function getOpenCountChange(part) { - switch (part.location) { - case "start": - return 1; - case "end": - return -1; - default: - throw new Error("Location should be one of 'start' or 'end' (given : " + part.location + ")"); - - } -} - -function getPairs(traits) { - if (traits.length === 0) { - return []; - } - var countOpen = 1; - var firstTrait = traits[0]; - for (var i = 1; i < traits.length; i++) { - var currentTrait = traits[i]; - countOpen += getOpenCountChange(currentTrait.part); - if (countOpen === 0) { - if (currentTrait.part.value !== firstTrait.part.value && currentTrait.part.value !== "") { - throwClosingTagNotMatchOpeningTag({ tags: [firstTrait.part, currentTrait.part] }); - } - var outer = getPairs(traits.slice(i + 1)); - return [[firstTrait, currentTrait]].concat(outer); - } - } - var part = firstTrait.part; - throwUnmatchedLoopException({ part: part, location: part.location }); -} - -var expandPairTrait = { - name: "ExpandPairTrait", - postparse: function postparse(parsed, _ref) { - var getTraits = _ref.getTraits, - _postparse = _ref.postparse; - - var traits = getTraits(traitName, parsed); - traits = traits.map(function (trait) { - return trait || []; - }); - traits = mergeSort(traits); - var pairs = getPairs(traits); - var expandedPairs = pairs.map(function (pair) { - var expandTo = pair[0].part.expandTo; - if (expandTo === "auto") { - expandTo = getExpandToDefault(parsed.slice(pair[0].offset, pair[1].offset)); - } - if (!expandTo) { - return [pair[0].offset, pair[1].offset]; - } - var left = DocUtils.getLeft(parsed, expandTo, pair[0].offset); - var right = DocUtils.getRight(parsed, expandTo, pair[1].offset); - return [left, right]; - }); - - var currentPairIndex = 0; - var innerParts = void 0; - return parsed.reduce(function (newParsed, part, i) { - var inPair = currentPairIndex < pairs.length && expandedPairs[currentPairIndex][0] <= i; - var pair = pairs[currentPairIndex]; - var expandedPair = expandedPairs[currentPairIndex]; - if (!inPair) { - newParsed.push(part); - return newParsed; - } - if (expandedPair[0] === i) { - innerParts = []; - } - if (pair[0].offset !== i && pair[1].offset !== i) { - innerParts.push(part); - } - if (expandedPair[1] === i) { - var basePart = parsed[pair[0].offset]; - delete basePart.location; - delete basePart.expandTo; - basePart.subparsed = _postparse(innerParts); - newParsed.push(basePart); - currentPairIndex++; - } - return newParsed; - }, []); - } -}; - -module.exports = function () { - return wrapper(expandPairTrait); -}; -},{"../doc-utils":1,"../errors":2,"../mergesort":6,"../module-wrapper":7,"../traits":16}],9:[function(require,module,exports){ - - -var DocUtils = require("../doc-utils"); -var dashInnerRegex = /^-([^\s]+)\s(.+)$/; -var wrapper = require("../module-wrapper"); - -var moduleName = "loop"; - -var loopModule = { - name: "LoopModule", - parse: function parse(placeHolderContent) { - var module = moduleName; - var type = "placeholder"; - if (placeHolderContent[0] === "#") { - return { type: type, value: placeHolderContent.substr(1), expandTo: "auto", module: module, location: "start", inverted: false }; - } - if (placeHolderContent[0] === "^") { - return { type: type, value: placeHolderContent.substr(1), expandTo: "auto", module: module, location: "start", inverted: true }; - } - if (placeHolderContent[0] === "/") { - return { type: type, value: placeHolderContent.substr(1), module: module, location: "end" }; - } - if (placeHolderContent[0] === "-") { - var value = placeHolderContent.replace(dashInnerRegex, "$2"); - var expandTo = placeHolderContent.replace(dashInnerRegex, "$1"); - return { type: type, value: value, expandTo: expandTo, module: module, location: "start", inverted: false }; - } - return null; - }, - getTraits: function getTraits(traitName, parsed) { - if (traitName !== "expandPair") { - return; - } - - return parsed.reduce(function (tags, part, offset) { - if (part.type === "placeholder" && part.module === moduleName) { - tags.push({ part: part, offset: offset }); - } - return tags; - }, []); - }, - render: function render(part, options) { - if (!part.type === "placeholder" || part.module !== moduleName) { - return null; - } - var totalValue = []; - function loopOver(scope) { - var scopeManager = options.scopeManager.createSubScopeManager(scope, part.value); - totalValue.push(options.render(DocUtils.mergeObjects({}, options, { - compiled: part.subparsed, - tags: {}, - scopeManager: scopeManager - }))); - } - options.scopeManager.loopOver(part.value, loopOver, part.inverted); - return { value: totalValue.join("") }; - } -}; - -module.exports = function () { - return wrapper(loopModule); -}; -},{"../doc-utils":1,"../module-wrapper":7}],10:[function(require,module,exports){ - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var DocUtils = require("../doc-utils"); -var Errors = require("../errors"); - -var moduleName = "rawxml"; -var wrapper = require("../module-wrapper"); - -function throwRawTagShouldBeOnlyTextInParagraph(options) { - var err = new Errors.XTTemplateError("Raw tag should be the only text in paragraph"); - var tag = options.part.value; - err.properties = { - id: "raw_xml_tag_should_be_only_text_in_paragraph", - explanation: "The tag " + tag, - xtag: options.part.value, - paragraphParts: options.paragraphParts - }; - throw err; -} - -function getInner(_ref) { - var part = _ref.part, - left = _ref.left, - right = _ref.right, - postparsed = _ref.postparsed, - index = _ref.index; - - var paragraphParts = postparsed.slice(left + 1, right); - paragraphParts.forEach(function (p, i) { - if (i === index - left - 1) { - return; - } - if (p.type === "placeholder" || p.type === "content" && p.position === "insidetag") { - throwRawTagShouldBeOnlyTextInParagraph({ paragraphParts: paragraphParts, part: part }); - } - }); - return part; -} - -var RawXmlModule = function () { - function RawXmlModule() { - _classCallCheck(this, RawXmlModule); - - this.name = "RawXmlModule"; - } - - _createClass(RawXmlModule, [{ - key: "optionsTransformer", - value: function optionsTransformer(options, docxtemplater) { - this.fileTypeConfig = docxtemplater.fileTypeConfig; - return options; - } - }, { - key: "parse", - value: function parse(placeHolderContent) { - var type = "placeholder"; - if (placeHolderContent[0] !== "@") { - return null; - } - return { type: type, value: placeHolderContent.substr(1), module: moduleName }; - } - }, { - key: "postparse", - value: function postparse(parsed) { - return DocUtils.traits.expandToOne(parsed, { moduleName: moduleName, getInner: getInner, expandTo: this.fileTypeConfig.tagRawXml }); - } - }, { - key: "render", - value: function render(part, options) { - if (part.module !== moduleName) { - return null; - } - var value = options.scopeManager.getValue(part.value); - if (value == null) { - value = options.nullGetter(part); - } - return { value: value }; - } - }]); - - return RawXmlModule; -}(); - -module.exports = function () { - return wrapper(new RawXmlModule()); -}; -},{"../doc-utils":1,"../errors":2,"../module-wrapper":7}],11:[function(require,module,exports){ - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var wrapper = require("../module-wrapper"); - -var Render = function () { - function Render() { - _classCallCheck(this, Render); - - this.name = "Render"; - } - - _createClass(Render, [{ - key: "set", - value: function set(obj) { - if (obj.compiled) { - this.compiled = obj.compiled; - } - if (obj.data != null) { - this.data = obj.data; - } - } - }, { - key: "getRenderedMap", - value: function getRenderedMap(mapper) { - var _this = this; - - return Object.keys(this.compiled).reduce(function (mapper, from) { - mapper[from] = { from: from, data: _this.data }; - return mapper; - }, mapper); - } - }]); - - return Render; -}(); - -module.exports = function () { - return wrapper(new Render()); -}; -},{"../module-wrapper":7}],12:[function(require,module,exports){ - - -var wrapper = require("../module-wrapper"); -var spacePreserve = { - name: "SpacePreserveModule", - postparse: function postparse(parsed) { - var chunk = []; - var inChunk = false; - var res = parsed.reduce(function (parsed, part) { - if (part.type === "tag" && part.position === "start" && part.text && part.value === "<w:t>") { - inChunk = true; - } - if (inChunk) { - if (part.type === "placeholder" && !part.module) { - chunk[0].value = '<w:t xml:space="preserve">'; - } - chunk.push(part); - } else { - parsed.push(part); - } - if (part.type === "tag" && part.position === "end" && part.text && part.value === "</w:t>") { - Array.prototype.push.apply(parsed, chunk); - inChunk = false; - chunk = []; - } - return parsed; - }, []); - Array.prototype.push.apply(res, chunk); - return res; - } -}; -module.exports = function () { - return wrapper(spacePreserve); -}; -},{"../module-wrapper":7}],13:[function(require,module,exports){ - - -var DocUtils = require("./doc-utils"); - -var parser = { - postparse: function postparse(parsed, modules) { - function getTraits(traitName, parsed) { - return modules.map(function (module) { - return module.getTraits(traitName, parsed); - }); - } - function postparse(parsed) { - return modules.reduce(function (parsed, module) { - return module.postparse(parsed, { postparse: postparse, getTraits: getTraits }); - }, parsed); - } - return postparse(parsed); - }, - parse: function parse(lexed, modules) { - function moduleParse(placeHolderContent, parsed) { - var moduleParsed = void 0; - for (var i = 0, l = modules.length; i < l; i++) { - var _module = modules[i]; - moduleParsed = _module.parse(placeHolderContent); - if (moduleParsed) { - parsed.push(moduleParsed); - return moduleParsed; - } - } - return null; - } - - var inPlaceHolder = false; - var placeHolderContent = void 0; - var tailParts = []; - return lexed.reduce(function (parsed, token) { - if (token.type === "delimiter") { - inPlaceHolder = token.position === "start"; - if (token.position === "end") { - placeHolderContent = DocUtils.wordToUtf8(placeHolderContent); - if (!moduleParse(placeHolderContent, parsed)) { - parsed.push({ type: "placeholder", value: placeHolderContent }); - } - Array.prototype.push.apply(parsed, tailParts); - tailParts = []; - return parsed; - } - placeHolderContent = ""; - return parsed; - } - if (inPlaceHolder) { - if (token.type === "content" && token.position === "insidetag") { - placeHolderContent += token.value; - } else { - tailParts.push(token); - } - return parsed; - } - parsed.push(token); - return parsed; - }, []); - } -}; - -module.exports = parser; -},{"./doc-utils":1}],14:[function(require,module,exports){ - - -var ScopeManager = require("./scope-manager"); -var DocUtils = require("./doc-utils"); - -function moduleRender(part, options) { - var moduleRendered = void 0; - for (var i = 0, l = options.modules.length; i < l; i++) { - var _module = options.modules[i]; - moduleRendered = _module.render(part, options); - if (moduleRendered) { - return moduleRendered; - } - } - return false; -} - -function render(options) { - options.render = render; - options.modules = options.modules; - if (!options.scopeManager) { - options.scopeManager = ScopeManager.createBaseScopeManager(options); - } - return options.compiled.map(function (part) { - var moduleRendered = moduleRender(part, options); - if (moduleRendered) { - return moduleRendered.value; - } - if (part.type === "placeholder") { - var value = options.scopeManager.getValue(part.value); - if (value == null) { - value = options.nullGetter(part); - } - return DocUtils.utf8ToWord(value); - } - if (part.type === "content" || part.type === "tag") { - return part.value; - } - throw new Error("Unimplemented tag type \"" + part.type + "\""); - }).join(""); -} - -module.exports = render; -},{"./doc-utils":1,"./scope-manager":15}],15:[function(require,module,exports){ - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Errors = require("./errors"); - -// This class responsibility is to manage the scope -var ScopeManager = function () { - function ScopeManager(options) { - _classCallCheck(this, ScopeManager); - - this.scopePath = options.scopePath; - this.scopeList = options.scopeList; - this.parser = options.parser; - } - - _createClass(ScopeManager, [{ - key: "loopOver", - value: function loopOver(tag, callback, inverted) { - inverted = inverted || false; - return this.loopOverValue(this.getValue(tag), callback, inverted); - } - }, { - key: "functorIfInverted", - value: function functorIfInverted(inverted, functor, value) { - if (inverted) { - functor(value); - } - } - }, { - key: "isValueFalsy", - value: function isValueFalsy(value, type) { - return value == null || !value || type === "[object Array]" && value.length === 0; - } - }, { - key: "loopOverValue", - value: function loopOverValue(value, functor, inverted) { - var type = Object.prototype.toString.call(value); - var currentValue = this.scopeList[this.num]; - if (this.isValueFalsy(value, type)) { - return this.functorIfInverted(inverted, functor, currentValue); - } - if (type === "[object Array]") { - for (var i = 0, scope; i < value.length; i++) { - scope = value[i]; - this.functorIfInverted(!inverted, functor, scope); - } - return; - } - if (type === "[object Object]") { - return this.functorIfInverted(!inverted, functor, value); - } - if (value === true) { - return this.functorIfInverted(!inverted, functor, currentValue); - } - } - }, { - key: "getValue", - value: function getValue(tag, num) { - // search in the scopes (in reverse order) and keep the first defined value - this.num = num == null ? this.scopeList.length - 1 : num; - var err = void 0; - var parser = void 0; - var res = void 0; - var scope = this.scopeList[this.num]; - try { - parser = this.parser(tag); - } catch (error) { - err = new Errors.XTScopeParserError("Scope parser compilation failed"); - err.properties = { - id: "scopeparser_compilation_failed", - tag: tag, - explanation: "The scope parser for the tag " + tag + " failed to compile", - rootError: error - }; - throw err; - } - try { - res = parser.get(scope, { num: this.num, scopeList: this.scopeList }); - } catch (error) { - err = new Errors.XTScopeParserError("Scope parser execution failed"); - err.properties = { - id: "scopeparser_execution_failed", - explanation: "The scope parser for the tag " + tag + " failed to execute", - scope: scope, - tag: tag, - rootError: error - }; - throw err; - } - if (res == null && this.num > 0) { - return this.getValue(tag, this.num - 1); - } - return res; - } - }, { - key: "createSubScopeManager", - value: function createSubScopeManager(scope, tag) { - var options = { - scopePath: this.scopePath.slice(0), - scopeList: this.scopeList.slice(0) - }; - - options.parser = this.parser; - options.scopeList = this.scopeList.concat(scope); - options.scopePath = this.scopePath.concat(tag); - return new ScopeManager(options); - } - }]); - - return ScopeManager; -}(); - -ScopeManager.createBaseScopeManager = function (_ref) { - var parser = _ref.parser, - tags = _ref.tags; - - var options = { parser: parser, tags: tags }; - options.scopePath = []; - options.scopeList = [tags]; - return new ScopeManager(options); -}; - -module.exports = ScopeManager; -},{"./errors":2}],16:[function(require,module,exports){ - - -var DocUtils = require("./doc-utils"); -var Errors = require("./errors"); - -function throwRawTagNotInParagraph(options) { - var err = new Errors.XTTemplateError("Raw tag not in paragraph"); - var tag = options.part.value; - err.properties = { - id: "raw_tag_outerxml_invalid", - explanation: "The tag \"" + tag + "\"", - rootError: options.rootError, - xtag: tag, - postparsed: options.postparsed, - expandTo: options.expandTo, - index: options.index - }; - throw err; -} - -function lastTagIsOpenTag(array, tag) { - if (array.length === 0) { - return false; - } - var lastTag = array[array.length - 1]; - var innerLastTag = lastTag.tag.substr(1); - var innerCurrentTag = tag.substr(2, tag.length - 3); - return innerLastTag.indexOf(innerCurrentTag) === 0; -} - -function addTag(array, tag) { - array.push({ tag: tag }); - return array; -} - -function getListXmlElements(parts) { - /* - get the different closing and opening tags between two texts (doesn't take into account tags that are opened then closed (those that are closed then opened are returned)): - returns:[{"tag":"</w:r>","offset":13},{"tag":"</w:p>","offset":265},{"tag":"</w:tc>","offset":271},{"tag":"<w:tc>","offset":828},{"tag":"<w:p>","offset":883},{"tag":"<w:r>","offset":1483}] - */ - var tags = parts.filter(function (part) { - return part.type === "tag"; - }).map(function (part) { - return part.value; - }); - - var res = []; - - for (var i = 0, tag; i < tags.length; i++) { - tag = tags[i]; - // closing tag - if (tag[1] === "/") { - if (lastTagIsOpenTag(res, tag)) { - res.pop(); - } else { - res = addTag(res, tag); - } - } else if (tag[tag.length - 1] !== "/") { - res = addTag(res, tag); - } - } - return res; -} - -function getExpandToDefault(parts) { - var xmlElements = getListXmlElements(parts); - for (var i = 0; i < xmlElements.length; i++) { - var xmlElement = xmlElements[i]; - if (xmlElement.tag.indexOf("<w:tc") === 0) { - return "w:tr"; - } - if (xmlElement.tag.indexOf("<a:tc") === 0) { - return "a:tr"; - } - } - return false; -} - -function expandOne(part, postparsed, options) { - var expandTo = part.expandTo || options.expandTo; - var index = postparsed.indexOf(part); - if (!expandTo) { - return postparsed; - } - var right = void 0, - left = void 0; - try { - right = DocUtils.getRight(postparsed, expandTo, index); - left = DocUtils.getLeft(postparsed, expandTo, index); - } catch (rootError) { - if (rootError instanceof Errors.XTTemplateError) { - throwRawTagNotInParagraph({ part: part, rootError: rootError, postparsed: postparsed, expandTo: expandTo, index: index }); - } - throw rootError; - } - var leftParts = postparsed.slice(left, index); - var rightParts = postparsed.slice(index + 1, right + 1); - var inner = options.getInner({ index: index, part: part, leftParts: leftParts, rightParts: rightParts, left: left, right: right, postparsed: postparsed }); - inner.expanded = [leftParts, rightParts]; - return DocUtils.concatArrays([postparsed.slice(0, left), [inner], postparsed.slice(right + 1)]); -} - -function expandToOne(postparsed, options) { - var expandToElements = postparsed.reduce(function (elements, part) { - if (part.type === "placeholder" && part.module === options.moduleName) { - elements.push(part); - } - return elements; - }, []); - - expandToElements.forEach(function (part) { - postparsed = expandOne(part, postparsed, options); - }); - return postparsed; -} - -module.exports = { - expandToOne: expandToOne, - getExpandToDefault: getExpandToDefault -}; -},{"./doc-utils":1,"./errors":2}],17:[function(require,module,exports){ - -// res class responsibility is to parse the XML. - -var DocUtils = require("./doc-utils"); -var memoize = require("./memoize"); - -function handleRecursiveCase(res) { - /* - Because xmlTemplater is recursive (meaning it can call it self), we need to handle special cases where the XML is not valid: - For example with res string "I am</w:t></w:r></w:p><w:p><w:r><w:t>sleeping", - - we need to match also the string that is inside an implicit <w:t> (that's the role of replacerUnshift) (in res case 'I am') - - we need to match the string that is at the right of a <w:t> (that's the role of replacerPush) (in res case 'sleeping') - the test: describe "scope calculation" it "should compute the scope between 2 <w:t>" makes sure that res part of code works - It should even work if they is no XML at all, for example if the code is just "I am sleeping", in res case however, they should only be one match - */ - - function replacerUnshift() { - var pn = { array: Array.prototype.slice.call(arguments) }; - pn.array.shift(); - var match = pn.array[0] + pn.array[1]; - // add match so that pn[0] = whole match, pn[1]= first parenthesis,... - pn.array.unshift(match); - pn.array.pop(); - var offset = pn.array.pop(); - pn.offset = offset; - pn.first = true; - // add at the beginning - res.matches.unshift(pn); - res.charactersAdded.unshift(0); - return res.charactersAddedCumulative.unshift(0); - } - - if (res.content.indexOf("<") === -1 && res.content.indexOf(">") === -1) { - res.content.replace(/^()([^<>]*)$/, replacerUnshift); - } - - var r = new RegExp("^()([^<]+)</(?:" + res.tagsXmlArrayJoined + ")>"); - res.content.replace(r, replacerUnshift); - - function replacerPush() { - var pn = { array: Array.prototype.slice.call(arguments) }; - pn.array.pop(); - var offset = pn.array.pop(); - pn.offset = offset; - pn.last = true; - // add at the end - res.matches.push(pn); - res.charactersAdded.push(0); - return res.charactersAddedCumulative.push(0); - } - - r = new RegExp("(<(?:" + res.tagsXmlArrayJoined + ")[^>]*>)([^>]+)$"); - res.content.replace(r, replacerPush); - return res; -} - -function xmlMatcher(content, tagsXmlArray) { - var res = {}; - res.content = content; - res.tagsXmlArray = tagsXmlArray; - res.tagsXmlArrayJoined = res.tagsXmlArray.join("|"); - var regexp = new RegExp("(<(?:" + res.tagsXmlArrayJoined + ")[^>]*>)([^<>]*)</(?:" + res.tagsXmlArrayJoined + ")>", "g"); - res.matches = DocUtils.pregMatchAll(regexp, res.content); - res.charactersAddedCumulative = res.matches.map(function () { - return 0; - }); - res.charactersAdded = res.matches.map(function () { - return 0; - }); - return handleRecursiveCase(res); -} - -var memoized = memoize(xmlMatcher); - -module.exports = function (content, tagsXmlArray) { - return DocUtils.cloneDeep(memoized(content, tagsXmlArray)); -}; -},{"./doc-utils":1,"./memoize":5}],18:[function(require,module,exports){ - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var DocUtils = require("./doc-utils"); -var ScopeManager = require("./scope-manager"); -var xmlMatcher = require("./xml-matcher"); -var Errors = require("./errors"); -var Lexer = require("./lexer"); -var Parser = require("./parser.js"); -var _render = require("./render.js"); - -function _getFullText(content, tagsXmlArray) { - var matcher = xmlMatcher(content, tagsXmlArray); - var res = matcher.matches.map(function (match) { - return match.array[2]; - }); - return DocUtils.wordToUtf8(DocUtils.convertSpaces(res.join(""))); -} - -module.exports = function () { - function XmlTemplater(content, options) { - _classCallCheck(this, XmlTemplater); - - this.fromJson(options); - this.setModules({ inspect: { filePath: this.filePath } }); - this.load(content); - } - - _createClass(XmlTemplater, [{ - key: "load", - value: function load(content) { - if (typeof content !== "string") { - var err = new Errors.XTInternalError("Content must be a string"); - err.properties.id = "xmltemplater_content_must_be_string"; - throw err; - } - this.content = content; - } - }, { - key: "setTags", - value: function setTags(tags) { - this.tags = tags != null ? tags : {}; - this.scopeManager = ScopeManager.createBaseScopeManager({ tags: this.tags, parser: this.parser }); - return this; - } - }, { - key: "fromJson", - value: function fromJson(options) { - this.filePath = options.filePath; - this.modules = options.modules; - this.fileTypeConfig = options.fileTypeConfig; - Object.keys(DocUtils.defaults).map(function (key) { - this[key] = options[key] != null ? options[key] : DocUtils.defaults[key]; - }, this); - } - }, { - key: "getFullText", - value: function getFullText() { - return _getFullText(this.content, this.fileTypeConfig.tagsXmlTextArray); - } - }, { - key: "setModules", - value: function setModules(obj) { - this.modules.forEach(function (module) { - module.set(obj); - }); - } - }, { - key: "parse", - value: function parse() { - this.xmllexed = Lexer.xmlparse(this.content, { text: this.fileTypeConfig.tagsXmlTextArray, other: this.fileTypeConfig.tagsXmlLexedArray }); - this.setModules({ inspect: { xmllexed: this.xmllexed } }); - this.lexed = Lexer.parse(this.xmllexed, this.delimiters); - this.setModules({ inspect: { lexed: this.lexed } }); - this.parsed = Parser.parse(this.lexed, this.modules); - this.setModules({ inspect: { parsed: this.parsed } }); - this.postparsed = Parser.postparse(this.parsed, this.modules); - return this; - } - /* - content is the whole content to be tagged - scope is the current scope - returns the new content of the tagged content - */ - - }, { - key: "render", - value: function render(to) { - this.filePath = to; - this.setModules({ inspect: { postparsed: this.postparsed } }); - this.content = _render({ - compiled: this.postparsed, - tags: this.tags, - modules: this.modules, - parser: this.parser, - nullGetter: this.nullGetter, - filePath: this.filePath - }); - this.setModules({ inspect: { content: this.content } }); - return this; - } - }]); - - return XmlTemplater; -}(); -},{"./doc-utils":1,"./errors":2,"./lexer":4,"./parser.js":13,"./render.js":14,"./scope-manager":15,"./xml-matcher":17}],19:[function(require,module,exports){ -function DOMParser(options){ - this.options = options ||{locator:{}}; - -} -DOMParser.prototype.parseFromString = function(source,mimeType){ - var options = this.options; - var sax = new XMLReader(); - var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler - var errorHandler = options.errorHandler; - var locator = options.locator; - var defaultNSMap = options.xmlns||{}; - var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} - if(locator){ - domBuilder.setDocumentLocator(locator) - } - - sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); - sax.domBuilder = options.domBuilder || domBuilder; - if(/\/x?html?$/.test(mimeType)){ - entityMap.nbsp = '\xa0'; - entityMap.copy = '\xa9'; - defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; - } - defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; - if(source){ - sax.parse(source,defaultNSMap,entityMap); - }else{ - sax.errorHandler.error("invalid doc source"); - } - return domBuilder.doc; -} -function buildErrorHandler(errorImpl,domBuilder,locator){ - if(!errorImpl){ - if(domBuilder instanceof DOMHandler){ - return domBuilder; - } - errorImpl = domBuilder ; - } - var errorHandler = {} - var isCallback = errorImpl instanceof Function; - locator = locator||{} - function build(key){ - var fn = errorImpl[key]; - if(!fn && isCallback){ - fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; - } - errorHandler[key] = fn && function(msg){ - fn('[xmldom '+key+']\t'+msg+_locator(locator)); - }||function(){}; - } - build('warning'); - build('error'); - build('fatalError'); - return errorHandler; -} - -//console.log('#\n\n\n\n\n\n\n####') -/** - * +ContentHandler+ErrorHandler - * +LexicalHandler+EntityResolver2 - * -DeclHandler-DTDHandler - * - * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler - * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 - * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html - */ -function DOMHandler() { - this.cdata = false; -} -function position(locator,node){ - node.lineNumber = locator.lineNumber; - node.columnNumber = locator.columnNumber; -} -/** - * @see org.xml.sax.ContentHandler#startDocument - * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html - */ -DOMHandler.prototype = { - startDocument : function() { - this.doc = new DOMImplementation().createDocument(null, null, null); - if (this.locator) { - this.doc.documentURI = this.locator.systemId; - } - }, - startElement:function(namespaceURI, localName, qName, attrs) { - var doc = this.doc; - var el = doc.createElementNS(namespaceURI, qName||localName); - var len = attrs.length; - appendElement(this, el); - this.currentElement = el; - - this.locator && position(this.locator,el) - for (var i = 0 ; i < len; i++) { - var namespaceURI = attrs.getURI(i); - var value = attrs.getValue(i); - var qName = attrs.getQName(i); - var attr = doc.createAttributeNS(namespaceURI, qName); - this.locator &&position(attrs.getLocator(i),attr); - attr.value = attr.nodeValue = value; - el.setAttributeNode(attr) - } - }, - endElement:function(namespaceURI, localName, qName) { - var current = this.currentElement - var tagName = current.tagName; - this.currentElement = current.parentNode; - }, - startPrefixMapping:function(prefix, uri) { - }, - endPrefixMapping:function(prefix) { - }, - processingInstruction:function(target, data) { - var ins = this.doc.createProcessingInstruction(target, data); - this.locator && position(this.locator,ins) - appendElement(this, ins); - }, - ignorableWhitespace:function(ch, start, length) { - }, - characters:function(chars, start, length) { - chars = _toString.apply(this,arguments) - //console.log(chars) - if(chars){ - if (this.cdata) { - var charNode = this.doc.createCDATASection(chars); - } else { - var charNode = this.doc.createTextNode(chars); - } - if(this.currentElement){ - this.currentElement.appendChild(charNode); - }else if(/^\s*$/.test(chars)){ - this.doc.appendChild(charNode); - //process xml - } - this.locator && position(this.locator,charNode) - } - }, - skippedEntity:function(name) { - }, - endDocument:function() { - this.doc.normalize(); - }, - setDocumentLocator:function (locator) { - if(this.locator = locator){// && !('lineNumber' in locator)){ - locator.lineNumber = 0; - } - }, - //LexicalHandler - comment:function(chars, start, length) { - chars = _toString.apply(this,arguments) - var comm = this.doc.createComment(chars); - this.locator && position(this.locator,comm) - appendElement(this, comm); - }, - - startCDATA:function() { - //used in characters() methods - this.cdata = true; - }, - endCDATA:function() { - this.cdata = false; - }, - - startDTD:function(name, publicId, systemId) { - var impl = this.doc.implementation; - if (impl && impl.createDocumentType) { - var dt = impl.createDocumentType(name, publicId, systemId); - this.locator && position(this.locator,dt) - appendElement(this, dt); - } - }, - /** - * @see org.xml.sax.ErrorHandler - * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html - */ - warning:function(error) { - console.warn('[xmldom warning]\t'+error,_locator(this.locator)); - }, - error:function(error) { - console.error('[xmldom error]\t'+error,_locator(this.locator)); - }, - fatalError:function(error) { - console.error('[xmldom fatalError]\t'+error,_locator(this.locator)); - throw error; - } -} -function _locator(l){ - if(l){ - return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' - } -} -function _toString(chars,start,length){ - if(typeof chars == 'string'){ - return chars.substr(start,length) - }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") - if(chars.length >= start+length || start){ - return new java.lang.String(chars,start,length)+''; - } - return chars; - } -} - -/* - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html - * used method of org.xml.sax.ext.LexicalHandler: - * #comment(chars, start, length) - * #startCDATA() - * #endCDATA() - * #startDTD(name, publicId, systemId) - * - * - * IGNORED method of org.xml.sax.ext.LexicalHandler: - * #endDTD() - * #startEntity(name) - * #endEntity(name) - * - * - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html - * IGNORED method of org.xml.sax.ext.DeclHandler - * #attributeDecl(eName, aName, type, mode, value) - * #elementDecl(name, model) - * #externalEntityDecl(name, publicId, systemId) - * #internalEntityDecl(name, value) - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html - * IGNORED method of org.xml.sax.EntityResolver2 - * #resolveEntity(String name,String publicId,String baseURI,String systemId) - * #resolveEntity(publicId, systemId) - * #getExternalSubset(name, baseURI) - * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html - * IGNORED method of org.xml.sax.DTDHandler - * #notationDecl(name, publicId, systemId) {}; - * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; - */ -"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ - DOMHandler.prototype[key] = function(){return null} -}) - -/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ -function appendElement (hander,node) { - if (!hander.currentElement) { - hander.doc.appendChild(node); - } else { - hander.currentElement.appendChild(node); - } -}//appendChild and setAttributeNS are preformance key - -//if(typeof require == 'function'){ - var XMLReader = require('./sax').XMLReader; - var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; - exports.XMLSerializer = require('./dom').XMLSerializer ; - exports.DOMParser = DOMParser; -//} - -},{"./dom":20,"./sax":21}],20:[function(require,module,exports){ -/* - * DOM Level 2 - * Object DOMException - * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html - * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html - */ - -function copy(src,dest){ - for(var p in src){ - dest[p] = src[p]; - } -} -/** -^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));? -^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));? - */ -function _extends(Class,Super){ - var pt = Class.prototype; - if(Object.create){ - var ppt = Object.create(Super.prototype) - pt.__proto__ = ppt; - } - if(!(pt instanceof Super)){ - function t(){} - t.prototype = Super.prototype; - t = new t(); - copy(pt,t); - Class.prototype = pt = t; - } - if(pt.constructor != Class){ - if(typeof Class != 'function'){ - console.error("unknow Class:"+Class) - } - pt.constructor = Class - } -} -var htmlns = 'http://www.w3.org/1999/xhtml' ; -// Node Types -var NodeType = {} -var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; -var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; -var TEXT_NODE = NodeType.TEXT_NODE = 3; -var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; -var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; -var ENTITY_NODE = NodeType.ENTITY_NODE = 6; -var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; -var COMMENT_NODE = NodeType.COMMENT_NODE = 8; -var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; -var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; -var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; -var NOTATION_NODE = NodeType.NOTATION_NODE = 12; - -// ExceptionCode -var ExceptionCode = {} -var ExceptionMessage = {}; -var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1); -var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2); -var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3); -var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4); -var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5); -var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6); -var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7); -var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8); -var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9); -var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10); -//level2 -var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11); -var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12); -var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13); -var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14); -var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15); - - -function DOMException(code, message) { - if(message instanceof Error){ - var error = message; - }else{ - error = this; - Error.call(this, ExceptionMessage[code]); - this.message = ExceptionMessage[code]; - if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException); - } - error.code = code; - if(message) this.message = this.message + ": " + message; - return error; -} -DOMException.prototype = Error.prototype; -copy(ExceptionCode,DOMException) -/** - * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177 - * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. - * The items in the NodeList are accessible via an integral index, starting from 0. - */ -function NodeList() { -} -NodeList.prototype = { - /** - * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. - * @standard level1 - */ - length:0, - /** - * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. - * @standard level1 - * @param index unsigned long - * Index into the collection. - * @return Node - * The node at the indexth position in the NodeList, or null if that is not a valid index. - */ - item: function(index) { - return this[index] || null; - }, - toString:function(isHTML,nodeFilter){ - for(var buf = [], i = 0;i<this.length;i++){ - serializeToString(this[i],buf,isHTML,nodeFilter); - } - return buf.join(''); - } -}; -function LiveNodeList(node,refresh){ - this._node = node; - this._refresh = refresh - _updateLiveList(this); -} -function _updateLiveList(list){ - var inc = list._node._inc || list._node.ownerDocument._inc; - if(list._inc != inc){ - var ls = list._refresh(list._node); - //console.log(ls.length) - __set__(list,'length',ls.length); - copy(ls,list); - list._inc = inc; - } -} -LiveNodeList.prototype.item = function(i){ - _updateLiveList(this); - return this[i]; -} - -_extends(LiveNodeList,NodeList); -/** - * - * Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes. - * NamedNodeMap objects in the DOM are live. - * used for attributes or DocumentType entities - */ -function NamedNodeMap() { -} - -function _findNodeIndex(list,node){ - var i = list.length; - while(i--){ - if(list[i] === node){return i} - } -} - -function _addNamedNode(el,list,newAttr,oldAttr){ - if(oldAttr){ - list[_findNodeIndex(list,oldAttr)] = newAttr; - }else{ - list[list.length++] = newAttr; - } - if(el){ - newAttr.ownerElement = el; - var doc = el.ownerDocument; - if(doc){ - oldAttr && _onRemoveAttribute(doc,el,oldAttr); - _onAddAttribute(doc,el,newAttr); - } - } -} -function _removeNamedNode(el,list,attr){ - //console.log('remove attr:'+attr) - var i = _findNodeIndex(list,attr); - if(i>=0){ - var lastIndex = list.length-1 - while(i<lastIndex){ - list[i] = list[++i] - } - list.length = lastIndex; - if(el){ - var doc = el.ownerDocument; - if(doc){ - _onRemoveAttribute(doc,el,attr); - attr.ownerElement = null; - } - } - }else{ - throw DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr)) - } -} -NamedNodeMap.prototype = { - length:0, - item:NodeList.prototype.item, - getNamedItem: function(key) { -// if(key.indexOf(':')>0 || key == 'xmlns'){ -// return null; -// } - //console.log() - var i = this.length; - while(i--){ - var attr = this[i]; - //console.log(attr.nodeName,key) - if(attr.nodeName == key){ - return attr; - } - } - }, - setNamedItem: function(attr) { - var el = attr.ownerElement; - if(el && el!=this._ownerElement){ - throw new DOMException(INUSE_ATTRIBUTE_ERR); - } - var oldAttr = this.getNamedItem(attr.nodeName); - _addNamedNode(this._ownerElement,this,attr,oldAttr); - return oldAttr; - }, - /* returns Node */ - setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR - var el = attr.ownerElement, oldAttr; - if(el && el!=this._ownerElement){ - throw new DOMException(INUSE_ATTRIBUTE_ERR); - } - oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName); - _addNamedNode(this._ownerElement,this,attr,oldAttr); - return oldAttr; - }, - - /* returns Node */ - removeNamedItem: function(key) { - var attr = this.getNamedItem(key); - _removeNamedNode(this._ownerElement,this,attr); - return attr; - - - },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR - - //for level2 - removeNamedItemNS:function(namespaceURI,localName){ - var attr = this.getNamedItemNS(namespaceURI,localName); - _removeNamedNode(this._ownerElement,this,attr); - return attr; - }, - getNamedItemNS: function(namespaceURI, localName) { - var i = this.length; - while(i--){ - var node = this[i]; - if(node.localName == localName && node.namespaceURI == namespaceURI){ - return node; - } - } - return null; - } -}; -/** - * @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 - */ -function DOMImplementation(/* Object */ features) { - this._features = {}; - if (features) { - for (var feature in features) { - this._features = features[feature]; - } - } -} - -DOMImplementation.prototype = { - hasFeature: function(/* string */ feature, /* string */ version) { - var versions = this._features[feature.toLowerCase()]; - if (versions && (!version || version in versions)) { - return true; - } else { - return false; - } - }, - // Introduced in DOM Level 2: - createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR - var doc = new Document(); - doc.implementation = this; - doc.childNodes = new NodeList(); - doc.doctype = doctype; - if(doctype){ - doc.appendChild(doctype); - } - if(qualifiedName){ - var root = doc.createElementNS(namespaceURI,qualifiedName); - doc.appendChild(root); - } - return doc; - }, - // Introduced in DOM Level 2: - createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR - var node = new DocumentType(); - node.name = qualifiedName; - node.nodeName = qualifiedName; - node.publicId = publicId; - node.systemId = systemId; - // Introduced in DOM Level 2: - //readonly attribute DOMString internalSubset; - - //TODO:.. - // readonly attribute NamedNodeMap entities; - // readonly attribute NamedNodeMap notations; - return node; - } -}; - - -/** - * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 - */ - -function Node() { -} - -Node.prototype = { - firstChild : null, - lastChild : null, - previousSibling : null, - nextSibling : null, - attributes : null, - parentNode : null, - childNodes : null, - ownerDocument : null, - nodeValue : null, - namespaceURI : null, - prefix : null, - localName : null, - // Modified in DOM Level 2: - insertBefore:function(newChild, refChild){//raises - return _insertBefore(this,newChild,refChild); - }, - replaceChild:function(newChild, oldChild){//raises - this.insertBefore(newChild,oldChild); - if(oldChild){ - this.removeChild(oldChild); - } - }, - removeChild:function(oldChild){ - return _removeChild(this,oldChild); - }, - appendChild:function(newChild){ - return this.insertBefore(newChild,null); - }, - hasChildNodes:function(){ - return this.firstChild != null; - }, - cloneNode:function(deep){ - return cloneNode(this.ownerDocument||this,this,deep); - }, - // Modified in DOM Level 2: - normalize:function(){ - var child = this.firstChild; - while(child){ - var next = child.nextSibling; - if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){ - this.removeChild(next); - child.appendData(next.data); - }else{ - child.normalize(); - child = next; - } - } - }, - // Introduced in DOM Level 2: - isSupported:function(feature, version){ - return this.ownerDocument.implementation.hasFeature(feature,version); - }, - // Introduced in DOM Level 2: - hasAttributes:function(){ - return this.attributes.length>0; - }, - lookupPrefix:function(namespaceURI){ - var el = this; - while(el){ - var map = el._nsMap; - //console.dir(map) - if(map){ - for(var n in map){ - if(map[n] == namespaceURI){ - return n; - } - } - } - el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; - } - return null; - }, - // Introduced in DOM Level 3: - lookupNamespaceURI:function(prefix){ - var el = this; - while(el){ - var map = el._nsMap; - //console.dir(map) - if(map){ - if(prefix in map){ - return map[prefix] ; - } - } - el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; - } - return null; - }, - // Introduced in DOM Level 3: - isDefaultNamespace:function(namespaceURI){ - var prefix = this.lookupPrefix(namespaceURI); - return prefix == null; - } -}; - - -function _xmlEncoder(c){ - return c == '<' && '<' || - c == '>' && '>' || - c == '&' && '&' || - c == '"' && '"' || - '&#'+c.charCodeAt()+';' -} - - -copy(NodeType,Node); -copy(NodeType,Node.prototype); - -/** - * @param callback return true for continue,false for break - * @return boolean true: break visit; - */ -function _visitNode(node,callback){ - if(callback(node)){ - return true; - } - if(node = node.firstChild){ - do{ - if(_visitNode(node,callback)){return true} - }while(node=node.nextSibling) - } -} - - - -function Document(){ -} -function _onAddAttribute(doc,el,newAttr){ - doc && doc._inc++; - var ns = newAttr.namespaceURI ; - if(ns == 'http://www.w3.org/2000/xmlns/'){ - //update namespace - el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value - } -} -function _onRemoveAttribute(doc,el,newAttr,remove){ - doc && doc._inc++; - var ns = newAttr.namespaceURI ; - if(ns == 'http://www.w3.org/2000/xmlns/'){ - //update namespace - delete el._nsMap[newAttr.prefix?newAttr.localName:''] - } -} -function _onUpdateChild(doc,el,newChild){ - if(doc && doc._inc){ - doc._inc++; - //update childNodes - var cs = el.childNodes; - if(newChild){ - cs[cs.length++] = newChild; - }else{ - //console.log(1) - var child = el.firstChild; - var i = 0; - while(child){ - cs[i++] = child; - child =child.nextSibling; - } - cs.length = i; - } - } -} - -/** - * attributes; - * children; - * - * writeable properties: - * nodeValue,Attr:value,CharacterData:data - * prefix - */ -function _removeChild(parentNode,child){ - var previous = child.previousSibling; - var next = child.nextSibling; - if(previous){ - previous.nextSibling = next; - }else{ - parentNode.firstChild = next - } - if(next){ - next.previousSibling = previous; - }else{ - parentNode.lastChild = previous; - } - _onUpdateChild(parentNode.ownerDocument,parentNode); - return child; -} -/** - * preformance key(refChild == null) - */ -function _insertBefore(parentNode,newChild,nextChild){ - var cp = newChild.parentNode; - if(cp){ - cp.removeChild(newChild);//remove and update - } - if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ - var newFirst = newChild.firstChild; - if (newFirst == null) { - return newChild; - } - var newLast = newChild.lastChild; - }else{ - newFirst = newLast = newChild; - } - var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild; - - newFirst.previousSibling = pre; - newLast.nextSibling = nextChild; - - - if(pre){ - pre.nextSibling = newFirst; - }else{ - parentNode.firstChild = newFirst; - } - if(nextChild == null){ - parentNode.lastChild = newLast; - }else{ - nextChild.previousSibling = newLast; - } - do{ - newFirst.parentNode = parentNode; - }while(newFirst !== newLast && (newFirst= newFirst.nextSibling)) - _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode); - //console.log(parentNode.lastChild.nextSibling == null) - if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { - newChild.firstChild = newChild.lastChild = null; - } - return newChild; -} -function _appendSingleChild(parentNode,newChild){ - var cp = newChild.parentNode; - if(cp){ - var pre = parentNode.lastChild; - cp.removeChild(newChild);//remove and update - var pre = parentNode.lastChild; - } - var pre = parentNode.lastChild; - newChild.parentNode = parentNode; - newChild.previousSibling = pre; - newChild.nextSibling = null; - if(pre){ - pre.nextSibling = newChild; - }else{ - parentNode.firstChild = newChild; - } - parentNode.lastChild = newChild; - _onUpdateChild(parentNode.ownerDocument,parentNode,newChild); - return newChild; - //console.log("__aa",parentNode.lastChild.nextSibling == null) -} -Document.prototype = { - //implementation : null, - nodeName : '#document', - nodeType : DOCUMENT_NODE, - doctype : null, - documentElement : null, - _inc : 1, - - insertBefore : function(newChild, refChild){//raises - if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){ - var child = newChild.firstChild; - while(child){ - var next = child.nextSibling; - this.insertBefore(child,refChild); - child = next; - } - return newChild; - } - if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){ - this.documentElement = newChild; - } - - return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild; - }, - removeChild : function(oldChild){ - if(this.documentElement == oldChild){ - this.documentElement = null; - } - return _removeChild(this,oldChild); - }, - // Introduced in DOM Level 2: - importNode : function(importedNode,deep){ - return importNode(this,importedNode,deep); - }, - // Introduced in DOM Level 2: - getElementById : function(id){ - var rtv = null; - _visitNode(this.documentElement,function(node){ - if(node.nodeType == ELEMENT_NODE){ - if(node.getAttribute('id') == id){ - rtv = node; - return true; - } - } - }) - return rtv; - }, - - //document factory method: - createElement : function(tagName){ - var node = new Element(); - node.ownerDocument = this; - node.nodeName = tagName; - node.tagName = tagName; - node.childNodes = new NodeList(); - var attrs = node.attributes = new NamedNodeMap(); - attrs._ownerElement = node; - return node; - }, - createDocumentFragment : function(){ - var node = new DocumentFragment(); - node.ownerDocument = this; - node.childNodes = new NodeList(); - return node; - }, - createTextNode : function(data){ - var node = new Text(); - node.ownerDocument = this; - node.appendData(data) - return node; - }, - createComment : function(data){ - var node = new Comment(); - node.ownerDocument = this; - node.appendData(data) - return node; - }, - createCDATASection : function(data){ - var node = new CDATASection(); - node.ownerDocument = this; - node.appendData(data) - return node; - }, - createProcessingInstruction : function(target,data){ - var node = new ProcessingInstruction(); - node.ownerDocument = this; - node.tagName = node.target = target; - node.nodeValue= node.data = data; - return node; - }, - createAttribute : function(name){ - var node = new Attr(); - node.ownerDocument = this; - node.name = name; - node.nodeName = name; - node.localName = name; - node.specified = true; - return node; - }, - createEntityReference : function(name){ - var node = new EntityReference(); - node.ownerDocument = this; - node.nodeName = name; - return node; - }, - // Introduced in DOM Level 2: - createElementNS : function(namespaceURI,qualifiedName){ - var node = new Element(); - var pl = qualifiedName.split(':'); - var attrs = node.attributes = new NamedNodeMap(); - node.childNodes = new NodeList(); - node.ownerDocument = this; - node.nodeName = qualifiedName; - node.tagName = qualifiedName; - node.namespaceURI = namespaceURI; - if(pl.length == 2){ - node.prefix = pl[0]; - node.localName = pl[1]; - }else{ - //el.prefix = null; - node.localName = qualifiedName; - } - attrs._ownerElement = node; - return node; - }, - // Introduced in DOM Level 2: - createAttributeNS : function(namespaceURI,qualifiedName){ - var node = new Attr(); - var pl = qualifiedName.split(':'); - node.ownerDocument = this; - node.nodeName = qualifiedName; - node.name = qualifiedName; - node.namespaceURI = namespaceURI; - node.specified = true; - if(pl.length == 2){ - node.prefix = pl[0]; - node.localName = pl[1]; - }else{ - //el.prefix = null; - node.localName = qualifiedName; - } - return node; - } -}; -_extends(Document,Node); - - -function Element() { - this._nsMap = {}; -} -Element.prototype = { - nodeType : ELEMENT_NODE, - hasAttribute : function(name){ - return this.getAttributeNode(name)!=null; - }, - getAttribute : function(name){ - var attr = this.getAttributeNode(name); - return attr && attr.value || ''; - }, - getAttributeNode : function(name){ - return this.attributes.getNamedItem(name); - }, - setAttribute : function(name, value){ - var attr = this.ownerDocument.createAttribute(name); - attr.value = attr.nodeValue = "" + value; - this.setAttributeNode(attr) - }, - removeAttribute : function(name){ - var attr = this.getAttributeNode(name) - attr && this.removeAttributeNode(attr); - }, - - //four real opeartion method - appendChild:function(newChild){ - if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ - return this.insertBefore(newChild,null); - }else{ - return _appendSingleChild(this,newChild); - } - }, - setAttributeNode : function(newAttr){ - return this.attributes.setNamedItem(newAttr); - }, - setAttributeNodeNS : function(newAttr){ - return this.attributes.setNamedItemNS(newAttr); - }, - removeAttributeNode : function(oldAttr){ - //console.log(this == oldAttr.ownerElement) - return this.attributes.removeNamedItem(oldAttr.nodeName); - }, - //get real attribute name,and remove it by removeAttributeNode - removeAttributeNS : function(namespaceURI, localName){ - var old = this.getAttributeNodeNS(namespaceURI, localName); - old && this.removeAttributeNode(old); - }, - - hasAttributeNS : function(namespaceURI, localName){ - return this.getAttributeNodeNS(namespaceURI, localName)!=null; - }, - getAttributeNS : function(namespaceURI, localName){ - var attr = this.getAttributeNodeNS(namespaceURI, localName); - return attr && attr.value || ''; - }, - setAttributeNS : function(namespaceURI, qualifiedName, value){ - var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); - attr.value = attr.nodeValue = "" + value; - this.setAttributeNode(attr) - }, - getAttributeNodeNS : function(namespaceURI, localName){ - return this.attributes.getNamedItemNS(namespaceURI, localName); - }, - - getElementsByTagName : function(tagName){ - return new LiveNodeList(this,function(base){ - var ls = []; - _visitNode(base,function(node){ - if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){ - ls.push(node); - } - }); - return ls; - }); - }, - getElementsByTagNameNS : function(namespaceURI, localName){ - return new LiveNodeList(this,function(base){ - var ls = []; - _visitNode(base,function(node){ - if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){ - ls.push(node); - } - }); - return ls; - - }); - } -}; -Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; -Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; - - -_extends(Element,Node); -function Attr() { -} -Attr.prototype.nodeType = ATTRIBUTE_NODE; -_extends(Attr,Node); - - -function CharacterData() { -} -CharacterData.prototype = { - data : '', - substringData : function(offset, count) { - return this.data.substring(offset, offset+count); - }, - appendData: function(text) { - text = this.data+text; - this.nodeValue = this.data = text; - this.length = text.length; - }, - insertData: function(offset,text) { - this.replaceData(offset,0,text); - - }, - appendChild:function(newChild){ - throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]) - }, - deleteData: function(offset, count) { - this.replaceData(offset,count,""); - }, - replaceData: function(offset, count, text) { - var start = this.data.substring(0,offset); - var end = this.data.substring(offset+count); - text = start + text + end; - this.nodeValue = this.data = text; - this.length = text.length; - } -} -_extends(CharacterData,Node); -function Text() { -} -Text.prototype = { - nodeName : "#text", - nodeType : TEXT_NODE, - splitText : function(offset) { - var text = this.data; - var newText = text.substring(offset); - text = text.substring(0, offset); - this.data = this.nodeValue = text; - this.length = text.length; - var newNode = this.ownerDocument.createTextNode(newText); - if(this.parentNode){ - this.parentNode.insertBefore(newNode, this.nextSibling); - } - return newNode; - } -} -_extends(Text,CharacterData); -function Comment() { -} -Comment.prototype = { - nodeName : "#comment", - nodeType : COMMENT_NODE -} -_extends(Comment,CharacterData); - -function CDATASection() { -} -CDATASection.prototype = { - nodeName : "#cdata-section", - nodeType : CDATA_SECTION_NODE -} -_extends(CDATASection,CharacterData); - - -function DocumentType() { -} -DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; -_extends(DocumentType,Node); - -function Notation() { -} -Notation.prototype.nodeType = NOTATION_NODE; -_extends(Notation,Node); - -function Entity() { -} -Entity.prototype.nodeType = ENTITY_NODE; -_extends(Entity,Node); - -function EntityReference() { -} -EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; -_extends(EntityReference,Node); - -function DocumentFragment() { -} -DocumentFragment.prototype.nodeName = "#document-fragment"; -DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; -_extends(DocumentFragment,Node); - - -function ProcessingInstruction() { -} -ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; -_extends(ProcessingInstruction,Node); -function XMLSerializer(){} -XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){ - return nodeSerializeToString.call(node,isHtml,nodeFilter); -} -Node.prototype.toString = nodeSerializeToString; -function nodeSerializeToString(isHtml,nodeFilter){ - var buf = []; - var refNode = this.nodeType == 9?this.documentElement:this; - var prefix = refNode.prefix; - var uri = refNode.namespaceURI; - - if(uri && prefix == null){ - //console.log(prefix) - var prefix = refNode.lookupPrefix(uri); - if(prefix == null){ - //isHTML = true; - var visibleNamespaces=[ - {namespace:uri,prefix:null} - //{namespace:uri,prefix:''} - ] - } - } - serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces); - //console.log('###',this.nodeType,uri,prefix,buf.join('')) - return buf.join(''); -} -function needNamespaceDefine(node,isHTML, visibleNamespaces) { - var prefix = node.prefix||''; - var uri = node.namespaceURI; - if (!prefix && !uri){ - return false; - } - if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace" - || uri == 'http://www.w3.org/2000/xmlns/'){ - return false; - } - - var i = visibleNamespaces.length - //console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces) - while (i--) { - var ns = visibleNamespaces[i]; - // get namespace prefix - //console.log(node.nodeType,node.tagName,ns.prefix,prefix) - if (ns.prefix == prefix){ - return ns.namespace != uri; - } - } - //console.log(isHTML,uri,prefix=='') - //if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){ - // return false; - //} - //node.flag = '11111' - //console.error(3,true,node.flag,node.prefix,node.namespaceURI) - return true; -} -function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ - if(nodeFilter){ - node = nodeFilter(node); - if(node){ - if(typeof node == 'string'){ - buf.push(node); - return; - } - }else{ - return; - } - //buf.sort.apply(attrs, attributeSorter); - } - switch(node.nodeType){ - case ELEMENT_NODE: - if (!visibleNamespaces) visibleNamespaces = []; - var startVisibleNamespaces = visibleNamespaces.length; - var attrs = node.attributes; - var len = attrs.length; - var child = node.firstChild; - var nodeName = node.tagName; - - isHTML = (htmlns === node.namespaceURI) ||isHTML - buf.push('<',nodeName); - - - - for(var i=0;i<len;i++){ - // add namespaces for attributes - var attr = attrs.item(i); - if (attr.prefix == 'xmlns') { - visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value }); - }else if(attr.nodeName == 'xmlns'){ - visibleNamespaces.push({ prefix: '', namespace: attr.value }); - } - } - for(var i=0;i<len;i++){ - var attr = attrs.item(i); - if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) { - var prefix = attr.prefix||''; - var uri = attr.namespaceURI; - var ns = prefix ? ' xmlns:' + prefix : " xmlns"; - buf.push(ns, '="' , uri , '"'); - visibleNamespaces.push({ prefix: prefix, namespace:uri }); - } - serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces); - } - // add namespace for current node - if (needNamespaceDefine(node,isHTML, visibleNamespaces)) { - var prefix = node.prefix||''; - var uri = node.namespaceURI; - var ns = prefix ? ' xmlns:' + prefix : " xmlns"; - buf.push(ns, '="' , uri , '"'); - visibleNamespaces.push({ prefix: prefix, namespace:uri }); - } - - if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){ - buf.push('>'); - //if is cdata child node - if(isHTML && /^script$/i.test(nodeName)){ - while(child){ - if(child.data){ - buf.push(child.data); - }else{ - serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); - } - child = child.nextSibling; - } - }else - { - while(child){ - serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); - child = child.nextSibling; - } - } - buf.push('</',nodeName,'>'); - }else{ - buf.push('/>'); - } - // remove added visible namespaces - //visibleNamespaces.length = startVisibleNamespaces; - return; - case DOCUMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - var child = node.firstChild; - while(child){ - serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); - child = child.nextSibling; - } - return; - case ATTRIBUTE_NODE: - return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"'); - case TEXT_NODE: - return buf.push(node.data.replace(/[<&]/g,_xmlEncoder)); - case CDATA_SECTION_NODE: - return buf.push( '<![CDATA[',node.data,']]>'); - case COMMENT_NODE: - return buf.push( "<!--",node.data,"-->"); - case DOCUMENT_TYPE_NODE: - var pubid = node.publicId; - var sysid = node.systemId; - buf.push('<!DOCTYPE ',node.name); - if(pubid){ - buf.push(' PUBLIC "',pubid); - if (sysid && sysid!='.') { - buf.push( '" "',sysid); - } - buf.push('">'); - }else if(sysid && sysid!='.'){ - buf.push(' SYSTEM "',sysid,'">'); - }else{ - var sub = node.internalSubset; - if(sub){ - buf.push(" [",sub,"]"); - } - buf.push(">"); - } - return; - case PROCESSING_INSTRUCTION_NODE: - return buf.push( "<?",node.target," ",node.data,"?>"); - case ENTITY_REFERENCE_NODE: - return buf.push( '&',node.nodeName,';'); - //case ENTITY_NODE: - //case NOTATION_NODE: - default: - buf.push('??',node.nodeName); - } -} -function importNode(doc,node,deep){ - var node2; - switch (node.nodeType) { - case ELEMENT_NODE: - node2 = node.cloneNode(false); - node2.ownerDocument = doc; - //var attrs = node2.attributes; - //var len = attrs.length; - //for(var i=0;i<len;i++){ - //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep)); - //} - case DOCUMENT_FRAGMENT_NODE: - break; - case ATTRIBUTE_NODE: - deep = true; - break; - //case ENTITY_REFERENCE_NODE: - //case PROCESSING_INSTRUCTION_NODE: - ////case TEXT_NODE: - //case CDATA_SECTION_NODE: - //case COMMENT_NODE: - // deep = false; - // break; - //case DOCUMENT_NODE: - //case DOCUMENT_TYPE_NODE: - //cannot be imported. - //case ENTITY_NODE: - //case NOTATION_NODE: - //can not hit in level3 - //default:throw e; - } - if(!node2){ - node2 = node.cloneNode(false);//false - } - node2.ownerDocument = doc; - node2.parentNode = null; - if(deep){ - var child = node.firstChild; - while(child){ - node2.appendChild(importNode(doc,child,deep)); - child = child.nextSibling; - } - } - return node2; -} -// -//var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1, -// attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,}; -function cloneNode(doc,node,deep){ - var node2 = new node.constructor(); - for(var n in node){ - var v = node[n]; - if(typeof v != 'object' ){ - if(v != node2[n]){ - node2[n] = v; - } - } - } - if(node.childNodes){ - node2.childNodes = new NodeList(); - } - node2.ownerDocument = doc; - switch (node2.nodeType) { - case ELEMENT_NODE: - var attrs = node.attributes; - var attrs2 = node2.attributes = new NamedNodeMap(); - var len = attrs.length - attrs2._ownerElement = node2; - for(var i=0;i<len;i++){ - node2.setAttributeNode(cloneNode(doc,attrs.item(i),true)); - } - break;; - case ATTRIBUTE_NODE: - deep = true; - } - if(deep){ - var child = node.firstChild; - while(child){ - node2.appendChild(cloneNode(doc,child,deep)); - child = child.nextSibling; - } - } - return node2; -} - -function __set__(object,key,value){ - object[key] = value -} -//do dynamic -try{ - if(Object.defineProperty){ - Object.defineProperty(LiveNodeList.prototype,'length',{ - get:function(){ - _updateLiveList(this); - return this.$$length; - } - }); - Object.defineProperty(Node.prototype,'textContent',{ - get:function(){ - return getTextContent(this); - }, - set:function(data){ - switch(this.nodeType){ - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - while(this.firstChild){ - this.removeChild(this.firstChild); - } - if(data || String(data)){ - this.appendChild(this.ownerDocument.createTextNode(data)); - } - break; - default: - //TODO: - this.data = data; - this.value = data; - this.nodeValue = data; - } - } - }) - - function getTextContent(node){ - switch(node.nodeType){ - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - var buf = []; - node = node.firstChild; - while(node){ - if(node.nodeType!==7 && node.nodeType !==8){ - buf.push(getTextContent(node)); - } - node = node.nextSibling; - } - return buf.join(''); - default: - return node.nodeValue; - } - } - __set__ = function(object,key,value){ - //console.log(value) - object['$$'+key] = value - } - } -}catch(e){//ie8 -} - -//if(typeof require == 'function'){ - exports.DOMImplementation = DOMImplementation; - exports.XMLSerializer = XMLSerializer; -//} - -},{}],21:[function(require,module,exports){ -//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] -//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] -//[5] Name ::= NameStartChar (NameChar)* -var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF -var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); -var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); -//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ -//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') - -//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE -//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE -var S_TAG = 0;//tag name offerring -var S_ATTR = 1;//attr name offerring -var S_ATTR_SPACE=2;//attr name end and space offer -var S_EQ = 3;//=space? -var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only) -var S_ATTR_END = 5;//attr value end and no space(quot end) -var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer) -var S_TAG_CLOSE = 7;//closed el<el /> - -function XMLReader(){ - -} - -XMLReader.prototype = { - parse:function(source,defaultNSMap,entityMap){ - var domBuilder = this.domBuilder; - domBuilder.startDocument(); - _copy(defaultNSMap ,defaultNSMap = {}) - parse(source,defaultNSMap,entityMap, - domBuilder,this.errorHandler); - domBuilder.endDocument(); - } -} -function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ - function fixedFromCharCode(code) { - // String.prototype.fromCharCode does not supports - // > 2 bytes unicode chars directly - if (code > 0xffff) { - code -= 0x10000; - var surrogate1 = 0xd800 + (code >> 10) - , surrogate2 = 0xdc00 + (code & 0x3ff); - - return String.fromCharCode(surrogate1, surrogate2); - } else { - return String.fromCharCode(code); - } - } - function entityReplacer(a){ - var k = a.slice(1,-1); - if(k in entityMap){ - return entityMap[k]; - }else if(k.charAt(0) === '#'){ - return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) - }else{ - errorHandler.error('entity not found:'+a); - return a; - } - } - function appendText(end){//has some bugs - if(end>start){ - var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); - locator&&position(start); - domBuilder.characters(xt,0,end-start); - start = end - } - } - function position(p,m){ - while(p>=lineEnd && (m = linePattern.exec(source))){ - lineStart = m.index; - lineEnd = lineStart + m[0].length; - locator.lineNumber++; - //console.log('line++:',locator,startPos,endPos) - } - locator.columnNumber = p-lineStart+1; - } - var lineStart = 0; - var lineEnd = 0; - var linePattern = /.*(?:\r\n?|\n)|.*$/g - var locator = domBuilder.locator; - - var parseStack = [{currentNSMap:defaultNSMapCopy}] - var closeMap = {}; - var start = 0; - while(true){ - try{ - var tagStart = source.indexOf('<',start); - if(tagStart<0){ - if(!source.substr(start).match(/^\s*$/)){ - var doc = domBuilder.doc; - var text = doc.createTextNode(source.substr(start)); - doc.appendChild(text); - domBuilder.currentElement = text; - } - return; - } - if(tagStart>start){ - appendText(tagStart); - } - switch(source.charAt(tagStart+1)){ - case '/': - var end = source.indexOf('>',tagStart+3); - var tagName = source.substring(tagStart+2,end); - var config = parseStack.pop(); - if(end<0){ - - tagName = source.substring(tagStart+2).replace(/[\s<].*/,''); - //console.error('#@@@@@@'+tagName) - errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName); - end = tagStart+1+tagName.length; - }else if(tagName.match(/\s</)){ - tagName = tagName.replace(/[\s<].*/,''); - errorHandler.error("end tag name: "+tagName+' maybe not complete'); - end = tagStart+1+tagName.length; - } - //console.error(parseStack.length,parseStack) - //console.error(config); - var localNSMap = config.localNSMap; - var endMatch = config.tagName == tagName; - var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase() - if(endIgnoreCaseMach){ - domBuilder.endElement(config.uri,config.localName,tagName); - if(localNSMap){ - for(var prefix in localNSMap){ - domBuilder.endPrefixMapping(prefix) ; - } - } - if(!endMatch){ - errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); - } - }else{ - parseStack.push(config) - } - - end++; - break; - // end elment - case '?':// <?...?> - locator&&position(tagStart); - end = parseInstruction(source,tagStart,domBuilder); - break; - case '!':// <!doctype,<![CDATA,<!-- - locator&&position(tagStart); - end = parseDCC(source,tagStart,domBuilder,errorHandler); - break; - default: - locator&&position(tagStart); - var el = new ElementAttributes(); - var currentNSMap = parseStack[parseStack.length-1].currentNSMap; - //elStartEnd - var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler); - var len = el.length; - - - if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){ - el.closed = true; - if(!entityMap.nbsp){ - errorHandler.warning('unclosed xml attribute'); - } - } - if(locator && len){ - var locator2 = copyLocator(locator,{}); - //try{//attribute position fixed - for(var i = 0;i<len;i++){ - var a = el[i]; - position(a.offset); - a.locator = copyLocator(locator,{}); - } - //}catch(e){console.error('@@@@@'+e)} - domBuilder.locator = locator2 - if(appendElement(el,domBuilder,currentNSMap)){ - parseStack.push(el) - } - domBuilder.locator = locator; - }else{ - if(appendElement(el,domBuilder,currentNSMap)){ - parseStack.push(el) - } - } - - - - if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){ - end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder) - }else{ - end++; - } - } - }catch(e){ - errorHandler.error('element parse error: '+e) - //errorHandler.error('element parse error: '+e); - end = -1; - //throw e; - } - if(end>start){ - start = end; - }else{ - //TODO: 这里有å¯èƒ½sax回退,有ä½ç½®é”™è¯¯é£Žé™© - appendText(Math.max(tagStart,start)+1); - } - } -} -function copyLocator(f,t){ - t.lineNumber = f.lineNumber; - t.columnNumber = f.columnNumber; - return t; -} - -/** - * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); - * @return end of the elementStartPart(end of elementEndPart for selfClosed el) - */ -function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){ - var attrName; - var value; - var p = ++start; - var s = S_TAG;//status - while(true){ - var c = source.charAt(p); - switch(c){ - case '=': - if(s === S_ATTR){//attrName - attrName = source.slice(start,p); - s = S_EQ; - }else if(s === S_ATTR_SPACE){ - s = S_EQ; - }else{ - //fatalError: equal must after attrName or space after attrName - throw new Error('attribute equal must after attrName'); - } - break; - case '\'': - case '"': - if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE - ){//equal - if(s === S_ATTR){ - errorHandler.warning('attribute value must after "="') - attrName = source.slice(start,p) - } - start = p+1; - p = source.indexOf(c,start) - if(p>0){ - value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); - el.add(attrName,value,start-1); - s = S_ATTR_END; - }else{ - //fatalError: no end quot match - throw new Error('attribute value no end \''+c+'\' match'); - } - }else if(s == S_ATTR_NOQUOT_VALUE){ - value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); - //console.log(attrName,value,start,p) - el.add(attrName,value,start); - //console.dir(el) - errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); - start = p+1; - s = S_ATTR_END - }else{ - //fatalError: no equal before - throw new Error('attribute value must after "="'); - } - break; - case '/': - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p)); - case S_ATTR_END: - case S_TAG_SPACE: - case S_TAG_CLOSE: - s =S_TAG_CLOSE; - el.closed = true; - case S_ATTR_NOQUOT_VALUE: - case S_ATTR: - case S_ATTR_SPACE: - break; - //case S_EQ: - default: - throw new Error("attribute invalid close char('/')") - } - break; - case ''://end document - //throw new Error('unexpected end of input') - errorHandler.error('unexpected end of input'); - if(s == S_TAG){ - el.setTagName(source.slice(start,p)); - } - return p; - case '>': - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p)); - case S_ATTR_END: - case S_TAG_SPACE: - case S_TAG_CLOSE: - break;//normal - case S_ATTR_NOQUOT_VALUE://Compatible state - case S_ATTR: - value = source.slice(start,p); - if(value.slice(-1) === '/'){ - el.closed = true; - value = value.slice(0,-1) - } - case S_ATTR_SPACE: - if(s === S_ATTR_SPACE){ - value = attrName; - } - if(s == S_ATTR_NOQUOT_VALUE){ - errorHandler.warning('attribute "'+value+'" missed quot(")!!'); - el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start) - }else{ - if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)){ - errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') - } - el.add(value,value,start) - } - break; - case S_EQ: - throw new Error('attribute value missed!!'); - } -// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) - return p; - /*xml space '\x20' | #x9 | #xD | #xA; */ - case '\u0080': - c = ' '; - default: - if(c<= ' '){//space - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p));//tagName - s = S_TAG_SPACE; - break; - case S_ATTR: - attrName = source.slice(start,p) - s = S_ATTR_SPACE; - break; - case S_ATTR_NOQUOT_VALUE: - var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); - errorHandler.warning('attribute "'+value+'" missed quot(")!!'); - el.add(attrName,value,start) - case S_ATTR_END: - s = S_TAG_SPACE; - break; - //case S_TAG_SPACE: - //case S_EQ: - //case S_ATTR_SPACE: - // void();break; - //case S_TAG_CLOSE: - //ignore warning - } - }else{//not space -//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE -//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE - switch(s){ - //case S_TAG:void();break; - //case S_ATTR:void();break; - //case S_ATTR_NOQUOT_VALUE:void();break; - case S_ATTR_SPACE: - var tagName = el.tagName; - if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)){ - errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!') - } - el.add(attrName,attrName,start); - start = p; - s = S_ATTR; - break; - case S_ATTR_END: - errorHandler.warning('attribute space is required"'+attrName+'"!!') - case S_TAG_SPACE: - s = S_ATTR; - start = p; - break; - case S_EQ: - s = S_ATTR_NOQUOT_VALUE; - start = p; - break; - case S_TAG_CLOSE: - throw new Error("elements closed character '/' and '>' must be connected to"); - } - } - }//end outer switch - //console.log('p++',p) - p++; - } -} -/** - * @return true if has new namespace define - */ -function appendElement(el,domBuilder,currentNSMap){ - var tagName = el.tagName; - var localNSMap = null; - //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; - var i = el.length; - while(i--){ - var a = el[i]; - var qName = a.qName; - var value = a.value; - var nsp = qName.indexOf(':'); - if(nsp>0){ - var prefix = a.prefix = qName.slice(0,nsp); - var localName = qName.slice(nsp+1); - var nsPrefix = prefix === 'xmlns' && localName - }else{ - localName = qName; - prefix = null - nsPrefix = qName === 'xmlns' && '' - } - //can not set prefix,because prefix !== '' - a.localName = localName ; - //prefix == null for no ns prefix attribute - if(nsPrefix !== false){//hack!! - if(localNSMap == null){ - localNSMap = {} - //console.log(currentNSMap,0) - _copy(currentNSMap,currentNSMap={}) - //console.log(currentNSMap,1) - } - currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; - a.uri = 'http://www.w3.org/2000/xmlns/' - domBuilder.startPrefixMapping(nsPrefix, value) - } - } - var i = el.length; - while(i--){ - a = el[i]; - var prefix = a.prefix; - if(prefix){//no prefix attribute has no namespace - if(prefix === 'xml'){ - a.uri = 'http://www.w3.org/XML/1998/namespace'; - }if(prefix !== 'xmlns'){ - a.uri = currentNSMap[prefix || ''] - - //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} - } - } - } - var nsp = tagName.indexOf(':'); - if(nsp>0){ - prefix = el.prefix = tagName.slice(0,nsp); - localName = el.localName = tagName.slice(nsp+1); - }else{ - prefix = null;//important!! - localName = el.localName = tagName; - } - //no prefix element has default namespace - var ns = el.uri = currentNSMap[prefix || '']; - domBuilder.startElement(ns,localName,tagName,el); - //endPrefixMapping and startPrefixMapping have not any help for dom builder - //localNSMap = null - if(el.closed){ - domBuilder.endElement(ns,localName,tagName); - if(localNSMap){ - for(prefix in localNSMap){ - domBuilder.endPrefixMapping(prefix) - } - } - }else{ - el.currentNSMap = currentNSMap; - el.localNSMap = localNSMap; - //parseStack.push(el); - return true; - } -} -function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ - if(/^(?:script|textarea)$/i.test(tagName)){ - var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd); - var text = source.substring(elStartEnd+1,elEndStart); - if(/[&<]/.test(text)){ - if(/^script$/i.test(tagName)){ - //if(!/\]\]>/.test(text)){ - //lexHandler.startCDATA(); - domBuilder.characters(text,0,text.length); - //lexHandler.endCDATA(); - return elEndStart; - //} - }//}else{//text area - text = text.replace(/&#?\w+;/g,entityReplacer); - domBuilder.characters(text,0,text.length); - return elEndStart; - //} - - } - } - return elStartEnd+1; -} -function fixSelfClosed(source,elStartEnd,tagName,closeMap){ - //if(tagName in closeMap){ - var pos = closeMap[tagName]; - if(pos == null){ - //console.log(tagName) - pos = source.lastIndexOf('</'+tagName+'>') - if(pos<elStartEnd){//忘记é—åˆ - pos = source.lastIndexOf('</'+tagName) - } - closeMap[tagName] =pos - } - return pos<elStartEnd; - //} -} -function _copy(source,target){ - for(var n in source){target[n] = source[n]} -} -function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!' - var next= source.charAt(start+2) - switch(next){ - case '-': - if(source.charAt(start + 3) === '-'){ - var end = source.indexOf('-->',start+4); - //append comment source.substring(4,end)//<!-- - if(end>start){ - domBuilder.comment(source,start+4,end-start-4); - return end+3; - }else{ - errorHandler.error("Unclosed comment"); - return -1; - } - }else{ - //error - return -1; - } - default: - if(source.substr(start+3,6) == 'CDATA['){ - var end = source.indexOf(']]>',start+9); - domBuilder.startCDATA(); - domBuilder.characters(source,start+9,end-start-9); - domBuilder.endCDATA() - return end+3; - } - //<!DOCTYPE - //startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) - var matchs = split(source,start); - var len = matchs.length; - if(len>1 && /!doctype/i.test(matchs[0][0])){ - var name = matchs[1][0]; - var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0] - var sysid = len>4 && matchs[4][0]; - var lastMatch = matchs[len-1] - domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'), - sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2')); - domBuilder.endDTD(); - - return lastMatch.index+lastMatch[0].length - } - } - return -1; -} - - - -function parseInstruction(source,start,domBuilder){ - var end = source.indexOf('?>',start); - if(end){ - var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); - if(match){ - var len = match[0].length; - domBuilder.processingInstruction(match[1], match[2]) ; - return end+2; - }else{//error - return -1; - } - } - return -1; -} - -/** - * @param source - */ -function ElementAttributes(source){ - -} -ElementAttributes.prototype = { - setTagName:function(tagName){ - if(!tagNamePattern.test(tagName)){ - throw new Error('invalid tagName:'+tagName) - } - this.tagName = tagName - }, - add:function(qName,value,offset){ - if(!tagNamePattern.test(qName)){ - throw new Error('invalid attribute:'+qName) - } - this[this.length++] = {qName:qName,value:value,offset:offset} - }, - length:0, - getLocalName:function(i){return this[i].localName}, - getLocator:function(i){return this[i].locator}, - getQName:function(i){return this[i].qName}, - getURI:function(i){return this[i].uri}, - getValue:function(i){return this[i].value} -// ,getIndex:function(uri, localName)){ -// if(localName){ -// -// }else{ -// var qName = uri -// } -// }, -// getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))}, -// getType:function(uri,localName){} -// getType:function(i){}, -} - - - - -function _set_proto_(thiz,parent){ - thiz.__proto__ = parent; - return thiz; -} -if(!(_set_proto_({},_set_proto_.prototype) instanceof _set_proto_)){ - _set_proto_ = function(thiz,parent){ - function p(){} - p.prototype = parent; - p = new p(); - for(parent in thiz){ - p[parent] = thiz[parent]; - } - return p; - } -} - -function split(source,start){ - var match; - var buf = []; - var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; - reg.lastIndex = start; - reg.exec(source);//skip < - while(match = reg.exec(source)){ - buf.push(match); - if(match[1])return buf; - } -} - -exports.XMLReader = XMLReader; - - -},{}],"/src/js/docxtemplater.js":[function(require,module,exports){ - - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var DocUtils = require("./doc-utils"); -DocUtils.traits = require("./traits"); -DocUtils.moduleWrapper = require("./module-wrapper"); -var wrapper = DocUtils.moduleWrapper; - -var Docxtemplater = function () { - function Docxtemplater() { - _classCallCheck(this, Docxtemplater); - - if (arguments.length > 0) { - throw new Error("The constructor with parameters have been removed in docxtemplater 3.0, please check the upgrade guide."); - } - this.compiled = {}; - this.modules = []; - this.setOptions({}); - } - - _createClass(Docxtemplater, [{ - key: "attachModule", - value: function attachModule(module) { - this.modules.push(wrapper(module)); - return this; - } - }, { - key: "setOptions", - value: function setOptions(options) { - var _this = this; - - this.options = options; - Object.keys(DocUtils.defaults).forEach(function (key) { - var defaultValue = DocUtils.defaults[key]; - _this[key] = _this.options[key] != null ? _this.options[key] : defaultValue; - }); - if (this.zip) { - this.updateFileTypeConfig(); - } - return this; - } - }, { - key: "loadZip", - value: function loadZip(zip) { - if (zip.loadAsync) { - throw new Error("Docxtemplater doesn't handle JSZip version >=3, see changelog"); - } - this.zip = zip; - this.updateFileTypeConfig(); - return this; - } - }, { - key: "compileFile", - value: function compileFile(fileName) { - var currentFile = this.createTemplateClass(fileName); - currentFile.parse(); - this.compiled[fileName] = currentFile; - } - }, { - key: "compile", - value: function compile() { - this.templatedFiles = this.fileTypeConfig.getTemplatedFiles(this.zip); - return this; - } - }, { - key: "updateFileTypeConfig", - value: function updateFileTypeConfig() { - this.fileType = this.zip.files["word/document.xml"] ? "docx" : "pptx"; - this.fileTypeConfig = this.options.fileTypeConfig || Docxtemplater.FileTypeConfig[this.fileType]; - return this; - } - }, { - key: "render", - value: function render() { - var _this2 = this; - - this.options.xmlFileNames = []; - this.modules = this.fileTypeConfig.baseModules.map(function (moduleFunction) { - return moduleFunction(); - }).concat(this.modules); - this.options = this.modules.reduce(function (options, module) { - return module.optionsTransformer(options, _this2); - }, this.options); - this.xmlDocuments = this.options.xmlFileNames.reduce(function (xmlDocuments, fileName) { - var content = _this2.zip.files[fileName].asText(); - xmlDocuments[fileName] = DocUtils.str2xml(content); - return xmlDocuments; - }, {}); - this.modules.forEach(function (module) { - module.set({ zip: _this2.zip, xmlDocuments: _this2.xmlDocuments, data: _this2.data }); - }); - this.compile(); - - this.modules.forEach(function (module) { - module.set({ compiled: _this2.compiled }); - }); - // Loop inside all templatedFiles (ie xml files with content). - // Sometimes they don't exist (footer.xml for example) - this.templatedFiles.forEach(function (fileName) { - if (_this2.zip.files[fileName] != null) { - _this2.compileFile(fileName); - } - }); - - this.mapper = this.modules.reduce(function (value, module) { - return module.getRenderedMap(value); - }, {}); - - Object.keys(this.mapper).forEach(function (to) { - var mapped = _this2.mapper[to]; - var from = mapped.from; - var currentFile = _this2.compiled[from]; - currentFile.setTags(mapped.data); - currentFile.render(to); - _this2.zip.file(to, currentFile.content); - }); - - Object.keys(this.xmlDocuments).forEach(function (fileName) { - _this2.zip.remove(fileName); - var content = DocUtils.xml2str(_this2.xmlDocuments[fileName]); - return _this2.zip.file(fileName, content, {}); - }); - return this; - } - }, { - key: "setData", - value: function setData(data) { - this.data = data; - return this; - } - }, { - key: "getZip", - value: function getZip() { - return this.zip; - } - }, { - key: "createTemplateClass", - value: function createTemplateClass(path) { - var usedData = this.zip.files[path].asText(); - return this.createTemplateClassFromContent(usedData, path); - } - }, { - key: "createTemplateClassFromContent", - value: function createTemplateClassFromContent(content, filePath) { - var _this3 = this; - - var xmltOptions = { - filePath: filePath - }; - Object.keys(DocUtils.defaults).forEach(function (key) { - xmltOptions[key] = _this3[key]; - }); - xmltOptions.fileTypeConfig = this.fileTypeConfig; - xmltOptions.modules = this.modules; - return new Docxtemplater.XmlTemplater(content, xmltOptions); - } - }, { - key: "getFullText", - value: function getFullText(path) { - return this.createTemplateClass(path || this.fileTypeConfig.textPath).getFullText(); - } - }, { - key: "getTemplatedFiles", - value: function getTemplatedFiles() { - this.compile(); - return this.templatedFiles; - } - }]); - - return Docxtemplater; -}(); - -Docxtemplater.DocUtils = require("./doc-utils"); -Docxtemplater.Errors = require("./errors"); -Docxtemplater.XmlTemplater = require("./xml-templater"); -Docxtemplater.FileTypeConfig = require("./file-type-config"); -Docxtemplater.XmlMatcher = require("./xml-matcher"); -module.exports = Docxtemplater; -},{"./doc-utils":1,"./errors":2,"./file-type-config":3,"./module-wrapper":7,"./traits":16,"./xml-matcher":17,"./xml-templater":18}]},{},[])("/src/js/docxtemplater.js") -}); - +import("system.result"); +import("system.vars"); +import("system.swing"); +import("system.fileIO"); +import("system.util"); + +/* This is a serverprocess to improve the performance + * This Process has 13k lines of code since 2 js-libs are included (results in about 420KB) + * The maximum size limit for pre-compiling is 64KB. If this process would be a "lib_" it'd cause every process where + * it's imported to be interpreted. As a serverprocess only this sp is interpreted + */ + + /* + Override the definition of the IntegerArrays, because Rhino does not fully support these TypedArrays. + The zip- and tempalter- lib check if these TypedArrays are defined and then uses them or an alternative. + Therefor make them not existant so that the alternative is used. + This should not cause any problems in other situations since this is a serverProcess and not code that is imported somewhere else. + */ +Int8Array = undefined; +Uint8Array = undefined; +Uint8ClampedArray = undefined; +Int16Array = undefined; +Uint16Array = undefined; +Uint16ClampedArray = undefined; +Int32Array = undefined; +Uint32Array = undefined; +Uint32ClampedArray = undefined; + +initTemplater();//automatically inits zipjs|no customizing is done in these two libraries + +var fileContent; + +if (vars.exists("$local.templateFilePath")) + fileContent = fileIO.getData(vars.get("$local.templateFilePath"), util.DATA_BINARY, "UTF8"); +else + fileContent = vars.get("$local.templateb64"); + +var zip = new JSZip(fileContent, {base64: true}); +//zip = zip.load(); +var docx = new Docxtemplater(); +//use ADITO-default delimiters instead of doxtemplater-delimiters +docx.delimiters.start = "{@"; +docx.delimiters.end = "@}"; +docx.attachModule(_getAutoNewLineModule()); +docx = docx.loadZip(zip); + +var phConfig = vars.get("$local.placeholderConfig"); +phConfig = JSON.parse(phConfig); +docx.setData(phConfig);//set the templateVariables +docx.render();//apply them (replace all occurences of {placeholer} by Value, ...) + +var out = docx.getZip().generate({ + type:"base64", + mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" +}); + +result.object(out.toString()); + +//this is a function for replacing newlines with a "<w:br/>"-tag +//prefix "=" by default since this is not used by the docxtemplater right now +//that's necessary because you cannot modify the data before parsing. (data will be escaped) +//so we need to replace onRender with a custom module +function _getAutoNewLineModule() +{ + var moduleName = "AutoNewLineModule"; + + var res = { + name: moduleName, + parse: function parse(placeHolderContent) { + var type = "placeholder"; + if (placeHolderContent[0] !== "=") + { + return null; + } + return { + type: type, + value: placeHolderContent.substr(1), + module: moduleName + }; + + }, + + render: function render(part, options) { + if (part.module !== moduleName) + { + return null; + } + var value = options.scopeManager.getValue(part.value); + if (value == null) + { + value = options.nullGetter(part); + } + else + { + value = value.replace(/(\r\n)|(\n)|(\r)/g, "<w:br/>"); + } + + return { + value: value + }; + } + } + + + return res; +} + + +/* + * do NOT TOUCH the following code. these are js-libraries + */ + + + + +//jszip +/*! + +JSZip - A Javascript class for generating and reading zip files +<http://stuartk.com/jszip> + +(c) 2009-2014 Stuart Knightley <stuart [at] stuartk.com> +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/master/LICENSE + +The MIT License +=============== + +Copyright (c) 2009-2016 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +*/ +function initJsZip() +{ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +'use strict'; +var DataReader = require('./dataReader'); + +function ArrayReader(data) { + if (data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + this.zero = 0; + + for(var i = 0; i < this.data.length; i++) { + data[i] = data[i] & 0xFF; + } + } +} +ArrayReader.prototype = new DataReader(); +/** + * @see DataReader.byteAt + */ +ArrayReader.prototype.byteAt = function(i) { + return this.data[this.zero + i]; +}; +/** + * @see DataReader.lastIndexOfSignature + */ +ArrayReader.prototype.lastIndexOfSignature = function(sig) { + var sig0 = sig.charCodeAt(0), + sig1 = sig.charCodeAt(1), + sig2 = sig.charCodeAt(2), + sig3 = sig.charCodeAt(3); + for (var i = this.length - 4; i >= 0; --i) { + if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { + return i - this.zero; + } + } + + return -1; +}; +/** + * @see DataReader.readData + */ +ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + return []; + } + var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = ArrayReader; + +},{"./dataReader":6}],2:[function(require,module,exports){ +'use strict'; +// private property +var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + + +// public method for encoding +exports.encode = function(input, utf8) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } + else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); + + } + + return output; +}; + +// public method for decoding +exports.decode = function(input, utf8) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = _keyStr.indexOf(input.charAt(i++)); + enc2 = _keyStr.indexOf(input.charAt(i++)); + enc3 = _keyStr.indexOf(input.charAt(i++)); + enc4 = _keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + return output; + +}; + +},{}],3:[function(require,module,exports){ +'use strict'; +function CompressedObject() { + this.compressedSize = 0; + this.uncompressedSize = 0; + this.crc32 = 0; + this.compressionMethod = null; + this.compressedContent = null; +} + +CompressedObject.prototype = { + /** + * Return the decompressed content in an unspecified format. + * The format will depend on the decompressor. + * @return {Object} the decompressed content. + */ + getContent: function() { + return null; // see implementation + }, + /** + * Return the compressed content in an unspecified format. + * The format will depend on the compressed conten source. + * @return {Object} the compressed content. + */ + getCompressedContent: function() { + return null; // see implementation + } +}; +module.exports = CompressedObject; + +},{}],4:[function(require,module,exports){ +'use strict'; +exports.STORE = { + magic: "\x00\x00", + compress: function(content, compressionOptions) { + return content; // no compression + }, + uncompress: function(content) { + return content; // no compression + }, + compressInputType: null, + uncompressInputType: null +}; +exports.DEFLATE = require('./flate'); + +},{"./flate":9}],5:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); + +var table = [ + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +]; + +/** + * + * Javascript crc32 + * http://www.webtoolkit.info/ + * + */ +module.exports = function crc32(input, crc) { + if (typeof input === "undefined" || !input.length) { + return 0; + } + + var isArray = utils.getTypeOf(input) !== "string"; + + if (typeof(crc) == "undefined") { + crc = 0; + } + var x = 0; + var y = 0; + var b = 0; + + crc = crc ^ (-1); + for (var i = 0, iTop = input.length; i < iTop; i++) { + b = isArray ? input[i] : input.charCodeAt(i); + y = (crc ^ b) & 0xFF; + x = table[y]; + crc = (crc >>> 8) ^ x; + } + + return crc ^ (-1); +}; +// vim: set shiftwidth=4 softtabstop=4: + +},{"./utils":22}],6:[function(require,module,exports){ +'use strict'; +var utils = require('./utils'); + +function DataReader(data) { + this.data = null; // type : see implementation + this.length = 0; + this.index = 0; + this.zero = 0; +} +DataReader.prototype = { + /** + * Check that the offset will not go too far. + * @param {string} offset the additional offset to check. + * @throws {Error} an Error if the offset is out of bounds. + */ + checkOffset: function(offset) { + this.checkIndex(this.index + offset); + }, + /** + * Check that the specifed index will not be too far. + * @param {string} newIndex the index to check. + * @throws {Error} an Error if the index is out of bounds. + */ + checkIndex: function(newIndex) { + if (this.length < this.zero + newIndex || newIndex < 0) { + throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); + } + }, + /** + * Change the index. + * @param {number} newIndex The new index. + * @throws {Error} if the new index is out of the data. + */ + setIndex: function(newIndex) { + this.checkIndex(newIndex); + this.index = newIndex; + }, + /** + * Skip the next n bytes. + * @param {number} n the number of bytes to skip. + * @throws {Error} if the new index is out of the data. + */ + skip: function(n) { + this.setIndex(this.index + n); + }, + /** + * Get the byte at the specified index. + * @param {number} i the index to use. + * @return {number} a byte. + */ + byteAt: function(i) { + // see implementations + }, + /** + * Get the next number with a given byte size. + * @param {number} size the number of bytes to read. + * @return {number} the corresponding number. + */ + readInt: function(size) { + var result = 0, + i; + this.checkOffset(size); + for (i = this.index + size - 1; i >= this.index; i--) { + result = (result << 8) + this.byteAt(i); + } + this.index += size; + return result; + }, + /** + * Get the next string with a given byte size. + * @param {number} size the number of bytes to read. + * @return {string} the corresponding string. + */ + readString: function(size) { + return utils.transformTo("string", this.readData(size)); + }, + /** + * Get raw data without conversion, <size> bytes. + * @param {number} size the number of bytes to read. + * @return {Object} the raw data, implementation specific. + */ + readData: function(size) { + // see implementations + }, + /** + * Find the last occurence of a zip signature (4 bytes). + * @param {string} sig the signature to find. + * @return {number} the index of the last occurence, -1 if not found. + */ + lastIndexOfSignature: function(sig) { + // see implementations + }, + /** + * Get the next date. + * @return {Date} the date. + */ + readDate: function() { + var dostime = this.readInt(4); + return new Date( + ((dostime >> 25) & 0x7f) + 1980, // year + ((dostime >> 21) & 0x0f) - 1, // month + (dostime >> 16) & 0x1f, // day + (dostime >> 11) & 0x1f, // hour + (dostime >> 5) & 0x3f, // minute + (dostime & 0x1f) << 1); // second + } +}; +module.exports = DataReader; + +},{"./utils":22}],7:[function(require,module,exports){ +'use strict'; +exports.base64 = false; +exports.binary = false; +exports.dir = false; +exports.createFolders = false; +exports.date = null; +exports.compression = null; +exports.compressionOptions = null; +exports.comment = null; +exports.unixPermissions = null; +exports.dosPermissions = null; + +},{}],8:[function(require,module,exports){ +'use strict'; +var utils = require('./utils'); + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2binary = function(str) { + return utils.string2binary(str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2Uint8Array = function(str) { + return utils.transformTo("uint8array", str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.uint8Array2String = function(array) { + return utils.transformTo("string", array); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2Blob = function(str) { + var buffer = utils.transformTo("arraybuffer", str); + return utils.arrayBuffer2Blob(buffer); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.arrayBuffer2Blob = function(buffer) { + return utils.arrayBuffer2Blob(buffer); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.transformTo = function(outputType, input) { + return utils.transformTo(outputType, input); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.getTypeOf = function(input) { + return utils.getTypeOf(input); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.checkSupport = function(type) { + return utils.checkSupport(type); +}; + +/** + * @deprecated + * This value will be removed in a future version without replacement. + */ +exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; + +/** + * @deprecated + * This value will be removed in a future version without replacement. + */ +exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; + + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.pretty = function(str) { + return utils.pretty(str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.findCompression = function(compressionMethod) { + return utils.findCompression(compressionMethod); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.isRegExp = function (object) { + return utils.isRegExp(object); +}; + + +},{"./utils":22}],9:[function(require,module,exports){ +'use strict'; +var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); + +var pako = require("pako"); +exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; +exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; + +exports.magic = "\x08\x00"; +exports.compress = function(input, compressionOptions) { + return pako.deflateRaw(input, { + level : compressionOptions.level || -1 // default compression + }); +}; +exports.uncompress = function(input) { + return pako.inflateRaw(input); +}; + +},{"pako":25}],10:[function(require,module,exports){ +'use strict'; + +var base64 = require('./base64'); + +/** +Usage: + zip = new JSZip(); + zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); + zip.folder("images").file("smile.gif", base64Data, {base64: true}); + zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); + zip.remove("tempfile"); + + base64zip = zip.generate(); + +**/ + +/** + * Representation a of zip file in js + * @constructor + * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional). + * @param {Object=} options the options for creating this objects (optional). + */ +function JSZip(data, options) { + // if this constructor is used without `new`, it adds `new` before itself: + if(!(this instanceof JSZip)) return new JSZip(data, options); + + // object containing the files : + // { + // "folder/" : {...}, + // "folder/data.txt" : {...} + // } + this.files = {}; + + this.comment = null; + + // Where we are in the hierarchy + this.root = ""; + if (data) { + this.load(data, options); + } + this.clone = function() { + var newObj = new JSZip(); + for (var i in this) { + if (typeof this[i] !== "function") { + newObj[i] = this[i]; + } + } + return newObj; + }; +} +JSZip.prototype = require('./object'); +JSZip.prototype.load = require('./load'); +JSZip.support = require('./support'); +JSZip.defaults = require('./defaults'); + +/** + * @deprecated + * This namespace will be removed in a future version without replacement. + */ +JSZip.utils = require('./deprecatedPublicUtils'); + +JSZip.base64 = { + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + encode : function(input) { + return base64.encode(input); + }, + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + decode : function(input) { + return base64.decode(input); + } +}; +JSZip.compressions = require('./compressions'); +module.exports = JSZip; + +},{"./base64":2,"./compressions":4,"./defaults":7,"./deprecatedPublicUtils":8,"./load":11,"./object":14,"./support":18}],11:[function(require,module,exports){ +'use strict'; +var base64 = require('./base64'); +var utf8 = require('./utf8'); +var utils = require('./utils'); +var ZipEntries = require('./zipEntries'); +module.exports = function(data, options) { + var files, zipEntries, i, input; + options = utils.extend(options || {}, { + base64: false, + checkCRC32: false, + optimizedBinaryString : false, + createFolders: false, + decodeFileName: utf8.utf8decode + }); + if (options.base64) { + data = base64.decode(data); + } + + zipEntries = new ZipEntries(data, options); + files = zipEntries.files; + for (i = 0; i < files.length; i++) { + input = files[i]; + this.file(input.fileNameStr, input.decompressed, { + binary: true, + optimizedBinaryString: true, + date: input.date, + dir: input.dir, + comment : input.fileCommentStr.length ? input.fileCommentStr : null, + unixPermissions : input.unixPermissions, + dosPermissions : input.dosPermissions, + createFolders: options.createFolders + }); + } + if (zipEntries.zipComment.length) { + this.comment = zipEntries.zipComment; + } + + return this; +}; + +},{"./base64":2,"./utf8":21,"./utils":22,"./zipEntries":23}],12:[function(require,module,exports){ +(function (Buffer){ +'use strict'; +module.exports = function(data, encoding){ + return new Buffer(data, encoding); +}; +module.exports.test = function(b){ + return Buffer.isBuffer(b); +}; + +}).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) +},{}],13:[function(require,module,exports){ +'use strict'; +var Uint8ArrayReader = require('./uint8ArrayReader'); + +function NodeBufferReader(data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + this.zero = 0; +} +NodeBufferReader.prototype = new Uint8ArrayReader(); + +/** + * @see DataReader.readData + */ +NodeBufferReader.prototype.readData = function(size) { + this.checkOffset(size); + var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = NodeBufferReader; + +},{"./uint8ArrayReader":19}],14:[function(require,module,exports){ +'use strict'; +var support = require('./support'); +var utils = require('./utils'); +var crc32 = require('./crc32'); +var signature = require('./signature'); +var defaults = require('./defaults'); +var base64 = require('./base64'); +var compressions = require('./compressions'); +var CompressedObject = require('./compressedObject'); +var nodeBuffer = require('./nodeBuffer'); +var utf8 = require('./utf8'); +var StringWriter = require('./stringWriter'); +var Uint8ArrayWriter = require('./uint8ArrayWriter'); + +/** + * Returns the raw data of a ZipObject, decompress the content if necessary. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ +var getRawData = function(file) { + if (file._data instanceof CompressedObject) { + file._data = file._data.getContent(); + file.options.binary = true; + file.options.base64 = false; + + if (utils.getTypeOf(file._data) === "uint8array") { + var copy = file._data; + // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. + // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). + file._data = new Uint8Array(copy.length); + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + if (copy.length !== 0) { + file._data.set(copy, 0); + } + } + } + return file._data; +}; + +/** + * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ +var getBinaryData = function(file) { + var result = getRawData(file), + type = utils.getTypeOf(result); + if (type === "string") { + if (!file.options.binary) { + // unicode text ! + // unicode string => binary string is a painful process, check if we can avoid it. + if (support.nodebuffer) { + return nodeBuffer(result, "utf-8"); + } + } + return file.asBinary(); + } + return result; +}; + +/** + * Transform this._data into a string. + * @param {function} filter a function String -> String, applied if not null on the result. + * @return {String} the string representing this._data. + */ +var dataToString = function(asUTF8) { + var result = getRawData(this); + if (result === null || typeof result === "undefined") { + return ""; + } + // if the data is a base64 string, we decode it before checking the encoding ! + if (this.options.base64) { + result = base64.decode(result); + } + if (asUTF8 && this.options.binary) { + // JSZip.prototype.utf8decode supports arrays as input + // skip to array => string step, utf8decode will do it. + result = out.utf8decode(result); + } + else { + // no utf8 transformation, do the array => string step. + result = utils.transformTo("string", result); + } + + if (!asUTF8 && !this.options.binary) { + result = utils.transformTo("string", out.utf8encode(result)); + } + return result; +}; +/** + * A simple object representing a file in the zip file. + * @constructor + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data + * @param {Object} options the options of the file + */ +var ZipObject = function(name, data, options) { + this.name = name; + this.dir = options.dir; + this.date = options.date; + this.comment = options.comment; + this.unixPermissions = options.unixPermissions; + this.dosPermissions = options.dosPermissions; + + this._data = data; + this.options = options; + + /* + * This object contains initial values for dir and date. + * With them, we can check if the user changed the deprecated metadata in + * `ZipObject#options` or not. + */ + this._initialMetadata = { + dir : options.dir, + date : options.date + }; +}; + +ZipObject.prototype = { + /** + * Return the content as UTF8 string. + * @return {string} the UTF8 string. + */ + asText: function() { + return dataToString.call(this, true); + }, + /** + * Returns the binary content. + * @return {string} the content as binary. + */ + asBinary: function() { + return dataToString.call(this, false); + }, + /** + * Returns the content as a nodejs Buffer. + * @return {Buffer} the content as a Buffer. + */ + asNodeBuffer: function() { + var result = getBinaryData(this); + return utils.transformTo("nodebuffer", result); + }, + /** + * Returns the content as an Uint8Array. + * @return {Uint8Array} the content as an Uint8Array. + */ + asUint8Array: function() { + var result = getBinaryData(this); + return utils.transformTo("uint8array", result); + }, + /** + * Returns the content as an ArrayBuffer. + * @return {ArrayBuffer} the content as an ArrayBufer. + */ + asArrayBuffer: function() { + return this.asUint8Array().buffer; + } +}; + +/** + * Transform an integer into a string in hexadecimal. + * @private + * @param {number} dec the number to convert. + * @param {number} bytes the number of bytes to generate. + * @returns {string} the result. + */ +var decToHex = function(dec, bytes) { + var hex = "", + i; + for (i = 0; i < bytes; i++) { + hex += String.fromCharCode(dec & 0xff); + dec = dec >>> 8; + } + return hex; +}; + +/** + * Transforms the (incomplete) options from the user into the complete + * set of options to create a file. + * @private + * @param {Object} o the options from the user. + * @return {Object} the complete set of options. + */ +var prepareFileAttrs = function(o) { + o = o || {}; + if (o.base64 === true && (o.binary === null || o.binary === undefined)) { + o.binary = true; + } + o = utils.extend(o, defaults); + o.date = o.date || new Date(); + if (o.compression !== null) o.compression = o.compression.toUpperCase(); + + return o; +}; + +/** + * Add a file in the current folder. + * @private + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file + * @param {Object} o the options of the file + * @return {Object} the new file. + */ +var fileAdd = function(name, data, o) { + // be sure sub folders exist + var dataType = utils.getTypeOf(data), + parent; + + o = prepareFileAttrs(o); + + if (typeof o.unixPermissions === "string") { + o.unixPermissions = parseInt(o.unixPermissions, 8); + } + + // UNX_IFDIR 0040000 see zipinfo.c + if (o.unixPermissions && (o.unixPermissions & 0x4000)) { + o.dir = true; + } + // Bit 4 Directory + if (o.dosPermissions && (o.dosPermissions & 0x0010)) { + o.dir = true; + } + + if (o.dir) { + name = forceTrailingSlash(name); + } + + if (o.createFolders && (parent = parentFolder(name))) { + folderAdd.call(this, parent, true); + } + + if (o.dir || data === null || typeof data === "undefined") { + o.base64 = false; + o.binary = false; + data = null; + dataType = null; + } + else if (dataType === "string") { + if (o.binary && !o.base64) { + // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask + if (o.optimizedBinaryString !== true) { + // this is a string, not in a base64 format. + // Be sure that this is a correct "binary string" + data = utils.string2binary(data); + } + } + } + else { // arraybuffer, uint8array, ... + o.base64 = false; + o.binary = true; + + if (!dataType && !(data instanceof CompressedObject)) { + throw new Error("The data of '" + name + "' is in an unsupported format !"); + } + + // special case : it's way easier to work with Uint8Array than with ArrayBuffer + if (dataType === "arraybuffer") { + data = utils.transformTo("uint8array", data); + } + } + + var object = new ZipObject(name, data, o); + this.files[name] = object; + return object; +}; + +/** + * Find the parent folder of the path. + * @private + * @param {string} path the path to use + * @return {string} the parent folder, or "" + */ +var parentFolder = function (path) { + if (path.slice(-1) == '/') { + path = path.substring(0, path.length - 1); + } + var lastSlash = path.lastIndexOf('/'); + return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; +}; + + +/** + * Returns the path with a slash at the end. + * @private + * @param {String} path the path to check. + * @return {String} the path with a trailing slash. + */ +var forceTrailingSlash = function(path) { + // Check the name ends with a / + if (path.slice(-1) != "/") { + path += "/"; // IE doesn't like substr(-1) + } + return path; +}; +/** + * Add a (sub) folder in the current folder. + * @private + * @param {string} name the folder's name + * @param {boolean=} [createFolders] If true, automatically create sub + * folders. Defaults to false. + * @return {Object} the new folder. + */ +var folderAdd = function(name, createFolders) { + createFolders = (typeof createFolders !== 'undefined') ? createFolders : false; + + name = forceTrailingSlash(name); + + // Does this folder already exist? + if (!this.files[name]) { + fileAdd.call(this, name, null, { + dir: true, + createFolders: createFolders + }); + } + return this.files[name]; +}; + +/** + * Generate a JSZip.CompressedObject for a given zipOject. + * @param {ZipObject} file the object to read. + * @param {JSZip.compression} compression the compression to use. + * @param {Object} compressionOptions the options to use when compressing. + * @return {JSZip.CompressedObject} the compressed result. + */ +var generateCompressedObjectFrom = function(file, compression, compressionOptions) { + var result = new CompressedObject(), + content; + + // the data has not been decompressed, we might reuse things ! + if (file._data instanceof CompressedObject) { + result.uncompressedSize = file._data.uncompressedSize; + result.crc32 = file._data.crc32; + + if (result.uncompressedSize === 0 || file.dir) { + compression = compressions['STORE']; + result.compressedContent = ""; + result.crc32 = 0; + } + else if (file._data.compressionMethod === compression.magic) { + result.compressedContent = file._data.getCompressedContent(); + } + else { + content = file._data.getContent(); + // need to decompress / recompress + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); + } + } + else { + // have uncompressed data + content = getBinaryData(file); + if (!content || content.length === 0 || file.dir) { + compression = compressions['STORE']; + content = ""; + } + result.uncompressedSize = content.length; + result.crc32 = crc32(content); + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); + } + + result.compressedSize = result.compressedContent.length; + result.compressionMethod = compression.magic; + + return result; +}; + + + + +/** + * Generate the UNIX part of the external file attributes. + * @param {Object} unixPermissions the unix permissions or null. + * @param {Boolean} isDir true if the entry is a directory, false otherwise. + * @return {Number} a 32 bit integer. + * + * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : + * + * TTTTsstrwxrwxrwx0000000000ADVSHR + * ^^^^____________________________ file type, see zipinfo.c (UNX_*) + * ^^^_________________________ setuid, setgid, sticky + * ^^^^^^^^^________________ permissions + * ^^^^^^^^^^______ not used ? + * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only + */ +var generateUnixExternalFileAttr = function (unixPermissions, isDir) { + + var result = unixPermissions; + if (!unixPermissions) { + // I can't use octal values in strict mode, hence the hexa. + // 040775 => 0x41fd + // 0100664 => 0x81b4 + result = isDir ? 0x41fd : 0x81b4; + } + + return (result & 0xFFFF) << 16; +}; + +/** + * Generate the DOS part of the external file attributes. + * @param {Object} dosPermissions the dos permissions or null. + * @param {Boolean} isDir true if the entry is a directory, false otherwise. + * @return {Number} a 32 bit integer. + * + * Bit 0 Read-Only + * Bit 1 Hidden + * Bit 2 System + * Bit 3 Volume Label + * Bit 4 Directory + * Bit 5 Archive + */ +var generateDosExternalFileAttr = function (dosPermissions, isDir) { + + // the dir flag is already set for compatibility + + return (dosPermissions || 0) & 0x3F; +}; + +/** + * Generate the various parts used in the construction of the final zip file. + * @param {string} name the file name. + * @param {ZipObject} file the file content. + * @param {JSZip.CompressedObject} compressedObject the compressed object. + * @param {number} offset the current offset from the start of the zip file. + * @param {String} platform let's pretend we are this platform (change platform dependents fields) + * @param {Function} encodeFileName the function to encode the file name / comment. + * @return {object} the zip parts. + */ +var generateZipParts = function(name, file, compressedObject, offset, platform, encodeFileName) { + var data = compressedObject.compressedContent, + useCustomEncoding = encodeFileName !== utf8.utf8encode, + encodedFileName = utils.transformTo("string", encodeFileName(file.name)), + utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), + comment = file.comment || "", + encodedComment = utils.transformTo("string", encodeFileName(comment)), + utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), + useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, + useUTF8ForComment = utfEncodedComment.length !== comment.length, + o = file.options, + dosTime, + dosDate, + extraFields = "", + unicodePathExtraField = "", + unicodeCommentExtraField = "", + dir, date; + + + // handle the deprecated options.dir + if (file._initialMetadata.dir !== file.dir) { + dir = file.dir; + } else { + dir = o.dir; + } + + // handle the deprecated options.date + if(file._initialMetadata.date !== file.date) { + date = file.date; + } else { + date = o.date; + } + + var extFileAttr = 0; + var versionMadeBy = 0; + if (dir) { + // dos or unix, we set the dos dir flag + extFileAttr |= 0x00010; + } + if(platform === "UNIX") { + versionMadeBy = 0x031E; // UNIX, version 3.0 + extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); + } else { // DOS or other, fallback to DOS + versionMadeBy = 0x0014; // DOS, version 2.0 + extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); + } + + // date + // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html + + dosTime = date.getHours(); + dosTime = dosTime << 6; + dosTime = dosTime | date.getMinutes(); + dosTime = dosTime << 5; + dosTime = dosTime | date.getSeconds() / 2; + + dosDate = date.getFullYear() - 1980; + dosDate = dosDate << 4; + dosDate = dosDate | (date.getMonth() + 1); + dosDate = dosDate << 5; + dosDate = dosDate | date.getDate(); + + if (useUTF8ForFileName) { + // set the unicode path extra field. unzip needs at least one extra + // field to correctly handle unicode path, so using the path is as good + // as any other information. This could improve the situation with + // other archive managers too. + // This field is usually used without the utf8 flag, with a non + // unicode path in the header (winrar, winzip). This helps (a bit) + // with the messy Windows' default compressed folders feature but + // breaks on p7zip which doesn't seek the unicode path extra field. + // So for now, UTF-8 everywhere ! + unicodePathExtraField = + // Version + decToHex(1, 1) + + // NameCRC32 + decToHex(crc32(encodedFileName), 4) + + // UnicodeName + utfEncodedFileName; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x70" + + // size + decToHex(unicodePathExtraField.length, 2) + + // content + unicodePathExtraField; + } + + if(useUTF8ForComment) { + + unicodeCommentExtraField = + // Version + decToHex(1, 1) + + // CommentCRC32 + decToHex(this.crc32(encodedComment), 4) + + // UnicodeName + utfEncodedComment; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x63" + + // size + decToHex(unicodeCommentExtraField.length, 2) + + // content + unicodeCommentExtraField; + } + + var header = ""; + + // version needed to extract + header += "\x0A\x00"; + // general purpose bit flag + // set bit 11 if utf8 + header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00"; + // compression method + header += compressedObject.compressionMethod; + // last mod file time + header += decToHex(dosTime, 2); + // last mod file date + header += decToHex(dosDate, 2); + // crc-32 + header += decToHex(compressedObject.crc32, 4); + // compressed size + header += decToHex(compressedObject.compressedSize, 4); + // uncompressed size + header += decToHex(compressedObject.uncompressedSize, 4); + // file name length + header += decToHex(encodedFileName.length, 2); + // extra field length + header += decToHex(extraFields.length, 2); + + + var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; + + var dirRecord = signature.CENTRAL_FILE_HEADER + + // version made by (00: DOS) + decToHex(versionMadeBy, 2) + + // file header (common to file and central directory) + header + + // file comment length + decToHex(encodedComment.length, 2) + + // disk number start + "\x00\x00" + + // internal file attributes TODO + "\x00\x00" + + // external file attributes + decToHex(extFileAttr, 4) + + // relative offset of local header + decToHex(offset, 4) + + // file name + encodedFileName + + // extra field + extraFields + + // file comment + encodedComment; + + return { + fileRecord: fileRecord, + dirRecord: dirRecord, + compressedObject: compressedObject + }; +}; + + +// return the actual prototype of JSZip +var out = { + /** + * Read an existing zip and merge the data in the current JSZip object. + * The implementation is in jszip-load.js, don't forget to include it. + * @param {String|ArrayBuffer|Uint8Array|Buffer} stream The stream to load + * @param {Object} options Options for loading the stream. + * options.base64 : is the stream in base64 ? default : false + * @return {JSZip} the current JSZip object + */ + load: function(stream, options) { + throw new Error("Load method is not defined. Is the file jszip-load.js included ?"); + }, + + /** + * Filter nested files/folders with the specified function. + * @param {Function} search the predicate to use : + * function (relativePath, file) {...} + * It takes 2 arguments : the relative path and the file. + * @return {Array} An array of matching elements. + */ + filter: function(search) { + var result = [], + filename, relativePath, file, fileClone; + for (filename in this.files) { + if (!this.files.hasOwnProperty(filename)) { + continue; + } + file = this.files[filename]; + // return a new object, don't let the user mess with our internal objects :) + fileClone = new ZipObject(file.name, file._data, utils.extend(file.options)); + relativePath = filename.slice(this.root.length, filename.length); + if (filename.slice(0, this.root.length) === this.root && // the file is in the current root + search(relativePath, fileClone)) { // and the file matches the function + result.push(fileClone); + } + } + return result; + }, + + /** + * Add a file to the zip file, or search a file. + * @param {string|RegExp} name The name of the file to add (if data is defined), + * the name of the file to find (if no data) or a regex to match files. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded + * @param {Object} o File options + * @return {JSZip|Object|Array} this JSZip object (when adding a file), + * a file (when searching by string) or an array of files (when searching by regex). + */ + file: function(name, data, o) { + if (arguments.length === 1) { + if (utils.isRegExp(name)) { + var regexp = name; + return this.filter(function(relativePath, file) { + return !file.dir && regexp.test(relativePath); + }); + } + else { // text + return this.filter(function(relativePath, file) { + return !file.dir && relativePath === name; + })[0] || null; + } + } + else { // more than one argument : we have data ! + name = this.root + name; + fileAdd.call(this, name, data, o); + } + return this; + }, + + /** + * Add a directory to the zip file, or search. + * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. + * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. + */ + folder: function(arg) { + if (!arg) { + return this; + } + + if (utils.isRegExp(arg)) { + return this.filter(function(relativePath, file) { + return file.dir && arg.test(relativePath); + }); + } + + // else, name is a new folder + var name = this.root + arg; + var newFolder = folderAdd.call(this, name); + + // Allow chaining by returning a new object with this folder as the root + var ret = this.clone(); + ret.root = newFolder.name; + return ret; + }, + + /** + * Delete a file, or a directory and all sub-files, from the zip + * @param {string} name the name of the file to delete + * @return {JSZip} this JSZip object + */ + remove: function(name) { + name = this.root + name; + var file = this.files[name]; + if (!file) { + // Look for any folders + if (name.slice(-1) != "/") { + name += "/"; + } + file = this.files[name]; + } + + if (file && !file.dir) { + // file + delete this.files[name]; + } else { + // maybe a folder, delete recursively + var kids = this.filter(function(relativePath, file) { + return file.name.slice(0, name.length) === name; + }); + for (var i = 0; i < kids.length; i++) { + delete this.files[kids[i].name]; + } + } + + return this; + }, + + /** + * Generate the complete zip file + * @param {Object} options the options to generate the zip file : + * - base64, (deprecated, use type instead) true to generate base64. + * - compression, "STORE" by default. + * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. + * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file + */ + generate: function(options) { + options = utils.extend(options || {}, { + base64: true, + compression: "STORE", + compressionOptions : null, + type: "base64", + platform: "DOS", + comment: null, + mimeType: 'application/zip', + encodeFileName: utf8.utf8encode + }); + + utils.checkSupport(options.type); + + // accept nodejs `process.platform` + if( + options.platform === 'darwin' || + options.platform === 'freebsd' || + options.platform === 'linux' || + options.platform === 'sunos' + ) { + options.platform = "UNIX"; + } + if (options.platform === 'win32') { + options.platform = "DOS"; + } + + var zipData = [], + localDirLength = 0, + centralDirLength = 0, + writer, i, + encodedComment = utils.transformTo("string", options.encodeFileName(options.comment || this.comment || "")); + + // first, generate all the zip parts. + for (var name in this.files) { + if (!this.files.hasOwnProperty(name)) { + continue; + } + var file = this.files[name]; + + var compressionName = file.options.compression || options.compression.toUpperCase(); + var compression = compressions[compressionName]; + if (!compression) { + throw new Error(compressionName + " is not a valid compression method !"); + } + var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; + + var compressedObject = generateCompressedObjectFrom.call(this, file, compression, compressionOptions); + + var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength, options.platform, options.encodeFileName); + localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; + centralDirLength += zipPart.dirRecord.length; + zipData.push(zipPart); + } + + var dirEnd = ""; + + // end of central dir signature + dirEnd = signature.CENTRAL_DIRECTORY_END + + // number of this disk + "\x00\x00" + + // number of the disk with the start of the central directory + "\x00\x00" + + // total number of entries in the central directory on this disk + decToHex(zipData.length, 2) + + // total number of entries in the central directory + decToHex(zipData.length, 2) + + // size of the central directory 4 bytes + decToHex(centralDirLength, 4) + + // offset of start of central directory with respect to the starting disk number + decToHex(localDirLength, 4) + + // .ZIP file comment length + decToHex(encodedComment.length, 2) + + // .ZIP file comment + encodedComment; + + + // we have all the parts (and the total length) + // time to create a writer ! + var typeName = options.type.toLowerCase(); + if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { + writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); + }else{ + writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); + } + + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].fileRecord); + writer.append(zipData[i].compressedObject.compressedContent); + } + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].dirRecord); + } + + writer.append(dirEnd); + + var zip = writer.finalize(); + + + + switch(options.type.toLowerCase()) { + // case "zip is an Uint8Array" + case "uint8array" : + case "arraybuffer" : + case "nodebuffer" : + return utils.transformTo(options.type.toLowerCase(), zip); + case "blob" : + return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip), options.mimeType); + // case "zip is a string" + case "base64" : + return (options.base64) ? base64.encode(zip) : zip; + default : // case "string" : + return zip; + } + + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + crc32: function (input, crc) { + return crc32(input, crc); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8encode: function (string) { + return utils.transformTo("string", utf8.utf8encode(string)); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8decode: function (input) { + return utf8.utf8decode(input); + } +}; +module.exports = out; + +},{"./base64":2,"./compressedObject":3,"./compressions":4,"./crc32":5,"./defaults":7,"./nodeBuffer":12,"./signature":15,"./stringWriter":17,"./support":18,"./uint8ArrayWriter":20,"./utf8":21,"./utils":22}],15:[function(require,module,exports){ +'use strict'; +exports.LOCAL_FILE_HEADER = "PK\x03\x04"; +exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; +exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; +exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; +exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; +exports.DATA_DESCRIPTOR = "PK\x07\x08"; + +},{}],16:[function(require,module,exports){ +'use strict'; +var DataReader = require('./dataReader'); +var utils = require('./utils'); + +function StringReader(data, optimizedBinaryString) { + this.data = data; + if (!optimizedBinaryString) { + this.data = utils.string2binary(this.data); + } + this.length = this.data.length; + this.index = 0; + this.zero = 0; +} +StringReader.prototype = new DataReader(); +/** + * @see DataReader.byteAt + */ +StringReader.prototype.byteAt = function(i) { + return this.data.charCodeAt(this.zero + i); +}; +/** + * @see DataReader.lastIndexOfSignature + */ +StringReader.prototype.lastIndexOfSignature = function(sig) { + return this.data.lastIndexOf(sig) - this.zero; +}; +/** + * @see DataReader.readData + */ +StringReader.prototype.readData = function(size) { + this.checkOffset(size); + // this will work because the constructor applied the "& 0xff" mask. + var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = StringReader; + +},{"./dataReader":6,"./utils":22}],17:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); + +/** + * An object to write any content to a string. + * @constructor + */ +var StringWriter = function() { + this.data = []; +}; +StringWriter.prototype = { + /** + * Append any content to the current string. + * @param {Object} input the content to add. + */ + append: function(input) { + input = utils.transformTo("string", input); + this.data.push(input); + }, + /** + * Finalize the construction an return the result. + * @return {string} the generated string. + */ + finalize: function() { + return this.data.join(""); + } +}; + +module.exports = StringWriter; + +},{"./utils":22}],18:[function(require,module,exports){ +(function (Buffer){ +'use strict'; +exports.base64 = true; +exports.array = true; +exports.string = true; +exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; +// contains true if JSZip can read/generate nodejs Buffer, false otherwise. +// Browserify will provide a Buffer implementation for browsers, which is +// an augmented Uint8Array (i.e., can be used as either Buffer or U8). +exports.nodebuffer = typeof Buffer !== "undefined"; +// contains true if JSZip can read/generate Uint8Array, false otherwise. +exports.uint8array = typeof Uint8Array !== "undefined"; + +if (typeof ArrayBuffer === "undefined") { + exports.blob = false; +} +else { + var buffer = new ArrayBuffer(0); + try { + exports.blob = new Blob([buffer], { + type: "application/zip" + }).size === 0; + } + catch (e) { + try { + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + exports.blob = builder.getBlob('application/zip').size === 0; + } + catch (e) { + exports.blob = false; + } + } +} + +}).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) +},{}],19:[function(require,module,exports){ +'use strict'; +var ArrayReader = require('./arrayReader'); + +function Uint8ArrayReader(data) { + if (data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + this.zero = 0; + } +} +Uint8ArrayReader.prototype = new ArrayReader(); +/** + * @see DataReader.readData + */ +Uint8ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. + return new Uint8Array(0); + } + var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = Uint8ArrayReader; + +},{"./arrayReader":1}],20:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); + +/** + * An object to write any content to an Uint8Array. + * @constructor + * @param {number} length The length of the array. + */ +var Uint8ArrayWriter = function(length) { + this.data = new Uint8Array(length); + this.index = 0; +}; +Uint8ArrayWriter.prototype = { + /** + * Append any content to the current array. + * @param {Object} input the content to add. + */ + append: function(input) { + if (input.length !== 0) { + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + input = utils.transformTo("uint8array", input); + this.data.set(input, this.index); + this.index += input.length; + } + }, + /** + * Finalize the construction an return the result. + * @return {Uint8Array} the generated array. + */ + finalize: function() { + return this.data; + } +}; + +module.exports = Uint8ArrayWriter; + +},{"./utils":22}],21:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); +var support = require('./support'); +var nodeBuffer = require('./nodeBuffer'); + +/** + * The following functions come from pako, from pako/lib/utils/strings + * released under the MIT license, see pako https://github.com/nodeca/pako/ + */ + +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff +var _utf8len = new Array(256); +for (var i=0; i<256; i++) { + _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); +} +_utf8len[254]=_utf8len[254]=1; // Invalid sequence start + +// convert string to array (typed, when possible) +var string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + if (support.uint8array) { + buf = new Uint8Array(buf_len); + } else { + buf = new Array(buf_len); + } + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; +}; + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +var utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; + +// convert array to string +var buf2string = function (buf) { + var str, i, out, c, c_len; + var len = buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i<len;) { + c = buf[i++]; + // quick process ascii + if (c < 0x80) { utf16buf[out++] = c; continue; } + + c_len = _utf8len[c]; + // skip 5 & 6 byte codes + if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + // shrinkBuf(utf16buf, out) + if (utf16buf.length !== out) { + if(utf16buf.subarray) { + utf16buf = utf16buf.subarray(0, out); + } else { + utf16buf.length = out; + } + } + + // return String.fromCharCode.apply(null, utf16buf); + return utils.applyFromCharCode(utf16buf); +}; + + +// That's all for the pako functions. + + +/** + * Transform a javascript string into an array (typed if possible) of bytes, + * UTF-8 encoded. + * @param {String} str the string to encode + * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. + */ +exports.utf8encode = function utf8encode(str) { + if (support.nodebuffer) { + return nodeBuffer(str, "utf-8"); + } + + return string2buf(str); +}; + + +/** + * Transform a bytes array (or a representation) representing an UTF-8 encoded + * string into a javascript string. + * @param {Array|Uint8Array|Buffer} buf the data de decode + * @return {String} the decoded string. + */ +exports.utf8decode = function utf8decode(buf) { + if (support.nodebuffer) { + return utils.transformTo("nodebuffer", buf).toString("utf-8"); + } + + buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); + + // return buf2string(buf); + // Chrome prefers to work with "small" chunks of data + // for the method buf2string. + // Firefox and Chrome has their own shortcut, IE doesn't seem to really care. + var result = [], k = 0, len = buf.length, chunk = 65536; + while (k < len) { + var nextBoundary = utf8border(buf, Math.min(k + chunk, len)); + if (support.uint8array) { + result.push(buf2string(buf.subarray(k, nextBoundary))); + } else { + result.push(buf2string(buf.slice(k, nextBoundary))); + } + k = nextBoundary; + } + return result.join(""); + +}; +// vim: set shiftwidth=4 softtabstop=4: + +},{"./nodeBuffer":12,"./support":18,"./utils":22}],22:[function(require,module,exports){ +'use strict'; +var support = require('./support'); +var compressions = require('./compressions'); +var nodeBuffer = require('./nodeBuffer'); +/** + * Convert a string to a "binary string" : a string containing only char codes between 0 and 255. + * @param {string} str the string to transform. + * @return {String} the binary string. + */ +exports.string2binary = function(str) { + var result = ""; + for (var i = 0; i < str.length; i++) { + result += String.fromCharCode(str.charCodeAt(i) & 0xff); + } + return result; +}; +exports.arrayBuffer2Blob = function(buffer, mimeType) { + exports.checkSupport("blob"); + mimeType = mimeType || 'application/zip'; + + try { + // Blob constructor + return new Blob([buffer], { + type: mimeType + }); + } + catch (e) { + + try { + // deprecated, browser only, old way + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + return builder.getBlob(mimeType); + } + catch (e) { + + // well, fuck ?! + throw new Error("Bug : can't construct the Blob."); + } + } + + +}; +/** + * The identity function. + * @param {Object} input the input. + * @return {Object} the same input. + */ +function identity(input) { + return input; +} + +/** + * Fill in an array with a string. + * @param {String} str the string to use. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. + */ +function stringToArrayLike(str, array) { + for (var i = 0; i < str.length; ++i) { + array[i] = str.charCodeAt(i) & 0xFF; + } + return array; +} + +/** + * Transform an array-like object to a string. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @return {String} the result. + */ +function arrayLikeToString(array) { + // Performances notes : + // -------------------- + // String.fromCharCode.apply(null, array) is the fastest, see + // see http://jsperf.com/converting-a-uint8array-to-a-string/2 + // but the stack is limited (and we can get huge arrays !). + // + // result += String.fromCharCode(array[i]); generate too many strings ! + // + // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 + var chunk = 65536; + var result = [], + len = array.length, + type = exports.getTypeOf(array), + k = 0, + canUseApply = true; + try { + switch(type) { + case "uint8array": + String.fromCharCode.apply(null, new Uint8Array(0)); + break; + case "nodebuffer": + String.fromCharCode.apply(null, nodeBuffer(0)); + break; + } + } catch(e) { + canUseApply = false; + } + + // no apply : slow and painful algorithm + // default browser on android 4.* + if (!canUseApply) { + var resultStr = ""; + for(var i = 0; i < array.length;i++) { + resultStr += String.fromCharCode(array[i]); + } + return resultStr; + } + while (k < len && chunk > 1) { + try { + if (type === "array" || type === "nodebuffer") { + result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + } + else { + result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + } + k += chunk; + } + catch (e) { + chunk = Math.floor(chunk / 2); + } + } + return result.join(""); +} + +exports.applyFromCharCode = arrayLikeToString; + + +/** + * Copy the data from an array-like to an other array-like. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. + */ +function arrayLikeToArrayLike(arrayFrom, arrayTo) { + for (var i = 0; i < arrayFrom.length; i++) { + arrayTo[i] = arrayFrom[i]; + } + return arrayTo; +} + +// a matrix containing functions to transform everything into everything. +var transform = {}; + +// string to ? +transform["string"] = { + "string": identity, + "array": function(input) { + return stringToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["string"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return stringToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": function(input) { + return stringToArrayLike(input, nodeBuffer(input.length)); + } +}; + +// array to ? +transform["array"] = { + "string": arrayLikeToString, + "array": identity, + "arraybuffer": function(input) { + return (new Uint8Array(input)).buffer; + }, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(input); + } +}; + +// arraybuffer to ? +transform["arraybuffer"] = { + "string": function(input) { + return arrayLikeToString(new Uint8Array(input)); + }, + "array": function(input) { + return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); + }, + "arraybuffer": identity, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(new Uint8Array(input)); + } +}; + +// uint8array to ? +transform["uint8array"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return input.buffer; + }, + "uint8array": identity, + "nodebuffer": function(input) { + return nodeBuffer(input); + } +}; + +// nodebuffer to ? +transform["nodebuffer"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["nodebuffer"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return arrayLikeToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": identity +}; + +/** + * Transform an input into any type. + * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. + * If no output type is specified, the unmodified input will be returned. + * @param {String} outputType the output type. + * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. + * @throws {Error} an Error if the browser doesn't support the requested output type. + */ +exports.transformTo = function(outputType, input) { + if (!input) { + // undefined, null, etc + // an empty string won't harm. + input = ""; + } + if (!outputType) { + return input; + } + exports.checkSupport(outputType); + var inputType = exports.getTypeOf(input); + var result = transform[inputType][outputType](input); + return result; +}; + +/** + * Return the type of the input. + * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. + * @param {Object} input the input to identify. + * @return {String} the (lowercase) type of the input. + */ +exports.getTypeOf = function(input) { + if (typeof input === "string") { + return "string"; + } + if (Object.prototype.toString.call(input) === "[object Array]") { + return "array"; + } + if (support.nodebuffer && nodeBuffer.test(input)) { + return "nodebuffer"; + } + if (support.uint8array && input instanceof Uint8Array) { + return "uint8array"; + } + if (support.arraybuffer && input instanceof ArrayBuffer) { + return "arraybuffer"; + } +}; + +/** + * Throw an exception if the type is not supported. + * @param {String} type the type to check. + * @throws {Error} an Error if the browser doesn't support the requested type. + */ +exports.checkSupport = function(type) { + var supported = support[type.toLowerCase()]; + if (!supported) { + throw new Error(type + " is not supported by this browser"); + } +}; +exports.MAX_VALUE_16BITS = 65535; +exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 + +/** + * Prettify a string read as binary. + * @param {string} str the string to prettify. + * @return {string} a pretty string. + */ +exports.pretty = function(str) { + var res = '', + code, i; + for (i = 0; i < (str || "").length; i++) { + code = str.charCodeAt(i); + res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); + } + return res; +}; + +/** + * Find a compression registered in JSZip. + * @param {string} compressionMethod the method magic to find. + * @return {Object|null} the JSZip compression object, null if none found. + */ +exports.findCompression = function(compressionMethod) { + for (var method in compressions) { + if (!compressions.hasOwnProperty(method)) { + continue; + } + if (compressions[method].magic === compressionMethod) { + return compressions[method]; + } + } + return null; +}; +/** +* Cross-window, cross-Node-context regular expression detection +* @param {Object} object Anything +* @return {Boolean} true if the object is a regular expression, +* false otherwise +*/ +exports.isRegExp = function (object) { + return Object.prototype.toString.call(object) === "[object RegExp]"; +}; + +/** + * Merge the objects passed as parameters into a new one. + * @private + * @param {...Object} var_args All objects to merge. + * @return {Object} a new object with the data of the others. + */ +exports.extend = function() { + var result = {}, i, attr; + for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers + for (attr in arguments[i]) { + if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { + result[attr] = arguments[i][attr]; + } + } + } + return result; +}; + + +},{"./compressions":4,"./nodeBuffer":12,"./support":18}],23:[function(require,module,exports){ +'use strict'; +var StringReader = require('./stringReader'); +var NodeBufferReader = require('./nodeBufferReader'); +var Uint8ArrayReader = require('./uint8ArrayReader'); +var ArrayReader = require('./arrayReader'); +var utils = require('./utils'); +var sig = require('./signature'); +var ZipEntry = require('./zipEntry'); +var support = require('./support'); +var jszipProto = require('./object'); +// class ZipEntries {{{ +/** + * All the entries in the zip file. + * @constructor + * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntries(data, loadOptions) { + this.files = []; + this.loadOptions = loadOptions; + if (data) { + this.load(data); + } +} +ZipEntries.prototype = { + /** + * Check that the reader is on the speficied signature. + * @param {string} expectedSignature the expected signature. + * @throws {Error} if it is an other signature. + */ + checkSignature: function(expectedSignature) { + var signature = this.reader.readString(4); + if (signature !== expectedSignature) { + throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + } + }, + /** + * Check if the given signature is at the given index. + * @param {number} askedIndex the index to check. + * @param {string} expectedSignature the signature to expect. + * @return {boolean} true if the signature is here, false otherwise. + */ + isSignature: function(askedIndex, expectedSignature) { + var currentIndex = this.reader.index; + this.reader.setIndex(askedIndex); + var signature = this.reader.readString(4); + var result = signature === expectedSignature; + this.reader.setIndex(currentIndex); + return result; + }, + /** + * Read the end of the central directory. + */ + readBlockEndOfCentral: function() { + this.diskNumber = this.reader.readInt(2); + this.diskWithCentralDirStart = this.reader.readInt(2); + this.centralDirRecordsOnThisDisk = this.reader.readInt(2); + this.centralDirRecords = this.reader.readInt(2); + this.centralDirSize = this.reader.readInt(4); + this.centralDirOffset = this.reader.readInt(4); + + this.zipCommentLength = this.reader.readInt(2); + // warning : the encoding depends of the system locale + // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. + // On a windows machine, this field is encoded with the localized windows code page. + var zipComment = this.reader.readData(this.zipCommentLength); + var decodeParamType = support.uint8array ? "uint8array" : "array"; + // To get consistent behavior with the generation part, we will assume that + // this is utf8 encoded unless specified otherwise. + var decodeContent = utils.transformTo(decodeParamType, zipComment); + this.zipComment = this.loadOptions.decodeFileName(decodeContent); + }, + /** + * Read the end of the Zip 64 central directory. + * Not merged with the method readEndOfCentral : + * The end of central can coexist with its Zip64 brother, + * I don't want to read the wrong number of bytes ! + */ + readBlockZip64EndOfCentral: function() { + this.zip64EndOfCentralSize = this.reader.readInt(8); + this.versionMadeBy = this.reader.readString(2); + this.versionNeeded = this.reader.readInt(2); + this.diskNumber = this.reader.readInt(4); + this.diskWithCentralDirStart = this.reader.readInt(4); + this.centralDirRecordsOnThisDisk = this.reader.readInt(8); + this.centralDirRecords = this.reader.readInt(8); + this.centralDirSize = this.reader.readInt(8); + this.centralDirOffset = this.reader.readInt(8); + + this.zip64ExtensibleData = {}; + var extraDataSize = this.zip64EndOfCentralSize - 44, + index = 0, + extraFieldId, + extraFieldLength, + extraFieldValue; + while (index < extraDataSize) { + extraFieldId = this.reader.readInt(2); + extraFieldLength = this.reader.readInt(4); + extraFieldValue = this.reader.readString(extraFieldLength); + this.zip64ExtensibleData[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Read the end of the Zip 64 central directory locator. + */ + readBlockZip64EndOfCentralLocator: function() { + this.diskWithZip64CentralDirStart = this.reader.readInt(4); + this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); + this.disksCount = this.reader.readInt(4); + if (this.disksCount > 1) { + throw new Error("Multi-volumes zip are not supported"); + } + }, + /** + * Read the local files, based on the offset read in the central part. + */ + readLocalFiles: function() { + var i, file; + for (i = 0; i < this.files.length; i++) { + file = this.files[i]; + this.reader.setIndex(file.localHeaderOffset); + this.checkSignature(sig.LOCAL_FILE_HEADER); + file.readLocalPart(this.reader); + file.handleUTF8(); + file.processAttributes(); + } + }, + /** + * Read the central directory. + */ + readCentralDir: function() { + var file; + + this.reader.setIndex(this.centralDirOffset); + while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) { + file = new ZipEntry({ + zip64: this.zip64 + }, this.loadOptions); + file.readCentralPart(this.reader); + this.files.push(file); + } + + if (this.centralDirRecords !== this.files.length) { + if (this.centralDirRecords !== 0 && this.files.length === 0) { + // We expected some records but couldn't find ANY. + // This is really suspicious, as if something went wrong. + throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); + } else { + // We found some records but not all. + // Something is wrong but we got something for the user: no error here. + // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); + } + } + }, + /** + * Read the end of central directory. + */ + readEndOfCentral: function() { + var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); + if (offset < 0) { + // Check if the content is a truncated zip or complete garbage. + // A "LOCAL_FILE_HEADER" is not required at the beginning (auto + // extractible zip for example) but it can give a good hint. + // If an ajax request was used without responseType, we will also + // get unreadable data. + var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); + + if (isGarbage) { + throw new Error("Can't find end of central directory : is this a zip file ? " + + "If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html"); + } else { + throw new Error("Corrupted zip : can't find end of central directory"); + } + } + this.reader.setIndex(offset); + var endOfCentralDirOffset = offset; + this.checkSignature(sig.CENTRAL_DIRECTORY_END); + this.readBlockEndOfCentral(); + + + /* extract from the zip spec : + 4) If one of the fields in the end of central directory + record is too small to hold required data, the field + should be set to -1 (0xFFFF or 0xFFFFFFFF) and the + ZIP64 format record should be created. + 5) The end of central directory record and the + Zip64 end of central directory locator record must + reside on the same disk when splitting or spanning + an archive. + */ + if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { + this.zip64 = true; + + /* + Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from + the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents + all numbers as 64-bit double precision IEEE 754 floating point numbers. + So, we have 53bits for integers and bitwise operations treat everything as 32bits. + see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators + and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 + */ + + // should look for a zip64 EOCD locator + offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + if (offset < 0) { + throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + this.readBlockZip64EndOfCentralLocator(); + + // now the zip64 EOCD record + if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { + // console.warn("ZIP64 end of central directory not where expected."); + this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + if (this.relativeOffsetEndOfZip64CentralDir < 0) { + throw new Error("Corrupted zip : can't find the ZIP64 end of central directory"); + } + } + this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + this.readBlockZip64EndOfCentral(); + } + + var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; + if (this.zip64) { + expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator + expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; + } + + var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; + + if (extraBytes > 0) { + // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); + if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { + // The offsets seem wrong, but we have something at the specified offset. + // So… we keep it. + } else { + // the offset is wrong, update the "zero" of the reader + // this happens if data has been prepended (crx files for example) + this.reader.zero = extraBytes; + } + } else if (extraBytes < 0) { + throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); + } + }, + prepareReader: function(data) { + var type = utils.getTypeOf(data); + utils.checkSupport(type); + if (type === "string" && !support.uint8array) { + this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString); + } + else if (type === "nodebuffer") { + this.reader = new NodeBufferReader(data); + } + else if (support.uint8array) { + this.reader = new Uint8ArrayReader(utils.transformTo("uint8array", data)); + } else if (support.array) { + this.reader = new ArrayReader(utils.transformTo("array", data)); + } else { + throw new Error("Unexpected error: unsupported type '" + type + "'"); + } + }, + /** + * Read a zip file and create ZipEntries. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. + */ + load: function(data) { + this.prepareReader(data); + this.readEndOfCentral(); + this.readCentralDir(); + this.readLocalFiles(); + } +}; +// }}} end of ZipEntries +module.exports = ZipEntries; + +},{"./arrayReader":1,"./nodeBufferReader":13,"./object":14,"./signature":15,"./stringReader":16,"./support":18,"./uint8ArrayReader":19,"./utils":22,"./zipEntry":24}],24:[function(require,module,exports){ +'use strict'; +var StringReader = require('./stringReader'); +var utils = require('./utils'); +var CompressedObject = require('./compressedObject'); +var jszipProto = require('./object'); +var support = require('./support'); + +var MADE_BY_DOS = 0x00; +var MADE_BY_UNIX = 0x03; + +// class ZipEntry {{{ +/** + * An entry in the zip file. + * @constructor + * @param {Object} options Options of the current file. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntry(options, loadOptions) { + this.options = options; + this.loadOptions = loadOptions; +} +ZipEntry.prototype = { + /** + * say if the file is encrypted. + * @return {boolean} true if the file is encrypted, false otherwise. + */ + isEncrypted: function() { + // bit 1 is set + return (this.bitFlag & 0x0001) === 0x0001; + }, + /** + * say if the file has utf-8 filename/comment. + * @return {boolean} true if the filename/comment is in utf-8, false otherwise. + */ + useUTF8: function() { + // bit 11 is set + return (this.bitFlag & 0x0800) === 0x0800; + }, + /** + * Prepare the function used to generate the compressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @return {Function} the callback to get the compressed content (the type depends of the DataReader class). + */ + prepareCompressedContent: function(reader, from, length) { + return function() { + var previousIndex = reader.index; + reader.setIndex(from); + var compressedFileData = reader.readData(length); + reader.setIndex(previousIndex); + + return compressedFileData; + }; + }, + /** + * Prepare the function used to generate the uncompressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @param {JSZip.compression} compression the compression used on this file. + * @param {number} uncompressedSize the uncompressed size to expect. + * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class). + */ + prepareContent: function(reader, from, length, compression, uncompressedSize) { + return function() { + + var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); + var uncompressedFileData = compression.uncompress(compressedFileData); + + if (uncompressedFileData.length !== uncompressedSize) { + throw new Error("Bug : uncompressed data size mismatch"); + } + + return uncompressedFileData; + }; + }, + /** + * Read the local part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readLocalPart: function(reader) { + var compression, localExtraFieldsLength; + + // we already know everything from the central dir ! + // If the central dir data are false, we are doomed. + // On the bright side, the local part is scary : zip64, data descriptors, both, etc. + // The less data we get here, the more reliable this should be. + // Let's skip the whole header and dash to the data ! + reader.skip(22); + // in some zip created on windows, the filename stored in the central dir contains \ instead of /. + // Strangely, the filename here is OK. + // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes + // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... + // Search "unzip mismatching "local" filename continuing with "central" filename version" on + // the internet. + // + // I think I see the logic here : the central directory is used to display + // content and the local directory is used to extract the files. Mixing / and \ + // may be used to display \ to windows users and use / when extracting the files. + // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 + this.fileNameLength = reader.readInt(2); + localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir + this.fileName = reader.readData(this.fileNameLength); + reader.skip(localExtraFieldsLength); + + if (this.compressedSize == -1 || this.uncompressedSize == -1) { + throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize == -1 || uncompressedSize == -1)"); + } + + compression = utils.findCompression(this.compressionMethod); + if (compression === null) { // no compression found + throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); + } + this.decompressed = new CompressedObject(); + this.decompressed.compressedSize = this.compressedSize; + this.decompressed.uncompressedSize = this.uncompressedSize; + this.decompressed.crc32 = this.crc32; + this.decompressed.compressionMethod = this.compressionMethod; + this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression); + this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize); + + // we need to compute the crc32... + if (this.loadOptions.checkCRC32) { + this.decompressed = utils.transformTo("string", this.decompressed.getContent()); + if (jszipProto.crc32(this.decompressed) !== this.crc32) { + throw new Error("Corrupted zip : CRC32 mismatch"); + } + } + }, + + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readCentralPart: function(reader) { + this.versionMadeBy = reader.readInt(2); + this.versionNeeded = reader.readInt(2); + this.bitFlag = reader.readInt(2); + this.compressionMethod = reader.readString(2); + this.date = reader.readDate(); + this.crc32 = reader.readInt(4); + this.compressedSize = reader.readInt(4); + this.uncompressedSize = reader.readInt(4); + this.fileNameLength = reader.readInt(2); + this.extraFieldsLength = reader.readInt(2); + this.fileCommentLength = reader.readInt(2); + this.diskNumberStart = reader.readInt(2); + this.internalFileAttributes = reader.readInt(2); + this.externalFileAttributes = reader.readInt(4); + this.localHeaderOffset = reader.readInt(4); + + if (this.isEncrypted()) { + throw new Error("Encrypted zip are not supported"); + } + + this.fileName = reader.readData(this.fileNameLength); + this.readExtraFields(reader); + this.parseZIP64ExtraField(reader); + this.fileComment = reader.readData(this.fileCommentLength); + }, + + /** + * Parse the external file attributes and get the unix/dos permissions. + */ + processAttributes: function () { + this.unixPermissions = null; + this.dosPermissions = null; + var madeBy = this.versionMadeBy >> 8; + + // Check if we have the DOS directory flag set. + // We look for it in the DOS and UNIX permissions + // but some unknown platform could set it as a compatibility flag. + this.dir = this.externalFileAttributes & 0x0010 ? true : false; + + if(madeBy === MADE_BY_DOS) { + // first 6 bits (0 to 5) + this.dosPermissions = this.externalFileAttributes & 0x3F; + } + + if(madeBy === MADE_BY_UNIX) { + this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; + // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); + } + + // fail safe : if the name ends with a / it probably means a folder + if (!this.dir && this.fileNameStr.slice(-1) === '/') { + this.dir = true; + } + }, + + /** + * Parse the ZIP64 extra field and merge the info in the current ZipEntry. + * @param {DataReader} reader the reader to use. + */ + parseZIP64ExtraField: function(reader) { + + if (!this.extraFields[0x0001]) { + return; + } + + // should be something, preparing the extra reader + var extraReader = new StringReader(this.extraFields[0x0001].value); + + // I really hope that these 64bits integer can fit in 32 bits integer, because js + // won't let us have more. + if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { + this.uncompressedSize = extraReader.readInt(8); + } + if (this.compressedSize === utils.MAX_VALUE_32BITS) { + this.compressedSize = extraReader.readInt(8); + } + if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { + this.localHeaderOffset = extraReader.readInt(8); + } + if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { + this.diskNumberStart = extraReader.readInt(4); + } + }, + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readExtraFields: function(reader) { + var start = reader.index, + extraFieldId, + extraFieldLength, + extraFieldValue; + + this.extraFields = this.extraFields || {}; + + while (reader.index < start + this.extraFieldsLength) { + extraFieldId = reader.readInt(2); + extraFieldLength = reader.readInt(2); + extraFieldValue = reader.readString(extraFieldLength); + + this.extraFields[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Apply an UTF8 transformation if needed. + */ + handleUTF8: function() { + var decodeParamType = support.uint8array ? "uint8array" : "array"; + if (this.useUTF8()) { + this.fileNameStr = jszipProto.utf8decode(this.fileName); + this.fileCommentStr = jszipProto.utf8decode(this.fileComment); + } else { + var upath = this.findExtraFieldUnicodePath(); + if (upath !== null) { + this.fileNameStr = upath; + } else { + var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); + this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); + } + + var ucomment = this.findExtraFieldUnicodeComment(); + if (ucomment !== null) { + this.fileCommentStr = ucomment; + } else { + var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); + this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); + } + } + }, + + /** + * Find the unicode path declared in the extra field, if any. + * @return {String} the unicode path, null otherwise. + */ + findExtraFieldUnicodePath: function() { + var upathField = this.extraFields[0x7075]; + if (upathField) { + var extraReader = new StringReader(upathField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the filename changed, this field is out of date. + if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(upathField.length - 5)); + } + return null; + }, + + /** + * Find the unicode comment declared in the extra field, if any. + * @return {String} the unicode comment, null otherwise. + */ + findExtraFieldUnicodeComment: function() { + var ucommentField = this.extraFields[0x6375]; + if (ucommentField) { + var extraReader = new StringReader(ucommentField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the comment changed, this field is out of date. + if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5)); + } + return null; + } +}; +module.exports = ZipEntry; + +},{"./compressedObject":3,"./object":14,"./stringReader":16,"./support":18,"./utils":22}],25:[function(require,module,exports){ +// Top level file is just a mixin of submodules & constants +'use strict'; + +var assign = require('./lib/utils/common').assign; + +var deflate = require('./lib/deflate'); +var inflate = require('./lib/inflate'); +var constants = require('./lib/zlib/constants'); + +var pako = {}; + +assign(pako, deflate, inflate, constants); + +module.exports = pako; + +},{"./lib/deflate":26,"./lib/inflate":27,"./lib/utils/common":28,"./lib/zlib/constants":31}],26:[function(require,module,exports){ +'use strict'; + + +var zlib_deflate = require('./zlib/deflate'); +var utils = require('./utils/common'); +var strings = require('./utils/strings'); +var msg = require('./zlib/messages'); +var ZStream = require('./zlib/zstream'); + +var toString = Object.prototype.toString; + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + +var Z_NO_FLUSH = 0; +var Z_FINISH = 4; + +var Z_OK = 0; +var Z_STREAM_END = 1; +var Z_SYNC_FLUSH = 2; + +var Z_DEFAULT_COMPRESSION = -1; + +var Z_DEFAULT_STRATEGY = 0; + +var Z_DEFLATED = 8; + +/* ===========================================================================*/ + + +/** + * class Deflate + * + * Generic JS-style wrapper for zlib calls. If you don't need + * streaming behaviour - use more simple functions: [[deflate]], + * [[deflateRaw]] and [[gzip]]. + **/ + +/* internal + * Deflate.chunks -> Array + * + * Chunks of output data, if [[Deflate#onData]] not overriden. + **/ + +/** + * Deflate.result -> Uint8Array|Array + * + * Compressed result, generated by default [[Deflate#onData]] + * and [[Deflate#onEnd]] handlers. Filled after you push last chunk + * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you + * push a chunk with explicit flush (call [[Deflate#push]] with + * `Z_SYNC_FLUSH` param). + **/ + +/** + * Deflate.err -> Number + * + * Error code after deflate finished. 0 (Z_OK) on success. + * You will not need it in real life, because deflate errors + * are possible only on wrong options or bad `onData` / `onEnd` + * custom handlers. + **/ + +/** + * Deflate.msg -> String + * + * Error message, if [[Deflate.err]] != 0 + **/ + + +/** + * new Deflate(options) + * - options (Object): zlib deflate options. + * + * Creates new deflator instance with specified params. Throws exception + * on bad params. Supported options: + * + * - `level` + * - `windowBits` + * - `memLevel` + * - `strategy` + * - `dictionary` + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Additional options, for internal needs: + * + * - `chunkSize` - size of generated data chunks (16K by default) + * - `raw` (Boolean) - do raw deflate + * - `gzip` (Boolean) - create gzip wrapper + * - `to` (String) - if equal to 'string', then result will be "binary string" + * (each char code [0..255]) + * - `header` (Object) - custom header for gzip + * - `text` (Boolean) - true if compressed data believed to be text + * - `time` (Number) - modification time, unix timestamp + * - `os` (Number) - operation system code + * - `extra` (Array) - array of bytes with extra data (max 65536) + * - `name` (String) - file name (binary string) + * - `comment` (String) - comment (binary string) + * - `hcrc` (Boolean) - true if header crc should be added + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + * + * var deflate = new pako.Deflate({ level: 3}); + * + * deflate.push(chunk1, false); + * deflate.push(chunk2, true); // true -> last chunk + * + * if (deflate.err) { throw new Error(deflate.err); } + * + * console.log(deflate.result); + * ``` + **/ +function Deflate(options) { + if (!(this instanceof Deflate)) return new Deflate(options); + + this.options = utils.assign({ + level: Z_DEFAULT_COMPRESSION, + method: Z_DEFLATED, + chunkSize: 16384, + windowBits: 15, + memLevel: 8, + strategy: Z_DEFAULT_STRATEGY, + to: '' + }, options || {}); + + var opt = this.options; + + if (opt.raw && (opt.windowBits > 0)) { + opt.windowBits = -opt.windowBits; + } + + else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { + opt.windowBits += 16; + } + + this.err = 0; // error code, if happens (0 = Z_OK) + this.msg = ''; // error message + this.ended = false; // used to avoid multiple onEnd() calls + this.chunks = []; // chunks of compressed data + + this.strm = new ZStream(); + this.strm.avail_out = 0; + + var status = zlib_deflate.deflateInit2( + this.strm, + opt.level, + opt.method, + opt.windowBits, + opt.memLevel, + opt.strategy + ); + + if (status !== Z_OK) { + throw new Error(msg[status]); + } + + if (opt.header) { + zlib_deflate.deflateSetHeader(this.strm, opt.header); + } + + if (opt.dictionary) { + var dict; + // Convert data if needed + if (typeof opt.dictionary === 'string') { + // If we need to compress text, change encoding to utf8. + dict = strings.string2buf(opt.dictionary); + } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { + dict = new Uint8Array(opt.dictionary); + } else { + dict = opt.dictionary; + } + + status = zlib_deflate.deflateSetDictionary(this.strm, dict); + + if (status !== Z_OK) { + throw new Error(msg[status]); + } + + this._dict_set = true; + } +} + +/** + * Deflate#push(data[, mode]) -> Boolean + * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be + * converted to utf8 byte sequence. + * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. + * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. + * + * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with + * new compressed chunks. Returns `true` on success. The last data block must have + * mode Z_FINISH (or `true`). That will flush internal pending buffers and call + * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you + * can use mode Z_SYNC_FLUSH, keeping the compression context. + * + * On fail call [[Deflate#onEnd]] with error code and return false. + * + * We strongly recommend to use `Uint8Array` on input for best speed (output + * array format is detected automatically). Also, don't skip last param and always + * use the same type in your code (boolean or number). That will improve JS speed. + * + * For regular `Array`-s make sure all elements are [0..255]. + * + * ##### Example + * + * ```javascript + * push(chunk, false); // push one of data chunks + * ... + * push(chunk, true); // push last chunk + * ``` + **/ +Deflate.prototype.push = function (data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var status, _mode; + + if (this.ended) { return false; } + + _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); + + // Convert data if needed + if (typeof data === 'string') { + // If we need to compress text, change encoding to utf8. + strm.input = strings.string2buf(data); + } else if (toString.call(data) === '[object ArrayBuffer]') { + strm.input = new Uint8Array(data); + } else { + strm.input = data; + } + + strm.next_in = 0; + strm.avail_in = strm.input.length; + + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ + + if (status !== Z_STREAM_END && status !== Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { + if (this.options.to === 'string') { + this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); + + // Finalize on the last chunk. + if (_mode === Z_FINISH) { + status = zlib_deflate.deflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === Z_OK; + } + + // callback interim results if Z_SYNC_FLUSH. + if (_mode === Z_SYNC_FLUSH) { + this.onEnd(Z_OK); + strm.avail_out = 0; + return true; + } + + return true; +}; + + +/** + * Deflate#onData(chunk) -> Void + * - chunk (Uint8Array|Array|String): ouput data. Type of array depends + * on js engine support. When string output requested, each chunk + * will be string. + * + * By default, stores data blocks in `chunks[]` property and glue + * those in `onEnd`. Override this handler, if you need another behaviour. + **/ +Deflate.prototype.onData = function (chunk) { + this.chunks.push(chunk); +}; + + +/** + * Deflate#onEnd(status) -> Void + * - status (Number): deflate status. 0 (Z_OK) on success, + * other if not. + * + * Called once after you tell deflate that the input stream is + * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) + * or if an error happened. By default - join collected chunks, + * free memory and fill `results` / `err` properties. + **/ +Deflate.prototype.onEnd = function (status) { + // On success - join + if (status === Z_OK) { + if (this.options.to === 'string') { + this.result = this.chunks.join(''); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; +}; + + +/** + * deflate(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * Compress `data` with deflate algorithm and `options`. + * + * Supported options are: + * + * - level + * - windowBits + * - memLevel + * - strategy + * - dictionary + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Sugar (options): + * + * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify + * negative windowBits implicitly. + * - `to` (String) - if equal to 'string', then result will be "binary string" + * (each char code [0..255]) + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); + * + * console.log(pako.deflate(data)); + * ``` + **/ +function deflate(input, options) { + var deflator = new Deflate(options); + + deflator.push(input, true); + + // That will never happens, if you don't cheat with options :) + if (deflator.err) { throw deflator.msg; } + + return deflator.result; +} + + +/** + * deflateRaw(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * The same as [[deflate]], but creates raw data, without wrapper + * (header and adler32 crc). + **/ +function deflateRaw(input, options) { + options = options || {}; + options.raw = true; + return deflate(input, options); +} + + +/** + * gzip(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * The same as [[deflate]], but create gzip wrapper instead of + * deflate one. + **/ +function gzip(input, options) { + options = options || {}; + options.gzip = true; + return deflate(input, options); +} + + +exports.Deflate = Deflate; +exports.deflate = deflate; +exports.deflateRaw = deflateRaw; +exports.gzip = gzip; + +},{"./utils/common":28,"./utils/strings":29,"./zlib/deflate":33,"./zlib/messages":38,"./zlib/zstream":40}],27:[function(require,module,exports){ +'use strict'; + + +var zlib_inflate = require('./zlib/inflate'); +var utils = require('./utils/common'); +var strings = require('./utils/strings'); +var c = require('./zlib/constants'); +var msg = require('./zlib/messages'); +var ZStream = require('./zlib/zstream'); +var GZheader = require('./zlib/gzheader'); + +var toString = Object.prototype.toString; + +/** + * class Inflate + * + * Generic JS-style wrapper for zlib calls. If you don't need + * streaming behaviour - use more simple functions: [[inflate]] + * and [[inflateRaw]]. + **/ + +/* internal + * inflate.chunks -> Array + * + * Chunks of output data, if [[Inflate#onData]] not overriden. + **/ + +/** + * Inflate.result -> Uint8Array|Array|String + * + * Uncompressed result, generated by default [[Inflate#onData]] + * and [[Inflate#onEnd]] handlers. Filled after you push last chunk + * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you + * push a chunk with explicit flush (call [[Inflate#push]] with + * `Z_SYNC_FLUSH` param). + **/ + +/** + * Inflate.err -> Number + * + * Error code after inflate finished. 0 (Z_OK) on success. + * Should be checked if broken data possible. + **/ + +/** + * Inflate.msg -> String + * + * Error message, if [[Inflate.err]] != 0 + **/ + + +/** + * new Inflate(options) + * - options (Object): zlib inflate options. + * + * Creates new inflator instance with specified params. Throws exception + * on bad params. Supported options: + * + * - `windowBits` + * - `dictionary` + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Additional options, for internal needs: + * + * - `chunkSize` - size of generated data chunks (16K by default) + * - `raw` (Boolean) - do raw inflate + * - `to` (String) - if equal to 'string', then result will be converted + * from utf8 to utf16 (javascript) string. When string output requested, + * chunk length can differ from `chunkSize`, depending on content. + * + * By default, when no options set, autodetect deflate/gzip data format via + * wrapper header. + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + * + * var inflate = new pako.Inflate({ level: 3}); + * + * inflate.push(chunk1, false); + * inflate.push(chunk2, true); // true -> last chunk + * + * if (inflate.err) { throw new Error(inflate.err); } + * + * console.log(inflate.result); + * ``` + **/ +function Inflate(options) { + if (!(this instanceof Inflate)) return new Inflate(options); + + this.options = utils.assign({ + chunkSize: 16384, + windowBits: 0, + to: '' + }, options || {}); + + var opt = this.options; + + // Force window size for `raw` data, if not set directly, + // because we have no header for autodetect. + if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { + opt.windowBits = -opt.windowBits; + if (opt.windowBits === 0) { opt.windowBits = -15; } + } + + // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate + if ((opt.windowBits >= 0) && (opt.windowBits < 16) && + !(options && options.windowBits)) { + opt.windowBits += 32; + } + + // Gzip header has no info about windows size, we can do autodetect only + // for deflate. So, if window size not set, force it to max when gzip possible + if ((opt.windowBits > 15) && (opt.windowBits < 48)) { + // bit 3 (16) -> gzipped data + // bit 4 (32) -> autodetect gzip/deflate + if ((opt.windowBits & 15) === 0) { + opt.windowBits |= 15; + } + } + + this.err = 0; // error code, if happens (0 = Z_OK) + this.msg = ''; // error message + this.ended = false; // used to avoid multiple onEnd() calls + this.chunks = []; // chunks of compressed data + + this.strm = new ZStream(); + this.strm.avail_out = 0; + + var status = zlib_inflate.inflateInit2( + this.strm, + opt.windowBits + ); + + if (status !== c.Z_OK) { + throw new Error(msg[status]); + } + + this.header = new GZheader(); + + zlib_inflate.inflateGetHeader(this.strm, this.header); +} + +/** + * Inflate#push(data[, mode]) -> Boolean + * - data (Uint8Array|Array|ArrayBuffer|String): input data + * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. + * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. + * + * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with + * new output chunks. Returns `true` on success. The last data block must have + * mode Z_FINISH (or `true`). That will flush internal pending buffers and call + * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you + * can use mode Z_SYNC_FLUSH, keeping the decompression context. + * + * On fail call [[Inflate#onEnd]] with error code and return false. + * + * We strongly recommend to use `Uint8Array` on input for best speed (output + * format is detected automatically). Also, don't skip last param and always + * use the same type in your code (boolean or number). That will improve JS speed. + * + * For regular `Array`-s make sure all elements are [0..255]. + * + * ##### Example + * + * ```javascript + * push(chunk, false); // push one of data chunks + * ... + * push(chunk, true); // push last chunk + * ``` + **/ +Inflate.prototype.push = function (data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var dictionary = this.options.dictionary; + var status, _mode; + var next_out_utf8, tail, utf8str; + var dict; + + // Flag to properly process Z_BUF_ERROR on testing inflate call + // when we check that all output data was flushed. + var allowBufError = false; + + if (this.ended) { return false; } + _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); + + // Convert data if needed + if (typeof data === 'string') { + // Only binary strings can be decompressed on practice + strm.input = strings.binstring2buf(data); + } else if (toString.call(data) === '[object ArrayBuffer]') { + strm.input = new Uint8Array(data); + } else { + strm.input = data; + } + + strm.next_in = 0; + strm.avail_in = strm.input.length; + + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + + status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ + + if (status === c.Z_NEED_DICT && dictionary) { + // Convert data if needed + if (typeof dictionary === 'string') { + dict = strings.string2buf(dictionary); + } else if (toString.call(dictionary) === '[object ArrayBuffer]') { + dict = new Uint8Array(dictionary); + } else { + dict = dictionary; + } + + status = zlib_inflate.inflateSetDictionary(this.strm, dict); + + } + + if (status === c.Z_BUF_ERROR && allowBufError === true) { + status = c.Z_OK; + allowBufError = false; + } + + if (status !== c.Z_STREAM_END && status !== c.Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + + if (strm.next_out) { + if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { + + if (this.options.to === 'string') { + + next_out_utf8 = strings.utf8border(strm.output, strm.next_out); + + tail = strm.next_out - next_out_utf8; + utf8str = strings.buf2string(strm.output, next_out_utf8); + + // move tail + strm.next_out = tail; + strm.avail_out = chunkSize - tail; + if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } + + this.onData(utf8str); + + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } + + // When no more input data, we should check that internal inflate buffers + // are flushed. The only way to do it when avail_out = 0 - run one more + // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. + // Here we set flag to process this error properly. + // + // NOTE. Deflate does not return error in this case and does not needs such + // logic. + if (strm.avail_in === 0 && strm.avail_out === 0) { + allowBufError = true; + } + + } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); + + if (status === c.Z_STREAM_END) { + _mode = c.Z_FINISH; + } + + // Finalize on the last chunk. + if (_mode === c.Z_FINISH) { + status = zlib_inflate.inflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === c.Z_OK; + } + + // callback interim results if Z_SYNC_FLUSH. + if (_mode === c.Z_SYNC_FLUSH) { + this.onEnd(c.Z_OK); + strm.avail_out = 0; + return true; + } + + return true; +}; + + +/** + * Inflate#onData(chunk) -> Void + * - chunk (Uint8Array|Array|String): ouput data. Type of array depends + * on js engine support. When string output requested, each chunk + * will be string. + * + * By default, stores data blocks in `chunks[]` property and glue + * those in `onEnd`. Override this handler, if you need another behaviour. + **/ +Inflate.prototype.onData = function (chunk) { + this.chunks.push(chunk); +}; + + +/** + * Inflate#onEnd(status) -> Void + * - status (Number): inflate status. 0 (Z_OK) on success, + * other if not. + * + * Called either after you tell inflate that the input stream is + * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) + * or if an error happened. By default - join collected chunks, + * free memory and fill `results` / `err` properties. + **/ +Inflate.prototype.onEnd = function (status) { + // On success - join + if (status === c.Z_OK) { + if (this.options.to === 'string') { + // Glue & convert here, until we teach pako to send + // utf8 alligned strings to onData + this.result = this.chunks.join(''); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; +}; + + +/** + * inflate(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * Decompress `data` with inflate/ungzip and `options`. Autodetect + * format via wrapper header by default. That's why we don't provide + * separate `ungzip` method. + * + * Supported options are: + * + * - windowBits + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information. + * + * Sugar (options): + * + * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify + * negative windowBits implicitly. + * - `to` (String) - if equal to 'string', then result will be converted + * from utf8 to utf16 (javascript) string. When string output requested, + * chunk length can differ from `chunkSize`, depending on content. + * + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) + * , output; + * + * try { + * output = pako.inflate(input); + * } catch (err) + * console.log(err); + * } + * ``` + **/ +function inflate(input, options) { + var inflator = new Inflate(options); + + inflator.push(input, true); + + // That will never happens, if you don't cheat with options :) + if (inflator.err) { throw inflator.msg; } + + return inflator.result; +} + + +/** + * inflateRaw(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * The same as [[inflate]], but creates raw data, without wrapper + * (header and adler32 crc). + **/ +function inflateRaw(input, options) { + options = options || {}; + options.raw = true; + return inflate(input, options); +} + + +/** + * ungzip(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * Just shortcut to [[inflate]], because it autodetects format + * by header.content. Done for convenience. + **/ + + +exports.Inflate = Inflate; +exports.inflate = inflate; +exports.inflateRaw = inflateRaw; +exports.ungzip = inflate; + +},{"./utils/common":28,"./utils/strings":29,"./zlib/constants":31,"./zlib/gzheader":34,"./zlib/inflate":36,"./zlib/messages":38,"./zlib/zstream":40}],28:[function(require,module,exports){ +'use strict'; + + +var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + + +exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } + + if (typeof source !== 'object') { + throw new TypeError(source + 'must be non-object'); + } + + for (var p in source) { + if (source.hasOwnProperty(p)) { + obj[p] = source[p]; + } + } + } + + return obj; +}; + + +// reduce buffer size, avoiding mem copy +exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; +}; + + +var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs + len), dest_offs); + return; + } + // Fallback to ordinary array + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + var i, l, len, pos, chunk, result; + + // calculate data length + len = 0; + for (i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + + // join chunks + result = new Uint8Array(len); + pos = 0; + for (i = 0, l = chunks.length; i < l; i++) { + chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + + return result; + } +}; + +var fnUntyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + return [].concat.apply([], chunks); + } +}; + + +// Enable/Disable typed arrays use, for testing +// +exports.setTyped = function (on) { + if (on) { + exports.Buf8 = Uint8Array; + exports.Buf16 = Uint16Array; + exports.Buf32 = Int32Array; + exports.assign(exports, fnTyped); + } else { + exports.Buf8 = Array; + exports.Buf16 = Array; + exports.Buf32 = Array; + exports.assign(exports, fnUntyped); + } +}; + +exports.setTyped(TYPED_OK); + +},{}],29:[function(require,module,exports){ +// String encode/decode helpers +'use strict'; + + +var utils = require('./common'); + + +// Quick check if we can use fast array to bin string conversion +// +// - apply(Array) can fail on Android 2.2 +// - apply(Uint8Array) can fail on iOS 5.1 Safary +// +var STR_APPLY_OK = true; +var STR_APPLY_UIA_OK = true; + +try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } +try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } + + +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff +var _utf8len = new utils.Buf8(256); +for (var q = 0; q < 256; q++) { + _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); +} +_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start + + +// convert string to array (typed, when possible) +exports.string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + buf = new utils.Buf8(buf_len); + + // convert + for (i = 0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; +}; + +// Helper (used in 2 places) +function buf2binstring(buf, len) { + // use fallback for big arrays to avoid stack overflow + if (len < 65537) { + if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { + return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); + } + } + + var result = ''; + for (var i = 0; i < len; i++) { + result += String.fromCharCode(buf[i]); + } + return result; +} + + +// Convert byte array to binary string +exports.buf2binstring = function (buf) { + return buf2binstring(buf, buf.length); +}; + + +// Convert binary string (typed, when possible) +exports.binstring2buf = function (str) { + var buf = new utils.Buf8(str.length); + for (var i = 0, len = buf.length; i < len; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; +}; + + +// convert array to string +exports.buf2string = function (buf, max) { + var i, out, c, c_len; + var len = max || buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len * 2); + + for (out = 0, i = 0; i < len;) { + c = buf[i++]; + // quick process ascii + if (c < 0x80) { utf16buf[out++] = c; continue; } + + c_len = _utf8len[c]; + // skip 5 & 6 byte codes + if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + return buf2binstring(utf16buf, out); +}; + + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +exports.utf8border = function (buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max - 1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; + +},{"./common":28}],30:[function(require,module,exports){ +'use strict'; + +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It doesn't worth to make additional optimizationa as in original. +// Small size is preferable. + +function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0, + s2 = ((adler >>> 16) & 0xffff) |0, + n = 0; + + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; + + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); + + s1 %= 65521; + s2 %= 65521; + } + + return (s1 | (s2 << 16)) |0; +} + + +module.exports = adler32; + +},{}],31:[function(require,module,exports){ +'use strict'; + + +module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + + + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; + +},{}],32:[function(require,module,exports){ +'use strict'; + +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. + + +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; + + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } + + return table; +} + +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); + + +function crc32(crc, buf, len, pos) { + var t = crcTable, + end = pos + len; + + crc ^= -1; + + for (var i = pos; i < end; i++) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; +} + + +module.exports = crc32; + +},{}],33:[function(require,module,exports){ +'use strict'; + +var utils = require('../utils/common'); +var trees = require('./trees'); +var adler32 = require('./adler32'); +var crc32 = require('./crc32'); +var msg = require('./messages'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +var Z_NO_FLUSH = 0; +var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +//var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +//var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +//var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + + +/* compression levels */ +//var Z_NO_COMPRESSION = 0; +//var Z_BEST_SPEED = 1; +//var Z_BEST_COMPRESSION = 9; +var Z_DEFAULT_COMPRESSION = -1; + + +var Z_FILTERED = 1; +var Z_HUFFMAN_ONLY = 2; +var Z_RLE = 3; +var Z_FIXED = 4; +var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +//var Z_BINARY = 0; +//var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + + +/* The deflate compression method */ +var Z_DEFLATED = 8; + +/*============================================================================*/ + + +var MAX_MEM_LEVEL = 9; +/* Maximum value for memLevel in deflateInit2 */ +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_MEM_LEVEL = 8; + + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ +var LITERALS = 256; +/* number of literal bytes 0..255 */ +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ +var D_CODES = 30; +/* number of distance codes */ +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); + +var PRESET_DICT = 0x20; + +var INIT_STATE = 42; +var EXTRA_STATE = 69; +var NAME_STATE = 73; +var COMMENT_STATE = 91; +var HCRC_STATE = 103; +var BUSY_STATE = 113; +var FINISH_STATE = 666; + +var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ +var BS_BLOCK_DONE = 2; /* block flush performed */ +var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ +var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ + +var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. + +function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; +} + +function rank(f) { + return ((f) << 1) - ((f) > 4 ? 9 : 0); +} + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->output buffer and copying into it. + * (See also read_buf()). + */ +function flush_pending(strm) { + var s = strm.state; + + //_tr_flush_bits(s); + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { return; } + + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } +} + + +function flush_block_only(s, last) { + trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); +} + + +function put_byte(s, b) { + s.pending_buf[s.pending++] = b; +} + + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +function putShortMSB(s, b) { +// put_byte(s, (Byte)(b >> 8)); +// put_byte(s, (Byte)(b & 0xff)); + s.pending_buf[s.pending++] = (b >>> 8) & 0xff; + s.pending_buf[s.pending++] = b & 0xff; +} + + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->input buffer and copying from it. + * (See also flush_pending()). + */ +function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + + if (len > size) { len = size; } + if (len === 0) { return 0; } + + strm.avail_in -= len; + + // zmemcpy(buf, strm->next_in, len); + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } + + else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + + strm.next_in += len; + strm.total_in += len; + + return len; +} + + +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; /* max hash chain length */ + var scan = s.strstart; /* current string */ + var match; /* matched string */ + var len; /* length of current match */ + var best_len = s.prev_length; /* best match length so far */ + var nice_match = s.nice_match; /* stop if match long enough */ + var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? + s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; + + var _win = s.window; // shortcut + + var wmask = s.w_mask; + var prev = s.prev; + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if (nice_match > s.lookahead) { nice_match = s.lookahead; } + + // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + // Assert(cur_match < s->strstart, "no future"); + match = cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ + + if (_win[match + best_len] !== scan_end || + _win[match + best_len - 1] !== scan_end1 || + _win[match] !== _win[scan] || + _win[++match] !== _win[scan + 1]) { + continue; + } + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2; + match++; + // Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + /*jshint noempty:false*/ + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + scan < strend); + + // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; +} + + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + + //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = s.window_size - s.lookahead - s.strstart; + + // JS ints have 32 bit, block below not needed + /* Deal with !@#$% 64K limit: */ + //if (sizeof(int) <= 2) { + // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + // more = wsize; + // + // } else if (more == (unsigned)(-1)) { + // /* Very unlikely, but possible on 16 bit machine if + // * strstart == 0 && lookahead == 1 (input done a byte at time) + // */ + // more--; + // } + //} + + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + /* we now have strstart >= MAX_DIST */ + s.block_start -= _w_size; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = (m >= _w_size ? m - _w_size : 0); + } while (--n); + + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = (m >= _w_size ? m - _w_size : 0); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); + + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + //Assert(more >= 2, "more < 2"); + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + + /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; +//#if MIN_MATCH != 3 +// Call update_hash() MIN_MATCH-3 more times +//#endif + while (s.insert) { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ +// if (s.high_water < s.window_size) { +// var curr = s.strstart + s.lookahead; +// var init = 0; +// +// if (s.high_water < curr) { +// /* Previous high water mark below current data -- zero WIN_INIT +// * bytes or up to end of window, whichever is less. +// */ +// init = s.window_size - curr; +// if (init > WIN_INIT) +// init = WIN_INIT; +// zmemzero(s->window + curr, (unsigned)init); +// s->high_water = curr + init; +// } +// else if (s->high_water < (ulg)curr + WIN_INIT) { +// /* High water mark at or above current data, but below current data +// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up +// * to end of window, whichever is less. +// */ +// init = (ulg)curr + WIN_INIT - s->high_water; +// if (init > s->window_size - s->high_water) +// init = s->window_size - s->high_water; +// zmemzero(s->window + s->high_water, (unsigned)init); +// s->high_water += init; +// } +// } +// +// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, +// "not enough room for search"); +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +function deflate_stored(s, flush) { + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + var max_block_size = 0xffff; + + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s.lookahead <= 1) { + + //Assert(s->strstart < s->w_size+MAX_DIST(s) || + // s->block_start >= (long)s->w_size, "slide too late"); +// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || +// s.block_start >= s.w_size)) { +// throw new Error("slide too late"); +// } + + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + + if (s.lookahead === 0) { + break; + } + /* flush the current block */ + } + //Assert(s->block_start >= 0L, "block gone"); +// if (s.block_start < 0) throw new Error("block gone"); + + s.strstart += s.lookahead; + s.lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + var max_start = s.block_start + max_block_size; + + if (s.strstart === 0 || s.strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + + + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + + s.insert = 0; + + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + + if (s.strstart > s.block_start) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_NEED_MORE; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +function deflate_fast(s, flush) { + var hash_head; /* head of the hash chain */ + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; /* flush the current block */ + } + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + } + if (s.match_length >= MIN_MATCH) { + // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only + + /*** _tr_tally_dist(s, s.strstart - s.match_start, + s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { + s.match_length--; /* string at strstart already in table */ + do { + s.strstart++; + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s.match_length !== 0); + s.strstart++; + } else + { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; + +//#if MIN_MATCH != 3 +// Call UPDATE_HASH() MIN_MATCH-3 more times +//#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s.window[s.strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +function deflate_slow(s, flush) { + var hash_head; /* head of hash chain */ + var bflush; /* set if current block must be flushed */ + + var max_insert; + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + */ + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + + if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && + s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + + if (s.match_length <= 5 && + (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s.match_length = MIN_MATCH - 1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + //check_match(s, s.strstart-1, s.prev_match, s.prev_length); + + /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, + s.prev_length - MIN_MATCH, bflush);***/ + bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + } else if (s.match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + if (bflush) { + /*** FLUSH_BLOCK_ONLY(s, 0) ***/ + flush_block_only(s, false); + /***/ + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + //Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s.match_available) { + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_BLOCK_DONE; +} + + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +function deflate_rle(s, flush) { + var bflush; /* set if current block must be flushed */ + var prev; /* byte at distance one to match */ + var scan, strend; /* scan goes up to strend for length of run */ + + var _win = s.window; + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + /*jshint noempty:false*/ + } while (prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s.match_length >= MIN_MATCH) { + //check_match(s, s.strstart, s.strstart - 1, s.match_length); + + /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +function deflate_huff(s, flush) { + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s.match_length = 0; + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; +} + +var configuration_table; + +configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), /* 3 */ + + new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ +]; + + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +function lm_init(s) { + s.window_size = 2 * s.w_size; + + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + + /* Set the default configuration parameters: + */ + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; +} + + +function DeflateState() { + this.strm = null; /* pointer back to this zlib stream */ + this.status = 0; /* as the name implies */ + this.pending_buf = null; /* output still pending */ + this.pending_buf_size = 0; /* size of pending_buf */ + this.pending_out = 0; /* next pending byte to output to the stream */ + this.pending = 0; /* nb of bytes in the pending buffer */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.gzhead = null; /* gzip header information to write */ + this.gzindex = 0; /* where in extra, name, or comment */ + this.method = Z_DEFLATED; /* can only be DEFLATED */ + this.last_flush = -1; /* value of flush param for previous deflate call */ + + this.w_size = 0; /* LZ77 window size (32K by default) */ + this.w_bits = 0; /* log2(w_size) (8..16) */ + this.w_mask = 0; /* w_size - 1 */ + + this.window = null; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. + */ + + this.window_size = 0; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + this.prev = null; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + this.head = null; /* Heads of the hash chains or NIL. */ + + this.ins_h = 0; /* hash index of string to be inserted */ + this.hash_size = 0; /* number of elements in hash table */ + this.hash_bits = 0; /* log2(hash_size) */ + this.hash_mask = 0; /* hash_size-1 */ + + this.hash_shift = 0; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + this.block_start = 0; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + this.match_length = 0; /* length of best match */ + this.prev_match = 0; /* previous match */ + this.match_available = 0; /* set if previous match exists */ + this.strstart = 0; /* start of string to insert */ + this.match_start = 0; /* start of matching string */ + this.lookahead = 0; /* number of valid bytes ahead in window */ + + this.prev_length = 0; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + this.max_chain_length = 0; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + this.max_lazy_match = 0; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ + // That's alias to max_lazy_match, don't use directly + //this.max_insert_length = 0; + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + this.level = 0; /* compression level (1..9) */ + this.strategy = 0; /* favor or force Huffman coding*/ + + this.good_match = 0; + /* Use a faster search when the previous match is longer than this */ + + this.nice_match = 0; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + + /* Didn't use ct_data typedef below to suppress compiler warning */ + + // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + // Use flat array of DOUBLE size, with interleaved fata, + // because JS does not support effective + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); + this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + + this.l_desc = null; /* desc. for literal tree */ + this.d_desc = null; /* desc. for distance tree */ + this.bl_desc = null; /* desc. for bit length tree */ + + //ush bl_count[MAX_BITS+1]; + this.bl_count = new utils.Buf16(MAX_BITS + 1); + /* number of codes at each bit length for an optimal tree */ + + //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ + zero(this.heap); + + this.heap_len = 0; /* number of elements in the heap */ + this.heap_max = 0; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; + zero(this.depth); + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + this.l_buf = 0; /* buffer index for literals or lengths */ + + this.lit_bufsize = 0; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + this.last_lit = 0; /* running index in l_buf */ + + this.d_buf = 0; + /* Buffer index for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + this.opt_len = 0; /* bit length of current block with optimal trees */ + this.static_len = 0; /* bit length of current block with static trees */ + this.matches = 0; /* number of string matches in current block */ + this.insert = 0; /* bytes at end of window left to insert */ + + + this.bi_buf = 0; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + this.bi_valid = 0; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + // Used for window memory init. We safely ignore it for JS. That makes + // sense only for pointers and memory check tools. + //this.high_water = 0; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ +} + + +function deflateResetKeep(strm) { + var s; + + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + + s = strm.state; + s.pending = 0; + s.pending_out = 0; + + if (s.wrap < 0) { + s.wrap = -s.wrap; + /* was made negative by deflate(..., Z_FINISH); */ + } + s.status = (s.wrap ? INIT_STATE : BUSY_STATE); + strm.adler = (s.wrap === 2) ? + 0 // crc32(0, Z_NULL, 0) + : + 1; // adler32(0, Z_NULL, 0) + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; +} + + +function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; +} + + +function deflateSetHeader(strm, head) { + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } + strm.state.gzhead = head; + return Z_OK; +} + + +function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { // === Z_NULL + return Z_STREAM_ERROR; + } + var wrap = 1; + + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } + + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } + + + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + + + if (windowBits === 8) { + windowBits = 9; + } + /* until 256-byte window bug fixed */ + + var s = new DeflateState(); + + strm.state = s; + s.strm = strm; + + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + + // Don't need mem init magic for JS. + //s.high_water = 0; /* nothing written to s->window yet */ + + s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + s.pending_buf_size = s.lit_bufsize * 4; + + //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + //s->pending_buf = (uchf *) overlay; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + + // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) + //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s.d_buf = 1 * s.lit_bufsize; + + //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s.l_buf = (1 + 2) * s.lit_bufsize; + + s.level = level; + s.strategy = strategy; + s.method = method; + + return deflateReset(strm); +} + +function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); +} + + +function deflate(strm, flush) { + var old_flush, s; + var beg, val; // for gzip header write only + + if (!strm || !strm.state || + flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + + s = strm.state; + + if (!strm.output || + (!strm.input && strm.avail_in !== 0) || + (s.status === FINISH_STATE && flush !== Z_FINISH)) { + return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + + s.strm = strm; /* just in case */ + old_flush = s.last_flush; + s.last_flush = flush; + + /* Write the header */ + if (s.status === INIT_STATE) { + + if (s.wrap === 2) { // GZIP header + strm.adler = 0; //crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { // s->gzhead == Z_NULL + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } + else { + put_byte(s, (s.gzhead.text ? 1 : 0) + + (s.gzhead.hcrc ? 2 : 0) + + (!s.gzhead.extra ? 0 : 4) + + (!s.gzhead.name ? 0 : 8) + + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 0xff); + put_byte(s, (s.gzhead.time >> 8) & 0xff); + put_byte(s, (s.gzhead.time >> 16) & 0xff); + put_byte(s, (s.gzhead.time >> 24) & 0xff); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, s.gzhead.os & 0xff); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 0xff); + put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + else // DEFLATE header + { + var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; + var level_flags = -1; + + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= (level_flags << 6); + if (s.strstart !== 0) { header |= PRESET_DICT; } + header += 31 - (header % 31); + + s.status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + strm.adler = 1; // adler32(0L, Z_NULL, 0); + } + } + +//#ifdef GZIP + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + + while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } + else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } + else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } + else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + strm.adler = 0; //crc32(0L, Z_NULL, 0); + s.status = BUSY_STATE; + } + } + else { + s.status = BUSY_STATE; + } + } +//#endif + + /* Flush as much pending output as possible */ + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s.last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && + flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm.avail_in !== 0 || s.lookahead !== 0 || + (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { + var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : + (s.strategy === Z_RLE ? deflate_rle(s, flush) : + configuration_table[s.level].func(s, flush)); + + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } + else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + + trees._tr_stored_block(s, 0, 0, false); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush === Z_FULL_FLUSH) { + /*** CLEAR_HASH(s); ***/ /* forget history */ + zero(s.head); // Fill with NIL (= 0); + + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + //Assert(strm->avail_out > 0, "bug2"); + //if (strm.avail_out <= 0) { throw new Error("bug2");} + + if (flush !== Z_FINISH) { return Z_OK; } + if (s.wrap <= 0) { return Z_STREAM_END; } + + /* Write the trailer */ + if (s.wrap === 2) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + put_byte(s, (strm.adler >> 16) & 0xff); + put_byte(s, (strm.adler >> 24) & 0xff); + put_byte(s, strm.total_in & 0xff); + put_byte(s, (strm.total_in >> 8) & 0xff); + put_byte(s, (strm.total_in >> 16) & 0xff); + put_byte(s, (strm.total_in >> 24) & 0xff); + } + else + { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s.wrap > 0) { s.wrap = -s.wrap; } + /* write the trailer only once! */ + return s.pending !== 0 ? Z_OK : Z_STREAM_END; +} + +function deflateEnd(strm) { + var status; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + status = strm.state.status; + if (status !== INIT_STATE && + status !== EXTRA_STATE && + status !== NAME_STATE && + status !== COMMENT_STATE && + status !== HCRC_STATE && + status !== BUSY_STATE && + status !== FINISH_STATE + ) { + return err(strm, Z_STREAM_ERROR); + } + + strm.state = null; + + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; +} + + +/* ========================================================================= + * Initializes the compression dictionary from the given byte + * sequence without producing any compressed output. + */ +function deflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var s; + var str, n; + var wrap; + var avail; + var next; + var input; + var tmpDict; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + s = strm.state; + wrap = s.wrap; + + if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { + return Z_STREAM_ERROR; + } + + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap === 1) { + /* adler32(strm->adler, dictionary, dictLength); */ + strm.adler = adler32(strm.adler, dictionary, dictLength, 0); + } + + s.wrap = 0; /* avoid computing Adler-32 in read_buf */ + + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s.w_size) { + if (wrap === 0) { /* already empty otherwise */ + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + /* use the tail */ + // dictionary = dictionary.slice(dictLength - s.w_size); + tmpDict = new utils.Buf8(s.w_size); + utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); + dictionary = tmpDict; + dictLength = s.w_size; + } + /* insert dictionary into window and hash */ + avail = strm.avail_in; + next = strm.next_in; + input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + str = s.strstart; + n = s.lookahead - (MIN_MATCH - 1); + do { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + + s.head[s.ins_h] = str; + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); + } + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK; +} + + +exports.deflateInit = deflateInit; +exports.deflateInit2 = deflateInit2; +exports.deflateReset = deflateReset; +exports.deflateResetKeep = deflateResetKeep; +exports.deflateSetHeader = deflateSetHeader; +exports.deflate = deflate; +exports.deflateEnd = deflateEnd; +exports.deflateSetDictionary = deflateSetDictionary; +exports.deflateInfo = 'pako deflate (from Nodeca project)'; + +/* Not implemented +exports.deflateBound = deflateBound; +exports.deflateCopy = deflateCopy; +exports.deflateParams = deflateParams; +exports.deflatePending = deflatePending; +exports.deflatePrime = deflatePrime; +exports.deflateTune = deflateTune; +*/ + +},{"../utils/common":28,"./adler32":30,"./crc32":32,"./messages":38,"./trees":39}],34:[function(require,module,exports){ +'use strict'; + + +function GZheader() { + /* true if compressed data believed to be text */ + this.text = 0; + /* modification time */ + this.time = 0; + /* extra flags (not used when writing a gzip file) */ + this.xflags = 0; + /* operating system */ + this.os = 0; + /* pointer to extra field or Z_NULL if none */ + this.extra = null; + /* extra field length (valid if extra != Z_NULL) */ + this.extra_len = 0; // Actually, we don't need it in JS, + // but leave for few code modifications + + // + // Setup limits is not necessary because in js we should not preallocate memory + // for inflate use constant limit in 65536 bytes + // + + /* space at extra (only when reading header) */ + // this.extra_max = 0; + /* pointer to zero-terminated file name or Z_NULL */ + this.name = ''; + /* space at name (only when reading header) */ + // this.name_max = 0; + /* pointer to zero-terminated comment or Z_NULL */ + this.comment = ''; + /* space at comment (only when reading header) */ + // this.comm_max = 0; + /* true if there was or will be a header crc */ + this.hcrc = 0; + /* true when done reading gzip header (not used when writing a gzip file) */ + this.done = false; +} + +module.exports = GZheader; + +},{}],35:[function(require,module,exports){ +'use strict'; + +// See state defs from inflate.js +var BAD = 30; /* got a data error -- remain here until reset */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state.mode === LEN + strm.avail_in >= 6 + strm.avail_out >= 258 + start >= strm.avail_out + state.bits < 8 + + On return, state.mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm.avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm.avail_out >= 258 for each loop to avoid checking for + output space. + */ +module.exports = function inflate_fast(strm, start) { + var state; + var _in; /* local strm.input */ + var last; /* have enough input while in < last */ + var _out; /* local strm.output */ + var beg; /* inflate()'s initial strm.output */ + var end; /* while out < end, enough space available */ +//#ifdef INFLATE_STRICT + var dmax; /* maximum distance from zlib header */ +//#endif + var wsize; /* window size or zero if not using window */ + var whave; /* valid bytes in the window */ + var wnext; /* window write index */ + // Use `s_window` instead `window`, avoid conflict with instrumentation tools + var s_window; /* allocated sliding window, if wsize != 0 */ + var hold; /* local strm.hold */ + var bits; /* local strm.bits */ + var lcode; /* local strm.lencode */ + var dcode; /* local strm.distcode */ + var lmask; /* mask for first level of length codes */ + var dmask; /* mask for first level of distance codes */ + var here; /* retrieved table entry */ + var op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + var len; /* match length, unused bytes */ + var dist; /* match distance */ + var from; /* where to copy match from */ + var from_source; + + + var input, output; // JS specific, because we have no pointers + + /* copy state to local variables */ + state = strm.state; + //here = state.here; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); +//#ifdef INFLATE_STRICT + dmax = state.dmax; +//#endif + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + s_window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; + + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + + here = lcode[hold & lmask]; + + dolen: + for (;;) { // Goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + if (op === 0) { /* literal */ + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + output[_out++] = here & 0xffff/*here.val*/; + } + else if (op & 16) { /* length base */ + len = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & ((1 << op) - 1); + hold >>>= op; + bits -= op; + } + //Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + + dodist: + for (;;) { // goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + + if (op & 16) { /* distance base */ + dist = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & ((1 << op) - 1); +//#ifdef INFLATE_STRICT + if (dist > dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } +//#endif + hold >>>= op; + bits -= op; + //Tracevv((stderr, "inflate: distance %u\n", dist)); + op = _out - beg; /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// if (len <= op - whave) { +// do { +// output[_out++] = 0; +// } while (--len); +// continue top; +// } +// len -= op - whave; +// do { +// output[_out++] = 0; +// } while (--op > whave); +// if (op === 0) { +// from = _out - dist; +// do { +// output[_out++] = output[from++]; +// } while (--len); +// continue top; +// } +//#endif + } + from = 0; // window index + from_source = s_window; + if (wnext === 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } + else { + from = _out - dist; /* copy direct from output */ + do { /* minimum length is three */ + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } + else if ((op & 64) === 0) { /* 2nd level distance code */ + here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dodist; + } + else { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } + else if ((op & 64) === 0) { /* 2nd level length code */ + here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dolen; + } + else if (op & 32) { /* end-of-block */ + //Tracevv((stderr, "inflate: end of block\n")); + state.mode = TYPE; + break top; + } + else { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } while (_in < last && _out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + + /* update state and return */ + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); + strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); + state.hold = hold; + state.bits = bits; + return; +}; + +},{}],36:[function(require,module,exports){ +'use strict'; + + +var utils = require('../utils/common'); +var adler32 = require('./adler32'); +var crc32 = require('./crc32'); +var inflate_fast = require('./inffast'); +var inflate_table = require('./inftrees'); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +//var Z_NO_FLUSH = 0; +//var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +//var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + +/* The deflate compression method */ +var Z_DEFLATED = 8; + + +/* STATES ====================================================================*/ +/* ===========================================================================*/ + + +var HEAD = 1; /* i: waiting for magic header */ +var FLAGS = 2; /* i: waiting for method and flags (gzip) */ +var TIME = 3; /* i: waiting for modification time (gzip) */ +var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ +var EXLEN = 5; /* i: waiting for extra length (gzip) */ +var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ +var NAME = 7; /* i: waiting for end of file name (gzip) */ +var COMMENT = 8; /* i: waiting for end of comment (gzip) */ +var HCRC = 9; /* i: waiting for header crc (gzip) */ +var DICTID = 10; /* i: waiting for dictionary check value */ +var DICT = 11; /* waiting for inflateSetDictionary() call */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ +var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ +var STORED = 14; /* i: waiting for stored size (length and complement) */ +var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ +var COPY = 16; /* i/o: waiting for input or output to copy stored block */ +var TABLE = 17; /* i: waiting for dynamic block table lengths */ +var LENLENS = 18; /* i: waiting for code length code lengths */ +var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ +var LEN_ = 20; /* i: same as LEN below, but only first time in */ +var LEN = 21; /* i: waiting for length/lit/eob code */ +var LENEXT = 22; /* i: waiting for length extra bits */ +var DIST = 23; /* i: waiting for distance code */ +var DISTEXT = 24; /* i: waiting for distance extra bits */ +var MATCH = 25; /* o: waiting for output space to copy string */ +var LIT = 26; /* o: waiting for output space to write literal */ +var CHECK = 27; /* i: waiting for 32-bit check value */ +var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ +var DONE = 29; /* finished check, done -- remain here until reset */ +var BAD = 30; /* got a data error -- remain here until reset */ +var MEM = 31; /* got an inflate() memory error -- remain here until reset */ +var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ + +/* ===========================================================================*/ + + + +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_WBITS = MAX_WBITS; + + +function zswap32(q) { + return (((q >>> 24) & 0xff) + + ((q >>> 8) & 0xff00) + + ((q & 0xff00) << 8) + + ((q & 0xff) << 24)); +} + + +function InflateState() { + this.mode = 0; /* current inflate mode */ + this.last = false; /* true if processing last block */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.havedict = false; /* true if dictionary provided */ + this.flags = 0; /* gzip header method and flags (0 if zlib) */ + this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ + this.check = 0; /* protected copy of check value */ + this.total = 0; /* protected copy of output count */ + // TODO: may be {} + this.head = null; /* where to save gzip header information */ + + /* sliding window */ + this.wbits = 0; /* log base 2 of requested window size */ + this.wsize = 0; /* window size or zero if not using window */ + this.whave = 0; /* valid bytes in the window */ + this.wnext = 0; /* window write index */ + this.window = null; /* allocated sliding window, if needed */ + + /* bit accumulator */ + this.hold = 0; /* input bit accumulator */ + this.bits = 0; /* number of bits in "in" */ + + /* for string and stored block copying */ + this.length = 0; /* literal or length of data to copy */ + this.offset = 0; /* distance back to copy string from */ + + /* for table and code decoding */ + this.extra = 0; /* extra bits needed */ + + /* fixed and dynamic code tables */ + this.lencode = null; /* starting table for length/literal codes */ + this.distcode = null; /* starting table for distance codes */ + this.lenbits = 0; /* index bits for lencode */ + this.distbits = 0; /* index bits for distcode */ + + /* dynamic table building */ + this.ncode = 0; /* number of code length code lengths */ + this.nlen = 0; /* number of length code lengths */ + this.ndist = 0; /* number of distance code lengths */ + this.have = 0; /* number of code lengths in lens[] */ + this.next = null; /* next available space in codes[] */ + + this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ + this.work = new utils.Buf16(288); /* work area for code table building */ + + /* + because we don't have pointers in js, we use lencode and distcode directly + as buffers so we don't need codes + */ + //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ + this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ + this.distdyn = null; /* dynamic table for distance codes (JS specific) */ + this.sane = 0; /* if false, allow invalid distance too far */ + this.back = 0; /* bits back of last unprocessed length/lit */ + this.was = 0; /* initial length of match */ +} + +function inflateResetKeep(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ''; /*Z_NULL*/ + if (state.wrap) { /* to support ill-conceived Java test suite */ + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.dmax = 32768; + state.head = null/*Z_NULL*/; + state.hold = 0; + state.bits = 0; + //state.lencode = state.distcode = state.next = state.codes; + state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); + state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); + + state.sane = 1; + state.back = -1; + //Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +function inflateReset(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); + +} + +function inflateReset2(strm, windowBits) { + var wrap; + var state; + + /* get the state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + + /* update state and reset the rest of it */ + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); +} + +function inflateInit2(strm, windowBits) { + var ret; + var state; + + if (!strm) { return Z_STREAM_ERROR; } + //strm.msg = Z_NULL; /* in case we return an error */ + + state = new InflateState(); + + //if (state === Z_NULL) return Z_MEM_ERROR; + //Tracev((stderr, "inflate: allocated\n")); + strm.state = state; + state.window = null/*Z_NULL*/; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null/*Z_NULL*/; + } + return ret; +} + +function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); +} + + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +var virgin = true; + +var lenfix, distfix; // We have no pointers in JS, so keep tables separate + +function fixedtables(state) { + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + var sym; + + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + + /* literal/length table */ + sym = 0; + while (sym < 144) { state.lens[sym++] = 8; } + while (sym < 256) { state.lens[sym++] = 9; } + while (sym < 280) { state.lens[sym++] = 7; } + while (sym < 288) { state.lens[sym++] = 8; } + + inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); + + /* distance table */ + sym = 0; + while (sym < 32) { state.lens[sym++] = 5; } + + inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); + + /* do this just once */ + virgin = false; + } + + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; +} + + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +function updatewindow(strm, src, end, copy) { + var dist; + var state = strm.state; + + /* if it hasn't been done already, allocate space for the window */ + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + + state.window = new utils.Buf8(state.wsize); + } + + /* copy state->wsize or less output bytes into the circular window */ + if (copy >= state.wsize) { + utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); + state.wnext = 0; + state.whave = state.wsize; + } + else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + //zmemcpy(state->window + state->wnext, end - copy, dist); + utils.arraySet(state.window, src, end - copy, dist, state.wnext); + copy -= dist; + if (copy) { + //zmemcpy(state->window, end - copy, copy); + utils.arraySet(state.window, src, end - copy, copy, 0); + state.wnext = copy; + state.whave = state.wsize; + } + else { + state.wnext += dist; + if (state.wnext === state.wsize) { state.wnext = 0; } + if (state.whave < state.wsize) { state.whave += dist; } + } + } + return 0; +} + +function inflate(strm, flush) { + var state; + var input, output; // input/output buffers + var next; /* next input INDEX */ + var put; /* next output INDEX */ + var have, left; /* available input and output */ + var hold; /* bit buffer */ + var bits; /* bits in bit buffer */ + var _in, _out; /* save starting available input and output */ + var copy; /* number of stored or match bytes to copy */ + var from; /* where to copy match bytes from */ + var from_source; + var here = 0; /* current decoding table entry */ + var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) + //var last; /* parent table entry */ + var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) + var len; /* length to copy for repeats, bits to drop */ + var ret; /* return code */ + var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ + var opts; + + var n; // temporary var for NEED_BITS + + var order = /* permutation of code lengths */ + [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; + + + if (!strm || !strm.state || !strm.output || + (!strm.input && strm.avail_in !== 0)) { + return Z_STREAM_ERROR; + } + + state = strm.state; + if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ + + + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + _in = have; + _out = left; + ret = Z_OK; + + inf_leave: // goto emulation + for (;;) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + //=== NEEDBITS(16); + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ + state.check = 0/*crc32(0L, Z_NULL, 0)*/; + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = FLAGS; + break; + } + state.flags = 0; /* expect zlib header */ + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { + strm.msg = 'incorrect header check'; + state.mode = BAD; + break; + } + if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// + len = (hold & 0x0f)/*BITS(4)*/ + 8; + if (state.wbits === 0) { + state.wbits = len; + } + else if (len > state.wbits) { + strm.msg = 'invalid window size'; + state.mode = BAD; + break; + } + state.dmax = 1 << len; + //Tracev((stderr, "inflate: zlib header ok\n")); + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = hold & 0x200 ? DICTID : TYPE; + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + break; + case FLAGS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.flags = hold; + if ((state.flags & 0xff) !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + if (state.flags & 0xe000) { + strm.msg = 'unknown header flags set'; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = ((hold >> 8) & 1); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = TIME; + /* falls through */ + case TIME: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.time = hold; + } + if (state.flags & 0x0200) { + //=== CRC4(state.check, hold) + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + hbuf[2] = (hold >>> 16) & 0xff; + hbuf[3] = (hold >>> 24) & 0xff; + state.check = crc32(state.check, hbuf, 4, 0); + //=== + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = OS; + /* falls through */ + case OS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.xflags = (hold & 0xff); + state.head.os = (hold >> 8); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state.flags & 0x0400) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + else if (state.head) { + state.head.extra = null/*Z_NULL*/; + } + state.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state.flags & 0x0400) { + copy = state.length; + if (copy > have) { copy = have; } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + // Use untyped array for more conveniend processing later + state.head.extra = new Array(state.head.extra_len); + } + utils.arraySet( + state.head.extra, + input, + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + //zmemcpy(state.head.extra + len, next, + // len + copy > state.head.extra_max ? + // state.head.extra_max - len : copy); + } + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { break inf_leave; } + } + state.length = 0; + state.mode = NAME; + /* falls through */ + case NAME: + if (state.flags & 0x0800) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + // TODO: 2 or 1 bytes? + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.name_max*/)) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state.flags & 0x1000) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.comm_max*/)) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + /* falls through */ + case HCRC: + if (state.flags & 0x0200) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.check & 0xffff)) { + strm.msg = 'header crc mismatch'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + if (state.head) { + state.head.hcrc = ((state.flags >> 9) & 1); + state.head.done = true; + } + strm.adler = state.check = 0; + state.mode = TYPE; + break; + case DICTID: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + strm.adler = state.check = zswap32(hold); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = DICT; + /* falls through */ + case DICT: + if (state.havedict === 0) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + return Z_NEED_DICT; + } + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } + /* falls through */ + case TYPEDO: + if (state.last) { + //--- BYTEBITS() ---// + hold >>>= bits & 7; + bits -= bits & 7; + //---// + state.mode = CHECK; + break; + } + //=== NEEDBITS(3); */ + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.last = (hold & 0x01)/*BITS(1)*/; + //--- DROPBITS(1) ---// + hold >>>= 1; + bits -= 1; + //---// + + switch ((hold & 0x03)/*BITS(2)*/) { + case 0: /* stored block */ + //Tracev((stderr, "inflate: stored block%s\n", + // state.last ? " (last)" : "")); + state.mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + //Tracev((stderr, "inflate: fixed codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = LEN_; /* decode codes */ + if (flush === Z_TREES) { + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break inf_leave; + } + break; + case 2: /* dynamic block */ + //Tracev((stderr, "inflate: dynamic codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = TABLE; + break; + case 3: + strm.msg = 'invalid block type'; + state.mode = BAD; + } + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break; + case STORED: + //--- BYTEBITS() ---// /* go to byte boundary */ + hold >>>= bits & 7; + bits -= bits & 7; + //---// + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { + strm.msg = 'invalid stored block lengths'; + state.mode = BAD; + break; + } + state.length = hold & 0xffff; + //Tracev((stderr, "inflate: stored length %u\n", + // state.length)); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = COPY_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case COPY_: + state.mode = COPY; + /* falls through */ + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { copy = have; } + if (copy > left) { copy = left; } + if (copy === 0) { break inf_leave; } + //--- zmemcpy(put, next, copy); --- + utils.arraySet(output, input, next, copy, put); + //---// + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + //Tracev((stderr, "inflate: stored end\n")); + state.mode = TYPE; + break; + case TABLE: + //=== NEEDBITS(14); */ + while (bits < 14) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// +//#ifndef PKZIP_BUG_WORKAROUND + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = 'too many length or distance symbols'; + state.mode = BAD; + break; + } +//#endif + //Tracev((stderr, "inflate: table sizes ok\n")); + state.have = 0; + state.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state.have < state.ncode) { + //=== NEEDBITS(3); + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + // We have separate tables & no pointers. 2 commented lines below not needed. + //state.next = state.codes; + //state.lencode = state.next; + // Switch to use dynamic table + state.lencode = state.lendyn; + state.lenbits = 7; + + opts = { bits: state.lenbits }; + ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + + if (ret) { + strm.msg = 'invalid code lengths set'; + state.mode = BAD; + break; + } + //Tracev((stderr, "inflate: code lengths ok\n")); + state.have = 0; + state.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_val < 16) { + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.lens[state.have++] = here_val; + } + else { + if (here_val === 16) { + //=== NEEDBITS(here.bits + 2); + n = here_bits + 2; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + if (state.have === 0) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 0x03);//BITS(2); + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + } + else if (here_val === 17) { + //=== NEEDBITS(here.bits + 3); + n = here_bits + 3; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 3 + (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + else { + //=== NEEDBITS(here.bits + 7); + n = here_bits + 7; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 11 + (hold & 0x7f);//BITS(7); + //--- DROPBITS(7) ---// + hold >>>= 7; + bits -= 7; + //---// + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + + /* handle error breaks in while */ + if (state.mode === BAD) { break; } + + /* check for end-of-block code (better have one) */ + if (state.lens[256] === 0) { + strm.msg = 'invalid code -- missing end-of-block'; + state.mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state.lenbits = 9; + + opts = { bits: state.lenbits }; + ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.lenbits = opts.bits; + // state.lencode = state.next; + + if (ret) { + strm.msg = 'invalid literal/lengths set'; + state.mode = BAD; + break; + } + + state.distbits = 6; + //state.distcode.copy(state.codes); + // Switch to use dynamic table + state.distcode = state.distdyn; + opts = { bits: state.distbits }; + ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.distbits = opts.bits; + // state.distcode = state.next; + + if (ret) { + strm.msg = 'invalid distances set'; + state.mode = BAD; + break; + } + //Tracev((stderr, 'inflate: codes ok\n')); + state.mode = LEN_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case LEN_: + state.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + inflate_fast(strm, _out); + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if (here_bits <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_op && (here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.lencode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + state.mode = LIT; + break; + } + if (here_op & 32) { + //Tracevv((stderr, "inflate: end of block\n")); + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } + //Tracevv((stderr, "inflate: length %u\n", state.length)); + state.was = state.length; + state.mode = DIST; + /* falls through */ + case DIST: + for (;;) { + here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if ((here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.distcode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + if (here_op & 64) { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = (here_op) & 15; + state.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } +//#ifdef INFLATE_STRICT + if (state.offset > state.dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +//#endif + //Tracevv((stderr, "inflate: distance %u\n", state.offset)); + state.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { break inf_leave; } + copy = _out - left; + if (state.offset > copy) { /* copy from window */ + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// Trace((stderr, "inflate.c too far\n")); +// copy -= state.whave; +// if (copy > state.length) { copy = state.length; } +// if (copy > left) { copy = left; } +// left -= copy; +// state.length -= copy; +// do { +// output[put++] = 0; +// } while (--copy); +// if (state.length === 0) { state.mode = LEN; } +// break; +//#endif + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } + else { + from = state.wnext - copy; + } + if (copy > state.length) { copy = state.length; } + from_source = state.window; + } + else { /* copy from output */ + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { copy = left; } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { state.mode = LEN; } + break; + case LIT: + if (left === 0) { break inf_leave; } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + // Use '|' insdead of '+' to make sure that result is signed + hold |= input[next++] << bits; + bits += 8; + } + //===// + _out -= left; + strm.total_out += _out; + state.total += _out; + if (_out) { + strm.adler = state.check = + /*UPDATE(state.check, put - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); + + } + _out = left; + // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too + if ((state.flags ? hold : zswap32(hold)) !== state.check) { + strm.msg = 'incorrect data check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: check matches trailer\n")); + } + state.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state.wrap && state.flags) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.total & 0xffffffff)) { + strm.msg = 'incorrect length check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: length matches trailer\n")); + } + state.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + + // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + + if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && + (state.mode < CHECK || flush !== Z_FINISH))) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap && _out) { + strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + + (state.mode === TYPE ? 128 : 0) + + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; +} + +function inflateEnd(strm) { + + if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { + return Z_STREAM_ERROR; + } + + var state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK; +} + +function inflateGetHeader(strm, head) { + var state; + + /* check state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } + + /* save header structure */ + state.head = head; + head.done = false; + return Z_OK; +} + +function inflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var state; + var dictid; + var ret; + + /* check state */ + if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } + state = strm.state; + + if (state.wrap !== 0 && state.mode !== DICT) { + return Z_STREAM_ERROR; + } + + /* check for correct dictionary identifier */ + if (state.mode === DICT) { + dictid = 1; /* adler32(0, null, 0)*/ + /* dictid = adler32(dictid, dictionary, dictLength); */ + dictid = adler32(dictid, dictionary, dictLength, 0); + if (dictid !== state.check) { + return Z_DATA_ERROR; + } + } + /* copy dictionary to window using updatewindow(), which will amend the + existing dictionary if appropriate */ + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state.mode = MEM; + return Z_MEM_ERROR; + } + state.havedict = 1; + // Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +exports.inflateReset = inflateReset; +exports.inflateReset2 = inflateReset2; +exports.inflateResetKeep = inflateResetKeep; +exports.inflateInit = inflateInit; +exports.inflateInit2 = inflateInit2; +exports.inflate = inflate; +exports.inflateEnd = inflateEnd; +exports.inflateGetHeader = inflateGetHeader; +exports.inflateSetDictionary = inflateSetDictionary; +exports.inflateInfo = 'pako inflate (from Nodeca project)'; + +/* Not implemented +exports.inflateCopy = inflateCopy; +exports.inflateGetDictionary = inflateGetDictionary; +exports.inflateMark = inflateMark; +exports.inflatePrime = inflatePrime; +exports.inflateSync = inflateSync; +exports.inflateSyncPoint = inflateSyncPoint; +exports.inflateUndermine = inflateUndermine; +*/ + +},{"../utils/common":28,"./adler32":30,"./crc32":32,"./inffast":35,"./inftrees":37}],37:[function(require,module,exports){ +'use strict'; + + +var utils = require('../utils/common'); + +var MAXBITS = 15; +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +var lbase = [ /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 +]; + +var lext = [ /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 +]; + +var dbase = [ /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0 +]; + +var dext = [ /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64 +]; + +module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) +{ + var bits = opts.bits; + //here = opts.here; /* table entry for duplication */ + + var len = 0; /* a code's length in bits */ + var sym = 0; /* index of code symbols */ + var min = 0, max = 0; /* minimum and maximum code lengths */ + var root = 0; /* number of index bits for root table */ + var curr = 0; /* number of index bits for current table */ + var drop = 0; /* code bits to drop for sub-table */ + var left = 0; /* number of prefix codes available */ + var used = 0; /* code entries in table used */ + var huff = 0; /* Huffman code */ + var incr; /* for incrementing code, index */ + var fill; /* index for replicating entries */ + var low; /* low bits for current root entry */ + var mask; /* mask for low root bits */ + var next; /* next available space in table */ + var base = null; /* base value table to use */ + var base_index = 0; +// var shoextra; /* extra bits table to use */ + var end; /* use base and extra for symbol > end */ + var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ + var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ + var extra = null; + var extra_index = 0; + + var here_bits, here_op, here_val; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + + /* bound code lengths, force root to be within code lengths */ + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { break; } + } + if (root > max) { + root = max; + } + if (max === 0) { /* no symbols to code at all */ + //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ + //table.bits[opts.table_index] = 1; //here.bits = (var char)1; + //table.val[opts.table_index++] = 0; //here.val = (var short)0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + + //table.op[opts.table_index] = 64; + //table.bits[opts.table_index] = 1; + //table.val[opts.table_index++] = 0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + opts.bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { break; } + } + if (root < min) { + root = min; + } + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } /* over-subscribed */ + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; /* incomplete set */ + } + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + // poor man optimization - use if-else instead of switch, + // to avoid deopts in old v8 + if (type === CODES) { + base = extra = work; /* dummy value--not used */ + end = 19; + + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + + } else { /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize opts for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = table_index; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = -1; /* trigger new sub-table when len > root */ + used = 1 << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + var i = 0; + /* process all codes and make table entries */ + for (;;) { + i++; + /* create table entry */ + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } + else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } + else { + here_op = 32 + 64; /* end of block */ + here_val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1 << (len - drop); + fill = 1 << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; + } while (fill !== 0); + + /* backwards increment the len-bit code huff */ + incr = 1 << (len - 1); + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + + /* go to next symbol, update count, len */ + sym++; + if (--count[len] === 0) { + if (len === max) { break; } + len = lens[lens_index + work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) !== low) { + /* if first time, transition to sub-tables */ + if (drop === 0) { + drop = root; + } + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { break; } + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1 << curr; + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* point entry in root table to sub-table */ + low = huff & mask; + /*table.op[low] = curr; + table.bits[low] = root; + table.val[low] = next - opts.table_index;*/ + table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff !== 0) { + //table.op[next + huff] = 64; /* invalid code marker */ + //table.bits[next + huff] = len - drop; + //table.val[next + huff] = 0; + table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; + } + + /* set return parameters */ + //opts.table_index += used; + opts.bits = root; + return 0; +}; + +},{"../utils/common":28}],38:[function(require,module,exports){ +'use strict'; + +module.exports = { + 2: 'need dictionary', /* Z_NEED_DICT 2 */ + 1: 'stream end', /* Z_STREAM_END 1 */ + 0: '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ +}; + +},{}],39:[function(require,module,exports){ +'use strict'; + + +var utils = require('../utils/common'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +//var Z_FILTERED = 1; +//var Z_HUFFMAN_ONLY = 2; +//var Z_RLE = 3; +var Z_FIXED = 4; +//var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +var Z_BINARY = 0; +var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + +/*============================================================================*/ + + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + +// From zutil.h + +var STORED_BLOCK = 0; +var STATIC_TREES = 1; +var DYN_TREES = 2; +/* The three kinds of block type */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +/* The minimum and maximum match lengths */ + +// From deflate.h +/* =========================================================================== + * Internal compression state. + */ + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ + +var LITERALS = 256; +/* number of literal bytes 0..255 */ + +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ + +var D_CODES = 30; +/* number of distance codes */ + +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ + +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ + +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var Buf_size = 16; +/* size of bit buffer in bi_buf */ + + +/* =========================================================================== + * Constants + */ + +var MAX_BL_BITS = 7; +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +var END_BLOCK = 256; +/* end of block literal code */ + +var REP_3_6 = 16; +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +var REPZ_3_10 = 17; +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +var REPZ_11_138 = 18; +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +/* eslint-disable comma-spacing,array-bracket-spacing */ +var extra_lbits = /* extra bits for each length code */ + [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; + +var extra_dbits = /* extra bits for each distance code */ + [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; + +var extra_blbits = /* extra bits for each bit length code */ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; + +var bl_order = + [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; +/* eslint-enable comma-spacing,array-bracket-spacing */ + +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +// We pre-fill arrays with 0 to avoid uninitialized gaps + +var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ + +// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 +var static_ltree = new Array((L_CODES + 2) * 2); +zero(static_ltree); +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +var static_dtree = new Array(D_CODES * 2); +zero(static_dtree); +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +var _dist_code = new Array(DIST_CODE_LEN); +zero(_dist_code); +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); +zero(_length_code); +/* length code for each normalized match length (0 == MIN_MATCH) */ + +var base_length = new Array(LENGTH_CODES); +zero(base_length); +/* First normalized length for each code (0 = MIN_MATCH) */ + +var base_dist = new Array(D_CODES); +zero(base_dist); +/* First normalized distance for each code (0 = distance of 1) */ + + +function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + + this.static_tree = static_tree; /* static tree or NULL */ + this.extra_bits = extra_bits; /* extra bits for each code or NULL */ + this.extra_base = extra_base; /* base index for extra_bits */ + this.elems = elems; /* max number of elements in the tree */ + this.max_length = max_length; /* max bit length for the codes */ + + // show if `static_tree` has data or dummy - needed for monomorphic objects + this.has_stree = static_tree && static_tree.length; +} + + +var static_l_desc; +var static_d_desc; +var static_bl_desc; + + +function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; /* the dynamic tree */ + this.max_code = 0; /* largest code with non zero frequency */ + this.stat_desc = stat_desc; /* the corresponding static tree */ +} + + + +function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; +} + + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +function put_short(s, w) { +// put_byte(s, (uch)((w) & 0xff)); +// put_byte(s, (uch)((ush)(w) >> 8)); + s.pending_buf[s.pending++] = (w) & 0xff; + s.pending_buf[s.pending++] = (w >>> 8) & 0xff; +} + + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +function send_bits(s, value, length) { + if (s.bi_valid > (Buf_size - length)) { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + put_short(s, s.bi_buf); + s.bi_buf = value >> (Buf_size - s.bi_valid); + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + s.bi_valid += length; + } +} + + +function send_code(s, c, tree) { + send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); +} + + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; +} + + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 0xff; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } +} + + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +function gen_bitlen(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; /* heap index */ + var n, m; /* iterate over the tree elements */ + var bits; /* bit length */ + var xbits; /* extra bits */ + var f; /* frequency */ + var overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ + + for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n * 2 + 1]/*.Len*/ = bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) { continue; } /* not a leaf node */ + + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]/*.Freq*/; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); + } + } + if (overflow === 0) { return; } + + // Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { bits--; } + s.bl_count[bits]--; /* move one leaf down the tree */ + s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ + s.bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { continue; } + if (tree[m * 2 + 1]/*.Len*/ !== bits) { + // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; + tree[m * 2 + 1]/*.Len*/ = bits; + } + n--; + } + } +} + + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +function gen_codes(tree, max_code, bl_count) +// ct_data *tree; /* the tree to decorate */ +// int max_code; /* largest code with non zero frequency */ +// ushf *bl_count; /* number of codes at each bit length */ +{ + var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ + var code = 0; /* running code value */ + var bits; /* bit index */ + var n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits - 1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, + // "inconsistent bit counts"); + //Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); + + for (n = 0; n <= max_code; n++) { + var len = tree[n * 2 + 1]/*.Len*/; + if (len === 0) { continue; } + /* Now reverse the bits */ + tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len); + + //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", + // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); + } +} + + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +function tr_static_init() { + var n; /* iterates over tree elements */ + var bits; /* bit counter */ + var length; /* length value */ + var code; /* code value */ + var dist; /* distance index */ + var bl_count = new Array(MAX_BITS + 1); + /* number of codes at each bit length for an optimal tree */ + + // do check in _tr_init() + //if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +/*#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif*/ + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES - 1; code++) { + base_length[code] = length; + for (n = 0; n < (1 << extra_lbits[code]); n++) { + _length_code[length++] = code; + } + } + //Assert (length == 256, "tr_static_init: length != 256"); + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + _length_code[length - 1] = code; + + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1 << extra_dbits[code]); n++) { + _dist_code[dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: dist != 256"); + dist >>= 7; /* from now on, all distances are divided by 128 */ + for (; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { + _dist_code[256 + dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n * 2 + 1]/*.Len*/ = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n * 2 + 1]/*.Len*/ = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes(static_ltree, L_CODES + 1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n * 2 + 1]/*.Len*/ = 5; + static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); + } + + // Now data ready and we can init static trees + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + + //static_init_done = true; +} + + +/* =========================================================================== + * Initialize a new block. + */ +function init_block(s) { + var n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } + + s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; +} + + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +function bi_windup(s) +{ + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + //put_byte(s, (Byte)s->bi_buf); + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +function copy_block(s, buf, len, header) +//DeflateState *s; +//charf *buf; /* the input data */ +//unsigned len; /* its length */ +//int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, len); + put_short(s, ~len); + } +// while (len--) { +// put_byte(s, *buf++); +// } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +function smaller(tree, n, m, depth) { + var _n2 = n * 2; + var _m2 = m * 2; + return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || + (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); +} + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +function pqdownheap(s, tree, k) +// deflate_state *s; +// ct_data *tree; /* the tree to restore */ +// int k; /* node to move down */ +{ + var v = s.heap[k]; + var j = k << 1; /* left son of k */ + while (j <= s.heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s.heap_len && + smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s.heap[j], s.depth)) { break; } + + /* Exchange v with the smallest son */ + s.heap[k] = s.heap[j]; + k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s.heap[k] = v; +} + + +// inlined manually +// var SMALLEST = 1; + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +function compress_block(s, ltree, dtree) +// deflate_state *s; +// const ct_data *ltree; /* literal tree */ +// const ct_data *dtree; /* distance tree */ +{ + var dist; /* distance of matched string */ + var lc; /* match length or unmatched char (if dist == 0) */ + var lx = 0; /* running index in l_buf */ + var code; /* the code to send */ + var extra; /* number of extra bits to send */ + + if (s.last_lit !== 0) { + do { + dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); + lc = s.pending_buf[s.l_buf + lx]; + lx++; + + if (dist === 0) { + send_code(s, lc, ltree); /* send a literal byte */ + //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + //Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + // "pendingBuf overflow"); + + } while (lx < s.last_lit); + } + + send_code(s, END_BLOCK, ltree); +} + + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +function build_tree(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; /* iterate over heap elements */ + var max_code = -1; /* largest code with non zero frequency */ + var node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n * 2]/*.Freq*/ !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + + } else { + tree[n * 2 + 1]/*.Len*/ = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); + tree[node * 2]/*.Freq*/ = 1; + s.depth[node] = 0; + s.opt_len--; + + if (has_stree) { + s.static_len -= stree[node * 2 + 1]/*.Len*/; + } + /* node is 0 or 1 so it does not have extra bits */ + } + desc.max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + //pqremove(s, tree, n); /* n = node of least frequency */ + /*** pqremove ***/ + n = s.heap[1/*SMALLEST*/]; + s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; + pqdownheap(s, tree, 1/*SMALLEST*/); + /***/ + + m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ + + s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ + s.heap[--s.heap_max] = m; + + /* Create a new node father of n and m */ + tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; + + /* and insert the new node in the heap */ + s.heap[1/*SMALLEST*/] = node++; + pqdownheap(s, tree, 1/*SMALLEST*/); + + } while (s.heap_len >= 2); + + s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes(tree, max_code, s.bl_count); +} + + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +function scan_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + s.bl_tree[curlen * 2]/*.Freq*/ += count; + + } else if (curlen !== 0) { + + if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } + s.bl_tree[REP_3_6 * 2]/*.Freq*/++; + + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; + + } else { + s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; + } + + count = 0; + prevlen = curlen; + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +function send_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); + + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + //Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +function build_bl_tree(s) { + var max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, s.bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { + break; + } + } + /* Update opt_len to include the bit length tree and counts */ + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // s->opt_len, s->static_len)); + + return max_blindex; +} + + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +function send_all_trees(s, lcodes, dcodes, blcodes) +// deflate_state *s; +// int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + var rank; /* index in bl_order */ + + //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + //Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); + } + //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ + //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ + //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +function detect_data_type(s) { + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + var black_mask = 0xf3ffc07f; + var n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { + return Z_BINARY; + } + } + + /* Check for textual ("white-listed") bytes. */ + if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || + s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + } + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + + +var static_init_done = false; + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +function _tr_init(s) +{ + + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + + s.bi_buf = 0; + s.bi_valid = 0; + + /* Initialize the first block of the first file: */ + init_block(s); +} + + +/* =========================================================================== + * Send a stored block + */ +function _tr_stored_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ + copy_block(s, buf, stored_len, true); /* with header */ +} + + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +function _tr_align(s) { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); +} + + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +function _tr_flush_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block, or NULL if too old */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + var max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s.level > 0) { + + /* Check if the file is binary or text */ + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + + /* Construct the literal and distance trees */ + build_tree(s, s.l_desc); + // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + + build_tree(s, s.d_desc); + // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s.opt_len + 3 + 7) >>> 3; + static_lenb = (s.static_len + 3 + 7) >>> 3; + + // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + // s->last_lit)); + + if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } + + } else { + // Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + + if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { + /* 4: two words for the lengths */ + + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + + send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + + } else { + send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); + } + // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + // s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +function _tr_tally(s, dist, lc) +// deflate_state *s; +// unsigned dist; /* distance of matched string */ +// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + //var out_length, in_length, dcode; + + s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; + + s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; + s.last_lit++; + + if (dist === 0) { + /* lc is the unmatched char */ + s.dyn_ltree[lc * 2]/*.Freq*/++; + } else { + s.matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + //Assert((ush)dist < (ush)MAX_DIST(s) && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; + s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility + +//#ifdef TRUNCATE_BLOCK +// /* Try to guess if it is profitable to stop the current block here */ +// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { +// /* Compute an upper bound for the compressed length */ +// out_length = s.last_lit*8; +// in_length = s.strstart - s.block_start; +// +// for (dcode = 0; dcode < D_CODES; dcode++) { +// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); +// } +// out_length >>>= 3; +// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +// // s->last_lit, in_length, out_length, +// // 100L - out_length*100L/in_length)); +// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { +// return true; +// } +// } +//#endif + + return (s.last_lit === s.lit_bufsize - 1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +exports._tr_init = _tr_init; +exports._tr_stored_block = _tr_stored_block; +exports._tr_flush_block = _tr_flush_block; +exports._tr_tally = _tr_tally; +exports._tr_align = _tr_align; + +},{"../utils/common":28}],40:[function(require,module,exports){ +'use strict'; + + +function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; +} + +module.exports = ZStream; + +},{}]},{},[10])(10) +}); +}; + + +//templater +//this is the build version: https://github.com/open-xml-templating/docxtemplater-build +//v3.0.8 (22.03.2017) +//https://github.com/open-xml-templating/docxtemplater +//Generate docx and pptx (microsoft word documents) from templates +/*The MIT License + +Copyright (c) 2013 Edgar HIPP + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +function initTemplater() +{ + initJsZip(); + +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Docxtemplater = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +"use strict"; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var memoize = require("./memoize"); +var DOMParser = require("xmldom").DOMParser; +var XMLSerializer = require("xmldom").XMLSerializer; +var Errors = require("./errors"); + +var DocUtils = {}; + +function parser(tag) { + return _defineProperty({}, "get", function get(scope) { + if (tag === ".") { + return scope; + } + return scope[tag]; + }); +} + +DocUtils.defaults = { + nullGetter: function nullGetter(part) { + if (!part.module) { + return "undefined"; + } + if (part.module === "rawxml") { + return ""; + } + return ""; + }, + + parser: memoize(parser), + delimiters: { + start: "{", + end: "}" + } +}; + +DocUtils.mergeObjects = function () { + var resObj = {}; + var obj = void 0, + keys = void 0; + for (var i = 0; i < arguments.length; i += 1) { + obj = arguments[i]; + keys = Object.keys(obj); + for (var j = 0; j < keys.length; j += 1) { + resObj[keys[j]] = obj[keys[j]]; + } + } + return resObj; +}; + +DocUtils.xml2str = function (xmlNode) { + var a = new XMLSerializer(); + return a.serializeToString(xmlNode); +}; + +DocUtils.decodeUtf8 = function (s) { + try { + if (s === undefined) { + return undefined; + } + // replace Ascii 160 space by the normal space, Ascii 32 + return decodeURIComponent(escape(DocUtils.convertSpaces(s))); + } catch (e) { + var err = new Error("End"); + err.properties.data = s; + err.properties.explanation = "Could not decode string to UTF8"; + throw err; + } +}; + +DocUtils.encodeUtf8 = function (s) { + return unescape(encodeURIComponent(s)); +}; + +DocUtils.str2xml = function (str, errorHandler) { + var parser = new DOMParser({ errorHandler: errorHandler }); + return parser.parseFromString(str, "text/xml"); +}; + +DocUtils.charMap = { + "&": "&", + "'": "'", + "<": "<", + ">": ">" +}; + +var regexStripRegexp = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; +DocUtils.escapeRegExp = function (str) { + return str.replace(regexStripRegexp, "\\$&"); +}; + +DocUtils.charMapRegexes = Object.keys(DocUtils.charMap).map(function (endChar) { + var startChar = DocUtils.charMap[endChar]; + return { + rstart: new RegExp(DocUtils.escapeRegExp(startChar), "g"), + rend: new RegExp(DocUtils.escapeRegExp(endChar), "g"), + start: startChar, + end: endChar + }; +}); + +DocUtils.wordToUtf8 = function (string) { + var r = void 0; + for (var i = 0, l = DocUtils.charMapRegexes.length; i < l; i++) { + r = DocUtils.charMapRegexes[i]; + string = string.replace(r.rstart, r.end); + } + return string; +}; + +DocUtils.utf8ToWord = function (string) { + if (typeof string !== "string") { + string = string.toString(); + } + var r = void 0; + for (var i = 0, l = DocUtils.charMapRegexes.length; i < l; i++) { + r = DocUtils.charMapRegexes[i]; + string = string.replace(r.rend, r.start); + } + return string; +}; + +DocUtils.cloneDeep = function (obj) { + return JSON.parse(JSON.stringify(obj)); +}; + +DocUtils.concatArrays = function (arrays) { + return arrays.reduce(function (result, array) { + Array.prototype.push.apply(result, array); + return result; + }, []); +}; + +var spaceRegexp = new RegExp(String.fromCharCode(160), "g"); +DocUtils.convertSpaces = function (s) { + return s.replace(spaceRegexp, " "); +}; + +DocUtils.pregMatchAll = function (regex, content) { + /* regex is a string, content is the content. It returns an array of all matches with their offset, for example: + regex=la + content=lolalolilala + returns: [{array: {0: 'la'},offset: 2},{array: {0: 'la'},offset: 8},{array: {0: 'la'} ,offset: 10}] + */ + var matchArray = []; + var match = void 0; + while ((match = regex.exec(content)) != null) { + matchArray.push({ array: match, offset: match.index }); + } + return matchArray; +}; + +DocUtils.sizeOfObject = function (obj) { + return Object.keys(obj).length; +}; + +function throwXmlTagNotFound(options) { + var err = new Errors.XTTemplateError("No tag '" + options.element + "' was found at the " + options.position); + err.properties = { + id: "no_xml_tag_found_at_" + options.position, + explanation: "No tag '" + options.element + "' was found at the " + options.position, + parsed: options.parsed, + index: options.index, + element: options.element + }; + throw err; +} + +DocUtils.getRight = function (parsed, element, index) { + for (var i = index, l = parsed.length; i < l; i++) { + var part = parsed[i]; + if (part.value === "</" + element + ">") { + return i; + } + } + throwXmlTagNotFound({ position: "right", element: element, parsed: parsed, index: index }); +}; + +DocUtils.getLeft = function (parsed, element, index) { + for (var i = index; i >= 0; i--) { + var part = parsed[i]; + if (part.value.indexOf("<" + element) === 0 && [">", " "].indexOf(part.value[element.length + 1]) !== -1) { + return i; + } + } + throwXmlTagNotFound({ position: "left", element: element, parsed: parsed, index: index }); +}; + +module.exports = DocUtils; +},{"./errors":2,"./memoize":5,"xmldom":19}],2:[function(require,module,exports){ +"use strict"; + +function XTError(message) { + this.name = "GenericError"; + this.message = message; + this.stack = new Error(message).stack; +} +XTError.prototype = Error.prototype; + +function XTTemplateError(message) { + this.name = "TemplateError"; + this.message = message; + this.stack = new Error(message).stack; +} +XTTemplateError.prototype = new XTError(); + +function XTScopeParserError(message) { + this.name = "ScopeParserError"; + this.message = message; + this.stack = new Error(message).stack; +} +XTScopeParserError.prototype = new XTError(); + +function XTInternalError(message) { + this.name = "InternalError"; + this.properties = { explanation: "InternalError" }; + this.message = message; + this.stack = new Error(message).stack; +} +XTInternalError.prototype = new XTError(); + +module.exports = { + XTError: XTError, + XTTemplateError: XTTemplateError, + XTInternalError: XTInternalError, + XTScopeParserError: XTScopeParserError +}; +},{}],3:[function(require,module,exports){ +"use strict"; + +var loopModule = require("./modules/loop"); +var spacePreserveModule = require("./modules/space-preserve"); +var rawXmlModule = require("./modules/rawxml"); +var expandPairTrait = require("./modules/expand-pair-trait"); +var render = require("./modules/render"); + +var PptXFileTypeConfig = { + getTemplatedFiles: function getTemplatedFiles(zip) { + var slideTemplates = zip.file(/ppt\/(slides|slideMasters)\/(slide|slideMaster)\d+\.xml/).map(function (file) { + return file.name; + }); + return slideTemplates.concat(["ppt/presentation.xml"]); + }, + + textPath: "ppt/slides/slide1.xml", + tagsXmlTextArray: ["a:t", "m:t"], + tagsXmlLexedArray: ["p:sp", "a:tc", "a:tr", "a:table", "a:p", "a:r"], + tagRawXml: "p:sp", + tagTextXml: "a:t", + baseModules: [render, expandPairTrait, rawXmlModule, loopModule] +}; + +var DocXFileTypeConfig = { + getTemplatedFiles: function getTemplatedFiles(zip) { + var slideTemplates = zip.file(/word\/(header|footer)\d+\.xml/).map(function (file) { + return file.name; + }); + return slideTemplates.concat(["word/document.xml"]); + }, + + textPath: "word/document.xml", + tagsXmlTextArray: ["w:t", "m:t"], + tagsXmlLexedArray: ["w:tc", "w:tr", "w:table", "w:p", "w:r"], + tagRawXml: "w:p", + tagTextXml: "w:t", + baseModules: [render, spacePreserveModule, expandPairTrait, rawXmlModule, loopModule] +}; + +module.exports = { + docx: DocXFileTypeConfig, + pptx: PptXFileTypeConfig +}; +},{"./modules/expand-pair-trait":8,"./modules/loop":9,"./modules/rawxml":10,"./modules/render":11,"./modules/space-preserve":12}],4:[function(require,module,exports){ +"use strict"; + +var Errors = require("./errors"); +var DocUtils = require("./doc-utils"); + +function inRange(range, match) { + return range[0] <= match.offset && match.offset < range[1]; +} + +function updateInTextTag(part, inTextTag) { + if (part.type === "tag" && part.position === "start" && part.text) { + if (inTextTag) { + throw new Error("Malformed xml : Already in text tag"); + } + return true; + } + if (part.type === "tag" && part.position === "end" && part.text) { + if (!inTextTag) { + throw new Error("Malformed xml : Already not in text tag"); + } + return false; + } + return inTextTag; +} + +function offsetSort(a, b) { + return a.offset - b.offset; +} + +function getTag(tag) { + var start = 1; + if (tag[1] === "/") { + start = 2; + } + var index = tag.indexOf(" "); + var end = index === -1 ? tag.length - 1 : index; + return { + tag: tag.slice(start, end), + position: start === 1 ? "start" : "end" + }; +} + +function tagMatcher(content, textMatchArray, othersMatchArray) { + var cursor = 0; + var contentLength = content.length; + var allMatches = DocUtils.concatArrays([textMatchArray.map(function (tag) { + return { tag: tag, text: true }; + }), othersMatchArray.map(function (tag) { + return { tag: tag, text: false }; + })]).reduce(function (allMatches, t) { + allMatches[t.tag] = t.text; + return allMatches; + }, {}); + var totalMatches = []; + + while (cursor < contentLength) { + cursor = content.indexOf("<", cursor); + if (cursor === -1) { + break; + } + var offset = cursor; + cursor = content.indexOf(">", cursor); + var tagText = content.slice(offset, cursor + 1); + + var _getTag = getTag(tagText), + tag = _getTag.tag, + position = _getTag.position; + + var text = allMatches[tag]; + if (text == null) { + continue; + } + totalMatches.push({ type: "tag", position: position, text: text, offset: offset, value: tagText }); + } + + return totalMatches; +} + +function throwUnopenedTagException(options) { + var err = new Errors.XTTemplateError("Unopened tag"); + err.properties = { + xtag: options.xtag.split(" ")[0], + id: "unopened_tag", + context: options.xtag, + explanation: "The tag beginning with '" + options.xtag.substr(0, 10) + "' is unclosed" + }; + throw err; +} + +function throwUnclosedTagException(options) { + var err = new Errors.XTTemplateError("Unclosed tag"); + err.properties = { + xtag: options.xtag.split(" ")[0].substr(1), + id: "unclosed_tag", + context: options.xtag, + explanation: "The tag beginning with '" + options.xtag.substr(0, 10) + "' is unclosed" + }; + throw err; +} + +function assertDelimiterOrdered(delimiterMatches, fullText) { + var inDelimiter = false; + var lastDelimiterMatch = { offset: 0 }; + var xtag = void 0; + delimiterMatches.forEach(function (delimiterMatch) { + xtag = fullText.substr(lastDelimiterMatch.offset, delimiterMatch.offset - lastDelimiterMatch.offset); + if (delimiterMatch.position === "start" && inDelimiter || delimiterMatch.position === "end" && !inDelimiter) { + if (delimiterMatch.position === "start") { + throwUnclosedTagException({ xtag: xtag }); + } else { + throwUnopenedTagException({ xtag: xtag }); + } + } + inDelimiter = !inDelimiter; + lastDelimiterMatch = delimiterMatch; + }); + var delimiterMatch = { offset: fullText.length }; + xtag = fullText.substr(lastDelimiterMatch.offset, delimiterMatch.offset - lastDelimiterMatch.offset); + if (inDelimiter) { + throwUnclosedTagException({ xtag: xtag }); + } +} + +function getAllIndexes(arr, val, position) { + var indexes = []; + var offset = -1; + do { + offset = arr.indexOf(val, offset + 1); + if (offset !== -1) { + indexes.push({ offset: offset, position: position }); + } + } while (offset !== -1); + return indexes; +} + +function Reader(innerContentParts) { + var _this = this; + + this.innerContentParts = innerContentParts; + this.full = ""; + this.parseDelimiters = function (delimiters) { + _this.full = _this.innerContentParts.join(""); + var offset = 0; + _this.ranges = _this.innerContentParts.map(function (part) { + offset += part.length; + return offset - part.length; + }); + + var delimiterMatches = DocUtils.concatArrays([getAllIndexes(_this.full, delimiters.start, "start"), getAllIndexes(_this.full, delimiters.end, "end")]).sort(offsetSort); + assertDelimiterOrdered(delimiterMatches, _this.full); + var delimiterLength = { start: delimiters.start.length, end: delimiters.end.length }; + var cutNext = 0; + var delimiterIndex = 0; + + _this.parsed = _this.ranges.map(function (offset, i) { + var range = [offset, offset + this.innerContentParts[i].length]; + var partContent = this.innerContentParts[i]; + var delimitersInOffset = []; + while (delimiterIndex < delimiterMatches.length && inRange(range, delimiterMatches[delimiterIndex])) { + delimitersInOffset.push(delimiterMatches[delimiterIndex]); + delimiterIndex++; + } + var parts = []; + var cursor = 0; + if (cutNext > 0) { + cursor = cutNext; + cutNext = 0; + } + delimitersInOffset.forEach(function (delimiterInOffset) { + var value = partContent.substr(cursor, delimiterInOffset.offset - offset - cursor); + if (value.length > 0) { + parts.push({ type: "content", value: value }); + } + parts.push({ type: "delimiter", position: delimiterInOffset.position }); + cursor = delimiterInOffset.offset - offset + delimiterLength[delimiterInOffset.position]; + }); + cutNext = cursor - partContent.length; + var value = partContent.substr(cursor); + if (value.length > 0) { + parts.push({ type: "content", value: value }); + } + return parts; + }, _this); + }; +} + +module.exports = { + parse: function parse(xmlparsed, delimiters) { + var inTextTag = false; + var innerContentParts = []; + xmlparsed.forEach(function (part) { + inTextTag = updateInTextTag(part, inTextTag); + if (inTextTag && part.type === "content") { + innerContentParts.push(part.value); + } + }); + var reader = new Reader(innerContentParts); + reader.parseDelimiters(delimiters); + + var newArray = []; + var index = 0; + xmlparsed.forEach(function (part) { + inTextTag = updateInTextTag(part, inTextTag); + if (part.type === "content") { + part.position = inTextTag ? "insidetag" : "outsidetag"; + } + if (inTextTag && part.type === "content") { + Array.prototype.push.apply(newArray, reader.parsed[index].map(function (p) { + if (p.type === "content") { + p.position = "insidetag"; + } + return p; + })); + index++; + } else { + newArray.push(part); + } + }); + return newArray; + }, + xmlparse: function xmlparse(content, xmltags) { + var matches = tagMatcher(content, xmltags.text, xmltags.other); + var cursor = 0; + var parsed = matches.reduce(function (parsed, match) { + var value = content.substr(cursor, match.offset - cursor); + if (value.length > 0) { + parsed.push({ type: "content", value: value }); + } + cursor = match.offset + match.value.length; + delete match.offset; + if (match.value.length > 0) { + parsed.push(match); + } + return parsed; + }, []); + var value = content.substr(cursor); + if (value.length > 0) { + parsed.push({ type: "content", value: value }); + } + return parsed; + } +}; +},{"./doc-utils":1,"./errors":2}],5:[function(require,module,exports){ +"use strict"; + +function memoize(func) { + var stringifyJson = JSON.stringify, + cache = {}; + function cachedfun() { + var hash = stringifyJson(arguments); + return hash in cache ? cache[hash] : cache[hash] = func.apply(this, arguments); + } + return cachedfun; +} + +module.exports = memoize; +},{}],6:[function(require,module,exports){ +"use strict"; + +function getMinFromArrays(arrays, state) { + var minIndex = -1; + for (var i = 0, l = arrays.length; i < l; i++) { + if (state[i] >= arrays[i].length) { + continue; + } + if (minIndex === -1 || arrays[i][state[i]].offset < arrays[minIndex][state[minIndex]].offset) { + minIndex = i; + } + } + if (minIndex === -1) { + throw new Error("minIndex negative"); + } + return minIndex; +} + +module.exports = function (arrays) { + var totalLength = arrays.reduce(function (sum, array) { + return sum + array.length; + }, 0); + arrays = arrays.filter(function (array) { + return array.length > 0; + }); + + var resultArray = new Array(totalLength); + + var state = arrays.map(function () { + return 0; + }); + + var i = 0; + + while (i <= totalLength - 1) { + var arrayIndex = getMinFromArrays(arrays, state); + resultArray[i] = arrays[arrayIndex][state[arrayIndex]]; + state[arrayIndex]++; + i++; + } + + return resultArray; +}; +},{}],7:[function(require,module,exports){ +"use strict"; + +function emptyFun() {} +function identity(i) { + return i; +} +module.exports = function (module) { + var defaults = { + set: emptyFun, + parse: emptyFun, + render: emptyFun, + getTraits: emptyFun, + optionsTransformer: identity, + getRenderedMap: identity, + postparse: identity + }; + if (Object.keys(defaults).every(function (key) { + return !module[key]; + })) { + throw new Error("This module cannot be wrapped, because it doesn't define any of the necessary functions"); + } + Object.keys(defaults).forEach(function (key) { + module[key] = module[key] || defaults[key]; + }); + return module; +}; +},{}],8:[function(require,module,exports){ +"use strict"; + +var traitName = "expandPair"; +var mergeSort = require("../mergesort"); +var DocUtils = require("../doc-utils"); +var wrapper = require("../module-wrapper"); + +var _require = require("../traits"), + getExpandToDefault = _require.getExpandToDefault; + +var Errors = require("../errors"); + +function throwUnmatchedLoopException(options) { + var location = options.location; + var t = location === "start" ? "unclosed" : "unopened"; + var T = location === "start" ? "Unclosed" : "Unopened"; + + var err = new Errors.XTTemplateError(T + " loop"); + var tag = options.part.value; + err.properties = { + id: t + "_loop", + explanation: "The loop with tag " + tag + " is " + t, + xtag: tag + }; + throw err; +} + +function throwClosingTagNotMatchOpeningTag(options) { + var tags = options.tags; + + var err = new Errors.XTTemplateError("Closing tag does not match opening tag"); + err.properties = { + id: "closing_tag_does_not_match_opening_tag", + explanation: "The tag \"" + tags[0].value + "\" is closed by the tag \"" + tags[1].value + "\"", + openingtag: tags[0].value, + closingtag: tags[1].value + }; + throw err; +} + +function getOpenCountChange(part) { + switch (part.location) { + case "start": + return 1; + case "end": + return -1; + default: + throw new Error("Location should be one of 'start' or 'end' (given : " + part.location + ")"); + + } +} + +function getPairs(traits) { + if (traits.length === 0) { + return []; + } + var countOpen = 1; + var firstTrait = traits[0]; + for (var i = 1; i < traits.length; i++) { + var currentTrait = traits[i]; + countOpen += getOpenCountChange(currentTrait.part); + if (countOpen === 0) { + if (currentTrait.part.value !== firstTrait.part.value && currentTrait.part.value !== "") { + throwClosingTagNotMatchOpeningTag({ tags: [firstTrait.part, currentTrait.part] }); + } + var outer = getPairs(traits.slice(i + 1)); + return [[firstTrait, currentTrait]].concat(outer); + } + } + var part = firstTrait.part; + throwUnmatchedLoopException({ part: part, location: part.location }); +} + +var expandPairTrait = { + name: "ExpandPairTrait", + postparse: function postparse(parsed, _ref) { + var getTraits = _ref.getTraits, + _postparse = _ref.postparse; + + var traits = getTraits(traitName, parsed); + traits = traits.map(function (trait) { + return trait || []; + }); + traits = mergeSort(traits); + var pairs = getPairs(traits); + var expandedPairs = pairs.map(function (pair) { + var expandTo = pair[0].part.expandTo; + if (expandTo === "auto") { + expandTo = getExpandToDefault(parsed.slice(pair[0].offset, pair[1].offset)); + } + if (!expandTo) { + return [pair[0].offset, pair[1].offset]; + } + var left = DocUtils.getLeft(parsed, expandTo, pair[0].offset); + var right = DocUtils.getRight(parsed, expandTo, pair[1].offset); + return [left, right]; + }); + + var currentPairIndex = 0; + var innerParts = void 0; + return parsed.reduce(function (newParsed, part, i) { + var inPair = currentPairIndex < pairs.length && expandedPairs[currentPairIndex][0] <= i; + var pair = pairs[currentPairIndex]; + var expandedPair = expandedPairs[currentPairIndex]; + if (!inPair) { + newParsed.push(part); + return newParsed; + } + if (expandedPair[0] === i) { + innerParts = []; + } + if (pair[0].offset !== i && pair[1].offset !== i) { + innerParts.push(part); + } + if (expandedPair[1] === i) { + var basePart = parsed[pair[0].offset]; + delete basePart.location; + delete basePart.expandTo; + basePart.subparsed = _postparse(innerParts); + newParsed.push(basePart); + currentPairIndex++; + } + return newParsed; + }, []); + } +}; + +module.exports = function () { + return wrapper(expandPairTrait); +}; +},{"../doc-utils":1,"../errors":2,"../mergesort":6,"../module-wrapper":7,"../traits":16}],9:[function(require,module,exports){ +"use strict"; + +var DocUtils = require("../doc-utils"); +var dashInnerRegex = /^-([^\s]+)\s(.+)$/; +var wrapper = require("../module-wrapper"); + +var moduleName = "loop"; + +var loopModule = { + name: "LoopModule", + parse: function parse(placeHolderContent) { + var module = moduleName; + var type = "placeholder"; + if (placeHolderContent[0] === "#") { + return { type: type, value: placeHolderContent.substr(1), expandTo: "auto", module: module, location: "start", inverted: false }; + } + if (placeHolderContent[0] === "^") { + return { type: type, value: placeHolderContent.substr(1), expandTo: "auto", module: module, location: "start", inverted: true }; + } + if (placeHolderContent[0] === "/") { + return { type: type, value: placeHolderContent.substr(1), module: module, location: "end" }; + } + if (placeHolderContent[0] === "-") { + var value = placeHolderContent.replace(dashInnerRegex, "$2"); + var expandTo = placeHolderContent.replace(dashInnerRegex, "$1"); + return { type: type, value: value, expandTo: expandTo, module: module, location: "start", inverted: false }; + } + return null; + }, + getTraits: function getTraits(traitName, parsed) { + if (traitName !== "expandPair") { + return; + } + + return parsed.reduce(function (tags, part, offset) { + if (part.type === "placeholder" && part.module === moduleName) { + tags.push({ part: part, offset: offset }); + } + return tags; + }, []); + }, + render: function render(part, options) { + if (!part.type === "placeholder" || part.module !== moduleName) { + return null; + } + var totalValue = []; + function loopOver(scope) { + var scopeManager = options.scopeManager.createSubScopeManager(scope, part.value); + totalValue.push(options.render(DocUtils.mergeObjects({}, options, { + compiled: part.subparsed, + tags: {}, + scopeManager: scopeManager + }))); + } + options.scopeManager.loopOver(part.value, loopOver, part.inverted); + return { value: totalValue.join("") }; + } +}; + +module.exports = function () { + return wrapper(loopModule); +}; +},{"../doc-utils":1,"../module-wrapper":7}],10:[function(require,module,exports){ +"use strict"; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var DocUtils = require("../doc-utils"); +var Errors = require("../errors"); + +var moduleName = "rawxml"; +var wrapper = require("../module-wrapper"); + +function throwRawTagShouldBeOnlyTextInParagraph(options) { + var err = new Errors.XTTemplateError("Raw tag should be the only text in paragraph"); + var tag = options.part.value; + err.properties = { + id: "raw_xml_tag_should_be_only_text_in_paragraph", + explanation: "The tag " + tag, + xtag: options.part.value, + paragraphParts: options.paragraphParts + }; + throw err; +} + +function getInner(_ref) { + var part = _ref.part, + left = _ref.left, + right = _ref.right, + postparsed = _ref.postparsed, + index = _ref.index; + + var paragraphParts = postparsed.slice(left + 1, right); + paragraphParts.forEach(function (p, i) { + if (i === index - left - 1) { + return; + } + if (p.type === "placeholder" || p.type === "content" && p.position === "insidetag") { + throwRawTagShouldBeOnlyTextInParagraph({ paragraphParts: paragraphParts, part: part }); + } + }); + return part; +} + +var RawXmlModule = function () { + function RawXmlModule() { + _classCallCheck(this, RawXmlModule); + + this.name = "RawXmlModule"; + } + + _createClass(RawXmlModule, [{ + key: "optionsTransformer", + value: function optionsTransformer(options, docxtemplater) { + this.fileTypeConfig = docxtemplater.fileTypeConfig; + return options; + } + }, { + key: "parse", + value: function parse(placeHolderContent) { + var type = "placeholder"; + if (placeHolderContent[0] !== "@") { + return null; + } + return { type: type, value: placeHolderContent.substr(1), module: moduleName }; + } + }, { + key: "postparse", + value: function postparse(parsed) { + return DocUtils.traits.expandToOne(parsed, { moduleName: moduleName, getInner: getInner, expandTo: this.fileTypeConfig.tagRawXml }); + } + }, { + key: "render", + value: function render(part, options) { + if (part.module !== moduleName) { + return null; + } + var value = options.scopeManager.getValue(part.value); + if (value == null) { + value = options.nullGetter(part); + } + return { value: value }; + } + }]); + + return RawXmlModule; +}(); + +module.exports = function () { + return wrapper(new RawXmlModule()); +}; +},{"../doc-utils":1,"../errors":2,"../module-wrapper":7}],11:[function(require,module,exports){ +"use strict"; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var wrapper = require("../module-wrapper"); + +var Render = function () { + function Render() { + _classCallCheck(this, Render); + + this.name = "Render"; + } + + _createClass(Render, [{ + key: "set", + value: function set(obj) { + if (obj.compiled) { + this.compiled = obj.compiled; + } + if (obj.data != null) { + this.data = obj.data; + } + } + }, { + key: "getRenderedMap", + value: function getRenderedMap(mapper) { + var _this = this; + + return Object.keys(this.compiled).reduce(function (mapper, from) { + mapper[from] = { from: from, data: _this.data }; + return mapper; + }, mapper); + } + }]); + + return Render; +}(); + +module.exports = function () { + return wrapper(new Render()); +}; +},{"../module-wrapper":7}],12:[function(require,module,exports){ +"use strict"; + +var wrapper = require("../module-wrapper"); +var spacePreserve = { + name: "SpacePreserveModule", + postparse: function postparse(parsed) { + var chunk = []; + var inChunk = false; + var result = parsed.reduce(function (parsed, part) { + if (part.type === "tag" && part.position === "start" && part.text && part.value === "<w:t>") { + inChunk = true; + } + if (inChunk) { + if (part.type === "placeholder" && !part.module) { + chunk[0].value = '<w:t xml:space="preserve">'; + } + chunk.push(part); + } else { + parsed.push(part); + } + if (part.type === "tag" && part.position === "end" && part.text && part.value === "</w:t>") { + Array.prototype.push.apply(parsed, chunk); + inChunk = false; + chunk = []; + } + return parsed; + }, []); + Array.prototype.push.apply(result, chunk); + return result; + } +}; +module.exports = function () { + return wrapper(spacePreserve); +}; +},{"../module-wrapper":7}],13:[function(require,module,exports){ +"use strict"; + +var DocUtils = require("./doc-utils"); + +var parser = { + postparse: function postparse(parsed, modules) { + function getTraits(traitName, parsed) { + return modules.map(function (module) { + return module.getTraits(traitName, parsed); + }); + } + function postparse(parsed) { + return modules.reduce(function (parsed, module) { + return module.postparse(parsed, { postparse: postparse, getTraits: getTraits }); + }, parsed); + } + return postparse(parsed); + }, + parse: function parse(lexed, modules) { + function moduleParse(placeHolderContent, parsed) { + var moduleParsed = void 0; + for (var i = 0, l = modules.length; i < l; i++) { + var _module = modules[i]; + moduleParsed = _module.parse(placeHolderContent); + if (moduleParsed) { + parsed.push(moduleParsed); + return moduleParsed; + } + } + return null; + } + + var inPlaceHolder = false; + var placeHolderContent = void 0; + var tailParts = []; + return lexed.reduce(function (parsed, token) { + if (token.type === "delimiter") { + inPlaceHolder = token.position === "start"; + if (token.position === "end") { + placeHolderContent = DocUtils.wordToUtf8(placeHolderContent); + if (!moduleParse(placeHolderContent, parsed)) { + parsed.push({ type: "placeholder", value: placeHolderContent }); + } + Array.prototype.push.apply(parsed, tailParts); + tailParts = []; + return parsed; + } + placeHolderContent = ""; + return parsed; + } + if (inPlaceHolder) { + if (token.type === "content" && token.position === "insidetag") { + placeHolderContent += token.value; + } else { + tailParts.push(token); + } + return parsed; + } + parsed.push(token); + return parsed; + }, []); + } +}; + +module.exports = parser; +},{"./doc-utils":1}],14:[function(require,module,exports){ +"use strict"; + +var ScopeManager = require("./scope-manager"); +var DocUtils = require("./doc-utils"); + +function moduleRender(part, options) { + var moduleRendered = void 0; + for (var i = 0, l = options.modules.length; i < l; i++) { + var _module = options.modules[i]; + moduleRendered = _module.render(part, options); + if (moduleRendered) { + return moduleRendered; + } + } + return false; +} + +function render(options) { + options.render = render; + options.modules = options.modules; + if (!options.scopeManager) { + options.scopeManager = ScopeManager.createBaseScopeManager(options); + } + return options.compiled.map(function (part) { + var moduleRendered = moduleRender(part, options); + if (moduleRendered) { + return moduleRendered.value; + } + if (part.type === "placeholder") { + var value = options.scopeManager.getValue(part.value); + if (value == null) { + value = options.nullGetter(part); + } + return DocUtils.utf8ToWord(value); + } + if (part.type === "content" || part.type === "tag") { + return part.value; + } + throw new Error("Unimplemented tag type \"" + part.type + "\""); + }).join(""); +} + +module.exports = render; +},{"./doc-utils":1,"./scope-manager":15}],15:[function(require,module,exports){ +"use strict"; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Errors = require("./errors"); + +// This class responsibility is to manage the scope +var ScopeManager = function () { + function ScopeManager(options) { + _classCallCheck(this, ScopeManager); + + this.scopePath = options.scopePath; + this.scopeList = options.scopeList; + this.parser = options.parser; + } + + _createClass(ScopeManager, [{ + key: "loopOver", + value: function loopOver(tag, callback, inverted) { + inverted = inverted || false; + return this.loopOverValue(this.getValue(tag), callback, inverted); + } + }, { + key: "functorIfInverted", + value: function functorIfInverted(inverted, functor, value) { + if (inverted) { + functor(value); + } + } + }, { + key: "isValueFalsy", + value: function isValueFalsy(value, type) { + return value == null || !value || type === "[object Array]" && value.length === 0; + } + }, { + key: "loopOverValue", + value: function loopOverValue(value, functor, inverted) { + var type = Object.prototype.toString.call(value); + var currentValue = this.scopeList[this.num]; + if (this.isValueFalsy(value, type)) { + return this.functorIfInverted(inverted, functor, currentValue); + } + if (type === "[object Array]") { + for (var i = 0, scope; i < value.length; i++) { + scope = value[i]; + this.functorIfInverted(!inverted, functor, scope); + } + return; + } + if (type === "[object Object]") { + return this.functorIfInverted(!inverted, functor, value); + } + if (value === true) { + return this.functorIfInverted(!inverted, functor, currentValue); + } + } + }, { + key: "getValue", + value: function getValue(tag, num) { + // search in the scopes (in reverse order) and keep the first defined value + this.num = num == null ? this.scopeList.length - 1 : num; + var err = void 0; + var parser = void 0; + var result = void 0; + var scope = this.scopeList[this.num]; + try { + parser = this.parser(tag); + } catch (error) { + err = new Errors.XTScopeParserError("Scope parser compilation failed"); + err.properties = { + id: "scopeparser_compilation_failed", + tag: tag, + explanation: "The scope parser for the tag " + tag + " failed to compile", + rootError: error + }; + throw err; + } + try { + result = parser.get(scope, { num: this.num, scopeList: this.scopeList }); + } catch (error) { + err = new Errors.XTScopeParserError("Scope parser execution failed"); + err.properties = { + id: "scopeparser_execution_failed", + explanation: "The scope parser for the tag " + tag + " failed to execute", + scope: scope, + tag: tag, + rootError: error + }; + throw err; + } + if (result == null && this.num > 0) { + return this.getValue(tag, this.num - 1); + } + return result; + } + }, { + key: "createSubScopeManager", + value: function createSubScopeManager(scope, tag) { + var options = { + scopePath: this.scopePath.slice(0), + scopeList: this.scopeList.slice(0) + }; + + options.parser = this.parser; + options.scopeList = this.scopeList.concat(scope); + options.scopePath = this.scopePath.concat(tag); + return new ScopeManager(options); + } + }]); + + return ScopeManager; +}(); + +ScopeManager.createBaseScopeManager = function (_ref) { + var parser = _ref.parser, + tags = _ref.tags; + + var options = { parser: parser, tags: tags }; + options.scopePath = []; + options.scopeList = [tags]; + return new ScopeManager(options); +}; + +module.exports = ScopeManager; +},{"./errors":2}],16:[function(require,module,exports){ +"use strict"; + +var DocUtils = require("./doc-utils"); +var Errors = require("./errors"); + +function throwRawTagNotInParagraph(options) { + var err = new Errors.XTTemplateError("Raw tag not in paragraph"); + var tag = options.part.value; + err.properties = { + id: "raw_tag_outerxml_invalid", + explanation: "The tag \"" + tag + "\"", + rootError: options.rootError, + xtag: tag, + postparsed: options.postparsed, + expandTo: options.expandTo, + index: options.index + }; + throw err; +} + +function lastTagIsOpenTag(array, tag) { + if (array.length === 0) { + return false; + } + var lastTag = array[array.length - 1]; + var innerLastTag = lastTag.tag.substr(1); + var innerCurrentTag = tag.substr(2, tag.length - 3); + return innerLastTag.indexOf(innerCurrentTag) === 0; +} + +function addTag(array, tag) { + array.push({ tag: tag }); + return array; +} + +function getListXmlElements(parts) { + /* + get the different closing and opening tags between two texts (doesn't take into account tags that are opened then closed (those that are closed then opened are returned)): + returns:[{"tag":"</w:r>","offset":13},{"tag":"</w:p>","offset":265},{"tag":"</w:tc>","offset":271},{"tag":"<w:tc>","offset":828},{"tag":"<w:p>","offset":883},{"tag":"<w:r>","offset":1483}] + */ + var tags = parts.filter(function (part) { + return part.type === "tag"; + }).map(function (part) { + return part.value; + }); + + var result = []; + + for (var i = 0, tag; i < tags.length; i++) { + tag = tags[i]; + // closing tag + if (tag[1] === "/") { + if (lastTagIsOpenTag(result, tag)) { + result.pop(); + } else { + result = addTag(result, tag); + } + } else if (tag[tag.length - 1] !== "/") { + result = addTag(result, tag); + } + } + return result; +} + +function getExpandToDefault(parts) { + var xmlElements = getListXmlElements(parts); + for (var i = 0; i < xmlElements.length; i++) { + var xmlElement = xmlElements[i]; + if (xmlElement.tag.indexOf("<w:tc") === 0) { + return "w:tr"; + } + if (xmlElement.tag.indexOf("<a:tc") === 0) { + return "a:tr"; + } + } + return false; +} + +function expandOne(part, postparsed, options) { + var expandTo = part.expandTo || options.expandTo; + var index = postparsed.indexOf(part); + if (!expandTo) { + return postparsed; + } + var right = void 0, + left = void 0; + try { + right = DocUtils.getRight(postparsed, expandTo, index); + left = DocUtils.getLeft(postparsed, expandTo, index); + } catch (rootError) { + if (rootError instanceof Errors.XTTemplateError) { + throwRawTagNotInParagraph({ part: part, rootError: rootError, postparsed: postparsed, expandTo: expandTo, index: index }); + } + throw rootError; + } + var leftParts = postparsed.slice(left, index); + var rightParts = postparsed.slice(index + 1, right + 1); + var inner = options.getInner({ index: index, part: part, leftParts: leftParts, rightParts: rightParts, left: left, right: right, postparsed: postparsed }); + inner.expanded = [leftParts, rightParts]; + return DocUtils.concatArrays([postparsed.slice(0, left), [inner], postparsed.slice(right + 1)]); +} + +function expandToOne(postparsed, options) { + var expandToElements = postparsed.reduce(function (elements, part) { + if (part.type === "placeholder" && part.module === options.moduleName) { + elements.push(part); + } + return elements; + }, []); + + expandToElements.forEach(function (part) { + postparsed = expandOne(part, postparsed, options); + }); + return postparsed; +} + +module.exports = { + expandToOne: expandToOne, + getExpandToDefault: getExpandToDefault +}; +},{"./doc-utils":1,"./errors":2}],17:[function(require,module,exports){ +"use strict"; +// res class responsibility is to parse the XML. + +var DocUtils = require("./doc-utils"); +var memoize = require("./memoize"); + +function handleRecursiveCase(res) { + /* + Because xmlTemplater is recursive (meaning it can call it self), we need to handle special cases where the XML is not valid: + For example with res string "I am</w:t></w:r></w:p><w:p><w:r><w:t>sleeping", + - we need to match also the string that is inside an implicit <w:t> (that's the role of replacerUnshift) (in res case 'I am') + - we need to match the string that is at the right of a <w:t> (that's the role of replacerPush) (in res case 'sleeping') + the test: describe "scope calculation" it "should compute the scope between 2 <w:t>" makes sure that res part of code works + It should even work if they is no XML at all, for example if the code is just "I am sleeping", in res case however, they should only be one match + */ + + function replacerUnshift() { + var pn = { array: Array.prototype.slice.call(arguments) }; + pn.array.shift(); + var match = pn.array[0] + pn.array[1]; + // add match so that pn[0] = whole match, pn[1]= first parenthesis,... + pn.array.unshift(match); + pn.array.pop(); + var offset = pn.array.pop(); + pn.offset = offset; + pn.first = true; + // add at the beginning + res.matches.unshift(pn); + res.charactersAdded.unshift(0); + return res.charactersAddedCumulative.unshift(0); + } + + if (res.content.indexOf("<") === -1 && res.content.indexOf(">") === -1) { + res.content.replace(/^()([^<>]*)$/, replacerUnshift); + } + + var r = new RegExp("^()([^<]+)</(?:" + res.tagsXmlArrayJoined + ")>"); + res.content.replace(r, replacerUnshift); + + function replacerPush() { + var pn = { array: Array.prototype.slice.call(arguments) }; + pn.array.pop(); + var offset = pn.array.pop(); + pn.offset = offset; + pn.last = true; + // add at the end + res.matches.push(pn); + res.charactersAdded.push(0); + return res.charactersAddedCumulative.push(0); + } + + r = new RegExp("(<(?:" + res.tagsXmlArrayJoined + ")[^>]*>)([^>]+)$"); + res.content.replace(r, replacerPush); + return res; +} + +function xmlMatcher(content, tagsXmlArray) { + var res = {}; + res.content = content; + res.tagsXmlArray = tagsXmlArray; + res.tagsXmlArrayJoined = res.tagsXmlArray.join("|"); + var regexp = new RegExp("(<(?:" + res.tagsXmlArrayJoined + ")[^>]*>)([^<>]*)</(?:" + res.tagsXmlArrayJoined + ")>", "g"); + res.matches = DocUtils.pregMatchAll(regexp, res.content); + res.charactersAddedCumulative = res.matches.map(function () { + return 0; + }); + res.charactersAdded = res.matches.map(function () { + return 0; + }); + return handleRecursiveCase(res); +} + +var memoized = memoize(xmlMatcher); + +module.exports = function (content, tagsXmlArray) { + return DocUtils.cloneDeep(memoized(content, tagsXmlArray)); +}; +},{"./doc-utils":1,"./memoize":5}],18:[function(require,module,exports){ +"use strict"; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var DocUtils = require("./doc-utils"); +var ScopeManager = require("./scope-manager"); +var xmlMatcher = require("./xml-matcher"); +var Errors = require("./errors"); +var Lexer = require("./lexer"); +var Parser = require("./parser.js"); +var _render = require("./render.js"); + +function _getFullText(content, tagsXmlArray) { + var matcher = xmlMatcher(content, tagsXmlArray); + var result = matcher.matches.map(function (match) { + return match.array[2]; + }); + return DocUtils.wordToUtf8(DocUtils.convertSpaces(result.join(""))); +} + +module.exports = function () { + function XmlTemplater(content, options) { + _classCallCheck(this, XmlTemplater); + + this.fromJson(options); + this.setModules({ inspect: { filePath: this.filePath } }); + this.load(content); + } + + _createClass(XmlTemplater, [{ + key: "load", + value: function load(content) { + if (typeof content !== "string") { + var err = new Errors.XTInternalError("Content must be a string"); + err.properties.id = "xmltemplater_content_must_be_string"; + throw err; + } + this.content = content; + } + }, { + key: "setTags", + value: function setTags(tags) { + this.tags = tags != null ? tags : {}; + this.scopeManager = ScopeManager.createBaseScopeManager({ tags: this.tags, parser: this.parser }); + return this; + } + }, { + key: "fromJson", + value: function fromJson(options) { + this.filePath = options.filePath; + this.modules = options.modules; + this.fileTypeConfig = options.fileTypeConfig; + Object.keys(DocUtils.defaults).map(function (key) { + this[key] = options[key] != null ? options[key] : DocUtils.defaults[key]; + }, this); + } + }, { + key: "getFullText", + value: function getFullText() { + return _getFullText(this.content, this.fileTypeConfig.tagsXmlTextArray); + } + }, { + key: "setModules", + value: function setModules(obj) { + this.modules.forEach(function (module) { + module.set(obj); + }); + } + }, { + key: "parse", + value: function parse() { + this.xmllexed = Lexer.xmlparse(this.content, { text: this.fileTypeConfig.tagsXmlTextArray, other: this.fileTypeConfig.tagsXmlLexedArray }); + this.setModules({ inspect: { xmllexed: this.xmllexed } }); + this.lexed = Lexer.parse(this.xmllexed, this.delimiters); + this.setModules({ inspect: { lexed: this.lexed } }); + this.parsed = Parser.parse(this.lexed, this.modules); + this.setModules({ inspect: { parsed: this.parsed } }); + this.postparsed = Parser.postparse(this.parsed, this.modules); + return this; + } + /* + content is the whole content to be tagged + scope is the current scope + returns the new content of the tagged content + */ + + }, { + key: "render", + value: function render(to) { + this.filePath = to; + this.setModules({ inspect: { postparsed: this.postparsed } }); + this.content = _render({ + compiled: this.postparsed, + tags: this.tags, + modules: this.modules, + parser: this.parser, + nullGetter: this.nullGetter, + filePath: this.filePath + }); + this.setModules({ inspect: { content: this.content } }); + return this; + } + }]); + + return XmlTemplater; +}(); +},{"./doc-utils":1,"./errors":2,"./lexer":4,"./parser.js":13,"./render.js":14,"./scope-manager":15,"./xml-matcher":17}],19:[function(require,module,exports){ +function DOMParser(options){ + this.options = options ||{locator:{}}; + +} +DOMParser.prototype.parseFromString = function(source,mimeType){ + var options = this.options; + var sax = new XMLReader(); + var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler + var errorHandler = options.errorHandler; + var locator = options.locator; + var defaultNSMap = options.xmlns||{}; + var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} + if(locator){ + domBuilder.setDocumentLocator(locator) + } + + sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); + sax.domBuilder = options.domBuilder || domBuilder; + if(/\/x?html?$/.test(mimeType)){ + entityMap.nbsp = '\xa0'; + entityMap.copy = '\xa9'; + defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; + } + defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; + if(source){ + sax.parse(source,defaultNSMap,entityMap); + }else{ + sax.errorHandler.error("invalid doc source"); + } + return domBuilder.doc; +} +function buildErrorHandler(errorImpl,domBuilder,locator){ + if(!errorImpl){ + if(domBuilder instanceof DOMHandler){ + return domBuilder; + } + errorImpl = domBuilder ; + } + var errorHandler = {} + var isCallback = errorImpl instanceof Function; + locator = locator||{} + function build(key){ + var fn = errorImpl[key]; + if(!fn && isCallback){ + fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; + } + errorHandler[key] = fn && function(msg){ + fn('[xmldom '+key+']\t'+msg+_locator(locator)); + }||function(){}; + } + build('warning'); + build('error'); + build('fatalError'); + return errorHandler; +} + +//console.log('#\n\n\n\n\n\n\n####') +/** + * +ContentHandler+ErrorHandler + * +LexicalHandler+EntityResolver2 + * -DeclHandler-DTDHandler + * + * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler + * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 + * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html + */ +function DOMHandler() { + this.cdata = false; +} +function position(locator,node){ + node.lineNumber = locator.lineNumber; + node.columnNumber = locator.columnNumber; +} +/** + * @see org.xml.sax.ContentHandler#startDocument + * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ +DOMHandler.prototype = { + startDocument : function() { + this.doc = new DOMImplementation().createDocument(null, null, null); + if (this.locator) { + this.doc.documentURI = this.locator.systemId; + } + }, + startElement:function(namespaceURI, localName, qName, attrs) { + var doc = this.doc; + var el = doc.createElementNS(namespaceURI, qName||localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; + + this.locator && position(this.locator,el) + for (var i = 0 ; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value = attrs.getValue(i); + var qName = attrs.getQName(i); + var attr = doc.createAttributeNS(namespaceURI, qName); + this.locator &&position(attrs.getLocator(i),attr); + attr.value = attr.nodeValue = value; + el.setAttributeNode(attr) + } + }, + endElement:function(namespaceURI, localName, qName) { + var current = this.currentElement + var tagName = current.tagName; + this.currentElement = current.parentNode; + }, + startPrefixMapping:function(prefix, uri) { + }, + endPrefixMapping:function(prefix) { + }, + processingInstruction:function(target, data) { + var ins = this.doc.createProcessingInstruction(target, data); + this.locator && position(this.locator,ins) + appendElement(this, ins); + }, + ignorableWhitespace:function(ch, start, length) { + }, + characters:function(chars, start, length) { + chars = _toString.apply(this,arguments) + //console.log(chars) + if(chars){ + if (this.cdata) { + var charNode = this.doc.createCDATASection(chars); + } else { + var charNode = this.doc.createTextNode(chars); + } + if(this.currentElement){ + this.currentElement.appendChild(charNode); + }else if(/^\s*$/.test(chars)){ + this.doc.appendChild(charNode); + //process xml + } + this.locator && position(this.locator,charNode) + } + }, + skippedEntity:function(name) { + }, + endDocument:function() { + this.doc.normalize(); + }, + setDocumentLocator:function (locator) { + if(this.locator = locator){// && !('lineNumber' in locator)){ + locator.lineNumber = 0; + } + }, + //LexicalHandler + comment:function(chars, start, length) { + chars = _toString.apply(this,arguments) + var comm = this.doc.createComment(chars); + this.locator && position(this.locator,comm) + appendElement(this, comm); + }, + + startCDATA:function() { + //used in characters() methods + this.cdata = true; + }, + endCDATA:function() { + this.cdata = false; + }, + + startDTD:function(name, publicId, systemId) { + var impl = this.doc.implementation; + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId); + this.locator && position(this.locator,dt) + appendElement(this, dt); + } + }, + /** + * @see org.xml.sax.ErrorHandler + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + warning:function(error) { + console.warn('[xmldom warning]\t'+error,_locator(this.locator)); + }, + error:function(error) { + console.error('[xmldom error]\t'+error,_locator(this.locator)); + }, + fatalError:function(error) { + console.error('[xmldom fatalError]\t'+error,_locator(this.locator)); + throw error; + } +} +function _locator(l){ + if(l){ + return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' + } +} +function _toString(chars,start,length){ + if(typeof chars == 'string'){ + return chars.substr(start,length) + }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") + if(chars.length >= start+length || start){ + return new java.lang.String(chars,start,length)+''; + } + return chars; + } +} + +/* + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html + * used method of org.xml.sax.ext.LexicalHandler: + * #comment(chars, start, length) + * #startCDATA() + * #endCDATA() + * #startDTD(name, publicId, systemId) + * + * + * IGNORED method of org.xml.sax.ext.LexicalHandler: + * #endDTD() + * #startEntity(name) + * #endEntity(name) + * + * + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html + * IGNORED method of org.xml.sax.ext.DeclHandler + * #attributeDecl(eName, aName, type, mode, value) + * #elementDecl(name, model) + * #externalEntityDecl(name, publicId, systemId) + * #internalEntityDecl(name, value) + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html + * IGNORED method of org.xml.sax.EntityResolver2 + * #resolveEntity(String name,String publicId,String baseURI,String systemId) + * #resolveEntity(publicId, systemId) + * #getExternalSubset(name, baseURI) + * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html + * IGNORED method of org.xml.sax.DTDHandler + * #notationDecl(name, publicId, systemId) {}; + * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; + */ +"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ + DOMHandler.prototype[key] = function(){return null} +}) + +/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ +function appendElement (hander,node) { + if (!hander.currentElement) { + hander.doc.appendChild(node); + } else { + hander.currentElement.appendChild(node); + } +}//appendChild and setAttributeNS are preformance key + +//if(typeof require == 'function'){ + var XMLReader = require('./sax').XMLReader; + var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; + exports.XMLSerializer = require('./dom').XMLSerializer ; + exports.DOMParser = DOMParser; +//} + +},{"./dom":20,"./sax":21}],20:[function(require,module,exports){ +/* + * DOM Level 2 + * Object DOMException + * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html + */ + +function copy(src,dest){ + for(var p in src){ + dest[p] = src[p]; + } +} +/** +^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));? +^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));? + */ +function _extends(Class,Super){ + var pt = Class.prototype; + if(Object.create){ + var ppt = Object.create(Super.prototype) + pt.__proto__ = ppt; + } + if(!(pt instanceof Super)){ + function t(){}; + t.prototype = Super.prototype; + t = new t(); + copy(pt,t); + Class.prototype = pt = t; + } + if(pt.constructor != Class){ + if(typeof Class != 'function'){ + console.error("unknow Class:"+Class) + } + pt.constructor = Class + } +} +var htmlns = 'http://www.w3.org/1999/xhtml' ; +// Node Types +var NodeType = {} +var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; +var TEXT_NODE = NodeType.TEXT_NODE = 3; +var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = NodeType.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = NodeType.COMMENT_NODE = 8; +var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = NodeType.NOTATION_NODE = 12; + +// ExceptionCode +var ExceptionCode = {} +var ExceptionMessage = {}; +var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1); +var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2); +var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3); +var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4); +var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5); +var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6); +var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7); +var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8); +var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9); +var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10); +//level2 +var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11); +var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12); +var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13); +var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14); +var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15); + + +function DOMException(code, message) { + if(message instanceof Error){ + var error = message; + }else{ + error = this; + Error.call(this, ExceptionMessage[code]); + this.message = ExceptionMessage[code]; + if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException); + } + error.code = code; + if(message) this.message = this.message + ": " + message; + return error; +}; +DOMException.prototype = Error.prototype; +copy(ExceptionCode,DOMException) +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177 + * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. + * The items in the NodeList are accessible via an integral index, starting from 0. + */ +function NodeList() { +}; +NodeList.prototype = { + /** + * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. + * @standard level1 + */ + length:0, + /** + * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. + * @standard level1 + * @param index unsigned long + * Index into the collection. + * @return Node + * The node at the indexth position in the NodeList, or null if that is not a valid index. + */ + item: function(index) { + return this[index] || null; + }, + toString:function(isHTML,nodeFilter){ + for(var buf = [], i = 0;i<this.length;i++){ + serializeToString(this[i],buf,isHTML,nodeFilter); + } + return buf.join(''); + } +}; +function LiveNodeList(node,refresh){ + this._node = node; + this._refresh = refresh + _updateLiveList(this); +} +function _updateLiveList(list){ + var inc = list._node._inc || list._node.ownerDocument._inc; + if(list._inc != inc){ + var ls = list._refresh(list._node); + //console.log(ls.length) + __set__(list,'length',ls.length); + copy(ls,list); + list._inc = inc; + } +} +LiveNodeList.prototype.item = function(i){ + _updateLiveList(this); + return this[i]; +} + +_extends(LiveNodeList,NodeList); +/** + * + * Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes. + * NamedNodeMap objects in the DOM are live. + * used for attributes or DocumentType entities + */ +function NamedNodeMap() { +}; + +function _findNodeIndex(list,node){ + var i = list.length; + while(i--){ + if(list[i] === node){return i} + } +} + +function _addNamedNode(el,list,newAttr,oldAttr){ + if(oldAttr){ + list[_findNodeIndex(list,oldAttr)] = newAttr; + }else{ + list[list.length++] = newAttr; + } + if(el){ + newAttr.ownerElement = el; + var doc = el.ownerDocument; + if(doc){ + oldAttr && _onRemoveAttribute(doc,el,oldAttr); + _onAddAttribute(doc,el,newAttr); + } + } +} +function _removeNamedNode(el,list,attr){ + //console.log('remove attr:'+attr) + var i = _findNodeIndex(list,attr); + if(i>=0){ + var lastIndex = list.length-1 + while(i<lastIndex){ + list[i] = list[++i] + } + list.length = lastIndex; + if(el){ + var doc = el.ownerDocument; + if(doc){ + _onRemoveAttribute(doc,el,attr); + attr.ownerElement = null; + } + } + }else{ + throw DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr)) + } +} +NamedNodeMap.prototype = { + length:0, + item:NodeList.prototype.item, + getNamedItem: function(key) { +// if(key.indexOf(':')>0 || key == 'xmlns'){ +// return null; +// } + //console.log() + var i = this.length; + while(i--){ + var attr = this[i]; + //console.log(attr.nodeName,key) + if(attr.nodeName == key){ + return attr; + } + } + }, + setNamedItem: function(attr) { + var el = attr.ownerElement; + if(el && el!=this._ownerElement){ + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + var oldAttr = this.getNamedItem(attr.nodeName); + _addNamedNode(this._ownerElement,this,attr,oldAttr); + return oldAttr; + }, + /* returns Node */ + setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR + var el = attr.ownerElement, oldAttr; + if(el && el!=this._ownerElement){ + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName); + _addNamedNode(this._ownerElement,this,attr,oldAttr); + return oldAttr; + }, + + /* returns Node */ + removeNamedItem: function(key) { + var attr = this.getNamedItem(key); + _removeNamedNode(this._ownerElement,this,attr); + return attr; + + + },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR + + //for level2 + removeNamedItemNS:function(namespaceURI,localName){ + var attr = this.getNamedItemNS(namespaceURI,localName); + _removeNamedNode(this._ownerElement,this,attr); + return attr; + }, + getNamedItemNS: function(namespaceURI, localName) { + var i = this.length; + while(i--){ + var node = this[i]; + if(node.localName == localName && node.namespaceURI == namespaceURI){ + return node; + } + } + return null; + } +}; +/** + * @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 + */ +function DOMImplementation(/* Object */ features) { + this._features = {}; + if (features) { + for (var feature in features) { + this._features = features[feature]; + } + } +}; + +DOMImplementation.prototype = { + hasFeature: function(/* string */ feature, /* string */ version) { + var versions = this._features[feature.toLowerCase()]; + if (versions && (!version || version in versions)) { + return true; + } else { + return false; + } + }, + // Introduced in DOM Level 2: + createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR + var doc = new Document(); + doc.implementation = this; + doc.childNodes = new NodeList(); + doc.doctype = doctype; + if(doctype){ + doc.appendChild(doctype); + } + if(qualifiedName){ + var root = doc.createElementNS(namespaceURI,qualifiedName); + doc.appendChild(root); + } + return doc; + }, + // Introduced in DOM Level 2: + createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR + var node = new DocumentType(); + node.name = qualifiedName; + node.nodeName = qualifiedName; + node.publicId = publicId; + node.systemId = systemId; + // Introduced in DOM Level 2: + //readonly attribute DOMString internalSubset; + + //TODO:.. + // readonly attribute NamedNodeMap entities; + // readonly attribute NamedNodeMap notations; + return node; + } +}; + + +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 + */ + +function Node() { +}; + +Node.prototype = { + firstChild : null, + lastChild : null, + previousSibling : null, + nextSibling : null, + attributes : null, + parentNode : null, + childNodes : null, + ownerDocument : null, + nodeValue : null, + namespaceURI : null, + prefix : null, + localName : null, + // Modified in DOM Level 2: + insertBefore:function(newChild, refChild){//raises + return _insertBefore(this,newChild,refChild); + }, + replaceChild:function(newChild, oldChild){//raises + this.insertBefore(newChild,oldChild); + if(oldChild){ + this.removeChild(oldChild); + } + }, + removeChild:function(oldChild){ + return _removeChild(this,oldChild); + }, + appendChild:function(newChild){ + return this.insertBefore(newChild,null); + }, + hasChildNodes:function(){ + return this.firstChild != null; + }, + cloneNode:function(deep){ + return cloneNode(this.ownerDocument||this,this,deep); + }, + // Modified in DOM Level 2: + normalize:function(){ + var child = this.firstChild; + while(child){ + var next = child.nextSibling; + if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){ + this.removeChild(next); + child.appendData(next.data); + }else{ + child.normalize(); + child = next; + } + } + }, + // Introduced in DOM Level 2: + isSupported:function(feature, version){ + return this.ownerDocument.implementation.hasFeature(feature,version); + }, + // Introduced in DOM Level 2: + hasAttributes:function(){ + return this.attributes.length>0; + }, + lookupPrefix:function(namespaceURI){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + for(var n in map){ + if(map[n] == namespaceURI){ + return n; + } + } + } + el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + lookupNamespaceURI:function(prefix){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + if(prefix in map){ + return map[prefix] ; + } + } + el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + isDefaultNamespace:function(namespaceURI){ + var prefix = this.lookupPrefix(namespaceURI); + return prefix == null; + } +}; + + +function _xmlEncoder(c){ + return c == '<' && '<' || + c == '>' && '>' || + c == '&' && '&' || + c == '"' && '"' || + '&#'+c.charCodeAt()+';' +} + + +copy(NodeType,Node); +copy(NodeType,Node.prototype); + +/** + * @param callback return true for continue,false for break + * @return boolean true: break visit; + */ +function _visitNode(node,callback){ + if(callback(node)){ + return true; + } + if(node = node.firstChild){ + do{ + if(_visitNode(node,callback)){return true} + }while(node=node.nextSibling) + } +} + + + +function Document(){ +} +function _onAddAttribute(doc,el,newAttr){ + doc && doc._inc++; + var ns = newAttr.namespaceURI ; + if(ns == 'http://www.w3.org/2000/xmlns/'){ + //update namespace + el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value + } +} +function _onRemoveAttribute(doc,el,newAttr,remove){ + doc && doc._inc++; + var ns = newAttr.namespaceURI ; + if(ns == 'http://www.w3.org/2000/xmlns/'){ + //update namespace + delete el._nsMap[newAttr.prefix?newAttr.localName:''] + } +} +function _onUpdateChild(doc,el,newChild){ + if(doc && doc._inc){ + doc._inc++; + //update childNodes + var cs = el.childNodes; + if(newChild){ + cs[cs.length++] = newChild; + }else{ + //console.log(1) + var child = el.firstChild; + var i = 0; + while(child){ + cs[i++] = child; + child =child.nextSibling; + } + cs.length = i; + } + } +} + +/** + * attributes; + * children; + * + * writeable properties: + * nodeValue,Attr:value,CharacterData:data + * prefix + */ +function _removeChild(parentNode,child){ + var previous = child.previousSibling; + var next = child.nextSibling; + if(previous){ + previous.nextSibling = next; + }else{ + parentNode.firstChild = next + } + if(next){ + next.previousSibling = previous; + }else{ + parentNode.lastChild = previous; + } + _onUpdateChild(parentNode.ownerDocument,parentNode); + return child; +} +/** + * preformance key(refChild == null) + */ +function _insertBefore(parentNode,newChild,nextChild){ + var cp = newChild.parentNode; + if(cp){ + cp.removeChild(newChild);//remove and update + } + if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ + var newFirst = newChild.firstChild; + if (newFirst == null) { + return newChild; + } + var newLast = newChild.lastChild; + }else{ + newFirst = newLast = newChild; + } + var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild; + + newFirst.previousSibling = pre; + newLast.nextSibling = nextChild; + + + if(pre){ + pre.nextSibling = newFirst; + }else{ + parentNode.firstChild = newFirst; + } + if(nextChild == null){ + parentNode.lastChild = newLast; + }else{ + nextChild.previousSibling = newLast; + } + do{ + newFirst.parentNode = parentNode; + }while(newFirst !== newLast && (newFirst= newFirst.nextSibling)) + _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode); + //console.log(parentNode.lastChild.nextSibling == null) + if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { + newChild.firstChild = newChild.lastChild = null; + } + return newChild; +} +function _appendSingleChild(parentNode,newChild){ + var cp = newChild.parentNode; + if(cp){ + var pre = parentNode.lastChild; + cp.removeChild(newChild);//remove and update + var pre = parentNode.lastChild; + } + var pre = parentNode.lastChild; + newChild.parentNode = parentNode; + newChild.previousSibling = pre; + newChild.nextSibling = null; + if(pre){ + pre.nextSibling = newChild; + }else{ + parentNode.firstChild = newChild; + } + parentNode.lastChild = newChild; + _onUpdateChild(parentNode.ownerDocument,parentNode,newChild); + return newChild; + //console.log("__aa",parentNode.lastChild.nextSibling == null) +} +Document.prototype = { + //implementation : null, + nodeName : '#document', + nodeType : DOCUMENT_NODE, + doctype : null, + documentElement : null, + _inc : 1, + + insertBefore : function(newChild, refChild){//raises + if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){ + var child = newChild.firstChild; + while(child){ + var next = child.nextSibling; + this.insertBefore(child,refChild); + child = next; + } + return newChild; + } + if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){ + this.documentElement = newChild; + } + + return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild; + }, + removeChild : function(oldChild){ + if(this.documentElement == oldChild){ + this.documentElement = null; + } + return _removeChild(this,oldChild); + }, + // Introduced in DOM Level 2: + importNode : function(importedNode,deep){ + return importNode(this,importedNode,deep); + }, + // Introduced in DOM Level 2: + getElementById : function(id){ + var rtv = null; + _visitNode(this.documentElement,function(node){ + if(node.nodeType == ELEMENT_NODE){ + if(node.getAttribute('id') == id){ + rtv = node; + return true; + } + } + }) + return rtv; + }, + + //document factory method: + createElement : function(tagName){ + var node = new Element(); + node.ownerDocument = this; + node.nodeName = tagName; + node.tagName = tagName; + node.childNodes = new NodeList(); + var attrs = node.attributes = new NamedNodeMap(); + attrs._ownerElement = node; + return node; + }, + createDocumentFragment : function(){ + var node = new DocumentFragment(); + node.ownerDocument = this; + node.childNodes = new NodeList(); + return node; + }, + createTextNode : function(data){ + var node = new Text(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createComment : function(data){ + var node = new Comment(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createCDATASection : function(data){ + var node = new CDATASection(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createProcessingInstruction : function(target,data){ + var node = new ProcessingInstruction(); + node.ownerDocument = this; + node.tagName = node.target = target; + node.nodeValue= node.data = data; + return node; + }, + createAttribute : function(name){ + var node = new Attr(); + node.ownerDocument = this; + node.name = name; + node.nodeName = name; + node.localName = name; + node.specified = true; + return node; + }, + createEntityReference : function(name){ + var node = new EntityReference(); + node.ownerDocument = this; + node.nodeName = name; + return node; + }, + // Introduced in DOM Level 2: + createElementNS : function(namespaceURI,qualifiedName){ + var node = new Element(); + var pl = qualifiedName.split(':'); + var attrs = node.attributes = new NamedNodeMap(); + node.childNodes = new NodeList(); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.tagName = qualifiedName; + node.namespaceURI = namespaceURI; + if(pl.length == 2){ + node.prefix = pl[0]; + node.localName = pl[1]; + }else{ + //el.prefix = null; + node.localName = qualifiedName; + } + attrs._ownerElement = node; + return node; + }, + // Introduced in DOM Level 2: + createAttributeNS : function(namespaceURI,qualifiedName){ + var node = new Attr(); + var pl = qualifiedName.split(':'); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.name = qualifiedName; + node.namespaceURI = namespaceURI; + node.specified = true; + if(pl.length == 2){ + node.prefix = pl[0]; + node.localName = pl[1]; + }else{ + //el.prefix = null; + node.localName = qualifiedName; + } + return node; + } +}; +_extends(Document,Node); + + +function Element() { + this._nsMap = {}; +}; +Element.prototype = { + nodeType : ELEMENT_NODE, + hasAttribute : function(name){ + return this.getAttributeNode(name)!=null; + }, + getAttribute : function(name){ + var attr = this.getAttributeNode(name); + return attr && attr.value || ''; + }, + getAttributeNode : function(name){ + return this.attributes.getNamedItem(name); + }, + setAttribute : function(name, value){ + var attr = this.ownerDocument.createAttribute(name); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr) + }, + removeAttribute : function(name){ + var attr = this.getAttributeNode(name) + attr && this.removeAttributeNode(attr); + }, + + //four real opeartion method + appendChild:function(newChild){ + if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ + return this.insertBefore(newChild,null); + }else{ + return _appendSingleChild(this,newChild); + } + }, + setAttributeNode : function(newAttr){ + return this.attributes.setNamedItem(newAttr); + }, + setAttributeNodeNS : function(newAttr){ + return this.attributes.setNamedItemNS(newAttr); + }, + removeAttributeNode : function(oldAttr){ + //console.log(this == oldAttr.ownerElement) + return this.attributes.removeNamedItem(oldAttr.nodeName); + }, + //get real attribute name,and remove it by removeAttributeNode + removeAttributeNS : function(namespaceURI, localName){ + var old = this.getAttributeNodeNS(namespaceURI, localName); + old && this.removeAttributeNode(old); + }, + + hasAttributeNS : function(namespaceURI, localName){ + return this.getAttributeNodeNS(namespaceURI, localName)!=null; + }, + getAttributeNS : function(namespaceURI, localName){ + var attr = this.getAttributeNodeNS(namespaceURI, localName); + return attr && attr.value || ''; + }, + setAttributeNS : function(namespaceURI, qualifiedName, value){ + var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr) + }, + getAttributeNodeNS : function(namespaceURI, localName){ + return this.attributes.getNamedItemNS(namespaceURI, localName); + }, + + getElementsByTagName : function(tagName){ + return new LiveNodeList(this,function(base){ + var ls = []; + _visitNode(base,function(node){ + if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){ + ls.push(node); + } + }); + return ls; + }); + }, + getElementsByTagNameNS : function(namespaceURI, localName){ + return new LiveNodeList(this,function(base){ + var ls = []; + _visitNode(base,function(node){ + if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){ + ls.push(node); + } + }); + return ls; + + }); + } +}; +Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; +Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; + + +_extends(Element,Node); +function Attr() { +}; +Attr.prototype.nodeType = ATTRIBUTE_NODE; +_extends(Attr,Node); + + +function CharacterData() { +}; +CharacterData.prototype = { + data : '', + substringData : function(offset, count) { + return this.data.substring(offset, offset+count); + }, + appendData: function(text) { + text = this.data+text; + this.nodeValue = this.data = text; + this.length = text.length; + }, + insertData: function(offset,text) { + this.replaceData(offset,0,text); + + }, + appendChild:function(newChild){ + throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]) + }, + deleteData: function(offset, count) { + this.replaceData(offset,count,""); + }, + replaceData: function(offset, count, text) { + var start = this.data.substring(0,offset); + var end = this.data.substring(offset+count); + text = start + text + end; + this.nodeValue = this.data = text; + this.length = text.length; + } +} +_extends(CharacterData,Node); +function Text() { +}; +Text.prototype = { + nodeName : "#text", + nodeType : TEXT_NODE, + splitText : function(offset) { + var text = this.data; + var newText = text.substring(offset); + text = text.substring(0, offset); + this.data = this.nodeValue = text; + this.length = text.length; + var newNode = this.ownerDocument.createTextNode(newText); + if(this.parentNode){ + this.parentNode.insertBefore(newNode, this.nextSibling); + } + return newNode; + } +} +_extends(Text,CharacterData); +function Comment() { +}; +Comment.prototype = { + nodeName : "#comment", + nodeType : COMMENT_NODE +} +_extends(Comment,CharacterData); + +function CDATASection() { +}; +CDATASection.prototype = { + nodeName : "#cdata-section", + nodeType : CDATA_SECTION_NODE +} +_extends(CDATASection,CharacterData); + + +function DocumentType() { +}; +DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; +_extends(DocumentType,Node); + +function Notation() { +}; +Notation.prototype.nodeType = NOTATION_NODE; +_extends(Notation,Node); + +function Entity() { +}; +Entity.prototype.nodeType = ENTITY_NODE; +_extends(Entity,Node); + +function EntityReference() { +}; +EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; +_extends(EntityReference,Node); + +function DocumentFragment() { +}; +DocumentFragment.prototype.nodeName = "#document-fragment"; +DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; +_extends(DocumentFragment,Node); + + +function ProcessingInstruction() { +} +ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; +_extends(ProcessingInstruction,Node); +function XMLSerializer(){} +XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){ + return nodeSerializeToString.call(node,isHtml,nodeFilter); +} +Node.prototype.toString = nodeSerializeToString; +function nodeSerializeToString(isHtml,nodeFilter){ + var buf = []; + var refNode = this.nodeType == 9?this.documentElement:this; + var prefix = refNode.prefix; + var uri = refNode.namespaceURI; + + if(uri && prefix == null){ + //console.log(prefix) + var prefix = refNode.lookupPrefix(uri); + if(prefix == null){ + //isHTML = true; + var visibleNamespaces=[ + {namespace:uri,prefix:null} + //{namespace:uri,prefix:''} + ] + } + } + serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces); + //console.log('###',this.nodeType,uri,prefix,buf.join('')) + return buf.join(''); +} +function needNamespaceDefine(node,isHTML, visibleNamespaces) { + var prefix = node.prefix||''; + var uri = node.namespaceURI; + if (!prefix && !uri){ + return false; + } + if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace" + || uri == 'http://www.w3.org/2000/xmlns/'){ + return false; + } + + var i = visibleNamespaces.length + //console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces) + while (i--) { + var ns = visibleNamespaces[i]; + // get namespace prefix + //console.log(node.nodeType,node.tagName,ns.prefix,prefix) + if (ns.prefix == prefix){ + return ns.namespace != uri; + } + } + //console.log(isHTML,uri,prefix=='') + //if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){ + // return false; + //} + //node.flag = '11111' + //console.error(3,true,node.flag,node.prefix,node.namespaceURI) + return true; +} +function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ + if(nodeFilter){ + node = nodeFilter(node); + if(node){ + if(typeof node == 'string'){ + buf.push(node); + return; + } + }else{ + return; + } + //buf.sort.apply(attrs, attributeSorter); + } + switch(node.nodeType){ + case ELEMENT_NODE: + if (!visibleNamespaces) visibleNamespaces = []; + var startVisibleNamespaces = visibleNamespaces.length; + var attrs = node.attributes; + var len = attrs.length; + var child = node.firstChild; + var nodeName = node.tagName; + + isHTML = (htmlns === node.namespaceURI) ||isHTML + buf.push('<',nodeName); + + + + for(var i=0;i<len;i++){ + // add namespaces for attributes + var attr = attrs.item(i); + if (attr.prefix == 'xmlns') { + visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value }); + }else if(attr.nodeName == 'xmlns'){ + visibleNamespaces.push({ prefix: '', namespace: attr.value }); + } + } + for(var i=0;i<len;i++){ + var attr = attrs.item(i); + if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) { + var prefix = attr.prefix||''; + var uri = attr.namespaceURI; + var ns = prefix ? ' xmlns:' + prefix : " xmlns"; + buf.push(ns, '="' , uri , '"'); + visibleNamespaces.push({ prefix: prefix, namespace:uri }); + } + serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces); + } + // add namespace for current node + if (needNamespaceDefine(node,isHTML, visibleNamespaces)) { + var prefix = node.prefix||''; + var uri = node.namespaceURI; + var ns = prefix ? ' xmlns:' + prefix : " xmlns"; + buf.push(ns, '="' , uri , '"'); + visibleNamespaces.push({ prefix: prefix, namespace:uri }); + } + + if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){ + buf.push('>'); + //if is cdata child node + if(isHTML && /^script$/i.test(nodeName)){ + while(child){ + if(child.data){ + buf.push(child.data); + }else{ + serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); + } + child = child.nextSibling; + } + }else + { + while(child){ + serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); + child = child.nextSibling; + } + } + buf.push('</',nodeName,'>'); + }else{ + buf.push('/>'); + } + // remove added visible namespaces + //visibleNamespaces.length = startVisibleNamespaces; + return; + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + var child = node.firstChild; + while(child){ + serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); + child = child.nextSibling; + } + return; + case ATTRIBUTE_NODE: + return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"'); + case TEXT_NODE: + return buf.push(node.data.replace(/[<&]/g,_xmlEncoder)); + case CDATA_SECTION_NODE: + return buf.push( '<![CDATA[',node.data,']]>'); + case COMMENT_NODE: + return buf.push( "<!--",node.data,"-->"); + case DOCUMENT_TYPE_NODE: + var pubid = node.publicId; + var sysid = node.systemId; + buf.push('<!DOCTYPE ',node.name); + if(pubid){ + buf.push(' PUBLIC "',pubid); + if (sysid && sysid!='.') { + buf.push( '" "',sysid); + } + buf.push('">'); + }else if(sysid && sysid!='.'){ + buf.push(' SYSTEM "',sysid,'">'); + }else{ + var sub = node.internalSubset; + if(sub){ + buf.push(" [",sub,"]"); + } + buf.push(">"); + } + return; + case PROCESSING_INSTRUCTION_NODE: + return buf.push( "<?",node.target," ",node.data,"?>"); + case ENTITY_REFERENCE_NODE: + return buf.push( '&',node.nodeName,';'); + //case ENTITY_NODE: + //case NOTATION_NODE: + default: + buf.push('??',node.nodeName); + } +} +function importNode(doc,node,deep){ + var node2; + switch (node.nodeType) { + case ELEMENT_NODE: + node2 = node.cloneNode(false); + node2.ownerDocument = doc; + //var attrs = node2.attributes; + //var len = attrs.length; + //for(var i=0;i<len;i++){ + //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep)); + //} + case DOCUMENT_FRAGMENT_NODE: + break; + case ATTRIBUTE_NODE: + deep = true; + break; + //case ENTITY_REFERENCE_NODE: + //case PROCESSING_INSTRUCTION_NODE: + ////case TEXT_NODE: + //case CDATA_SECTION_NODE: + //case COMMENT_NODE: + // deep = false; + // break; + //case DOCUMENT_NODE: + //case DOCUMENT_TYPE_NODE: + //cannot be imported. + //case ENTITY_NODE: + //case NOTATION_NODE: + //can not hit in level3 + //default:throw e; + } + if(!node2){ + node2 = node.cloneNode(false);//false + } + node2.ownerDocument = doc; + node2.parentNode = null; + if(deep){ + var child = node.firstChild; + while(child){ + node2.appendChild(importNode(doc,child,deep)); + child = child.nextSibling; + } + } + return node2; +} +// +//var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1, +// attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,}; +function cloneNode(doc,node,deep){ + var node2 = new node.constructor(); + for(var n in node){ + var v = node[n]; + if(typeof v != 'object' ){ + if(v != node2[n]){ + node2[n] = v; + } + } + } + if(node.childNodes){ + node2.childNodes = new NodeList(); + } + node2.ownerDocument = doc; + switch (node2.nodeType) { + case ELEMENT_NODE: + var attrs = node.attributes; + var attrs2 = node2.attributes = new NamedNodeMap(); + var len = attrs.length + attrs2._ownerElement = node2; + for(var i=0;i<len;i++){ + node2.setAttributeNode(cloneNode(doc,attrs.item(i),true)); + } + break;; + case ATTRIBUTE_NODE: + deep = true; + } + if(deep){ + var child = node.firstChild; + while(child){ + node2.appendChild(cloneNode(doc,child,deep)); + child = child.nextSibling; + } + } + return node2; +} + +function __set__(object,key,value){ + object[key] = value +} +//do dynamic +try{ + if(Object.defineProperty){ + Object.defineProperty(LiveNodeList.prototype,'length',{ + get:function(){ + _updateLiveList(this); + return this.$$length; + } + }); + Object.defineProperty(Node.prototype,'textContent',{ + get:function(){ + return getTextContent(this); + }, + set:function(data){ + switch(this.nodeType){ + case ELEMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + while(this.firstChild){ + this.removeChild(this.firstChild); + } + if(data || String(data)){ + this.appendChild(this.ownerDocument.createTextNode(data)); + } + break; + default: + //TODO: + this.data = data; + this.value = data; + this.nodeValue = data; + } + } + }) + + function getTextContent(node){ + switch(node.nodeType){ + case ELEMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + var buf = []; + node = node.firstChild; + while(node){ + if(node.nodeType!==7 && node.nodeType !==8){ + buf.push(getTextContent(node)); + } + node = node.nextSibling; + } + return buf.join(''); + default: + return node.nodeValue; + } + } + __set__ = function(object,key,value){ + //console.log(value) + object['$$'+key] = value + } + } +}catch(e){//ie8 +} + +//if(typeof require == 'function'){ + exports.DOMImplementation = DOMImplementation; + exports.XMLSerializer = XMLSerializer; +//} + +},{}],21:[function(require,module,exports){ +//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] +//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +//[5] Name ::= NameStartChar (NameChar)* +var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF +var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); +var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); +//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ +//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') + +//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE +//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE +var S_TAG = 0;//tag name offerring +var S_ATTR = 1;//attr name offerring +var S_ATTR_SPACE=2;//attr name end and space offer +var S_EQ = 3;//=space? +var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only) +var S_ATTR_END = 5;//attr value end and no space(quot end) +var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer) +var S_TAG_CLOSE = 7;//closed el<el /> + +function XMLReader(){ + +} + +XMLReader.prototype = { + parse:function(source,defaultNSMap,entityMap){ + var domBuilder = this.domBuilder; + domBuilder.startDocument(); + _copy(defaultNSMap ,defaultNSMap = {}) + parse(source,defaultNSMap,entityMap, + domBuilder,this.errorHandler); + domBuilder.endDocument(); + } +} +function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ + function fixedFromCharCode(code) { + // String.prototype.fromCharCode does not supports + // > 2 bytes unicode chars directly + if (code > 0xffff) { + code -= 0x10000; + var surrogate1 = 0xd800 + (code >> 10) + , surrogate2 = 0xdc00 + (code & 0x3ff); + + return String.fromCharCode(surrogate1, surrogate2); + } else { + return String.fromCharCode(code); + } + } + function entityReplacer(a){ + var k = a.slice(1,-1); + if(k in entityMap){ + return entityMap[k]; + }else if(k.charAt(0) === '#'){ + return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) + }else{ + errorHandler.error('entity not found:'+a); + return a; + } + } + function appendText(end){//has some bugs + if(end>start){ + var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); + locator&&position(start); + domBuilder.characters(xt,0,end-start); + start = end + } + } + function position(p,m){ + while(p>=lineEnd && (m = linePattern.exec(source))){ + lineStart = m.index; + lineEnd = lineStart + m[0].length; + locator.lineNumber++; + //console.log('line++:',locator,startPos,endPos) + } + locator.columnNumber = p-lineStart+1; + } + var lineStart = 0; + var lineEnd = 0; + var linePattern = /.*(?:\r\n?|\n)|.*$/g + var locator = domBuilder.locator; + + var parseStack = [{currentNSMap:defaultNSMapCopy}] + var closeMap = {}; + var start = 0; + while(true){ + try{ + var tagStart = source.indexOf('<',start); + if(tagStart<0){ + if(!source.substr(start).match(/^\s*$/)){ + var doc = domBuilder.doc; + var text = doc.createTextNode(source.substr(start)); + doc.appendChild(text); + domBuilder.currentElement = text; + } + return; + } + if(tagStart>start){ + appendText(tagStart); + } + switch(source.charAt(tagStart+1)){ + case '/': + var end = source.indexOf('>',tagStart+3); + var tagName = source.substring(tagStart+2,end); + var config = parseStack.pop(); + if(end<0){ + + tagName = source.substring(tagStart+2).replace(/[\s<].*/,''); + //console.error('#@@@@@@'+tagName) + errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName); + end = tagStart+1+tagName.length; + }else if(tagName.match(/\s</)){ + tagName = tagName.replace(/[\s<].*/,''); + errorHandler.error("end tag name: "+tagName+' maybe not complete'); + end = tagStart+1+tagName.length; + } + //console.error(parseStack.length,parseStack) + //console.error(config); + var localNSMap = config.localNSMap; + var endMatch = config.tagName == tagName; + var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase() + if(endIgnoreCaseMach){ + domBuilder.endElement(config.uri,config.localName,tagName); + if(localNSMap){ + for(var prefix in localNSMap){ + domBuilder.endPrefixMapping(prefix) ; + } + } + if(!endMatch){ + errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); + } + }else{ + parseStack.push(config) + } + + end++; + break; + // end elment + case '?':// <?...?> + locator&&position(tagStart); + end = parseInstruction(source,tagStart,domBuilder); + break; + case '!':// <!doctype,<![CDATA,<!-- + locator&&position(tagStart); + end = parseDCC(source,tagStart,domBuilder,errorHandler); + break; + default: + locator&&position(tagStart); + var el = new ElementAttributes(); + var currentNSMap = parseStack[parseStack.length-1].currentNSMap; + //elStartEnd + var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler); + var len = el.length; + + + if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){ + el.closed = true; + if(!entityMap.nbsp){ + errorHandler.warning('unclosed xml attribute'); + } + } + if(locator && len){ + var locator2 = copyLocator(locator,{}); + //try{//attribute position fixed + for(var i = 0;i<len;i++){ + var a = el[i]; + position(a.offset); + a.locator = copyLocator(locator,{}); + } + //}catch(e){console.error('@@@@@'+e)} + domBuilder.locator = locator2 + if(appendElement(el,domBuilder,currentNSMap)){ + parseStack.push(el) + } + domBuilder.locator = locator; + }else{ + if(appendElement(el,domBuilder,currentNSMap)){ + parseStack.push(el) + } + } + + + + if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){ + end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder) + }else{ + end++; + } + } + }catch(e){ + errorHandler.error('element parse error: '+e) + //errorHandler.error('element parse error: '+e); + end = -1; + //throw e; + } + if(end>start){ + start = end; + }else{ + //TODO: 这里有å¯èƒ½sax回退,有ä½ç½®é”™è¯¯é£Žé™© + appendText(Math.max(tagStart,start)+1); + } + } +} +function copyLocator(f,t){ + t.lineNumber = f.lineNumber; + t.columnNumber = f.columnNumber; + return t; +} + +/** + * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); + * @return end of the elementStartPart(end of elementEndPart for selfClosed el) + */ +function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){ + var attrName; + var value; + var p = ++start; + var s = S_TAG;//status + while(true){ + var c = source.charAt(p); + switch(c){ + case '=': + if(s === S_ATTR){//attrName + attrName = source.slice(start,p); + s = S_EQ; + }else if(s === S_ATTR_SPACE){ + s = S_EQ; + }else{ + //fatalError: equal must after attrName or space after attrName + throw new Error('attribute equal must after attrName'); + } + break; + case '\'': + case '"': + if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE + ){//equal + if(s === S_ATTR){ + errorHandler.warning('attribute value must after "="') + attrName = source.slice(start,p) + } + start = p+1; + p = source.indexOf(c,start) + if(p>0){ + value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + el.add(attrName,value,start-1); + s = S_ATTR_END; + }else{ + //fatalError: no end quot match + throw new Error('attribute value no end \''+c+'\' match'); + } + }else if(s == S_ATTR_NOQUOT_VALUE){ + value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + //console.log(attrName,value,start,p) + el.add(attrName,value,start); + //console.dir(el) + errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); + start = p+1; + s = S_ATTR_END + }else{ + //fatalError: no equal before + throw new Error('attribute value must after "="'); + } + break; + case '/': + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + s =S_TAG_CLOSE; + el.closed = true; + case S_ATTR_NOQUOT_VALUE: + case S_ATTR: + case S_ATTR_SPACE: + break; + //case S_EQ: + default: + throw new Error("attribute invalid close char('/')") + } + break; + case ''://end document + //throw new Error('unexpected end of input') + errorHandler.error('unexpected end of input'); + if(s == S_TAG){ + el.setTagName(source.slice(start,p)); + } + return p; + case '>': + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + break;//normal + case S_ATTR_NOQUOT_VALUE://Compatible state + case S_ATTR: + value = source.slice(start,p); + if(value.slice(-1) === '/'){ + el.closed = true; + value = value.slice(0,-1) + } + case S_ATTR_SPACE: + if(s === S_ATTR_SPACE){ + value = attrName; + } + if(s == S_ATTR_NOQUOT_VALUE){ + errorHandler.warning('attribute "'+value+'" missed quot(")!!'); + el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start) + }else{ + if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)){ + errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') + } + el.add(value,value,start) + } + break; + case S_EQ: + throw new Error('attribute value missed!!'); + } +// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) + return p; + /*xml space '\x20' | #x9 | #xD | #xA; */ + case '\u0080': + c = ' '; + default: + if(c<= ' '){//space + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p));//tagName + s = S_TAG_SPACE; + break; + case S_ATTR: + attrName = source.slice(start,p) + s = S_ATTR_SPACE; + break; + case S_ATTR_NOQUOT_VALUE: + var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + errorHandler.warning('attribute "'+value+'" missed quot(")!!'); + el.add(attrName,value,start) + case S_ATTR_END: + s = S_TAG_SPACE; + break; + //case S_TAG_SPACE: + //case S_EQ: + //case S_ATTR_SPACE: + // void();break; + //case S_TAG_CLOSE: + //ignore warning + } + }else{//not space +//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE +//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE + switch(s){ + //case S_TAG:void();break; + //case S_ATTR:void();break; + //case S_ATTR_NOQUOT_VALUE:void();break; + case S_ATTR_SPACE: + var tagName = el.tagName; + if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)){ + errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!') + } + el.add(attrName,attrName,start); + start = p; + s = S_ATTR; + break; + case S_ATTR_END: + errorHandler.warning('attribute space is required"'+attrName+'"!!') + case S_TAG_SPACE: + s = S_ATTR; + start = p; + break; + case S_EQ: + s = S_ATTR_NOQUOT_VALUE; + start = p; + break; + case S_TAG_CLOSE: + throw new Error("elements closed character '/' and '>' must be connected to"); + } + } + }//end outer switch + //console.log('p++',p) + p++; + } +} +/** + * @return true if has new namespace define + */ +function appendElement(el,domBuilder,currentNSMap){ + var tagName = el.tagName; + var localNSMap = null; + //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; + var i = el.length; + while(i--){ + var a = el[i]; + var qName = a.qName; + var value = a.value; + var nsp = qName.indexOf(':'); + if(nsp>0){ + var prefix = a.prefix = qName.slice(0,nsp); + var localName = qName.slice(nsp+1); + var nsPrefix = prefix === 'xmlns' && localName + }else{ + localName = qName; + prefix = null + nsPrefix = qName === 'xmlns' && '' + } + //can not set prefix,because prefix !== '' + a.localName = localName ; + //prefix == null for no ns prefix attribute + if(nsPrefix !== false){//hack!! + if(localNSMap == null){ + localNSMap = {} + //console.log(currentNSMap,0) + _copy(currentNSMap,currentNSMap={}) + //console.log(currentNSMap,1) + } + currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; + a.uri = 'http://www.w3.org/2000/xmlns/' + domBuilder.startPrefixMapping(nsPrefix, value) + } + } + var i = el.length; + while(i--){ + a = el[i]; + var prefix = a.prefix; + if(prefix){//no prefix attribute has no namespace + if(prefix === 'xml'){ + a.uri = 'http://www.w3.org/XML/1998/namespace'; + }if(prefix !== 'xmlns'){ + a.uri = currentNSMap[prefix || ''] + + //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} + } + } + } + var nsp = tagName.indexOf(':'); + if(nsp>0){ + prefix = el.prefix = tagName.slice(0,nsp); + localName = el.localName = tagName.slice(nsp+1); + }else{ + prefix = null;//important!! + localName = el.localName = tagName; + } + //no prefix element has default namespace + var ns = el.uri = currentNSMap[prefix || '']; + domBuilder.startElement(ns,localName,tagName,el); + //endPrefixMapping and startPrefixMapping have not any help for dom builder + //localNSMap = null + if(el.closed){ + domBuilder.endElement(ns,localName,tagName); + if(localNSMap){ + for(prefix in localNSMap){ + domBuilder.endPrefixMapping(prefix) + } + } + }else{ + el.currentNSMap = currentNSMap; + el.localNSMap = localNSMap; + //parseStack.push(el); + return true; + } +} +function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ + if(/^(?:script|textarea)$/i.test(tagName)){ + var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd); + var text = source.substring(elStartEnd+1,elEndStart); + if(/[&<]/.test(text)){ + if(/^script$/i.test(tagName)){ + //if(!/\]\]>/.test(text)){ + //lexHandler.startCDATA(); + domBuilder.characters(text,0,text.length); + //lexHandler.endCDATA(); + return elEndStart; + //} + }//}else{//text area + text = text.replace(/&#?\w+;/g,entityReplacer); + domBuilder.characters(text,0,text.length); + return elEndStart; + //} + + } + } + return elStartEnd+1; +} +function fixSelfClosed(source,elStartEnd,tagName,closeMap){ + //if(tagName in closeMap){ + var pos = closeMap[tagName]; + if(pos == null){ + //console.log(tagName) + pos = source.lastIndexOf('</'+tagName+'>') + if(pos<elStartEnd){//忘记é—åˆ + pos = source.lastIndexOf('</'+tagName) + } + closeMap[tagName] =pos + } + return pos<elStartEnd; + //} +} +function _copy(source,target){ + for(var n in source){target[n] = source[n]} +} +function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!' + var next= source.charAt(start+2) + switch(next){ + case '-': + if(source.charAt(start + 3) === '-'){ + var end = source.indexOf('-->',start+4); + //append comment source.substring(4,end)//<!-- + if(end>start){ + domBuilder.comment(source,start+4,end-start-4); + return end+3; + }else{ + errorHandler.error("Unclosed comment"); + return -1; + } + }else{ + //error + return -1; + } + default: + if(source.substr(start+3,6) == 'CDATA['){ + var end = source.indexOf(']]>',start+9); + domBuilder.startCDATA(); + domBuilder.characters(source,start+9,end-start-9); + domBuilder.endCDATA() + return end+3; + } + //<!DOCTYPE + //startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) + var matchs = split(source,start); + var len = matchs.length; + if(len>1 && /!doctype/i.test(matchs[0][0])){ + var name = matchs[1][0]; + var pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0] + var sysid = len>4 && matchs[4][0]; + var lastMatch = matchs[len-1] + domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'), + sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2')); + domBuilder.endDTD(); + + return lastMatch.index+lastMatch[0].length + } + } + return -1; +} + + + +function parseInstruction(source,start,domBuilder){ + var end = source.indexOf('?>',start); + if(end){ + var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); + if(match){ + var len = match[0].length; + domBuilder.processingInstruction(match[1], match[2]) ; + return end+2; + }else{//error + return -1; + } + } + return -1; +} + +/** + * @param source + */ +function ElementAttributes(source){ + +} +ElementAttributes.prototype = { + setTagName:function(tagName){ + if(!tagNamePattern.test(tagName)){ + throw new Error('invalid tagName:'+tagName) + } + this.tagName = tagName + }, + add:function(qName,value,offset){ + if(!tagNamePattern.test(qName)){ + throw new Error('invalid attribute:'+qName) + } + this[this.length++] = {qName:qName,value:value,offset:offset} + }, + length:0, + getLocalName:function(i){return this[i].localName}, + getLocator:function(i){return this[i].locator}, + getQName:function(i){return this[i].qName}, + getURI:function(i){return this[i].uri}, + getValue:function(i){return this[i].value} +// ,getIndex:function(uri, localName)){ +// if(localName){ +// +// }else{ +// var qName = uri +// } +// }, +// getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))}, +// getType:function(uri,localName){} +// getType:function(i){}, +} + + + + +function _set_proto_(thiz,parent){ + thiz.__proto__ = parent; + return thiz; +} +if(!(_set_proto_({},_set_proto_.prototype) instanceof _set_proto_)){ + _set_proto_ = function(thiz,parent){ + function p(){}; + p.prototype = parent; + p = new p(); + for(parent in thiz){ + p[parent] = thiz[parent]; + } + return p; + } +} + +function split(source,start){ + var match; + var buf = []; + var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; + reg.lastIndex = start; + reg.exec(source);//skip < + while(match = reg.exec(source)){ + buf.push(match); + if(match[1])return buf; + } +} + +exports.XMLReader = XMLReader; + + +},{}],"/src/js/docxtemplater.js":[function(require,module,exports){ +"use strict"; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var DocUtils = require("./doc-utils"); +DocUtils.traits = require("./traits"); +DocUtils.moduleWrapper = require("./module-wrapper"); +var wrapper = DocUtils.moduleWrapper; + +var Docxtemplater = function () { + function Docxtemplater() { + _classCallCheck(this, Docxtemplater); + + if (arguments.length > 0) { + throw new Error("The constructor with parameters have been removed in docxtemplater 3.0, please check the upgrade guide."); + } + this.compiled = {}; + this.modules = []; + this.setOptions({}); + } + + _createClass(Docxtemplater, [{ + key: "attachModule", + value: function attachModule(module) { + this.modules.push(wrapper(module)); + return this; + } + }, { + key: "setOptions", + value: function setOptions(options) { + var _this = this; + + this.options = options; + Object.keys(DocUtils.defaults).forEach(function (key) { + var defaultValue = DocUtils.defaults[key]; + _this[key] = _this.options[key] != null ? _this.options[key] : defaultValue; + }); + if (this.zip) { + this.updateFileTypeConfig(); + } + return this; + } + }, { + key: "loadZip", + value: function loadZip(zip) { + if (zip.loadAsync) { + throw new Error("Docxtemplater doesn't handle JSZip version >=3, see changelog"); + } + this.zip = zip; + this.updateFileTypeConfig(); + return this; + } + }, { + key: "compileFile", + value: function compileFile(fileName) { + var currentFile = this.createTemplateClass(fileName); + currentFile.parse(); + this.compiled[fileName] = currentFile; + } + }, { + key: "compile", + value: function compile() { + this.templatedFiles = this.fileTypeConfig.getTemplatedFiles(this.zip); + return this; + } + }, { + key: "updateFileTypeConfig", + value: function updateFileTypeConfig() { + this.fileType = this.zip.files["word/document.xml"] ? "docx" : "pptx"; + this.fileTypeConfig = this.options.fileTypeConfig || Docxtemplater.FileTypeConfig[this.fileType]; + return this; + } + }, { + key: "render", + value: function render() { + var _this2 = this; + + this.options.xmlFileNames = []; + this.modules = this.fileTypeConfig.baseModules.map(function (moduleFunction) { + return moduleFunction(); + }).concat(this.modules); + this.options = this.modules.reduce(function (options, module) { + return module.optionsTransformer(options, _this2); + }, this.options); + this.xmlDocuments = this.options.xmlFileNames.reduce(function (xmlDocuments, fileName) { + var content = _this2.zip.files[fileName].asText(); + xmlDocuments[fileName] = DocUtils.str2xml(content); + return xmlDocuments; + }, {}); + this.modules.forEach(function (module) { + module.set({ zip: _this2.zip, xmlDocuments: _this2.xmlDocuments, data: _this2.data }); + }); + this.compile(); + + this.modules.forEach(function (module) { + module.set({ compiled: _this2.compiled }); + }); + // Loop inside all templatedFiles (ie xml files with content). + // Sometimes they don't exist (footer.xml for example) + this.templatedFiles.forEach(function (fileName) { + if (_this2.zip.files[fileName] != null) { + _this2.compileFile(fileName); + } + }); + + this.mapper = this.modules.reduce(function (value, module) { + return module.getRenderedMap(value); + }, {}); + + Object.keys(this.mapper).forEach(function (to) { + var mapped = _this2.mapper[to]; + var from = mapped.from; + var currentFile = _this2.compiled[from]; + currentFile.setTags(mapped.data); + currentFile.render(to); + _this2.zip.file(to, currentFile.content); + }); + + Object.keys(this.xmlDocuments).forEach(function (fileName) { + _this2.zip.remove(fileName); + var content = DocUtils.xml2str(_this2.xmlDocuments[fileName]); + return _this2.zip.file(fileName, content, {}); + }); + return this; + } + }, { + key: "setData", + value: function setData(data) { + this.data = data; + return this; + } + }, { + key: "getZip", + value: function getZip() { + return this.zip; + } + }, { + key: "createTemplateClass", + value: function createTemplateClass(path) { + var usedData = this.zip.files[path].asText(); + return this.createTemplateClassFromContent(usedData, path); + } + }, { + key: "createTemplateClassFromContent", + value: function createTemplateClassFromContent(content, filePath) { + var _this3 = this; + + var xmltOptions = { + filePath: filePath + }; + Object.keys(DocUtils.defaults).forEach(function (key) { + xmltOptions[key] = _this3[key]; + }); + xmltOptions.fileTypeConfig = this.fileTypeConfig; + xmltOptions.modules = this.modules; + return new Docxtemplater.XmlTemplater(content, xmltOptions); + } + }, { + key: "getFullText", + value: function getFullText(path) { + return this.createTemplateClass(path || this.fileTypeConfig.textPath).getFullText(); + } + }, { + key: "getTemplatedFiles", + value: function getTemplatedFiles() { + this.compile(); + return this.templatedFiles; + } + }]); + + return Docxtemplater; +}(); + +Docxtemplater.DocUtils = require("./doc-utils"); +Docxtemplater.Errors = require("./errors"); +Docxtemplater.XmlTemplater = require("./xml-templater"); +Docxtemplater.FileTypeConfig = require("./file-type-config"); +Docxtemplater.XmlMatcher = require("./xml-matcher"); +module.exports = Docxtemplater; +},{"./doc-utils":1,"./errors":2,"./file-type-config":3,"./module-wrapper":7,"./traits":16,"./xml-matcher":17,"./xml-templater":18}]},{},[])("/src/js/docxtemplater.js") +}); + } \ No newline at end of file diff --git a/process/mailbridge/process.js b/process/mailbridge/process.js index 210f2c5fc8ef057aa5b26430ac13c320dc483933..88f17d8b32509fd74629bb49748cf66968984268 100644 --- a/process/mailbridge/process.js +++ b/process/mailbridge/process.js @@ -8,4 +8,5 @@ var sender = text.decodeFirst(vars.getString("$local.sender")); var recipients = text.decodeMS(vars.getString("$local.recipients")); var mailObj = mail.resolveMail(vars.getString("$local.mail")); -IncomingEmailExecutor.mailToActivity(mailObj); +var incomingMailExec = new IncomingEmailExecutor(mailObj); +incomingMailExec.autoProcess(); \ No newline at end of file diff --git a/process/sendBulkMail_serverProcess/process.js b/process/sendBulkMail_serverProcess/process.js index 68c0371b37a3721cd13e0aef3113a8e170034ecd..6a68f3deaaa3dc0b3ef04025b4d395920228145f 100644 --- a/process/sendBulkMail_serverProcess/process.js +++ b/process/sendBulkMail_serverProcess/process.js @@ -10,9 +10,10 @@ import("system.notification"); var startTime = datetime.date(); var bulkMailId = vars.get("$local.bulkMailId"); var user = vars.get("$local.user"); -var res = BulkMailUtils.sendBulkMail(bulkMailId); +var testRecipients = JSON.parse(vars.get("$local.testRecipients")); +var res = BulkMailUtils.sendBulkMail(bulkMailId, testRecipients); -if (user) +if (user && !testRecipients) { var mailName = db.cell(SqlCondition.begin() .andPrepare("BULKMAIL.BULKMAILID", bulkMailId) diff --git a/report/Offer_report/reportData.jrxml b/report/Offer_report/reportData.jrxml index 5ab436382c2801b7bec17416b3178bcbcbd1a360..30df427aa7638931068dc1ae8eca790608850264 100644 --- a/report/Offer_report/reportData.jrxml +++ b/report/Offer_report/reportData.jrxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e7a916c8-3f9a-497d-84bb-3909b15271ea"> - <property name="ireport.zoom" value="2.1435888100000016"/> + <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="myAddr" class="java.lang.String"/> @@ -24,7 +24,7 @@ <parameter name="OfferDeliveryTerm" class="java.lang.String"/> <parameter name="responsible" class="java.lang.String"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> - <defaultValueExpression><![CDATA["C:\\entwicklungszweige\\0.0\\project\\xRM-Basic5.1\\report\\Offer_report\\"]]></defaultValueExpression> + <defaultValueExpression><![CDATA["C:\\Users\\m.mansour\\Desktop\\xRM-Basic 2019\\xRM-Basic 2019\\report\\Offer_report\\"]]></defaultValueExpression> </parameter> <parameter name="adito.datasource.subdata" class="java.lang.Object"/> <parameter name="SUMITEMSUM" class="java.lang.Double"/> @@ -488,4 +488,4 @@ </line> </band> </pageFooter> -</jasperReport> \ No newline at end of file +</jasperReport> diff --git a/report/Offer_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js b/report/Offer_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js index 475d8abf9eb731b6a8830bb7e81bab59abc81fb9..4572bef869ba742cdabc5155acd3fc3ecf76fe13 100644 --- a/report/Offer_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js +++ b/report/Offer_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js @@ -4,13 +4,12 @@ import("system.translate"); import("system.question"); import("system.vars"); import("system.db"); -import("lib_email"); var details = vars.get("$global.RptOfferOrderDetails"); var orgid = db.cell("select ORGANISATION_ID from CONTACT where CONTACTID = '" + details[1] + "'"); if (orgid.substr(0, 2) == '0 ') // Privatperson { - var count = db.cell("select count(*) from COMMUNICATION where medium_id = 3 and STANDARD = 1 and CONTACT_ID = '" + details[1] + "'"); + var count = db.cell("select count(*) from COMMUNICATION where medium_id = 3 and ISSTANDARD = 1 and CONTACT_ID = '" + details[1] + "'"); if (count == "0") question.showMessage(translate.text("no standard email office")); else sendAutoMail( translate.text("Offer") + " " + details[0], details[1], "Email_Angebot", details[2], "AGB", [], [["SPNR", details[5]]] ); @@ -33,7 +32,7 @@ else // Funktion - Person in Firma var relccid = text.decodeMS(contactid["DLG_CHOOSE_PERSON_FOREMAIL.tbl_person_cc"]); if (relccid.length == 0) contactid = ""; // keine Person markiert und OK geklickt else - relccid = db.array(db.COLUMN, "select ADDR from COMMUNICATION where MEDIUM_ID = 3 and STANDARD = 1 and " + relccid = db.array(db.COLUMN, "select ADDR from COMMUNICATION where MEDIUM_ID = 3 and ISSTANDARD = 1 and " + "CONTACT_ID in ('" + relccid.join("','") + "') and CONTACT_ID <> '" + reltoid + "'"); if ( reltoid != "" ) diff --git a/report/Reminder_report/Reminder_report.aod b/report/Reminder_report/Reminder_report.aod new file mode 100644 index 0000000000000000000000000000000000000000..f36b26362cf772bd2f0e45c006c6134b18a6d019 --- /dev/null +++ b/report/Reminder_report/Reminder_report.aod @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/report/1.2.0"> + <name>Reminder_report</name> + <title>Mahnung</title> + <description></description> + <majorModelMode>DISTRIBUTED</majorModelMode> + <reportData>%aditoprj%/report/Reminder_report/reportData.jrxml</reportData> + <reportType>JASPER</reportType> + <images> + <image> + <name>myLogo</name> + <fileName>myLogo.png</fileName> + <imageData>%aditoprj%/report/Reminder_report/myLogo.png</imageData> + </image> + </images> + <ribbon> + <name>ribbon</name> + <ribbonTasks> + <ribbonTask> + <name>TASK_REPORT</name> + <showNavigationBar v="true" /> + <showZoom v="true" /> + <showExport v="true" /> + <showAux v="true" /> + <icon>REPORT_24</icon> + <enabled v="true" /> + <layoutPosition>POSITION_TOP</layoutPosition> + </ribbonTask> + </ribbonTasks> + </ribbon> +</report> diff --git a/report/Reminder_report/myLogo.png b/report/Reminder_report/myLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..1378cecbb3519bf289edcc469e43f76c3eca6f83 Binary files /dev/null and b/report/Reminder_report/myLogo.png differ diff --git a/report/Reminder_report/reportData.jrxml b/report/Reminder_report/reportData.jrxml new file mode 100644 index 0000000000000000000000000000000000000000..731bdfbc40b623144ca50cb15b3a2b56122a624c --- /dev/null +++ b/report/Reminder_report/reportData.jrxml @@ -0,0 +1,222 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Mahnung" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e7a916c8-3f9a-497d-84bb-3909b15271ea"> + <property name="ireport.zoom" value="2.1435888100000016"/> + <property name="ireport.x" value="0"/> + <property name="ireport.y" value="144"/> + <parameter name="myAddr" class="java.lang.String"/> + <parameter name="Kontenabstimmung" class="java.lang.String"/> + <parameter name="Rech.-Nr" class="java.lang.String"/> + <parameter name="Rech.-Datum" class="java.lang.String"/> + <parameter name="fällig" class="java.lang.String"/> + <parameter name="Rech.-Betrag" class="java.lang.String"/> + <parameter name="offen" class="java.lang.String"/> + <parameter name="ADRESSE" class="java.lang.String"/> + <parameter name="FAELLIG" class="java.lang.String"/> + <parameter name="adito.image.myLogo" class="java.lang.String"/> + <parameter name="Address" class="java.lang.String"/> + <parameter name="ReminderAddress" class="java.lang.String"/> + <parameter name="Reminder" class="java.lang.String"/> + <parameter name="Ordernumber" class="java.lang.String"/> + <parameter name="Orderdate" class="java.lang.String"/> + <parameter name="DueDate" class="java.lang.String"/> + <parameter name="Due" class="java.lang.String"/> + <parameter name="DUEDATE" class="java.lang.String"/> + <parameter name="Dunninglevel" class="java.lang.String"/> + <field name="PAYED" class="java.lang.String"/> + <field name="RELATION_ID" class="java.lang.String"/> + <field name="CURRENCY" class="java.lang.String"/> + <field name="ORDERDATE" class="java.lang.String"/> + <field name="VAT" class="java.lang.String"/> + <field name="ORDERCODE" class="java.lang.String"/> + <field name="NET" class="java.lang.String"/> + <field name="BRUTTO" class="java.lang.String"/> + <field name="OFFEN" class="java.lang.String"/> + <field name="DUEDATE" class="java.lang.String"/> + <field name="DUNNINGTEXT" class="java.lang.String"/> + <field name="DUNNINGLEVEL" class="java.lang.String"/> + <group name="Salesorderrelid"> + <groupExpression><![CDATA[$F{RELATION_ID}]]></groupExpression> + <groupHeader> + <band height="115"> + <textField> + <reportElement x="13" y="0" width="68" height="15" uuid="0a515534-8d2a-4e3e-9370-6cac4c65ef68"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Ordernumber}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="104" y="0" width="63" height="15" uuid="87fc2f40-ffdc-47d5-9fd8-7a8caf821114"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Orderdate}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="202" y="0" width="62" height="15" uuid="86eacb27-6bb5-4ce8-b8cf-c3f0993380ad"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{DueDate}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="429" y="0" width="59" height="15" uuid="62a0909f-ef03-4242-969a-8a9532d1aa9a"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Due}]]></textFieldExpression> + </textField> + <line> + <reportElement x="13" y="33" width="527" height="1" uuid="d5108302-191f-4e27-8920-fcd330d335e8"/> + </line> + <textField> + <reportElement x="104" y="36" width="64" height="15" uuid="ca4c366a-1954-4aee-91c4-05c093b04df5"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ORDERDATE}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="13" y="36" width="68" height="15" uuid="3fcb3ee0-fe4d-409e-8cb8-7a0e6ceca5ab"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ORDERCODE}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="202" y="36" width="62" height="15" uuid="b5e006cf-5d37-42a1-bf74-0b49d3a39b27"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{DUEDATE}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="428" y="36" width="60" height="15" uuid="d57eeb7b-f517-4c85-a925-cdc3c1ea0830"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{OFFEN}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="307" y="35" width="56" height="15" uuid="72a49ece-7fc0-4cd7-a00c-94580845d150"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{BRUTTO}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="307" y="15" width="56" height="15" uuid="a991ccab-0b04-4550-bbd2-2033a5fad0f0"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{CURRENCY}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="429" y="15" width="59" height="15" uuid="8e257160-536a-418a-b9df-80fa020268b8"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{CURRENCY}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="326" y="0" width="62" height="15" uuid="000feb72-9b7d-42e6-ade9-8e12359c3eef"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$R{Rech.-Betrag}]]></textFieldExpression> + </textField> + </band> + </groupHeader> + </group> + <background> + <band splitType="Stretch"/> + </background> + <pageHeader> + <band height="268" splitType="Stretch"> + <image scaleImage="RetainShape" hAlign="Center"> + <reportElement x="181" y="11" width="178" height="50" uuid="b417e562-a7ce-46fa-9fe0-931b165724fd"/> + <imageExpression><![CDATA[$P{adito.image.myLogo}]]></imageExpression> + </image> + <textField> + <reportElement x="13" y="88" width="527" height="20" forecolor="#000000" uuid="a47fa80c-6b70-4c8a-938d-3d44273b1ffb"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Address}]]></textFieldExpression> + </textField> + <frame> + <reportElement x="13" y="88" width="527" height="20" uuid="8a4e17f6-7a46-4f2b-9ef1-e6bbcbc1e192"/> + <box> + <pen lineWidth="0.75" lineColor="#666666"/> + <topPen lineWidth="0.75" lineColor="#666666"/> + <leftPen lineWidth="0.75" lineColor="#666666"/> + <bottomPen lineWidth="0.75" lineColor="#666666"/> + <rightPen lineWidth="0.75" lineColor="#666666"/> + </box> + </frame> + <textField isStretchWithOverflow="true"> + <reportElement x="13" y="122" width="152" height="20" uuid="c8514bfb-5e34-43f4-a256-7899cb58f0c1"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{ReminderAddress}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="13" y="172" width="132" height="20" uuid="d21620a9-4a49-496e-80f6-db842f0b70a9"/> + <textElement> + <font fontName="Segoe UI" size="14" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{Reminder}]]></textFieldExpression> + </textField> + <textField pattern="dd.MM.yyyy"> + <reportElement x="388" y="192" width="100" height="20" uuid="5141d92f-3325-445b-b616-90630c1648f7"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="13" y="232" width="294" height="20" uuid="3f7d1c4a-a326-436b-831d-5da9fd255bf0"/> + <textElement> + <font fontName="Segoe UI" size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$F{DUNNINGTEXT}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="13" y="212" width="214" height="20" uuid="52834aec-d107-4cc7-9662-1cdd73ba15c1"/> + <textElement> + <font fontName="Segoe UI" size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{Dunninglevel} + " " + $F{DUNNINGLEVEL}]]></textFieldExpression> + </textField> + </band> + </pageHeader> + <pageFooter> + <band height="36" splitType="Stretch"> + <textField pattern="EEEEE dd MMMMM yyyy"> + <reportElement x="340" y="13" width="112" height="15" forecolor="#999999" uuid="26510f19-a203-4b34-8093-f6a9f7f6050e"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="452" y="13" width="48" height="15" forecolor="#999999" uuid="218ef560-390f-4807-b7f6-98e6f6162892"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$R{Seite}+" "+$V{PAGE_NUMBER}+" "+$R{von}]]></textFieldExpression> + </textField> + <textField evaluationTime="Report"> + <reportElement x="500" y="13" width="40" height="15" forecolor="#999999" uuid="7ac354ed-0f8f-41fa-80a5-c2a0f74f7e09"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <line> + <reportElement x="13" y="8" width="527" height="1" forecolor="#999999" uuid="f18b20c8-8d7d-4f84-b2cf-d23dae828ee8"/> + </line> + </band> + </pageFooter> +</jasperReport> diff --git a/report/Salesorder_report/Salesorder_report.aod b/report/Salesorder_report/Salesorder_report.aod new file mode 100644 index 0000000000000000000000000000000000000000..6d51194466b8f81a34ac35ae7138a0a6f0556d22 --- /dev/null +++ b/report/Salesorder_report/Salesorder_report.aod @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/report/1.2.0"> + <name>Salesorder_report</name> + <title>Beleg</title> + <description></description> + <majorModelMode>DISTRIBUTED</majorModelMode> + <alias>Data_alias</alias> + <reportData>%aditoprj%/report/Salesorder_report/reportData.jrxml</reportData> + <reportType>JASPER</reportType> + <subReports> + <subreport> + <name>UMST</name> + <reportData>%aditoprj%/report/Salesorder_report/UMST.jrxml</reportData> + </subreport> + </subReports> + <images> + <image> + <name>myLogo</name> + <fileName>myLogo.png</fileName> + <imageData>%aditoprj%/report/Salesorder_report/myLogo.png</imageData> + </image> + </images> + <ribbon> + <name>ribbon</name> + <ribbonTasks> + <ribbonTask> + <name>TASK_REPORT</name> + <showNavigationBar v="true" /> + <showZoom v="true" /> + <showExport v="true" /> + <showAux v="true" /> + <icon>REPORT_24</icon> + <enabled v="true" /> + <layoutPosition>POSITION_TOP</layoutPosition> + <customComponents> + <rcCommandButton> + <name>Button</name> + <onClick>%aditoprj%/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js</onClick> + <title>Senden per E-Mail</title> + <imageData>%aditoprj%/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/imageData.png</imageData> + </rcCommandButton> + </customComponents> + </ribbonTask> + </ribbonTasks> + </ribbon> +</report> diff --git a/report/Salesorder_report/UMST.jasper b/report/Salesorder_report/UMST.jasper new file mode 100644 index 0000000000000000000000000000000000000000..bd3f3c91254e95dbb28fbe7481e8e38b00be9b3a Binary files /dev/null and b/report/Salesorder_report/UMST.jasper differ diff --git a/report/Salesorder_report/UMST.jrxml b/report/Salesorder_report/UMST.jrxml new file mode 100644 index 0000000000000000000000000000000000000000..cef8c14fd1629de3082c839b8060781cc2ad467e --- /dev/null +++ b/report/Salesorder_report/UMST.jrxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="UMST" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="3c210ce1-38c3-4477-b1a7-ccf465a2332d"> + <property name="ireport.zoom" value="4.0"/> + <property name="ireport.x" value="0"/> + <property name="ireport.y" value="0"/> + <parameter name="zzglUmst" class="java.lang.String"/> + <queryString> + <![CDATA[]]> + </queryString> + <field name="VAT" class="java.lang.String"/> + <field name="WERT" class="java.lang.Double"/> + <sortField name="VAT"/> + <variable name="WERT_1" class="java.lang.Double" resetType="Group" resetGroup="VAT" calculation="Sum"> + <variableExpression><![CDATA[$F{WERT}]]></variableExpression> + </variable> + <group name="VAT"> + <groupExpression><![CDATA[$F{VAT}]]></groupExpression> + <groupHeader> + <band height="18"> + <textField> + <reportElement x="103" y="0" width="108" height="15" uuid="3d348b3c-02e2-48e4-b8bf-4aec0f800811"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{zzglUmst} + " " + $F{VAT} + " %"]]></textFieldExpression> + </textField> + <textField evaluationTime="Group" evaluationGroup="VAT" pattern="#,##0.00;-#,##0.00"> + <reportElement x="217" y="0" width="54" height="15" uuid="f0256bf8-4a37-4500-87f3-128745a1e2ce"> + <printWhenExpression><![CDATA[!$F{VAT}.equals("0.0")]]></printWhenExpression> + </reportElement> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$V{WERT_1}]]></textFieldExpression> + </textField> + </band> + </groupHeader> + </group> + <background> + <band splitType="Stretch"/> + </background> +</jasperReport> diff --git a/report/Salesorder_report/myLogo.png b/report/Salesorder_report/myLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..1378cecbb3519bf289edcc469e43f76c3eca6f83 Binary files /dev/null and b/report/Salesorder_report/myLogo.png differ diff --git a/report/Salesorder_report/reportData.jrxml b/report/Salesorder_report/reportData.jrxml new file mode 100644 index 0000000000000000000000000000000000000000..5ba84dcc365b4e7581f23cb273b525636854895f --- /dev/null +++ b/report/Salesorder_report/reportData.jrxml @@ -0,0 +1,442 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Beleg" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e7a916c8-3f9a-497d-84bb-3909b15271ea"> + <property name="ireport.zoom" value="1.5"/> + <property name="ireport.x" value="0"/> + <property name="ireport.y" value="96"/> + <parameter name="myAddr" class="java.lang.String"/> + <parameter name="Artikelbezeichnung" class="java.lang.String"/> + <parameter name="Artikel-Nr" class="java.lang.String"/> + <parameter name="Einzelpreis" class="java.lang.String"/> + <parameter name="Menge" class="java.lang.String"/> + <parameter name="MWST" class="java.lang.String"/> + <parameter name="zzgl." class="java.lang.String"/> + <parameter name="Belegtyp" class="java.lang.String"/> + <parameter name="Datum" class="java.lang.String"/> + <parameter name="Nummer" class="java.lang.String"/> + <parameter name="Zahlungsbedingung" class="java.lang.String"/> + <parameter name="Lieferbedingung" class="java.lang.String"/> + <parameter name="Rabatt" class="java.lang.String"/> + <parameter name="Gesamt" class="java.lang.String"/> + <parameter name="Summe" class="java.lang.String"/> + <parameter name="zzglUMST" class="java.lang.String"/> + <parameter name="ADRESSE" class="java.lang.String"/> + <parameter name="PERSON" class="java.lang.String"/> + <parameter name="ZAHLBED" class="java.lang.String"/> + <parameter name="LIEFBED" class="java.lang.String"/> + <parameter name="Stornotext" class="java.lang.String"/> + <parameter name="SUMITEMSUM" class="java.lang.Double"/> + <parameter name="TOTAL" class="java.lang.String"/> + <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> + <defaultValueExpression><![CDATA["C:\\Users\\m.mansour\\Desktop\\xRM-Basic 2019\\xRM-Basic 2019\\report\\Salesorder_report\\"]]></defaultValueExpression> + </parameter> + <parameter name="adito.datasource.subdata" class="java.lang.Object" isForPrompting="false"/> + <parameter name="adito.image.myLogo" class="java.lang.String"/> + <parameter name="anzahl" class="java.lang.String"/> + <parameter name="OrderType" class="java.lang.String"/> + <parameter name="PaymentConditions" class="java.lang.String"/> + <parameter name="OrderPaymentTerm" class="java.lang.String"/> + <parameter name="DeliveryConditions" class="java.lang.String"/> + <parameter name="OrderDeliveryTerm" class="java.lang.String"/> + <parameter name="Address" class="java.lang.String"/> + <parameter name="SALESORDERAddr" class="java.lang.String"/> + <parameter name="Total" class="java.lang.String"/> + <parameter name="Number" class="java.lang.String"/> + <parameter name="Date" class="java.lang.String"/> + <parameter name="Articlenumber" class="java.lang.String"/> + <parameter name="Articledescription" class="java.lang.String"/> + <parameter name="Person" class="java.lang.String"/> + <parameter name="Amount" class="java.lang.String"/> + <parameter name="Discount" class="java.lang.String"/> + <parameter name="Unitprice" class="java.lang.String"/> + <parameter name="VAT" class="java.lang.String"/> + <parameter name="Sum" class="java.lang.String"/> + <queryString> + <![CDATA[]]> + </queryString> + <field name="PRODUCTID" class="java.lang.String"/> + <field name="PRODUCTCODE" class="java.lang.String"/> + <field name="SALESORDERID" class="java.lang.String"/> + <field name="CURRENCY" class="java.lang.String"/> + <field name="FOOTER" class="java.lang.String"/> + <field name="HEADER" class="java.lang.String"/> + <field name="ORDERCODE" class="java.lang.String"/> + <field name="ORDERDATE" class="java.lang.String"/> + <field name="SALESORDER.VAT" class="java.lang.String"/> + <field name="ORDERITEM.DISCOUNT" class="java.lang.String"/> + <field name="ITEMNAME" class="java.lang.String"/> + <field name="ORDERITEM.SALESORDER_ID" class="java.lang.String"/> + <field name="PRICE" class="java.lang.String"/> + <field name="PRODUCT_ID" class="java.lang.String"/> + <field name="QUANTITY" class="java.lang.String"/> + <field name="ORDERITEM.UNIT" class="java.lang.String"/> + <field name="ITEMSORT" class="java.lang.String"/> + <field name="ORDERITEM.VAT" class="java.lang.String"/> + <field name="UNITTEXT" class="java.lang.String"/> + <field name="ITEMSUM" class="java.lang.String"/> + <sortField name="ITEMSORT"/> + <variable name="Menge_Einheit" class="java.lang.String"> + <variableExpression><![CDATA[$F{QUANTITY}.toString() + " " + $F{UNITTEXT}]]></variableExpression> + </variable> + <group name="SALESORDERID"> + <groupExpression><![CDATA[$F{SALESORDERID}]]></groupExpression> + <groupHeader> + <band height="53"> + <textField isStretchWithOverflow="true"> + <reportElement x="0" y="0" width="146" height="15" uuid="c462ada5-3614-4037-a832-2063c9984900"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{SALESORDERAddr}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="347" y="0" width="100" height="15" uuid="358dc7c8-e5fe-430d-bd83-a2d76d2e2179"/> + <textElement> + <font fontName="Segoe UI" size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{OrderType}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="347" y="20" width="50" height="15" uuid="f27d5581-b73b-4a1c-97fe-809debd77775"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Number}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="348" y="35" width="50" height="15" uuid="731882eb-328c-4e30-b44a-fd17b8a8b95a"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Date}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="397" y="20" width="55" height="15" uuid="14ec5c0b-29bf-4719-95c0-05e3779175b6"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ORDERCODE}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="397" y="35" width="55" height="15" uuid="3451e207-2ac2-4045-b2be-0d1476b21380"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ORDERDATE}]]></textFieldExpression> + </textField> + </band> + <band height="19"> + <textField isStretchWithOverflow="true"> + <reportElement x="0" y="0" width="555" height="15" uuid="6b48863f-95dd-494b-9c1c-35f5254c43da"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Person}]]></textFieldExpression> + </textField> + </band> + <band height="17"> + <textField isStretchWithOverflow="true"> + <reportElement x="0" y="0" width="555" height="15" uuid="0a20b228-aeb9-46d7-bd1d-ca4615a529e9"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{HEADER}]]></textFieldExpression> + </textField> + </band> + <band height="18"> + <printWhenExpression><![CDATA[$P{Belegtyp}.equals("Storno") && !$P{Stornotext}.equals("")]]></printWhenExpression> + <textField isStretchWithOverflow="true"> + <reportElement x="0" y="0" width="555" height="15" uuid="3357ca3b-0720-4cf7-81bc-ee0b882d8f2e"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Stornotext}]]></textFieldExpression> + </textField> + </band> + <band height="27"> + <staticText> + <reportElement x="0" y="9" width="30" height="15" uuid="43778b06-86fc-47fa-bbe7-24f9b0b3d909"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <text><![CDATA[Pos]]></text> + </staticText> + <textField> + <reportElement x="30" y="9" width="83" height="15" uuid="f85de48a-2bbb-4b78-91e9-9dd42000e45e"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Articlenumber}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="113" y="9" width="131" height="15" uuid="9d65f719-86ff-4842-9235-c2382296f9a4"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Articledescription}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="265" y="9" width="66" height="15" uuid="83721667-5409-4eeb-ad20-019a9b5a4f86"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Amount}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement x="330" y="9" width="53" height="15" uuid="b0482e3e-3e46-4867-bef5-69febaa17928"> + <printWhenExpression><![CDATA[!$P{anzahl}.equals("0")]]></printWhenExpression> + </reportElement> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Discount} + "\n%"]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement x="386" y="9" width="53" height="15" uuid="4333aa5c-f9da-497d-8d76-c8739db008a1"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Unitprice} + "\n" + $F{CURRENCY}]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement x="442" y="9" width="37" height="15" uuid="8b8c7d2d-f223-4d54-9e8a-ba6e283f1b8a"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{VAT} + "\n%"]]></textFieldExpression> + </textField> + <textField> + <reportElement x="477" y="9" width="77" height="15" uuid="ca1e1455-d2ad-43cd-abc7-9e5a1c2e641e"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Sum} +"\n"+ $F{CURRENCY}]]></textFieldExpression> + </textField> + <line> + <reportElement x="0" y="5" width="557" height="1" uuid="bcf5aa25-cae6-4a51-a66a-aaf8d46ea922"/> + </line> + </band> + <band height="9"> + <line> + <reportElement x="2" y="5" width="555" height="1" uuid="a55486d6-44b1-4716-8397-ab23d30cb233"/> + </line> + </band> + </groupHeader> + <groupFooter> + <band height="32"> + <printWhenExpression><![CDATA[$P{Belegtyp}.toString().equalsIgnoreCase("Lieferschein") && !$F{SALESORDER.VAT}.toString().equalsIgnoreCase("0")]]></printWhenExpression> + <textField pattern="#,##0.00;-#,##0.00"> + <reportElement x="490" y="17" width="65" height="15" uuid="c04eaf8a-9756-4ae0-bc80-fcbe78b0ea6c"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{SUMITEMSUM}]]></textFieldExpression> + </textField> + <line> + <reportElement x="287" y="9" width="268" height="1" uuid="51bdbd2e-8619-4db2-99af-01a303469229"/> + </line> + </band> + <band height="33"> + <subreport> + <reportElement x="283" y="0" width="271" height="25" uuid="6a3cbbb3-6d74-49a2-a19e-a0126132f7e0"/> + <subreportParameter name="zzglUmst"> + <subreportParameterExpression><![CDATA[$P{zzglUMST}]]></subreportParameterExpression> + </subreportParameter> + <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRMapArrayDataSource)$P{adito.datasource.subdata}).cloneDataSource()]]></dataSourceExpression> + <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "UMST.jasper"]]></subreportExpression> + </subreport> + </band> + <band height="33"> + <textField> + <reportElement x="405" y="4" width="83" height="15" uuid="5b93cde2-fe92-4c90-bcc4-80d96b2a362f"/> + <textElement> + <font fontName="Segoe UI" size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{Total} + " " +$F{CURRENCY}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="488" y="4" width="64" height="15" uuid="389711a3-219f-4c9b-b6f0-0d16a1d4595f"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{TOTAL}]]></textFieldExpression> + </textField> + <line> + <reportElement x="287" y="-5" width="268" height="1" uuid="a75692c5-2f18-46f2-b505-b3df9ea559fb"/> + </line> + <line> + <reportElement x="287" y="24" width="270" height="2" uuid="b115e896-9a50-4cdc-9ce6-40ccaf726299"/> + <graphicElement> + <pen lineWidth="3.0" lineStyle="Double"/> + </graphicElement> + </line> + </band> + <band height="22"> + <textField isStretchWithOverflow="true"> + <reportElement x="99" y="2" width="442" height="20" uuid="d5e3900e-a293-4e6f-b6de-28613da90b8a"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{OrderPaymentTerm}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="0" width="100" height="20" uuid="b3876fe7-62fa-4af1-94c9-37364f391341"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{PaymentConditions} + ":"]]></textFieldExpression> + </textField> + </band> + <band height="20"> + <textField> + <reportElement x="0" y="0" width="100" height="20" uuid="578ee813-05f9-486d-83a1-dba4e78b6851"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{DeliveryConditions} + ":"]]></textFieldExpression> + </textField> + <textField isStretchWithOverflow="true"> + <reportElement x="99" y="0" width="442" height="20" uuid="5353573a-e5a9-43fa-a9d2-5740085d224a"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{OrderDeliveryTerm}]]></textFieldExpression> + </textField> + </band> + </groupFooter> + </group> + <group name="VAT"> + <groupExpression><![CDATA[$F{ORDERITEM.VAT}]]></groupExpression> + </group> + <background> + <band splitType="Stretch"/> + </background> + <pageHeader> + <band height="145" splitType="Stretch"> + <image scaleImage="RetainShape" hAlign="Center"> + <reportElement x="194" y="29" width="164" height="41" uuid="c32a0a11-0b12-4a5a-b368-9d086d5e6106"/> + <imageExpression><![CDATA[$P{adito.image.myLogo}]]></imageExpression> + </image> + <textField> + <reportElement x="0" y="97" width="555" height="20" forecolor="#999999" uuid="3a30004a-a50d-42dc-a144-bc1da0294773"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{Address}]]></textFieldExpression> + </textField> + <frame> + <reportElement x="0" y="97" width="555" height="20" uuid="53390ff4-34ba-498b-aa43-d2af83d1c5c5"/> + <box> + <pen lineWidth="0.75" lineColor="#999999"/> + <topPen lineWidth="0.75" lineColor="#999999"/> + <leftPen lineWidth="0.75" lineColor="#999999"/> + <bottomPen lineWidth="0.75" lineColor="#999999"/> + <rightPen lineWidth="0.75" lineColor="#999999"/> + </box> + </frame> + </band> + </pageHeader> + <detail> + <band height="20" splitType="Stretch"> + <textField> + <reportElement x="0" y="4" width="30" height="15" uuid="0f758907-3120-4cf7-8a86-2095d58d2b46"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ITEMSORT}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="30" y="4" width="83" height="15" uuid="35e07d2a-3677-467e-a721-dfd5f9f39973"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{PRODUCTCODE}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="113" y="4" width="152" height="15" uuid="64acab7d-d360-4036-9ce5-89948409083d"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ITEMNAME}]]></textFieldExpression> + </textField> + <textField> + <reportElement x="265" y="4" width="66" height="15" uuid="e33ce58d-c53f-4288-86c3-3d610a81e976"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$V{Menge_Einheit}]]></textFieldExpression> + </textField> + <textField pattern="#,##0.00;-#,##0.00"> + <reportElement x="330" y="4" width="53" height="15" uuid="10173f2e-6a66-4909-a136-ba8eee2c69d3"> + <printWhenExpression><![CDATA[!$F{ORDERITEM.DISCOUNT}.equals("0,00")]]></printWhenExpression> + </reportElement> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ORDERITEM.DISCOUNT}]]></textFieldExpression> + </textField> + <textField pattern="#,##0.00;-#,##0.00"> + <reportElement x="386" y="4" width="53" height="15" uuid="a29b24be-f6b0-4755-b8dc-56cf358ce4fe"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{PRICE}]]></textFieldExpression> + </textField> + <textField pattern="#,##0.00;-#,##0.00"> + <reportElement x="443" y="4" width="36" height="15" uuid="2f05ba9c-ee86-4f5d-ae4d-ed0af2282b19"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ORDERITEM.VAT}]]></textFieldExpression> + </textField> + <textField pattern="#,##0.00"> + <reportElement x="488" y="4" width="64" height="15" uuid="d4d35c15-d9b7-4e47-abd2-30edab0e7aaf"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{ITEMSUM}]]></textFieldExpression> + </textField> + </band> + </detail> + <columnFooter> + <band height="21" splitType="Stretch"> + <textField isStretchWithOverflow="true"> + <reportElement x="0" y="0" width="555" height="20" uuid="678c4956-6136-49ba-8199-ed41c384e3ea"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[$F{FOOTER}]]></textFieldExpression> + </textField> + </band> + </columnFooter> + <pageFooter> + <band height="46" splitType="Stretch"> + <textField pattern="EEEEE dd MMMMM yyyy"> + <reportElement x="370" y="24" width="83" height="20" forecolor="#999999" uuid="07424005-2256-4514-a2da-6b00b8e5e5c9"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="452" y="24" width="62" height="20" forecolor="#999999" uuid="1dd85e84-1044-4ca0-aabf-3e07d75c4fa7"/> + <textElement textAlignment="Right"> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA["Seite "+$V{PAGE_NUMBER}+" von"]]></textFieldExpression> + </textField> + <textField evaluationTime="Report"> + <reportElement x="514" y="24" width="40" height="20" forecolor="#999999" uuid="a1f1ca02-0eb6-4647-b6ff-ff326f8ce8b2"/> + <textElement> + <font fontName="Segoe UI" size="8"/> + </textElement> + <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> + </textField> + <line> + <reportElement x="0" y="12" width="555" height="1" uuid="0258b976-95c5-4f91-aadc-6cb68fcc2808"/> + <graphicElement> + <pen lineColor="#999999"/> + </graphicElement> + </line> + </band> + </pageFooter> +</jasperReport> diff --git a/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/imageData.png b/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/imageData.png new file mode 100644 index 0000000000000000000000000000000000000000..49cda7d673d367ab30051c9aa9dda1dcfad22177 Binary files /dev/null and b/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/imageData.png differ diff --git a/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js b/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js new file mode 100644 index 0000000000000000000000000000000000000000..9c8dc10fe8b0c59cbd29d2f2401ddc5525fd6240 --- /dev/null +++ b/report/Salesorder_report/ribbon/ribbontasks/task_report/customcomponents/button/onClick.js @@ -0,0 +1,45 @@ +import("system.text"); +import("system.question"); +import("system.translate"); +import("system.swing"); +import("system.vars"); +import("system.db"); +import("lib_email"); + +var details = vars.get("$global.RptOfferOrderDetails"); +var orgid = db.array(db.ROW, "select ORG_ID, LANG from RELATION where RELATIONID = '" + details[1] + "'"); +if (orgid[0].substr(0, 2) == '0 ') // Privatperson +{ + var count = db.cell("select count(*) from COMM where medium_id = 3 and STANDARD = 1 and RELATION_ID = '" + details[1] + "'"); + if (count == "0") question.showMessage(translate.text("keine Standard-E-Mail Büro vorhanden !")); + else + sendAutoMail( translate.text(details[3]) + " " + details[0], details[1], details[4], details[2], details[5], relccid, [["SPNR", details[6]]], orgid[1] ); +} +else // Funktion - Person in Firma +{ + var orgrelid = db.cell("select RELATIONID from RELATION where ORG_ID = '" + orgid + "'"); + var relobjid = db.array(db.COLUMN, "select ORG_ID from OBJECTRELATION join RELATION on RELATIONID = DEST_ID where SOURCE_ID = '" + orgrelid + "' and RELVALUE = 9"); + relationid = db.array(db.COLUMN, "select RELATIONID from RELATION left join PERS on PERSID = PERS_ID" + + " where RELATION.STATUS = 1 and ORG_ID in ('" + orgid[0] + "', '" + relobjid.join("','") + "')"); + + vars.set("$local.relids", "'" + relationid.join("','") + "'"); + vars.set("$local.cmb_pers_to", details[1]); //Empfänger vorbelegen + + relationid = swing.askUserQuestion("Email", "DLG_CHOOSE_PERS_FOREMAIL") + if ( relationid == null ) relationid = ""; //Abbruch geklickt + else + { + var reltoid = relationid["DLG_CHOOSE_PERS_FOREMAIL.cmb_pers_to"]; + var language = db.cell("select LANG from RELATION where RELATIONID = '" + reltoid + "'") + + var relccid = text.decodeMS(relationid["DLG_CHOOSE_PERS_FOREMAIL.tbl_pers_cc"]); + if (relccid.length == 0) relationid = ""; // keine Person markiert und OK geklickt + else + relccid = db.array(db.COLUMN, "select ADDR from COMM where MEDIUM_ID = 3 and STANDARD = 1 and " + + "RELATION_ID in ('" + relccid.join("','") + "') and RELATION_ID <> '" + reltoid + "'"); + + if ( reltoid != "" ) + sendAutoMail( translate.text(details[3]) + " " + details[0], reltoid, details[4], details[2], details[5], relccid, [["SPNR", details[6]]], language ); + else question.showMessage(translate.text("Bitte einen Adressat in 'to' eintragen!")); + } +} \ No newline at end of file diff --git a/system/default/default.aod b/system/default/default.aod index fdabfb84c273955bb6b0172a47b857c182f08d52..daab14d940d75328fb0bc5fe8c6c1bd708def34a 100644 --- a/system/default/default.aod +++ b/system/default/default.aod @@ -8,5 +8,4 @@ <loginUser>admin</loginUser> <autoLogin v="false" /> <aditoDebug>TRACE</aditoDebug> - <enableJDitoDebug v="true" /> </system>