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

make objectrelation types editable if in usage (only name, icon)

parent 88a2a211
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@
<documentation>%aditoprj%/entity/ObjectRelationType_entity/documentation.adoc</documentation>
<icon>VAADIN:SPLIT</icon>
<title>Relation type</title>
<grantUpdateProcess>%aditoprj%/entity/ObjectRelationType_entity/grantUpdateProcess.js</grantUpdateProcess>
<grantDeleteProcess>%aditoprj%/entity/ObjectRelationType_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/ObjectRelationType_entity/contentTitleProcess.js</contentTitleProcess>
<iconId>VAADIN:SPLIT</iconId>
......@@ -84,6 +83,7 @@
<title>Context 1</title>
<consumer>Contexts</consumer>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/source_object_type/stateProcess.js</stateProcess>
<displayValueProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/source_object_type/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
......@@ -113,12 +113,6 @@
<fieldName>Context</fieldName>
</dependency>
</entityConsumer>
<entityActionField>
<name>removeUsage</name>
<title>Delete all usage</title>
<onActionProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/removeusage/onActionProcess.js</onActionProcess>
<iconId>NEON:TRASH</iconId>
</entityActionField>
<entityField>
<name>Type2Enabled_proxy</name>
<title>Enable relation type 2</title>
......@@ -132,6 +126,23 @@
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>UsageCount_param</name>
<valueProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/usagecount_param/valueProcess.js</valueProcess>
</entityParameter>
<entityActionGroup>
<name>removeActionGroup</name>
<children>
<entityActionField>
<name>removeUsage</name>
<title>Delete all usage</title>
<onActionProcess>%aditoprj%/entity/ObjectRelationType_entity/entityfields/removeactiongroup/children/removeusage/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<isSelectionAction v="true" />
<iconId>NEON:TRASH</iconId>
</entityActionField>
</children>
</entityActionGroup>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
......@@ -2,7 +2,7 @@ import("system.vars");
import("system.result");
import("system.neon");
if (vars.getString("$field.Type2Enabled_proxy") == "0")
if (vars.getString("$field.Type2Enabled_proxy") == "0" || vars.getString("$param.UsageCount_param") > 0)
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
......
import("system.logging");
import("system.vars");
import("system.result");
import("system.neon");
logging.log(JSON.stringify([vars.getString("$param.UsageCount_param")], null, "\t"))
if (vars.getString("$param.UsageCount_param") > 0)
{
result.string(neon.COMPONENTSTATE_DISABLED);
}
else
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
\ No newline at end of file
......@@ -5,4 +5,4 @@ import("system.result");
result.object(db.cell(SqlCondition.begin()
.andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
.andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID")
.buildSql("select count(*) from AB_OBJECTRELATION", "1=2")) <= 0);
\ No newline at end of file
.buildSql("select count(*) from AB_OBJECTRELATION", "1=2")));
\ No newline at end of file
import("Sql_lib");
import("system.db");
import("system.vars");
import("system.result");
result.object(db.cell(SqlCondition.begin()
.andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", "$field.UID")
.andPrepareVars("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", "$field.DEST_OBJECTRELATIONTYPEID")
.buildSql("select count(*) from AB_OBJECTRELATION", "1=2")) <= 0);
\ No newline at end of file
result.object(vars.get("$param.UsageCount_param") <= 0);
\ No newline at end of file
......@@ -17,6 +17,6 @@ if (usageCount <= 0)
}
else
{
// TODO: Show message hier nicht möglich: mit Grant-Prozess ausführung komplett verhindern, wenn es diese gibt.
// TODO: Show message hier nicht möglich: mit Grant-Prozess ausführung komplett verhindern.
//question.showMessage(translate.withArguments("There are still %0 relations using the type %1.", [usageCount, translate.text(vars.get("$field.SOURCE_RELATION_TITLE")) + " -> " + translate.text(vars.get("$field.DEST_RELATION_TITLE"))]), question.WARNING, translate.text("Cannot remove relation type"))
}
\ 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