diff --git a/entity/DistrictResponsible_entity/grantDeleteProcess.js b/entity/DistrictResponsible_entity/grantDeleteProcess.js index 7039de6df63613d5985e26ef10ab10e90161e5c9..164a0d74af04ec7f0ad9cc499c8b4fb6b775e031 100644 --- a/entity/DistrictResponsible_entity/grantDeleteProcess.js +++ b/entity/DistrictResponsible_entity/grantDeleteProcess.js @@ -8,6 +8,7 @@ var currentContext = ContextUtils.getCurrentContextId(); var canDelete = new HasLinkedObjectTester() .andNoEntityRows("DistrictContact_entity", "DistrictContacts", {ObjectId_param : currentContext, RowId_param : rowId}) //District Contact + .andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "DISTRICTRESPONSIBLE", AssignmentRowId_param : rowId}) //Documents .validate(); result.string(canDelete); \ No newline at end of file diff --git a/entity/District_entity/District_entity.aod b/entity/District_entity/District_entity.aod index 1501adb177652439951bcd1501084f8e55729aa4..a195aacda5cdca59724adce2e23bd420598082f2 100644 --- a/entity/District_entity/District_entity.aod +++ b/entity/District_entity/District_entity.aod @@ -5,7 +5,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/District_entity/documentation.adoc</documentation> <icon>VAADIN:GLOBE</icon> - <grantDelete v="false" /> + <grantDelete v="true" /> <grantDeleteProcess>%aditoprj%/entity/District_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/District_entity/contentTitleProcess.js</contentTitleProcess> <iconIdProcess>%aditoprj%/entity/District_entity/iconIdProcess.js</iconIdProcess> diff --git a/entity/District_entity/grantDeleteProcess.js b/entity/District_entity/grantDeleteProcess.js index 74e29836785f40313a3ff29d94ae95cf743007df..2aa49f3be4ce09fa49552cf97b5b5ab914774d6d 100644 --- a/entity/District_entity/grantDeleteProcess.js +++ b/entity/District_entity/grantDeleteProcess.js @@ -6,7 +6,11 @@ import("system.vars"); var districtId = vars.get("$field.DISTRICTID"); var count = newSelect("COUNT(*)") .from("DISTRICT") - .where("DISTRICT.PARENTDISTRICT_DISTRICTID", districtId) - .cell(); - -result.string(count == 0); + .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); diff --git a/entity/LeadLog_entity/LeadLog_entity.aod b/entity/LeadLog_entity/LeadLog_entity.aod index 60e321526ff8163355ca475842c04ef2ff6af8aa..6ebe0432210ce13bf1eda860c5496b14cbfa87e1 100644 --- a/entity/LeadLog_entity/LeadLog_entity.aod +++ b/entity/LeadLog_entity/LeadLog_entity.aod @@ -6,7 +6,8 @@ <documentation>%aditoprj%/entity/LeadLog_entity/documentation.adoc</documentation> <grantCreate v="false" /> <grantUpdate v="false" /> - <grantDelete v="false" /> + <grantDelete v="true" /> + <grantDeleteProcess>%aditoprj%/entity/LeadLog_entity/grantDeleteProcess.js</grantDeleteProcess> <recordContainer>db</recordContainer> <entityFields> <entityProvider> diff --git a/entity/LeadLog_entity/grantDeleteProcess.js b/entity/LeadLog_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cea08cc1f625bdd4b38ced32dffe9b979c2a0c5b --- /dev/null +++ b/entity/LeadLog_entity/grantDeleteProcess.js @@ -0,0 +1,10 @@ +import("system.vars"); +import("system.result"); + +var leadLogId = vars.get("$field.LEADLOGID"); + +var canDelete = new HasLinkedObjectTester() + .andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "LEADLOG", AssignmentRowId_param : leadLogId}) //Documents + .validate(); + +result.string(canDelete); \ No newline at end of file diff --git a/entity/Leadimport_entity/grantDeleteProcess.js b/entity/Leadimport_entity/grantDeleteProcess.js index 416fae60ccb6b7be26ccf428eb9c5f692b18b077..673d09de7739420cae7e94fc8270ceacba96564b 100644 --- a/entity/Leadimport_entity/grantDeleteProcess.js +++ b/entity/Leadimport_entity/grantDeleteProcess.js @@ -8,6 +8,7 @@ var currentContext = ContextUtils.getCurrentContextId(); var canDelete = new HasLinkedObjectTester() .andNoEntityRows("Task_entity", "Tasks", {ObjectId_param : currentContext, RowId_param : rowId}) //Tasks + .andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "LEADIMPORT", AssignmentRowId_param : rowId}) //Documents .validate(); result.string(canDelete); diff --git a/entity/SupportTicket_entity/SupportTicket_entity.aod b/entity/SupportTicket_entity/SupportTicket_entity.aod index 18411b1b108aadcd8107ce353aed8febb31b5fc8..a82e8b8219ed27ae068e6c3630c6b37cc1deaa28 100644 --- a/entity/SupportTicket_entity/SupportTicket_entity.aod +++ b/entity/SupportTicket_entity/SupportTicket_entity.aod @@ -4,6 +4,7 @@ <title>Support Ticket</title> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/SupportTicket_entity/documentation.adoc</documentation> + <grantDeleteProcess>%aditoprj%/entity/SupportTicket_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/SupportTicket_entity/contentTitleProcess.js</contentTitleProcess> <contentDescriptionProcess>%aditoprj%/entity/SupportTicket_entity/contentDescriptionProcess.js</contentDescriptionProcess> <afterUiInit>%aditoprj%/entity/SupportTicket_entity/afterUiInit.js</afterUiInit> diff --git a/entity/SupportTicket_entity/grantDeleteProcess.js b/entity/SupportTicket_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1300a4f0d525e6083e9f8dc6df280f802ef813c2 --- /dev/null +++ b/entity/SupportTicket_entity/grantDeleteProcess.js @@ -0,0 +1,10 @@ +import("system.vars"); +import("system.result"); + +var uid = vars.get("$sys.uid"); + +var canDelete = new HasLinkedObjectTester() + .andNoEntityRows("Document_entity", "Documents", {AssignmentTable_param : "TICKET", AssignmentRowId_param : uid}) //Documents + .validate(); + +result.string(canDelete); \ No newline at end of file