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

merged origin/2021.0 into dev_xrm_marketing

parents 9317d3ae 2470c750
No related branches found
No related tags found
No related merge requests found
Showing
with 183 additions and 55 deletions
......@@ -690,6 +690,42 @@
<fieldName>BlacklistTypeKeyword</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>bf774c79-2902-4fdb-a8d2-8a157294bc27</name>
<entityName>Planning_entity</entityName>
<fieldName>KeywordKinds</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>3a570fef-552b-4d94-b010-33a7ffee7a96</name>
<entityName>Planning_entity</entityName>
<fieldName>KeywordStatus</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>5dc1bb58-75cb-4214-b6f5-065e8de26779</name>
<entityName>Planning_entity</entityName>
<fieldName>KeywordGroupcode</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>49358965-6e83-4279-82a8-babf257c3b5f</name>
<entityName>PlanningAddToOrganisations_entity</entityName>
<fieldName>KeywordStatus</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>f7aa1856-6896-4531-8b15-d3c5504172fb</name>
<entityName>PlanningAddToOrganisations_entity</entityName>
<fieldName>KeywordGroupcode</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>12a0dd2c-57f2-4277-b25c-9f824b82308d</name>
<entityName>PlanningChangeStatusAndResponsible_entity</entityName>
<fieldName>KeywordStatus</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
......@@ -705,7 +741,7 @@
</entityProvider>
<entityField>
<name>TITLE_TRANSLATED</name>
<state>INVISIBLE</state>
<title>Title (translated)</title>
<valueProcess>%aditoprj%/entity/KeywordEntry_entity/entityfields/title_translated/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
......
......@@ -6,7 +6,8 @@
<documentation>%aditoprj%/entity/LeadLog_entity/documentation.adoc</documentation>
<grantCreate v="false" />
<grantUpdate v="false" />
<grantDelete v="false" />
<grantDelete v="true" />
<grantDeleteProcess>%aditoprj%/entity/LeadLog_entity/grantDeleteProcess.js</grantDeleteProcess>
<recordContainer>db</recordContainer>
<entityFields>
<entityProvider>
......
import("system.vars");
import("system.result");
var leadLogId = vars.get("$field.LEADLOGID");
var canDelete = new HasLinkedObjectTester()
.andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "LEADLOG", AssignmentRowId_param : leadLogId}) //Documents
.validate();
result.string(canDelete);
\ No newline at end of file
......@@ -8,6 +8,7 @@ var currentContext = ContextUtils.getCurrentContextId();
var canDelete = new HasLinkedObjectTester()
.andNoEntityRows("Task_entity", "Tasks", {ObjectId_param : currentContext, RowId_param : rowId}) //Tasks
.andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "LEADIMPORT", AssignmentRowId_param : rowId}) //Documents
.validate();
result.string(canDelete);
......@@ -33,6 +33,4 @@ if (template)
}
ActivityUtils.createNewActivity(null, links, null, null, translate.text("Letter"), text.parseDocument(content), $KeywordRegistry.activityDirection$outgoing(), [[template.filename, content, false]]);
}
else
throw new Error("Error while using a document template: The provided template does not contain data.");
\ No newline at end of file
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ if (vars.exists("$local.idvalues"))
{
var groupingInfo = JSON.parse(semiId[0]);
logSelect.and("AB_LOGHISTORY.USER_NEW", groupingInfo.u);
var dateFilterValue = datetime.toLong(groupingInfo.d, "yyyy-MM-dd HH:mm");
var dateFilterValue = datetime.toLong(groupingInfo.d, "yyyy-MM-dd HH:mm", "UTC"); // #1076044 set tz to prevent time gaps.
logSelect.and("AB_LOGHISTORY.DATE_NEW", dateFilterValue, SqlBuilder.GREATER_OR_EQUAL());
logSelect.and("AB_LOGHISTORY.DATE_NEW", eMath.addInt(dateFilterValue, datetime.ONE_MINUTE), SqlBuilder.LESS());
}
......
......@@ -7,7 +7,7 @@ import("Sql_lib");
import("Keyword_lib");
var cond = newWhere("AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID", KeywordUtils.getCategoryIdByName($KeywordRegistry.MemberRole()));
cond.and("AB_KEYWORD_ENTRY.ISACTIVE", "1");
var usageFilter = vars.get("$param.UsageFilter_param");
var subFilter = vars.get("$param.UsageSubFilter_param");
......
......@@ -106,9 +106,16 @@ if (Utils.isNullOrEmpty(idValues) || memberRows.length === 0)
.entity("Person_entity")
.uids(responsibleUids)
.fields(["ORGANISATION_ID", "ORGANISATION_NAME", "CONTACTROLE", "POSITION",
"FIRSTNAME", "LASTNAME", "SALUTATION", "TITLE"]);
var persRows = entities.getRows(loadingConfPers);
"FIRSTNAME", "LASTNAME", "SALUTATION", "TITLE", "PERSONID", "CONTACTID"]);
var persRowsMap = {};
entities.getRows(loadingConfPers).forEach(function(item) {
persRowsMap[item["CONTACTID"]] = item;
});
var persRows = [];
responsibleUids.forEach(function(uid) {
persRows.push(persRowsMap[uid]);
});
persRows = persRows.map(function(row){
return [row["SALUTATION"], row["TITLE"], row["FIRSTNAME"], row["LASTNAME"],
......
......@@ -6,7 +6,7 @@ import("system.vars");
import("system.result");
var res = [translate.text("Total gross") + ": " + vars.get("$field.TotalGross.displayValue"),
translate.text("Probability") + ": " + vars.get("$field.PROBABILITY.displayValue"),
translate.text("Probability") + ": " + vars.get("$field.PROBABILITY") + "%",
translate.text("Creation date") + ": " + datetime.toDate(vars.get("$field.DATE_NEW"), translate.text("dd.MM.yyyy"))];
result.string(res.join(" | "));
\ No newline at end of file
import("system.result");
import("system.vars");
import("Sql_lib");
var contactIds = "";
if (vars.exists("$param.ContactIds_param") && vars.get("$param.ContactIds_param")) {
var contactIds = null;
if(vars.exists("$param.ContactIds_param") && vars.get("$param.ContactIds_param"))
{
contactIds = vars.get("$param.ContactIds_param");
}
if (contactIds)
result.string(contactIds);
\ No newline at end of file
if(!contactIds && vars.get("$field.CONTACT_ORG_ID"))
{
var sql = newSelect("CONTACTID").from("CONTACT")
.where("CONTACT.ORGANISATION_ID", vars.get("$field.CONTACT_ORG_ID"));
contactIds = JSON.stringify(sql.arrayColumn());
}
if(contactIds)
{
result.string(contactIds);
}
......@@ -8,13 +8,13 @@ import("Entity_lib");
import("Contact_lib");
import("system.datetime");
var contactid = vars.get("$local.value");
if(contactid != "")
var contactId = vars.get("$local.value");
if(contactId != "")
{
//Language Preset
var lang = newSelect("ISOLANGUAGE")
.from("CONTACT")
.where("CONTACT.CONTACTID", contactid)
.where("CONTACT.CONTACTID", contactId)
.cell();
if(lang != "")
{
......@@ -22,30 +22,41 @@ if(contactid != "")
}
//Address Preset
var defaultAddressId = ContactUtils.getDefaultAddressId(contactid);
var defaultAddressId = ContactUtils.getDefaultAddressId(contactId);
if (defaultAddressId)
{
neon.setFieldValue("$field.ChosenAddress", defaultAddressId);
neon.setFieldValue("$field.ADDRESS", AddressUtils.getAddressById(defaultAddressId));
}
var addrobj = new AddrObject(contactid);
var addrobj = new AddrObject(contactId);
var salutation = addrobj.getFormattedAddress(false, "{letter_salutation},");
if (salutation != "Err.,")
{
neon.setFieldValue("field.LETTERSALUTATION", salutation);
}
// set $field.CONTATCT_ORG_ID per contactid
var orgid = ContactUtils.getPersOrgIds(contactid);
// set $field.CONTATCT_ORG_ID per contactId
var orgid = ContactUtils.getPersOrgIds(contactId);
neon.setFieldValue("$field.CONTACT_ORG_ID", orgid[2]);
//Salesproject Preset
if(vars.get("$field.OBJECT_TYPE") == "Salesproject")
{
var today = datetime.today();
{
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();
}
var salesProjectId = newSelect("SALESPROJECT.SALESPROJECTID")
.from("SALESPROJECT")
.where("SALESPROJECT.CONTACT_ID", contactid)
.where("SALESPROJECT.CONTACT_ID", contactId)
.cell();
if(salesProjectId)
{
......
......@@ -3,8 +3,11 @@ import("system.result");
import("system.neon");
import("system.vars");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT ||
(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")))
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
{
result.string(neon.COMPONENTSTATE_READONLY);
}
else
result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
{
result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
}
......@@ -6,27 +6,31 @@ import("Sql_lib");
import("Context_lib");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
var contactId = "";
if ((!vars.exists("$param.ContactId_param") || !vars.get("$param.ContactId_param"))
&& (vars.exists("$param.ObjectType_param")
&& vars.get("$param.ObjectType_param")
&& vars.exists("$param.ObjectRowId_param")
&& vars.get("$param.ObjectRowId_param")))
{
contactId = ContextUtils.getContactId(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param"))
} else if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) {
contactId = vars.get("$param.ContactId_param");
}
if (contactId)
{
var lang = newSelect("ISOLANGUAGE")
.from("CONTACT")
.where("CONTACT.CONTACTID", contactId)
.cell();
if(lang != "")
neon.setFieldValue("field.ISOLANGUAGE", lang);
var contactId = "";
if ((!vars.exists("$param.ContactId_param") || !vars.get("$param.ContactId_param"))
&& (vars.exists("$param.ObjectType_param")
&& vars.get("$param.ObjectType_param")
&& vars.exists("$param.ObjectRowId_param")
&& vars.get("$param.ObjectRowId_param")))
{
contactId = ContextUtils.getContactId(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param"));
}
else if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param"))
{
contactId = vars.get("$param.ContactId_param");
}
result.string(contactId);
}
\ No newline at end of file
if (contactId)
{
var lang = newSelect("ISOLANGUAGE")
.from("CONTACT")
.where("CONTACT.CONTACTID", contactId)
.cell();
if(lang != "")
neon.setFieldValue("field.ISOLANGUAGE", lang);
result.string(contactId);
}
}
......@@ -2,5 +2,18 @@ import("system.vars");
import("system.result");
import("system.neon");
import("Offer_lib");
import("system.entities");
result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
var loadConfig = entities.createConfigForLoadingRows()
.entity("OfferItem_entity")
.addParameter("OfferId_param", vars.get("$field.OFFERID"));
var offerItemCount = entities.getRowCount(loadConfig);
if(offerItemCount > 0)
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
else
{
result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
}
import("system.vars");
import("system.neon");
//reload the field on save to make sure the offercode is really unique, otherwise the offercode could be the same for two offers created at
//the same time
neon.refresh(["$field.OFFERCODE"]);
\ No newline at end of file
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
{
neon.refresh(["$field.OFFERCODE"]);
}
\ No newline at end of file
......@@ -4,4 +4,11 @@ import("system.neon");
import("Offer_lib");
import("KeywordRegistry_basic");
result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) || vars.get("$field.STATUS") == $KeywordRegistry.offerStatus$sent() ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
\ No newline at end of file
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
{
result.string(neon.COMPONENTSTATE_READONLY);
}
else
{
result.string(OfferUtils.isEditable(vars.get("$field.STATUS")) || vars.get("$field.STATUS") == $KeywordRegistry.offerStatus$sent() ? neon.COMPONENTSTATE_AUTO : neon.COMPONENTSTATE_DISABLED);
}
import("system.tools");
import("system.result");
import("system.vars");
import("KeywordRegistry_basic");
// as one field (status) should be editable if status is sent and all other not, it is done by a state process in each field.
// using the grant update would also disable the status field.
\ No newline at end of file
// using the grant update would also disable the status field.
var status = vars.get("$field.STATUS");
var editable = status != $KeywordRegistry.offerStatus$sent()
&& status != $KeywordRegistry.offerStatus$won()
&& status != $KeywordRegistry.offerStatus$lost();
result.string(editable || tools.hasRole(vars.get("$sys.user"), "INTERNAL_ADMINISTRATOR"));
......@@ -73,8 +73,9 @@
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00</outputFormat>
<inputFormat>#,##0.00</inputFormat>
<mandatory v="true" />
<valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/price/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/price/displayValueProcess.js</displayValueProcess>
<onValidation>%aditoprj%/entity/Offeritem_entity/entityfields/price/onValidation.js</onValidation>
</entityField>
<entityField>
<name>PRODUCT_ID</name>
......@@ -292,6 +293,10 @@
</entityActionField>
</children>
</entityActionGroup>
<entityField>
<name>itemInsertStatements</name>
<documentation>%aditoprj%/entity/Offeritem_entity/entityfields/iteminsertstatements/documentation.adoc</documentation>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
= itemInsertStatements
Helper field to store the statements for the childitems (statements get built with the correct amounts when changing the product or the quantity).
Statements get stored as stringified object.
And parsed and inserted in the onInsertProcess
\ No newline at end of file
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