Skip to content
Snippets Groups Projects
Commit 99aa12bd authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

targetConsumer in all Object_entity-Providers

parent 23d1c56f
No related branches found
No related tags found
No related merge requests found
......@@ -5,4 +5,4 @@ import("Context_lib");
if (vars.get("$field.TARGET_CONTEXT"))
{
result.string(ContextUtils.getContextName(vars.get("$field.TARGET_CONTEXT")));
}
}
\ No newline at end of file
......@@ -133,6 +133,7 @@
<entityProvider>
<name>FilteredObjects</name>
<fieldType>DEPENDENCY_IN</fieldType>
<targetConsumerProcess>%aditoprj%/entity/Object_entity/entityfields/filteredobjects/targetConsumerProcess.js</targetConsumerProcess>
<dependencies>
<entityDependency>
<name>e644a709-cc8f-425e-bef2-9c51eea9bbe9</name>
......
......@@ -4,28 +4,7 @@ import("Context_lib");
if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"))
{
switch(vars.get("$param.ObjectType_param"))
{
case ContextUtils.getContextName("Organisation"):
result.string("Organisations");
break;
case ContextUtils.getContextName("Person"):
result.string("Persons");
break;
case ContextUtils.getContextName("Offer"):
result.string("Offers");
break;
case ContextUtils.getContextName("Order"):
result.string("Orders");
break;
case ContextUtils.getContextName("Product"):
result.string("Products");
break;
case ContextUtils.getContextName("Contract"):
result.string("Contracts");
break;
case ContextUtils.getContextName("Salesproject"):
result.string("Salesprojects");
break;
}
var consumer = ContextUtils.getContextConsumer(vars.get("$param.ObjectType_param"));
if (consumer)
result.string(consumer);
}
\ No newline at end of file
import("system.vars");
import("system.result");
import("Context_lib");
if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"))
{
var consumer = ContextUtils.getContextConsumer(vars.get("$param.ObjectType_param"));
if (consumer)
result.string(consumer);
}
\ No newline at end of file
......@@ -54,6 +54,34 @@ ContextUtils.getContextName = function(pContextId)
return pContextId;
}
/**
* Returns the Name of the correct Consumer or null
*
* @param {String} pContextId the id of a context
* @return {String|null} Name of the correct Consumer
*/
ContextUtils.getContextConsumer = function(pContextId)
{
// TODO: is there a better solution without a swiutch case? maybe metadata of context / entity
switch(pContextId)
{
case ContextUtils.getContextName("Organisation"):
return "Organisations";
case ContextUtils.getContextName("Person"):
return "Persons";
case ContextUtils.getContextName("Offer"):
return "Offers";
case ContextUtils.getContextName("Order"):
return "Orders";
case ContextUtils.getContextName("Product"):
return "Products";
case ContextUtils.getContextName("Contract"):
return "Contracts";
case ContextUtils.getContextName("Salesproject"):
return "Salesprojects";
}
}
/**
*
* @param {Boolean} [pFilter=false] filter only for contexts which have a mapping in ContextUtils.getSelectMap
......
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