Skip to content
Snippets Groups Projects
Commit 71c38795 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch '1073720_FixOrderPresetSalesproject' into '2021.0'

1073720 fix order preset salesproject

See merge request xrm/basic!801
parents 4f0d02bc 559069f2
No related branches found
No related tags found
No related merge requests found
import("system.vars");
import("Order_lib");
OrderUtils.createNewOrder(null, null, JSON.parse(vars.get("$param.ObjectRowId_param"))[0]);
OrderUtils.createNewOrder(null, null, JSON.parse(vars.get("$param.ObjectRowId_param"))[0]);
\ No newline at end of file
......@@ -175,6 +175,7 @@
<consumer>Languages</consumer>
<groupable v="true" />
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/Order_entity/entityfields/isolanguage/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/isolanguage/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
......@@ -519,6 +520,7 @@
<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>
......
......@@ -32,7 +32,7 @@ if(contactId != "")
neon.setFieldValue("$field.DELIVERYADDRESS", AddressUtils.getAddressById(defaultAddressId));
}
var cond;hal
var cond;
if(ContactUtils.isPersonOfOrganisation(contactId))//change contactId to contactId of organisation if needed
{
contactId = newSelect("CONTACT.CONTACTID")
......
import("system.result");
import("system.neon");
import("system.vars");
import("Sql_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value") && vars.get("$field.CONTACT_ID"))
{
var lang = newSelect("ISOLANGUAGE")
.from("CONTACT")
.where("CONTACT.CONTACTID", vars.get("$field.CONTACT_ID"))
.cell();
if(lang != "")
{
result.string(lang);
}
}
\ No newline at end of file
import("system.neon");
import("system.vars");
import("system.result");
import("Contact_lib");
import("Sql_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value"))
{
var contactId = vars.get("$field.CONTACT_ID");
if(contactId)
{
if(ContactUtils.isPersonOfOrganisation(contactId))//change contactId to contactId of organisation if needed
{
contactId = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.ORGANISATION_ID", newSelect("CONTACT.ORGANISATION_ID")
.from("CONTACT")
.where("CONTACT.CONTACTID", contactId)
.cell())
.and("CONTACT.PERSON_ID is null")
.cell();
}
if(contactId)
{
//Salesproject Preset
var salesProjectIds = newSelect("SALESPROJECT.SALESPROJECTID")
.from("SALESPROJECT")
.where("SALESPROJECT.CONTACT_ID", contactId)
.arrayColumn();
if(salesProjectIds.length == 1)
{
result.string(salesProjectIds[0]);
}
}
}
}
\ No newline at end of file
......@@ -179,8 +179,15 @@ ContactUtils.getContactType = function(pContactId, pPersonId, pOrganisationId)
*/
ContactUtils.isOrganisation = function(pContactId, pPersonId, pOrganisationId)
{
var contactType = ContactUtils.getContactType(pContactId, pPersonId, pOrganisationId);
var contactType;
if(pContactId)
{
contactType = ContactUtils.getContactTypeByContactId(pContactId);
}
else
{
contactType = ContactUtils.getContactTypeByPersOrg(pPersonId, pOrganisationId);
}
return contactType == 1;
}
......@@ -199,8 +206,15 @@ ContactUtils.isOrganisation = function(pContactId, pPersonId, pOrganisationId)
*/
ContactUtils.isPrivatePerson = function(pContactId, pPersonId, pOrganisationId)
{
var contactType = ContactUtils.getContactType(pContactId, pPersonId, pOrganisationId);
var contactType;
if(pContactId)
{
contactType = ContactUtils.getContactTypeByContactId(pContactId);
}
else
{
contactType = ContactUtils.getContactTypeByPersOrg(pPersonId, pOrganisationId);
}
return contactType == 2;
}
......@@ -219,8 +233,15 @@ ContactUtils.isPrivatePerson = function(pContactId, pPersonId, pOrganisationId)
*/
ContactUtils.isPersonOfOrganisation = function(pContactId, pPersonId, pOrganisationId)
{
var contactType = ContactUtils.getContactType(pContactId, pPersonId, pOrganisationId);
var contactType;
if(pContactId)
{
contactType = ContactUtils.getContactTypeByContactId(pContactId);
}
else
{
contactType = ContactUtils.getContactTypeByPersOrg(pPersonId, pOrganisationId);
}
return contactType == 3;
}
......
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