Skip to content
Snippets Groups Projects
Commit 3a38272c authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch '1073891-beobachtungshotfix' into '2021.0.0'

1073891 beobachtungshotfix

See merge request xrm/basic!648
parents 1aca2af6 14999889
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 60 deletions
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));
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")));
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
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")));
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));
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
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
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")));
<?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>
......@@ -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>
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.
......
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);
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