dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40561
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20587: programrules engine support for assigning dataelement values in EC and TC
------------------------------------------------------------
revno: 20587
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-08 15:59:37 +0200
message:
programrules engine support for assigning dataelement values in EC and TC
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/rulebound/rulebound-controller.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-10-07 14:25:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-10-08 13:59:37 +0000
@@ -39,7 +39,8 @@
$scope.treeLoaded = false;
$scope.selectedSection = {id: 'ALL'};
$rootScope.ruleeffects = {};
- $scope.hiddenFields = {};
+ $scope.hiddenFields = [];
+ $scope.assignedFields = [];
$scope.calendarSetting = CalendarService.getSetting();
@@ -979,6 +980,7 @@
$scope.warningMessages = [];
$scope.hiddenSections = [];
$scope.hiddenFields = [];
+ $scope.assignedFields = [];
//console.log('args.event: ', $rootScope.ruleeffects['SINGLE_EVENT'][0]);
if($rootScope.ruleeffects[args.event]) {
@@ -1019,12 +1021,12 @@
$log.warn("ProgramRuleAction " + effect.id + " is of type HIDEFIELD, bot does not have a dataelement defined");
}
}
- if(effect.action === "HIDESECTION") {
+ else if(effect.action === "HIDESECTION") {
if(effect.programStageSection){
$scope.hiddenSections[effect.programStageSection] = effect.programStageSection;
}
}
- if(effect.action === "SHOWERROR" && effect.dataElement.id){
+ else if(effect.action === "SHOWERROR" && effect.dataElement.id){
var dialogOptions = {
headerText: 'validation_error',
bodyText: effect.content + effect.data
@@ -1033,9 +1035,15 @@
$scope.currentEvent[effect.dataElement.id] = $scope.currentEventOriginialValue[effect.dataElement.id];
}
- if(effect.action === "SHOWWARNING"){
+ else if(effect.action === "SHOWWARNING"){
$scope.warningMessages.push(effect.content + effect.data);
}
+ else if (effect.action === "ASSIGNVARIABLE") {
+
+ //For "ASSIGNVARIABLE" actions where we have a dataelement, we save the calculated value to the dataelement:
+ affectedEvent[effect.dataElement.id] = effect.data;
+ $scope.assignedFields[effect.dataElement.id] = true;
+ }
}
});
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-10-07 14:23:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-10-08 13:59:37 +0000
@@ -81,6 +81,7 @@
ng-required={{eventGridColumn.compulsory}}
name="foo"
input-field-id={{eventGridColumn.id}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
on-select="saveDatavalue()"
style="width:100%;">
<ui-select-match allow-clear="true" class="form-control-ui-select" placeholder="{{'select_or_search' | translate}}">{{$select.selected.name || $select.selected}}</ui-select-match>
@@ -96,6 +97,7 @@
input-field-id={{eventGridColumn.id}}
ng-change="saveDatavalue()"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
ng-model="currentEvent[eventGridColumn.id]"
value=""> {{'no_value' | translate}}<br>
</label>
@@ -105,6 +107,7 @@
input-field-id={{eventGridColumn.id}}
ng-change="saveDatavalue()"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
ng-model="currentEvent[eventGridColumn.id]"
value={{option.name}}> {{option.name}}<br>
</label>
@@ -117,6 +120,7 @@
number-type={{eventGridColumn.valueType}}
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -128,6 +132,7 @@
number-type={{eventGridColumn.valueType}}
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -139,6 +144,7 @@
number-type={{eventGridColumn.valueType}}
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -150,6 +156,7 @@
number-type={{eventGridColumn.valueType}}
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -161,6 +168,7 @@
number-type={{eventGridColumn.valueType}}
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -170,6 +178,7 @@
<input type="text"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -179,6 +188,7 @@
<textarea rows="3"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -188,6 +198,7 @@
<div ng-switch-when="BOOLEAN">
<select ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-change="saveDatavalue()"
@@ -205,6 +216,7 @@
d2-date-validator
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
blur-or-change="saveDatavalue()"
@@ -217,6 +229,7 @@
max-date="prStDes[eventGridColumn.id].allowFutureDate ? '' : 0"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
style="width:99%;"/>
@@ -225,6 +238,7 @@
<input type="checkbox"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-change="saveDatavalue()" />
@@ -233,6 +247,7 @@
<input type="text"
ng-model="currentEvent[eventGridColumn.id]"
ng-required={{eventGridColumn.compulsory}}
+ ng-disabled="assignedFields[eventGridColumn.id]"
name="foo"
input-field-id={{eventGridColumn.id}}
ng-blur="saveDatavalue()"
@@ -340,6 +355,7 @@
<ui-select ng-model="currentEvent[de.dataElement.id]"
theme="select2"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
on-select="saveDatavalue()"
@@ -357,6 +373,7 @@
input-field-id={{de.dataElement.id}}
ng-change="saveDatavalue()"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
ng-model="currentEvent[de.dataElement.id]"
value="">{{'no_value' | translate}}<br>
</label><br>
@@ -367,6 +384,7 @@
input-field-id={{de.dataElement.id}}
ng-change="saveDatavalue()"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
ng-model="currentEvent[de.dataElement.id]"
value={{option.name}}> {{option.name}}<br>
</label><br>
@@ -380,6 +398,7 @@
number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -391,6 +410,7 @@
number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -402,6 +422,7 @@
number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -413,6 +434,7 @@
number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -424,6 +446,7 @@
number-type={{prStDes[de.dataElement.id].dataElement.valueType}}
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -433,6 +456,7 @@
<input type="text"
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -442,6 +466,7 @@
<textarea rows="3"
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
@@ -451,6 +476,7 @@
<div ng-switch-when="BOOLEAN">
<select ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-change="saveDatavalue()"
@@ -468,6 +494,7 @@
d2-date-validator
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
blur-or-change="saveDatavalue()"
@@ -481,6 +508,7 @@
d2-date-validator
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
blur-or-change="saveDatavalue()"
@@ -490,6 +518,7 @@
<input type="checkbox"
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-change="saveDatavalue()" />
@@ -498,6 +527,7 @@
<input type="text"
ng-model="currentEvent[de.dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
+ ng-disabled="assignedFields[de.dataElement.id]"
name="foo"
input-field-id={{de.dataElement.id}}
ng-blur="saveDatavalue()"
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-10-07 08:51:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-10-08 13:59:37 +0000
@@ -39,7 +39,8 @@
//variable is set while looping through the program stages later.
$scope.stagesCanBeShownAsTable = false;
$scope.showHelpText = {};
- $scope.hiddenFields = {};
+ $scope.hiddenFields = [];
+ $scope.assignedFields = [];
$scope.errorMessages = {};
$scope.warningMessages = {};
$scope.hiddenSections = {};
@@ -90,6 +91,11 @@
});
}
+ $scope.assignedFields = [];
+ $scope.hiddenSections = [];
+ $scope.warningMessages = [];
+ $scope.errorMessages = [];
+
angular.forEach($rootScope.ruleeffects[event], function (effect) {
if (effect.dataElement) {
//in the data entry controller we only care about the "hidefield", showerror and showwarning actions
@@ -150,8 +156,15 @@
else {
$log.warn("ProgramRuleAction " + effect.id + " is of type HIDESECTION, bot does not have a section defined");
}
+ } else if (effect.action === "ASSIGNVARIABLE") {
+ if(effect.ineffect && effect.dataElement) {
+ //For "ASSIGNVARIABLE" actions where we have a dataelement, we save the calculated value to the dataelement:
+ //Blank out the value:
+ affectedEvent[effect.dataElement.id] = effect.data;
+ $scope.assignedFields[effect.dataElement.id] = true;
+ $scope.saveDatavalueForEvent($scope.prStDes[effect.dataElement.id], null, affectedEvent);
+ }
}
-
}
});
};
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-10-06 14:56:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html 2015-10-08 13:59:37 +0000
@@ -25,7 +25,7 @@
<ui-select ng-model="currentEvent[prStDe.dataElement.id]"
theme="select2"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
name="foo"
on-select="saveDatavalue(prStDe, innerForm.foo)"
style="width:100%;">
@@ -42,7 +42,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
name={{prStDe.dataElement.id}}
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
value=""> {{'no_value' | translate}}<br>
@@ -54,7 +54,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
name={{prStDe.dataElement.id}}
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
value={{option.name}}> {{option.name}}
@@ -71,7 +71,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -83,7 +83,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -95,7 +95,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -107,7 +107,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -119,7 +119,7 @@
ng-model="currentEvent[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -129,7 +129,7 @@
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo">
</textarea>
@@ -140,7 +140,7 @@
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -149,7 +149,7 @@
class="form-control"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo">
<option value="">{{'please_select'| translate}}</option>
@@ -167,7 +167,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
blur-or-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -177,7 +177,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -187,7 +187,7 @@
ng-class="getInputNotifcationClass(prStDe.dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[prStDe.dataElement.id]"
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -246,7 +246,7 @@
<ui-select ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
theme="select2"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
name="foo"
on-select="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
style="width:100%;">
@@ -263,7 +263,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
name={{currentEvent[prStDes[de.dataElement.id].dataElement.id]}}
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id])"
value=""> {{'no_value' | translate}}<br>
@@ -275,7 +275,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
name={{currentEvent[prStDes[de.dataElement.id].dataElement.id]}}
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id])"
value={{option.name}}> {{option.name}}
@@ -292,7 +292,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -304,7 +304,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -316,7 +316,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -328,7 +328,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -340,7 +340,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -349,7 +349,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id])"
name="foo">
<option value="">{{'please_select'| translate}}</option>
@@ -367,7 +367,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
blur-or-change="saveDatavalue(prStDes[de.dataElement.id])"
name="foo"/>
</div>
@@ -377,7 +377,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-change="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -387,7 +387,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo">
</textarea>
@@ -398,7 +398,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id], innerForm.foo)"
name="foo"/>
</div>
@@ -408,7 +408,7 @@
ng-class="getInputNotifcationClass(prStDes[de.dataElement.id].dataElement.id,false, currentEvent)"
ng-model="currentEvent[prStDes[de.dataElement.id].dataElement.id]"
ng-required={{prStDes[de.dataElement.id].compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed || assignedFields[de.dataElement.id]"
ng-blur="saveDatavalue(prStDes[de.dataElement.id])"
name="foo"/>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html 2015-10-06 14:56:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html 2015-10-08 13:59:37 +0000
@@ -22,7 +22,7 @@
ng-class="getInputDueDateClass(eventRow)"
d2-date
ng-model="eventRow.eventDate"
- ng-disabled="eventRow.status === 'SKIPPED' || eventRow.enrollmentStatus !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="eventRow.status === 'SKIPPED' || eventRow.enrollmentStatus !== 'ACTIVE' || eventRow.editingNotAllowed "
ng-required="true"
blur-or-change="saveEventDateForEvent(eventRow)"/>
<span ng-if="invalidDate === eventRow.event" class="error">{{'date_required'| translate}}</span>
@@ -34,7 +34,7 @@
<ui-select ng-model="eventRow[prStDe.dataElement.id]"
theme="select2"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
name="foo"
on-select="saveDatavalue(prStDe, innerForm.foo)"
style="width:100%;">
@@ -51,7 +51,7 @@
class="form-control"
name={{prStDe.dataElement.id}}
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-model="eventRow[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
value=""> {{'no_value' | translate}}<br>
@@ -63,7 +63,7 @@
ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
name={{prStDe.dataElement.id}}
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-model="eventRow[prStDe.dataElement.id]"
ng-change="saveDatavalue(prStDe, innerForm.foo)"
value={{option.name}}> {{option.name}}
@@ -80,7 +80,7 @@
ng-model="eventRow[prStDe.dataElement.id]"
d2-number-validator
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -138,7 +138,7 @@
class="form-control"
ng-model="eventRow[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo">
</textarea>
@@ -149,7 +149,7 @@
class="form-control"
ng-model="eventRow[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -158,7 +158,7 @@
class="form-control"
ng-model="eventRow[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo">
<option value="">{{'please_select'| translate}}</option>
@@ -176,7 +176,7 @@
ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
ng-model="eventRow[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
blur-or-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -186,7 +186,7 @@
ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
ng-model="eventRow[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-change="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -196,7 +196,7 @@
ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
ng-model="eventRow[prStDe.dataElement.id]"
ng-required={{prStDe.compulsory}}
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-blur="saveDatavalue(prStDe, innerForm.foo)"
name="foo"/>
</div>
@@ -254,7 +254,7 @@
<div class="align-center" ng-show="prStDe.allowProvidedElsewhere">
<input type="checkbox"
ng-model="eventRow.providedElsewhere[prStDe.dataElement.id]"
- ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed"
+ ng-disabled="selectedEnrollment.status !== 'ACTIVE' || eventRow.editingNotAllowed || assignedFields[prStDe.dataElement.id] "
ng-change="saveDatavalueLocation(prStDe)"/>
</div>
</td>-->
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/rulebound/rulebound-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/rulebound/rulebound-controller.js 2015-10-05 08:58:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/rulebound/rulebound-controller.js 2015-10-08 13:59:37 +0000
@@ -47,7 +47,11 @@
{
keyDataInEffect = true;
}
- } else {
+ }
+ else if(effect.action === "ASSIGNVARIABLE") {
+ //the dataentry control saves the variable and or dataelement
+ }
+ else {
$log.warn("action: '" + effect.action + "' not supported by rulebound-controller.js");
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-10-07 14:23:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-10-08 13:59:37 +0000
@@ -1560,9 +1560,10 @@
if($rootScope.ruleeffects[ruleEffectKey][action.id].action === "ASSIGNVARIABLE" && $rootScope.ruleeffects[ruleEffectKey][action.id].ineffect){
//from earlier evaluation, the data portion of the ruleeffect now contains the value of the variable to be assign.
//the content portion of the ruleeffect defines the name for the variable, when dollar is removed:
- var variabletoassign = $rootScope.ruleeffects[ruleEffectKey][action.id].content.replace("#{","").replace("}","");
+ var variabletoassign = $rootScope.ruleeffects[ruleEffectKey][action.id].content ?
+ $rootScope.ruleeffects[ruleEffectKey][action.id].content.replace("#{","").replace("}","") : null;
- if(!angular.isDefined(variablesHash[variabletoassign])){
+ if((!variabletoassign || !angular.isDefined(variablesHash[variabletoassign])) && !$rootScope.ruleeffects[ruleEffectKey][action.id].dataElement){
$log.warn("Variable " + variabletoassign + " was not defined.");
}