From b140a8a92bd38ffd9551b423f9a66cd657f90e81 Mon Sep 17 00:00:00 2001 From: Benjamin Ulrich <b.ulrich@adito.de> Date: Wed, 29 Sep 2021 14:12:45 +0000 Subject: [PATCH] Sales 1082791 fix offer probability filter --- ...alter_OfferProbabilityVarcharToInteger.xml | 25 +++++++++++++ .../basic/2021.2.0/Offer/changelog.xml | 6 ++++ .../Data_alias/basic/2021.2.0/changelog.xml | 1 + aliasDefinition/Data_alias/Data_alias.aod | 36 +++++++++---------- entity/Offer_entity/Offer_entity.aod | 4 +-- .../probability/dropDownProcess.js | 17 +++++++++ .../entityfields/probability/valueProcess.js | 8 ----- 7 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 .liquibase/Data_alias/basic/2021.2.0/Offer/alter_OfferProbabilityVarcharToInteger.xml create mode 100644 .liquibase/Data_alias/basic/2021.2.0/Offer/changelog.xml create mode 100644 entity/Offer_entity/entityfields/probability/dropDownProcess.js delete mode 100644 entity/Offer_entity/entityfields/probability/valueProcess.js diff --git a/.liquibase/Data_alias/basic/2021.2.0/Offer/alter_OfferProbabilityVarcharToInteger.xml b/.liquibase/Data_alias/basic/2021.2.0/Offer/alter_OfferProbabilityVarcharToInteger.xml new file mode 100644 index 0000000000..b4e5a8a169 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.2.0/Offer/alter_OfferProbabilityVarcharToInteger.xml @@ -0,0 +1,25 @@ +<?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 dbms="derby" author="b.ulrich" id="58fad879-afc5-48b3-984f-a9ebba7185cd"> + <sql> + ALTER TABLE OFFER ADD COLUMN PROBABILITY_NEW CHAR(10); + UPDATE OFFER SET PROBABILITY_NEW=CAST ( PROBABILITY as CHAR(10)); + ALTER TABLE OFFER DROP COLUMN PROBABILITY; + RENAME COLUMN OFFER.PROBABILITY_NEW TO PROBABILITY; + + ALTER TABLE OFFER ADD COLUMN PROBABILITY_NEW INTEGER; + UPDATE OFFER SET PROBABILITY_NEW=CAST ( PROBABILITY as INTEGER); + ALTER TABLE OFFER DROP COLUMN PROBABILITY; + RENAME COLUMN OFFER.PROBABILITY_NEW TO PROBABILITY; + </sql> + </changeSet> + + <changeSet author="b.ulrich" id="1dc2d055-0f1a-447a-af36-fb0b36bb5558"> + <preConditions onFail="CONTINUE"> + <not> + <dbms type="derby" /> + </not> + </preConditions> + <modifyDataType columnName="PROBABILITY" newDataType="INTEGER" tableName="OFFER"/> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2021.2.0/Offer/changelog.xml b/.liquibase/Data_alias/basic/2021.2.0/Offer/changelog.xml new file mode 100644 index 0000000000..107af93251 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.2.0/Offer/changelog.xml @@ -0,0 +1,6 @@ +<?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="alter_OfferProbabilityVarcharToInteger.xml"/> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.2.0/changelog.xml b/.liquibase/Data_alias/basic/2021.2.0/changelog.xml index aa084e4023..b00d7a17d3 100644 --- a/.liquibase/Data_alias/basic/2021.2.0/changelog.xml +++ b/.liquibase/Data_alias/basic/2021.2.0/changelog.xml @@ -5,6 +5,7 @@ <include relativeToChangelogFile="true" file="Duplicate/changelog.xml"/> <include relativeToChangelogFile="true" file="TopicTree/changelog.xml"/> <include relativeToChangelogFile="true" file="CampaignStep/changelog.xml"/> + <include relativeToChangelogFile="true" file="Offer/changelog.xml"/> <include relativeToChangelogFile="true" file="xRM-Service/changelog.xml"/> <include relativeToChangelogFile="true" file="Mosaico/changelog.xml"/> </databaseChangeLog> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 5d1357c00c..c1729e6a6e 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -2688,7 +2688,7 @@ <name>VAT</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="3" /> + <columnType v="2" /> <size v="14" /> <scale v="2" /> <notNull v="false" /> @@ -2714,8 +2714,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="19" /> - <scale v="0" /> + <size v="29" /> + <scale v="9" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -2766,9 +2766,9 @@ <name>PROBABILITY</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="3" /> - <size v="6" /> - <scale v="2" /> + <columnType v="4" /> + <size v="10" /> + <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -2848,7 +2848,7 @@ <name>NET</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="3" /> + <columnType v="2" /> <size v="14" /> <scale v="2" /> <notNull v="false" /> @@ -2873,7 +2873,7 @@ <name>HEADER</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="-1" /> + <columnType v="2005" /> <size v="2147483647" /> <scale v="0" /> <notNull v="false" /> @@ -2935,7 +2935,7 @@ <name>ADDRESS</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="-1" /> + <columnType v="2005" /> <size v="2147483647" /> <scale v="0" /> <notNull v="false" /> @@ -3008,7 +3008,7 @@ <name>INFO</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="-1" /> + <columnType v="2005" /> <size v="2147483647" /> <scale v="0" /> <notNull v="false" /> @@ -3030,8 +3030,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="19" /> - <scale v="0" /> + <size v="29" /> + <scale v="9" /> <notNull v="false" /> <isUnique v="false" /> <index v="false" /> @@ -3058,8 +3058,8 @@ <dbName></dbName> <primaryKey v="false" /> <columnType v="93" /> - <size v="19" /> - <scale v="0" /> + <size v="29" /> + <scale v="9" /> <notNull v="true" /> <isUnique v="false" /> <index v="false" /> @@ -3113,7 +3113,7 @@ <name>FOOTER</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="-1" /> + <columnType v="2005" /> <size v="2147483647" /> <scale v="0" /> <notNull v="false" /> @@ -3155,7 +3155,7 @@ <name>DISCOUNT</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="3" /> + <columnType v="2" /> <size v="14" /> <scale v="2" /> <notNull v="false" /> @@ -3169,7 +3169,7 @@ <name>DISCOUNTED_NET</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="3" /> + <columnType v="2" /> <size v="14" /> <scale v="2" /> <notNull v="false" /> @@ -3183,7 +3183,7 @@ <name>DISCOUNTED_VAT</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="3" /> + <columnType v="2" /> <size v="14" /> <scale v="2" /> <notNull v="false" /> diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index f6b1857720..3eeea68776 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -61,14 +61,14 @@ <entityField> <name>PROBABILITY</name> <title>Probability</title> - <consumer>KeywordProbabilityOffer</consumer> <contentType>NUMBER</contentType> <maxValue v="100" /> <minValue v="0" /> <outputFormat>0'%'</outputFormat> <groupable v="true" /> + <dropDownProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/dropDownProcess.js</dropDownProcess> + <textInputAllowed v="false" /> <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/valueProcess.js</valueProcess> </entityField> <entityField> <name>STATUS</name> diff --git a/entity/Offer_entity/entityfields/probability/dropDownProcess.js b/entity/Offer_entity/entityfields/probability/dropDownProcess.js new file mode 100644 index 0000000000..552d502680 --- /dev/null +++ b/entity/Offer_entity/entityfields/probability/dropDownProcess.js @@ -0,0 +1,17 @@ +import("system.result"); +import("Sql_lib"); + +//needed because we want to +//1. have a dropdown with the valeus defined at the keyword +//2. be able to have text input to specify other values +//3. while still making it possible to filter using both the dropdown and userinput +// +//It is possible to do the first two ones with a normal keyword consumer without using a dropdown. We do need the dropDown instead of using a normal consumer to also make the third one possible. +var sqlHelper = new SqlMaskingUtils(); +var sql = newSelect(["AB_KEYWORD_ENTRY.KEYID", sqlHelper.concatenate(["AB_KEYWORD_ENTRY.KEYID", "'%'"])]) + .from("AB_KEYWORD_ENTRY") + .where("AB_KEYWORD_ENTRY.CONTAINER", "ProbabilityOffer") + .and("AB_KEYWORD_ENTRY.ISACTIVE", "1") + .orderBy("SORTING").table() + +result.object(sql); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/probability/valueProcess.js b/entity/Offer_entity/entityfields/probability/valueProcess.js deleted file mode 100644 index 9ae444393c..0000000000 --- a/entity/Offer_entity/entityfields/probability/valueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.neon"); -import("system.result"); -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 -- GitLab