Commit 1f97125e authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with dropdown of retrieval of default data.

parent 99edcbd9
Version 1.18 (not yet released)
Version 1.17.1
============
* Fixed issue with dropdown of retrieval of default data.
Version 1.17
============
......
......@@ -53,7 +53,9 @@
$scope.deletedActions = [];
$scope.deletedDefaultDataInputs = [];
$scope.deletedDefaultDataActions = [];
$scope.default_data_fields = [];
$scope.default_data_fields = {};
$scope.doNotChangeDefaultDataOutputConfiguration = false;
$scope.default_data_output_configuration = $scope.formProcessor.default_data_output_configuration;
$scope.permissions = CRM.form_processor.permissions;
$scope.actionTitles = CRM.form_processor.actionTitles;
$scope.defaultDataActionTitles = CRM.form_processor.defaultDataActionTitles;
......@@ -94,10 +96,36 @@
$scope.$watchCollection('formProcessor.default_data_actions', function (newActions, oldActions) {
formProcessorFactory.getFieldList([], $scope.formProcessor.default_data_actions, false, "form_processor_default_data")
.then(function(fields) {
$scope.default_data_fields = fields;
$scope.doNotChangeDefaultDataOutputConfiguration = true;
angular.forEach(fields, function(field, key) {
if (!$scope.default_data_fields.hasOwnProperty(field.name)) {
$scope.default_data_fields[field.name] = field;
}
});
angular.forEach($scope.default_data_fields, function(fieldLabel, fieldName) {
var found = false;
angular.forEach(fields, function(field, key) {
if (field.name == fieldName) {
found = true;
}
});
if (!found) {
delete $scope.default_data_fields[fieldName];
}
});
angular.forEach($scope.formProcessor.default_data_output_configuration, function(mapping, field) {
$scope.default_data_output_configuration[field] = mapping;
});
$scope.doNotChangeDefaultDataOutputConfiguration = false;
});
});
$scope.$watchCollection('default_data_output_configuration', function(newDefaultDataOutputConfiguration, oldDefaultDataOutputConfiguration) {
if (!$scope.doNotChangeDefaultDataOutputConfiguration) {
$scope.formProcessor.default_data_output_configuration = newDefaultDataOutputConfiguration;
}
});
$scope.isValidName = function(name) {
return (!name) || name.match(/^[a-z0-9_]+$/) ? true : false;
};
......
<div class="crm-block" ng-form="defaultDataOutput" crm-ui-id-scope>
<h3 class="widget-header">{{ts('Set defaults')}}</h3>
<table>
<thead>
<th>{{ts('Field')}}</th>
......@@ -14,12 +13,13 @@
name="{{input.name}}"
crm-ui-id="defaultData.{{input.name}}"
crm-ui-select="{dropdownAutoWidth : true, allowClear: true}"
ng-model="formProcessor.default_data_output_configuration[input.name]"
ng-model="default_data_output_configuration[input.name]"
ng-required="false"
ng-options="field.name as field.label for field in default_data_fields track by field.name"
>
<option value="">{{ts('- Select field to add to the output -')}}</option>
<option ng-repeat="field in default_data_fields track by field.name" value="{{field.name}}">{{field.label}}</option>
</select>
</td>
</tr>
</table>
</div>
......@@ -17,7 +17,7 @@
<url desc="Action-Provider Extension">https://lab.civicrm.org/extensions/action-provider</url>
</urls>
<releaseDate>2020-11-10</releaseDate>
<version>1.18-dev</version>
<version>1.17.1</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment