diff --git a/.aditoprj/blueprints/CreateObservationActionBlueprint.xml b/.aditoprj/blueprints/CreateObservationActionBlueprint.xml index 21f989f10c424baeccf3e1aa48e95b9d32652082..c1485ebd7b66be4381ef43602ce4de78139530f2 100644 --- a/.aditoprj/blueprints/CreateObservationActionBlueprint.xml +++ b/.aditoprj/blueprints/CreateObservationActionBlueprint.xml @@ -18,18 +18,12 @@ Observation.insertAction();</onActionProcess> <isObjectAction v="true" /> <iconId>VAADIN:EYE</iconId> - <stateProcess>import("system.result"); + <stateProcess>import("system.vars"); +import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) -{ - result.string(neon.COMPONENTSTATE_EDITABLE); -} -else -{ - result.string(neon.COMPONENTSTATE_INVISIBLE); -}</stateProcess> +result.string(Observation.actionState(vars.get("$sys.selection")));</stateProcess> <titleProcess>import("system.result"); import("Observation_lib"); import("system.vars"); @@ -43,18 +37,12 @@ result.string(Observation.observeActionTitle(vars.get("$sys.selection"))); Observation.cancelAction();</onActionProcess> <iconId>VAADIN:EYE_SLASH</iconId> - <stateProcess>import("system.result"); + <stateProcess>import("system.vars"); +import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) -{ - result.string(neon.COMPONENTSTATE_EDITABLE); -} -else -{ - result.string(neon.COMPONENTSTATE_INVISIBLE); -}</stateProcess> +result.string(Observation.actionState(vars.get("$sys.selection"), true));</stateProcess> <titleProcess>import("system.result"); import("system.vars"); import("Observation_lib"); diff --git a/entity/Activity_entity/entityfields/filteractions/children/cancelobservation/stateProcess.js b/entity/Activity_entity/entityfields/filteractions/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Activity_entity/entityfields/filteractions/children/cancelobservation/stateProcess.js +++ b/entity/Activity_entity/entityfields/filteractions/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Activity_entity/entityfields/filteractions/children/observe/stateProcess.js b/entity/Activity_entity/entityfields/filteractions/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Activity_entity/entityfields/filteractions/children/observe/stateProcess.js +++ b/entity/Activity_entity/entityfields/filteractions/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Campaign_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Campaign_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Campaign_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Campaign_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Campaign_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Campaign_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Campaign_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Campaign_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Contract_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Contract_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Contract_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Contract_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Contract_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Contract_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Contract_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Contract_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Employee_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Employee_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Employee_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Employee_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Employee_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Employee_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Employee_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Employee_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Leadimport_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Leadimport_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Leadimport_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Leadimport_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Leadimport_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Leadimport_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Leadimport_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Leadimport_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Observation_entity/documentation.adoc b/entity/Observation_entity/documentation.adoc index 7ecfc5a25ee243668153799dfbc20d77c4caade5..0db0131d36de6a27d8c489504d3c388eb7d9fecc 100644 --- a/entity/Observation_entity/documentation.adoc +++ b/entity/Observation_entity/documentation.adoc @@ -14,3 +14,8 @@ inserted, updated or deleted. * The entity had to have a content Title * The entity had to be customizing in the Blacklist_param of the Context Consumer if its not an dependency. Otherwise it had to be customizing in the Dependency_lib with the "isObservable" option * The entityfields which should not be displayed must also be customized + +=== Enable Observation + +* Enable the custom field observation.isEnabled in the _____PREFERENCES_PROJECT +* Create the Observation Context and add the Entity, the Views (ObservationEdit_view, ObservationFilter_view, ObservationPreview_view), the Icon (VAADIN:EYE) and the Tile "Observation" to it diff --git a/entity/Offer_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Offer_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Offer_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Offer_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Offer_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Offer_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..495784da276212e9797b304f45d8aec7925b3dbb 100644 --- a/entity/Offer_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Offer_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Order_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Order_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Order_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Order_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Order_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Order_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Order_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Organisation_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Organisation_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Organisation_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..495784da276212e9797b304f45d8aec7925b3dbb 100644 --- a/entity/Organisation_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js +++ b/entity/Organisation_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js b/entity/Person_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..6ed1e38413fe09d9835cc86a64a09c6f01f49e74 100644 --- a/entity/Person_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Person_entity/entityfields/filterviewactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js b/entity/Person_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Person_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js +++ b/entity/Person_entity/entityfields/filterviewactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Product_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Product_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/Product_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Product_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/Product_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Product_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Product_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Product_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/Salesproject_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Salesproject_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..6ed1e38413fe09d9835cc86a64a09c6f01f49e74 100644 --- a/entity/Salesproject_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Salesproject_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Salesproject_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Salesproject_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Salesproject_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/entity/SupportTicket_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/SupportTicket_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..7a8ef816343ccbc78fe5b4a1203a4a2b46e58956 100644 --- a/entity/SupportTicket_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/SupportTicket_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); diff --git a/entity/SupportTicket_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/SupportTicket_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..495784da276212e9797b304f45d8aec7925b3dbb 100644 --- a/entity/SupportTicket_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/SupportTicket_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js b/entity/Task_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js index 9a0350f5edebe397b96a84766e7cdb8d99f77ee5..6ed1e38413fe09d9835cc86a64a09c6f01f49e74 100644 --- a/entity/Task_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js +++ b/entity/Task_entity/entityfields/observeactiongroup/children/cancelobservation/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"), true)); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/observeactiongroup/children/observe/stateProcess.js b/entity/Task_entity/entityfields/observeactiongroup/children/observe/stateProcess.js index 461276ea5e1e98e967047207ac6d654225a1b1c6..8b0b88a4adfc98771cb6dc0d714db8e25fd67df5 100644 --- a/entity/Task_entity/entityfields/observeactiongroup/children/observe/stateProcess.js +++ b/entity/Task_entity/entityfields/observeactiongroup/children/observe/stateProcess.js @@ -1,8 +1,6 @@ +import("system.vars"); import("system.result"); import("Observation_lib"); import("system.neon"); -if (!Observation.countObservations()) - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +result.string(Observation.actionState(vars.get("$sys.selection"))); diff --git a/neonContext/Observation/Observation.aod b/neonContext/Observation/Observation.aod deleted file mode 100644 index aeab7d749b7e799c4c22e6d58f55bbc73c5be06c..0000000000000000000000000000000000000000 --- a/neonContext/Observation/Observation.aod +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> - <name>Observation</name> - <title>Observation</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <icon>VAADIN:EYE</icon> - <filterView>ObservationFilter_view</filterView> - <editView>ObservationEdit_view</editView> - <previewView>ObservationPreview_view</previewView> - <entity>Observation_entity</entity> - <references> - <neonViewReference> - <name>081e645d-ede7-4987-891c-725e2300c7a0</name> - <view>ObservationFilter_view</view> - </neonViewReference> - <neonViewReference> - <name>381da87e-006b-4fd6-b2b2-18e53d675928</name> - <view>ObservationEdit_view</view> - </neonViewReference> - <neonViewReference> - <name>8e1417a2-f172-451f-9e76-81b852abcaa1</name> - <view>ObservationPreview_view</view> - </neonViewReference> - </references> -</neonContext> diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod index 5d52844d504ba892a669e325ff75b9e7fa5fcf6a..5f6409c320f26bda583ea59060e7d04892bac782 100644 --- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod +++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod @@ -148,5 +148,10 @@ <name>nominatim.resultLimit</name> <description>Amount of rows returned by the address search. Default is 10, maximum is 50.</description> </customIntegerProperty> + <customBooleanProperty> + <name>observation.isEnabled</name> + <description>Whether the observations are enabled or not</description> + <property v="false" /> + </customBooleanProperty> </customProperties> </preferences> diff --git a/process/Observation_lib/process.js b/process/Observation_lib/process.js index 1cbc373cb581ed7551da0ca9158505846641936f..d7f37d17b7117a6c0557b693f267ec3067d52ef8 100644 --- a/process/Observation_lib/process.js +++ b/process/Observation_lib/process.js @@ -1,3 +1,4 @@ +import("system.neon"); import("KeywordRegistry_basic"); import("system.logging"); import("system.text"); @@ -535,11 +536,11 @@ Observation.observeActionTitle = function (pUIDs) * * @return {Int} Count of records */ -Observation.countObservations = function () +Observation.countObservations = function (pSelectedUIDs) { let contextID = ContextUtils.getCurrentContextId(); let observer = EmployeeUtils.getCurrentUserId(); - let selectedUIDs = vars.get("$sys.selection").filter(function (el) { + let selectedUIDs = pSelectedUIDs.filter(function (el) { return el; }); let rowCount = newSelect("COUNT(*)") @@ -555,6 +556,33 @@ Observation.countObservations = function () return parseInt(rowCount.cell()); } +/** + * Returns the state for the Observation Actions + * + * @param {Void} [pSelectedUIDs] The IDs which were selected in the filter view + * @param {Void} [pIsCancelAction] true when the fucntion is called in the CancelAction + * @return {Void} + */ +Observation.actionState = function (pSelectedUIDs, pIsCancelAction) +{ + let isEnabled = project.getPreferenceValue("custom.observation.isEnabled", "false"); + if (isEnabled == "false") + { + return neon.COMPONENTSTATE_INVISIBLE; + } + + let cond = pIsCancelAction ? Observation.countObservations(pSelectedUIDs) : !Observation.countObservations(pSelectedUIDs); + + if (cond) + { + return neon.COMPONENTSTATE_EDITABLE; + } + else + { + return neon.COMPONENTSTATE_INVISIBLE; + } +} + /** * Returns an object with the entity and filter. * If filter or entity are not set, they are set to an empty filter and the current entity. diff --git a/process/workflowExtension_serverProcess/process.js b/process/workflowExtension_serverProcess/process.js index e41601e19704431dcbd03f6022eb9eead22368a1..a2fe06d71683692aaf05900c2d878c513b492c4e 100644 --- a/process/workflowExtension_serverProcess/process.js +++ b/process/workflowExtension_serverProcess/process.js @@ -1,3 +1,4 @@ +import("system.project"); import("Context_lib"); import("Classification_lib"); import("Workflow_lib"); @@ -10,6 +11,9 @@ var entityName = ContextUtils.getEntity(localVariables["targetContext"]); var rowData = JSON.parse(localVariables[WorkflowVariables.ROWDATA()]); var changedRows = JSON.parse(localVariables[WorkflowVariables.CHANGED_ROWS()]); -Observation.checkObservation(JSON.parse(vars.get("$local.variablesWorkflow"))); +if (project.getPreferenceValue("custom.observation.isEnabled", false) == "true") +{ + Observation.checkObservation(localVariables); +} ClassificationUtils.setClassificationStorageDatasetsOutdated([targetId], entityName, rowData, changedRows);