Skip to content
Snippets Groups Projects
Commit c2913d66 authored by Tobias Feldmann's avatar Tobias Feldmann
Browse files

Lookup in Offer

parent dc854ef6
No related branches found
No related tags found
No related merge requests found
......@@ -319,15 +319,6 @@
</entityParameter>
</children>
</entityOutgoingField>
<entityField>
<name>PERS_FIRSTNAME</name>
</entityField>
<entityField>
<name>PERS_LASTNAME</name>
</entityField>
<entityField>
<name>ORG_NAME</name>
</entityField>
<entityOutgoingField>
<name>OfferSalesproject_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
......@@ -457,18 +448,6 @@
<name>RELATION_PERS_ID.value</name>
<recordfield>RELATION.PERS_ID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ORG_NAME.value</name>
<recordfield>ORG.NAME</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>PERS_FIRSTNAME.value</name>
<recordfield>PERS.FIRSTNAME</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>PERS_LASTNAME.value</name>
<recordfield>PERS.LASTNAME</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
import("system.result");
import("system.vars");
import("Relation_lib");
import("system.neon");
result.string(RelationUtils.getNameByPersOrg("$field.RELATION_PERS_ID",
"$field.RELATION_ORG_ID",
"$field.PERS_FIRSTNAME",
"$field.PERS_LASTNAME",
"$field.ORG_NAME"));
\ No newline at end of file
result.string(RelationUtils.getNameByPersOrgWithRelationId(vars.getString("$field.RELATION_ID")));
\ No newline at end of file
import("system.result");
import("Relation_lib");
result.string(RelationUtils.getContextByPersOrg("$field.RELATION_PERS_ID",
"$field.RELATION_ORG_ID"));
\ No newline at end of file
result.string(RelationUtils.getContextByRelationId(vars.getString("$field.RELATION_ID")));
\ No newline at end of file
......@@ -97,6 +97,25 @@ RelationUtils.getContextByPersOrg = function(pPersIdField, pOrgIdField)
}
}
RelationUtils.getContextByRelationId = function(pRelationId)
{
if(!pRelationId)
return "";
else
{
switch (RelationUtils.getRelationTypeByRelation(pRelationId))
{
case 1: // Org
return "Org_context";
case 2: // private Pers
case 3: // Pers
return "Pers_context";
default:
return "";
}
}
}
RelationUtils.getNameByPersOrg = function(pPersIdField, pOrgIdField, pPersFirstnameField,
pPersLastnameField, pOrgnameField)
{
......@@ -118,6 +137,31 @@ RelationUtils.getNameByPersOrg = function(pPersIdField, pOrgIdField, pPersFirstn
}
}
RelationUtils.getNameByPersOrgWithRelationId = function(pRelationId)
{
var data = db.array(db.ROW, SqlCondition.begin()
.andPrepare("RELATION.RELATIONID", pRelationId)
.buildSelect("select RELATION.PERS_ID, RELATION.ORG_ID, PERS.FIRSTNAME, PERS.LASTNAME, ORG.NAME from RELATION RELATION join ORG on ORG.ORGID = RELATION.ORG_ID left join PERS on PERS.PERSID = RELATION.PERS_ID", "1 = 2"));
if(!data[0] && !data[1])
return "";
else
{
switch (RelationUtils.getRelationTypeByPersOrg(data[0], data[1]))
{
case 1: // Org
return data[4];
case 2: // private Pers
case 3: // Pers
return data[2]
.concat(" " , data[3]);
default:
return "";
}
}
}
/**
* returns the from string for the relation joined with org, pers, address
*
......
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