diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 5d94da608c95aa16f902a3d5523a11f3e93aca05..952462eb663f1d751e1620f4200d2f24fe6c6d6d 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -2613,6 +2613,20 @@ <title></title> <description></description> </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></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/entity/Offeritem_entity/Offeritem_entity.aod b/entity/Offeritem_entity/Offeritem_entity.aod index d9120e5fd556ff2dde1e5831a129a3106d3823e2..46b68d0898f6b7018caad548d9d356a1b50e0854 100644 --- a/entity/Offeritem_entity/Offeritem_entity.aod +++ b/entity/Offeritem_entity/Offeritem_entity.aod @@ -168,6 +168,13 @@ </entityDependency> </dependencies> </entityIncomingField> + <entityField> + <name>INFO</name> + <documentation>%aditoprj%/entity/Offeritem_entity/entityfields/info/documentation.adoc</documentation> + <title>Description</title> + <contentType>LONG_TEXT</contentType> + <valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/info/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -265,6 +272,10 @@ <name>VAT.value</name> <recordfield>OFFERITEM.VAT</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>INFO.value</name> + <recordfield>OFFERITEM.INFO</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Offeritem_entity/entityfields/info/documentation.adoc b/entity/Offeritem_entity/entityfields/info/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..8c8b222cffb2b4ffe82dab0d49d9facaa5145342 --- /dev/null +++ b/entity/Offeritem_entity/entityfields/info/documentation.adoc @@ -0,0 +1 @@ +The INFO field is copied from the product if in NEW-mode. \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/info/valueProcess.js b/entity/Offeritem_entity/entityfields/info/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..584fb9fb5f36021714ff43451fa6a3a467f96bad --- /dev/null +++ b/entity/Offeritem_entity/entityfields/info/valueProcess.js @@ -0,0 +1,12 @@ +import("system.db"); +import("system.result"); +import("system.vars"); +import("system.neon"); +import("Sql_lib"); + +if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +{ + // TODO: loading from db until loading from dfo is possible. + var productId = vars.get("$field.PRODUCT_ID"); + result.string(db.cell(SqlCondition.begin().andPrepareVars("PRODUCT.PRODUCTID", "$field.PRODUCT_ID").buildSelect("select INFO from PRODUCT", "1=2"))); +} \ No newline at end of file diff --git a/entity/Prod2prod_entity/Prod2prod_entity.aod b/entity/Prod2prod_entity/Prod2prod_entity.aod index b435ec40b1befc9da57d1901ab8ae7d5e1ac5bac..29507f9fe4733b2cea723f310b0fa63b7fdd13f7 100644 --- a/entity/Prod2prod_entity/Prod2prod_entity.aod +++ b/entity/Prod2prod_entity/Prod2prod_entity.aod @@ -49,7 +49,7 @@ <entityField> <name>TAKEPRICE</name> <documentation>%aditoprj%/entity/Prod2prod_entity/entityfields/takeprice/documentation.adoc</documentation> - <title>Price</title> + <title>Take price</title> <contentType>BOOLEAN</contentType> <possibleItemsProcess>%aditoprj%/entity/Prod2prod_entity/entityfields/takeprice/possibleItemsProcess.js</possibleItemsProcess> </entityField> diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 4b37e9feec0dd61438d28135ee7312f0195dcea4..2b5f0dbfd15e8cbc7cca8c5c2c8d046841b30459 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -1362,6 +1362,57 @@ <entry> <key>Open salesprojects</key> </entry> + <entry> + <key>July</key> + </entry> + <entry> + <key>ADITO Facebook Feed</key> + </entry> + <entry> + <key>ADITO Twitter Feed</key> + </entry> + <entry> + <key>June</key> + </entry> + <entry> + <key>October</key> + </entry> + <entry> + <key>Take price</key> + </entry> + <entry> + <key>Twitter Feed</key> + </entry> + <entry> + <key>November</key> + </entry> + <entry> + <key>December</key> + </entry> + <entry> + <key>May</key> + </entry> + <entry> + <key>April</key> + </entry> + <entry> + <key>January</key> + </entry> + <entry> + <key>March</key> + </entry> + <entry> + <key>September</key> + </entry> + <entry> + <key>August</key> + </entry> + <entry> + <key>Category</key> + </entry> + <entry> + <key>February</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 3d984a421e51f37f3f11795e53f7b53a8e98f23b..fa29bffd2c5f718771704ec92e5eaac67d44a12e 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -1685,6 +1685,58 @@ <key>New activity</key> <value>Aktivität erstellen</value> </entry> + <entry> + <key>July</key> + </entry> + <entry> + <key>ADITO Facebook Feed</key> + </entry> + <entry> + <key>ADITO Twitter Feed</key> + </entry> + <entry> + <key>June</key> + </entry> + <entry> + <key>October</key> + </entry> + <entry> + <key>Take price</key> + <value>Preis übernehmen</value> + </entry> + <entry> + <key>Twitter Feed</key> + </entry> + <entry> + <key>November</key> + </entry> + <entry> + <key>December</key> + </entry> + <entry> + <key>May</key> + </entry> + <entry> + <key>April</key> + </entry> + <entry> + <key>January</key> + </entry> + <entry> + <key>March</key> + </entry> + <entry> + <key>September</key> + </entry> + <entry> + <key>August</key> + </entry> + <entry> + <key>Category</key> + </entry> + <entry> + <key>February</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 8de5af179949a4bfaeeeeeaf5b46a782e61e4daf..58cc1a94eda1570994113bdfe9ca23460ec6b26f 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -1379,6 +1379,57 @@ <entry> <key>Open salesprojects</key> </entry> + <entry> + <key>July</key> + </entry> + <entry> + <key>ADITO Facebook Feed</key> + </entry> + <entry> + <key>ADITO Twitter Feed</key> + </entry> + <entry> + <key>June</key> + </entry> + <entry> + <key>October</key> + </entry> + <entry> + <key>Take price</key> + </entry> + <entry> + <key>Twitter Feed</key> + </entry> + <entry> + <key>November</key> + </entry> + <entry> + <key>December</key> + </entry> + <entry> + <key>May</key> + </entry> + <entry> + <key>April</key> + </entry> + <entry> + <key>January</key> + </entry> + <entry> + <key>March</key> + </entry> + <entry> + <key>September</key> + </entry> + <entry> + <key>August</key> + </entry> + <entry> + <key>Category</key> + </entry> + <entry> + <key>February</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/OfferitemPreview_view/OfferitemPreview_view.aod b/neonView/OfferitemPreview_view/OfferitemPreview_view.aod index 4d5047d3344e5142efb6fb86dcec45576ab65406..3f8fb1b11d4061384daaed6c6e2a429658124356 100644 --- a/neonView/OfferitemPreview_view/OfferitemPreview_view.aod +++ b/neonView/OfferitemPreview_view/OfferitemPreview_view.aod @@ -32,6 +32,10 @@ <name>e25386dc-a740-4f93-a1f0-32317cf5a36a</name> <entityField>OPTIONAL</entityField> </entityFieldLink> + <entityFieldLink> + <name>4b1853d4-1fc8-4c14-a5e2-1c5d0468442c</name> + <entityField>INFO</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/others/db_changes/struct/create_offeritem.xml b/others/db_changes/struct/create_offeritem.xml index 0f62e8ccbc40eff3db151856362a6c0610a4e010..627ba98c0956f8a53df725eaf8bb72d42ccf2539 100644 --- a/others/db_changes/struct/create_offeritem.xml +++ b/others/db_changes/struct/create_offeritem.xml @@ -25,6 +25,7 @@ </column> <column name="DISCOUNT" type="NUMERIC(14,2)"/> <column name="ITEMPOSITION" type="VARCHAR(30)"/> + <column name="INFO" type="NCLOB"/> <column name="DATE_EDIT" type="TIMESTAMP"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> diff --git a/process/OfferOrder_lib/process.js b/process/OfferOrder_lib/process.js index a1dde7990a75c953ba34523ac9641752507a8f45..c75347a393fae5e6c04f3ab793c1e33421cae87c 100644 --- a/process/OfferOrder_lib/process.js +++ b/process/OfferOrder_lib/process.js @@ -244,17 +244,21 @@ ItemUtils.prototype.roundPrice = function(price) { /** * Inserts parts list of the passed product into database. * - * @param {String[]} columns req Array of Item DB Columns + * @param {String[]} columns req Array of Item DB Columns * @param {String} productId req UID of root product (selected product) * @param {String} assignedTo opt UID of parent item * @param {String} currency opt currency for price list to use * @param {String} relationId opt relationid 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: [["DESTINATION-DB-FIELD", "PRODUCT-DB-FIELD"], ...] * * @return {String[]} Array of inserted ItemIDs * * @abstract */ -ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, currency, relationId) { +ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, currency, relationId, additionalProductInfo) { + if (additionalProductInfo == undefined) { additionalProductInfo = [] } + var insertedItemIds = []; //save address for this here to call methods in recursive sub function __itemInsertStatement var self = this; @@ -274,6 +278,7 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c var statements = []; + columns = columns.concat(additionalProductInfo.map(function(item) {return item[0]})); var colTypes = db.getColumnTypes(table, columns); __itemInsertStatement(partsList.root, assignedTo, currency, relationId); @@ -295,8 +300,11 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c var p2pid = partsListObj.ids[i]; var P2pObject = partsList[p2pid]; var prodid = partsList[p2pid].sourceid; - var ProductDetails = ProductUtils.getProductDetails(prodid, { currency: currency, quantity: P2pObject.quantity, relationId: relationId } ) - + var ProductDetails = ProductUtils.getProductDetails( + prodid, + { currency: currency, quantity: P2pObject.quantity, relationId: relationId }, + additionalProductInfo.map(function(item) {return item[1]})); + var price = ""; var vat = ""; if (P2pObject.takeprice && ProductDetails.productId && ProductDetails.PriceListToUse) { @@ -318,7 +326,9 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c , pos , itemsort , datetime.date() - , vars.get("$sys.user")]; + , vars.get("$sys.user")] + // add aditional details + .concat(additionalProductInfo.map(function(item) {return ProductDetails[item[1]]})); statements.push([table, columns, colTypes, vals]); insertedItemIds.push(newid); diff --git a/process/Offer_lib/process.js b/process/Offer_lib/process.js index 9876c3b210d7c99e1f8b14b80b715d3c34aa81cb..ec78bc02a4e836b0ad5169f4ffcc72c1f2d1b65f 100644 --- a/process/Offer_lib/process.js +++ b/process/Offer_lib/process.js @@ -286,7 +286,7 @@ OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCu , "DATE_NEW" , "USER_NEW"]; - return ItemUtils.prototype.insertPartsList.apply(this, [cols, pProductId, pAssignedTo, pCurrency, pRelationId]); + return ItemUtils.prototype.insertPartsList.apply(this, [cols, pProductId, pAssignedTo, pCurrency, pRelationId, [["INFO", "INFO"]]]); } OfferItemUtils.prototype.deletePartsList = function(pItemId) { diff --git a/process/Product_lib/process.js b/process/Product_lib/process.js index 9b1d043f5dd8759d598fb46ed8e5694dd732ec50..6122cd8b2bafdc3cbcf50b05377e89c9ac0b6ebd 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"); @@ -88,6 +87,8 @@ ProductUtils.getStockCount = function(pid) { * * @param {String} pid req ProductID * @param {Object} priceListFilter opt { currency: "currencyValue", quantity: "quantityValue", relationId: "relationIdValue (for custom price lists)" } + * @param {String[]} additionalProductInfoFields additional fields from Product + * They are added to the result with the Fieldname as key. e.g. if the array is ["INFO"] the result will contain the key "INFO" * * @example //Product_entity, Field: PRODUCT_ID, Process: onValueChange * var pid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCT_ID")); @@ -95,7 +96,7 @@ ProductUtils.getStockCount = function(pid) { * var relid = vars.exists("$param.RelationId_param") ? vars.get("$param.RelationId_param") : ""; * var pUtils = new ProductUtils(); * var PriceListFilter = { currency: curr, quantity: vars.get("$field.QUANTITY"), relationId: relid }; - * var ProductDetails = pUtils.getProductDetails(pid, PriceListFilter); + * var ProductDetails = pUtils.getProductDetails(pid, PriceListFilter, ["INFO"]); * * @return {Object} { <br> * productId: "productid" <br> @@ -137,15 +138,20 @@ ProductUtils.getStockCount = function(pid) { * , buySell: "SP" / "PP" <br> * , fromQuantity: "fromquantity" <br> * , currency: "keyvalue of keyword 'CURRENCY'" <br> - * } } <br> + * } }, <br> + * INFO: "the productinfo" * } */ -ProductUtils.getProductDetails = function(pid, priceListFilter) +ProductUtils.getProductDetails = function(pid, priceListFilter, additionalProductInfoFields) { + if (additionalProductInfoFields == undefined) {additionalProductInfoFields = []} var ProductDetails = {}; var cols = []; var colsProduct = ["PRODUCT.PRODUCTID", "PRODUCT.PRODUCTNAME", "PRODUCT.GROUPCODEID", "PRODUCT.UNIT"]; + var defaultProductFieldCount = colsProduct.length; + colsProduct = colsProduct.concat(additionalProductInfoFields.map(function(item) {return "PRODUCT." + item})); + cols = cols.concat(colsProduct); var joins = []; @@ -190,7 +196,7 @@ ProductUtils.getProductDetails = function(pid, priceListFilter) .buildSelect("select " + cols.join(", ") + " from PRODUCT " + joins.join(" "), "1 = 2", "order by " + orderby.join(", ")) -logging.log(ProductDataSql.toSource()) + var ProductData = db.table(ProductDataSql); for (var i = 0; i < ProductData.length; i++) @@ -207,6 +213,14 @@ logging.log(ProductDataSql.toSource()) , CurrentValidPriceLists: {} , PriceListToUse: null }; + + // add additional fields to the details + var countPos = defaultProductFieldCount; + additionalProductInfoFields.forEach(function(productField) + { + this[productField] = ProductData[i][countPos]; + countPos++; + }, ProductDetails); } //Pricelist (all) var colIdx = colsProduct.length;