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 @@
</entityParameter>
<entityParameter>
<name>ObjectRowId_param</name>
<valueProcess>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/valueProcess.js</valueProcess>
<expose v="true" />
<documentation>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/documentation.adoc</documentation>
<description>PARAMETER</description>
......
import("system.db");
import("system.result");
import("system.vars");
import("Contact_lib");
......@@ -5,6 +6,9 @@ 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]);
if (ids.length >= 3 && 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)
}
//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 = {
"ContactId_param" : pContactId,
"OrderType_param" : pOrderType,
"OrderLanguage_param" : pLanguage,
"OfferId_param" : pOfferId,
"OfferId_param" : pSourceOfferId,
"OrderCurrency_param" : pCurrency || "",
"OrderHeader_param" : pHeader || "",
"OrderFooter_param" : pFooter || "",
......@@ -121,10 +121,10 @@ OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pC
/**
* copies all offerItems of an offer and creates orderItems for an order
*
* @param {String} pOfferId the offer to get the items from
* @param {String} pOrderId the order to create the items for
* @param {String} pSourceOfferId the offer to get the items from
* @param {String} pSourceOfferId the order to create the items for
*/
OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId)
OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pSourceOfferId)
{
var InputMapping = {
"OFFERITEM": {
......@@ -146,21 +146,21 @@ OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId)
"INFO" : "INFO",
"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: {
"OFFER_ID" : pOrderId
"OFFER_ID" : pSourceOfferId
}
}
};
CopyModuleUtils.copyModule(InputMapping);
var oiUtils = new OrderItemUtils(pOrderId);
var oiUtils = new OrderItemUtils(pSourceOfferId);
//update order price
cols = ["NET", "VAT"];
var vals = oiUtils.getNetAndVat();
newWhere("SALESORDER.SALESORDERID", pOrderId)
newWhere("SALESORDER.SALESORDERID", pSourceOfferId)
.updateData(true, "SALESORDER", cols, null, vals);
}
......@@ -557,9 +557,9 @@ OrderUtils.openReminderReport = function (pOrderID)
*
* @class
*/
function OrderItemUtils(pOrderId) {
function OrderItemUtils(pSourceOfferId) {
// extends ItemUtils
ItemUtils.apply(this, [pOrderId, "SALESORDER"]);
ItemUtils.apply(this, [pSourceOfferId, "SALESORDER"]);
OrderItemUtils.prototype = Object.create(ItemUtils.prototype);
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