Skip to content
Snippets Groups Projects
Commit fcf2df88 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Johannes Goderbauer
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1050510][Probleme bei der Verknüpfung...

[Projekt: Entwicklung - Neon][TicketNr.: 1050510][Probleme bei der Verknüpfung zwischen Beleg und Vertriebsprojekt]


(cherry picked from commit e446bf28)
parent cd34d15f
No related branches found
No related tags found
No related merge requests found
...@@ -594,7 +594,6 @@ ...@@ -594,7 +594,6 @@
</entityParameter> </entityParameter>
<entityParameter> <entityParameter>
<name>ObjectRowId_param</name> <name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/valueProcess.js</valueProcess>
<expose v="true" /> <expose v="true" />
<documentation>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/documentation.adoc</documentation> <documentation>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/documentation.adoc</documentation>
<description>PARAMETER</description> <description>PARAMETER</description>
......
import("system.db");
import("system.result"); import("system.result");
import("system.vars"); import("system.vars");
import("Contact_lib"); import("Contact_lib");
...@@ -5,6 +6,9 @@ import("Contact_lib"); ...@@ -5,6 +6,9 @@ import("Contact_lib");
if (vars.get("$field.CONTACT_ID")) if (vars.get("$field.CONTACT_ID"))
{ {
var ids = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); var ids = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID"));
if (ids.length >= 3 && ids[2]) if (ids.length >= 3 && ids[2]){
result.string(ids[2]); result.string(db.cell("select CONTACTID from CONTACT"
+ " join ORGANISATION on ORGANISATIONID = ORGANISATION_ID"
+ " where ORGANISATION_ID = '" + ids[2] + "'"
+ " and PERSON_ID is null"))}
} }
\ No newline at end of file
...@@ -93,13 +93,13 @@ OrderUtils.createNewOrder = function(pContextId, pRowId, pRelationId) ...@@ -93,13 +93,13 @@ OrderUtils.createNewOrder = function(pContextId, pRowId, pRelationId)
} }
//TODO refactor function to minimize the params and only give an object that contains the data //TODO refactor function to minimize the params and only give an object that contains the data
OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus) OrderUtils.copyOrder = function (pSourceOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus)
{ {
var params = { var params = {
"ContactId_param" : pContactId, "ContactId_param" : pContactId,
"OrderType_param" : pOrderType, "OrderType_param" : pOrderType,
"OrderLanguage_param" : pLanguage, "OrderLanguage_param" : pLanguage,
"OfferId_param" : pOfferId, "OfferId_param" : pSourceOfferId,
"OrderCurrency_param" : pCurrency || "", "OrderCurrency_param" : pCurrency || "",
"OrderHeader_param" : pHeader || "", "OrderHeader_param" : pHeader || "",
"OrderFooter_param" : pFooter || "", "OrderFooter_param" : pFooter || "",
...@@ -121,10 +121,10 @@ OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pC ...@@ -121,10 +121,10 @@ OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pC
/** /**
* copies all offerItems of an offer and creates orderItems for an order * copies all offerItems of an offer and creates orderItems for an order
* *
* @param {String} pOfferId the offer to get the items from * @param {String} pSourceOfferId the offer to get the items from
* @param {String} pOrderId the order to create the items for * @param {String} pSourceOfferId the order to create the items for
*/ */
OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId) OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pSourceOfferId)
{ {
var InputMapping = { var InputMapping = {
"OFFERITEM": { "OFFERITEM": {
...@@ -146,21 +146,21 @@ OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId) ...@@ -146,21 +146,21 @@ OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId)
"INFO" : "INFO", "INFO" : "INFO",
"VAT" : "VAT" "VAT" : "VAT"
}, },
condition: newWhereIfSet("OFFERITEM.OFFER_ID", pOfferId).orderBy("ITEMSORT").toString("1=2", true), condition: newWhereIfSet("OFFERITEM.OFFER_ID", pSourceOfferId).orderBy("ITEMSORT").toString("1=2", true),
ValueMapping: { ValueMapping: {
"OFFER_ID" : pOrderId "OFFER_ID" : pSourceOfferId
} }
} }
}; };
CopyModuleUtils.copyModule(InputMapping); CopyModuleUtils.copyModule(InputMapping);
var oiUtils = new OrderItemUtils(pOrderId); var oiUtils = new OrderItemUtils(pSourceOfferId);
//update order price //update order price
cols = ["NET", "VAT"]; cols = ["NET", "VAT"];
var vals = oiUtils.getNetAndVat(); var vals = oiUtils.getNetAndVat();
newWhere("SALESORDER.SALESORDERID", pOrderId) newWhere("SALESORDER.SALESORDERID", pSourceOfferId)
.updateData(true, "SALESORDER", cols, null, vals); .updateData(true, "SALESORDER", cols, null, vals);
} }
...@@ -557,9 +557,9 @@ OrderUtils.openReminderReport = function (pOrderID) ...@@ -557,9 +557,9 @@ OrderUtils.openReminderReport = function (pOrderID)
* *
* @class * @class
*/ */
function OrderItemUtils(pOrderId) { function OrderItemUtils(pSourceOfferId) {
// extends ItemUtils // extends ItemUtils
ItemUtils.apply(this, [pOrderId, "SALESORDER"]); ItemUtils.apply(this, [pSourceOfferId, "SALESORDER"]);
OrderItemUtils.prototype = Object.create(ItemUtils.prototype); OrderItemUtils.prototype = Object.create(ItemUtils.prototype);
OrderItemUtils.prototype.constructor = OrderItemUtils; OrderItemUtils.prototype.constructor = OrderItemUtils;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment