Newer
Older
import("system.result");
import("Sql_lib");
import("system.vars");
//Don't allow deletion if the district is a superordinate district
var districtId = vars.get("$field.DISTRICTID");
var count = newSelect("COUNT(*)")
.where("DISTRICT.PARENTDISTRICT_DISTRICTID", districtId);
var canDelete = new HasLinkedObjectTester()
.andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "DISTRICT", AssignmentRowId_param : districtId}) //Documents
.andSqlYieldsZero(count)
.validate();
result.string(canDelete);