Skip to content
Snippets Groups Projects
Commit 75751296 authored by dsg03695's avatar dsg03695
Browse files

Ticket #1066025: if a district responsible is connected with a existing...

Ticket #1066025: if a district responsible is connected with a existing district contact then the entity cannot be deleted.
parent 3b13c730
No related branches found
No related tags found
No related merge requests found
......@@ -175,6 +175,14 @@
<name>currentOrganisationId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>ObjectId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>RowId_param</name>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
......@@ -6,6 +6,13 @@ import("Sql_lib");
var organisationID = vars.get("$param.currentOrganisationId_param");
var cond = newWhere();
if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars.exists("$param.ObjectId_param") && vars.get("$param.ObjectId_param"))
{
cond.and("DISTRICTCONTACT.ADVISER_CONTACT_ID", newSelect("DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID")
.from("DISTRICTRESPONSIBLE")
.where("DISTRICTRESPONSIBLE.DISTRICTRESPONSIBLEID", "$param.RowId_param")
, SqlBuilder.IN());
}
if (organisationID)
{
cond.and("DISTRICTCONTACT.CONTACT_ID", organisationID);
......
......@@ -5,6 +5,7 @@
<documentation>%aditoprj%/entity/DistrictResponsible_entity/documentation.adoc</documentation>
<icon>VAADIN:GLOBE</icon>
<title>District Responsible</title>
<grantDeleteProcess>%aditoprj%/entity/DistrictResponsible_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/DistrictResponsible_entity/contentTitleProcess.js</contentTitleProcess>
<iconIdProcess>%aditoprj%/entity/DistrictResponsible_entity/iconIdProcess.js</iconIdProcess>
<image>VAADIN:GLOBE</image>
......
import("Context_lib");
import("system.vars");
import("system.result");
import("Entity_lib");
var rowId = vars.get("$field.DISTRICTRESPONSIBLEID");
var currentContext = ContextUtils.getCurrentContextId();
var canDelete = new HasLinkedObjectTester()
.andNoEntityRows("DistrictContact_entity", "DistrictContacts", {ObjectId_param : currentContext, RowId_param : rowId}) //District Contact
.validate();
result.string(canDelete);
\ 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