Skip to content

Commit

Permalink
Merge pull request #2662 from civicrm/staging
Browse files Browse the repository at this point in the history
Sync master with staging
  • Loading branch information
davialexandre committed Jun 5, 2018
2 parents 814af4c + a098e8a commit bb03bbe
Show file tree
Hide file tree
Showing 475 changed files with 9,958 additions and 7,975 deletions.
4 changes: 2 additions & 2 deletions com.civicrm.hrjobroles/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>Compucorp Ltd</author>
<email>info@compucorp.co.uk</email>
</maintainer>
<releaseDate>2018-04-30</releaseDate>
<version>1.7.6</version>
<releaseDate>2018-06-05</releaseDate>
<version>1.7.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions com.civicrm.hrjobroles/js/dist/job-roles.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,11 @@ define([
};
}

vm[optionsData[optionGroupName].storage] = getActiveValues(optionsData[optionGroupName].data);
vm[optionsData[optionGroupName].storage] = optionGroupName !== 'cost_centres'
? getActiveValues(optionsData[optionGroupName].data)
: optionsData[optionGroupName].data.filter(function (optionValue) {
return !!+optionValue.is_active;
});
}
}
});
Expand Down Expand Up @@ -1114,6 +1118,12 @@ define([
*/
function updateRole (roleId, roleType) {
var updatedRole;
var optionsData = {
'location': {data: vm.LocationsData},
'level': {data: vm.LevelsData},
'department': {data: vm.DepartmentsData},
'region': {data: vm.RegionsData}
};

$log.debug('Update Role');

Expand All @@ -1122,17 +1132,11 @@ define([
}

updatedRole = angular.copy(vm.editData[roleId]);
updatedRole.location = (updatedRole.location === undefined) ? updatedRole.location = '' : updatedRole.location;
updatedRole.level = (updatedRole.level === undefined) ? updatedRole.level = '' : updatedRole.level;
updatedRole.department = (updatedRole.department === undefined) ? updatedRole.department = '' : updatedRole.department;
updatedRole.region = (updatedRole.region === undefined) ? updatedRole.region = '' : updatedRole.region;
updatedRole.start_date = convertDateToServerFormat(updatedRole.start_date);

if (updatedRole.end_date) {
updatedRole.end_date = convertDateToServerFormat(updatedRole.end_date);
} else {
delete updatedRole.end_date;
}
// Ensure location, level, department, region exist and not disabled
_.forEach(optionsData, function (option, type) {
optionsData[type].status = _.includes(_.keys(option.data), updatedRole[type]);
});
updatedRole = sanitizeUpdatedRole(updatedRole, optionsData);

if (updatedRole.funders && updatedRole.funders.length) {
updateFundersContactsList(updatedRole.funders);
Expand All @@ -1146,6 +1150,30 @@ define([
});
}

/**
* Update submitted role if undefined or option type is disabled
*
* @param {Object} updatedRole
* @param {Object} optionData
* @returns {Object}
*/
function sanitizeUpdatedRole (updatedRole, optionData) {
_.forEach(_.keys(optionData), function (optionType) {
updatedRole[optionType] = (updatedRole[optionType] === undefined || !optionData[optionType].status)
? updatedRole[optionType] = ''
: updatedRole[optionType];
});
updatedRole.start_date = convertDateToServerFormat(updatedRole.start_date);

if (updatedRole.end_date) {
updatedRole.end_date = convertDateToServerFormat(updatedRole.end_date);
} else {
delete updatedRole.end_date;
}

return updatedRole;
}

/**
* Checks if JobRole dates are actual, if not checks if they exist in any of contract's revisions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ define([
$rootScope.$digest();
});

it('builds the "CostCentreList" collection containing the "weight" property', function () {
expect(Object.keys(ctrl.CostCentreList).length).toBe(3);
it('builds the "CostCentreList" array containing the "weight" property', function () {
expect(ctrl.CostCentreList).toEqual(jasmine.any(Array));
expect(ctrl.CostCentreList.length).toBe(3);
expect(ctrl.CostCentreList[0].weight).not.toBeNull();
expect(ctrl.CostCentreList[1].weight).not.toBeNull();
expect(ctrl.CostCentreList[2].weight).not.toBeNull();
Expand Down
40 changes: 24 additions & 16 deletions com.civicrm.hrjobroles/views/include/add_new_role.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<label for="newLocation" class="col-xs-4 control-label">Location:</label>
<div class="col-xs-6">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData['new_role_id']['location']"
Expand All @@ -99,17 +99,19 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_location')"></i>
</a>
</div>
</div>
<div class="col-xs-1 control-label">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_location')"></i>
</a>
</div>
</div>
<div class="form-group">
<label for="newRegion" class="col-xs-4 control-label">Region:</label>
<div class="col-xs-6">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData['new_role_id']['region']"
Expand All @@ -122,17 +124,19 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_region')"></i>
</a>
</div>
</div>
<div class="col-xs-1 control-label">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_region')"></i>
</a>
</div>
</div>
<div class="form-group">
<label for="newDepartment" class="col-xs-4 control-label">Department:</label>
<div class="col-xs-6">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData['new_role_id']['department']"
Expand All @@ -144,17 +148,19 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_department')"></i>
</a>
</div>
</div>
<div class="col-xs-1 control-label">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_department')"></i>
</a>
</div>
</div>
<div class="form-group">
<label for="newLevel" class="col-xs-4 control-label">Level:</label>
<div class="col-xs-6">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData['new_role_id']['level']"
Expand All @@ -166,11 +172,13 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_level_type')"></i>
</a>
</div>
</div>
<div class="col-xs-1 control-label">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_level_type')"></i>
</a>
</div>
</div>
</div>
</div>
Expand Down
48 changes: 28 additions & 20 deletions com.civicrm.hrjobroles/views/include/job_role_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@
<label for="newLocation" class="col-sm-4 control-label">
Location:
</label>
<div class="col-sm-8">
<div class="col-sm-7">
<p class="form-control-static" ng-show="!editableForm.$visible">
{{jobroles.LocationsData[jobroles.editData[job_roles_data.id]['location']]['title'] || '-'}}
</p>
<span ng-show="editableForm.$visible">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData[job_roles_data.id]['location']"
Expand All @@ -172,24 +172,26 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_location')"></i>
</a>
</div>
</span>
</div>
<div class="col-sm-1 control-label" ng-show="editableForm.$visible">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_location')"></i>
</a>
</div>
</div>
<div class="form-group" ng-init="jobroles.initData(job_roles_data.id, 'region', job_roles_data.region)">
<label for="newRegion" class="col-sm-4 control-label">
Region:
</label>
<div class="col-sm-8">
<div class="col-sm-7">
<p class="form-control-static" ng-show="!editableForm.$visible">
{{jobroles.RegionsData[jobroles.editData[job_roles_data.id]['region']]['title'] || '-'}}
</p>
<span ng-show="editableForm.$visible">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData[job_roles_data.id]['region']"
Expand All @@ -202,24 +204,26 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_region')"></i>
</a>
</div>
</span>
</div>
<div class="col-sm-1 control-label" ng-show="editableForm.$visible">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_region')"></i>
</a>
</div>
</div>
<div class="form-group" ng-init="jobroles.initData(job_roles_data.id, 'department', job_roles_data.department)">
<label for="newDepartment" class="col-sm-4 control-label">
Department:
</label>
<div class="col-sm-8">
<div class="col-sm-7">
<p class="form-control-static" ng-show="!editableForm.$visible">
{{jobroles.DepartmentsData[jobroles.editData[job_roles_data.id]['department']]['title'] || '-'}}
</p>
<span ng-show="editableForm.$visible">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData[job_roles_data.id]['department']"
Expand All @@ -232,24 +236,26 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_department')"></i>
</a>
</div>
</span>
</div>
<div class="col-sm-1 control-label" ng-show="editableForm.$visible">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_department')"></i>
</a>
</div>
</div>
<div class="form-group" ng-init="jobroles.initData(job_roles_data.id, 'level', job_roles_data.level_type)">
<label for="newLevel" class="col-sm-4 control-label">
Level:
</label>
<div class="col-sm-8">
<div class="col-sm-7">
<p class="form-control-static" ng-show="!editableForm.$visible">
{{jobroles.LevelsData[jobroles.editData[job_roles_data.id]['level']]['title'] || '-'}}
</p>
<span ng-show="editableForm.$visible">
<div class="form-inline">
<div class="crm_custom-select">
<div class="crm_custom-select crm_custom-select--full">
<ui-select
prevent-animations
ng-model="jobroles.editData[job_roles_data.id]['level']"
Expand All @@ -262,12 +268,14 @@
</ui-select-choices>
</ui-select>
</div>
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_level_type')"></i>
</a>
</div>
</span>
</div>
<div class="col-sm-1 control-label" ng-show="editableForm.$visible">
<a class="pointer">
<i class="crm-i fa-wrench" ng-click="jobroles.openOptionsEditor('hrjc_level_type')"></i>
</a>
</div>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions contactaccessrights/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>Compucorp Ltd</author>
<email>info@compucorp.co.uk</email>
</maintainer>
<releaseDate>2018-04-30</releaseDate>
<version>1.7.6</version>
<releaseDate>2018-06-05</releaseDate>
<version>1.7.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions contactsummary/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>Compucorp Ltd</author>
<email>info@compucorp.co.uk</email>
</maintainer>
<releaseDate>2018-04-30</releaseDate>
<version>1.7.6</version>
<releaseDate>2018-06-05</releaseDate>
<version>1.7.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions contactsummary/js/dist/contact-summary.min.js

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions contactsummary/scss/components/_info-button.scss

This file was deleted.

4 changes: 2 additions & 2 deletions hrbank/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>info@civicrm.org</email>
</maintainer>
<releaseDate>2018-04-30</releaseDate>
<version>1.7.6</version>
<releaseDate>2018-06-05</releaseDate>
<version>1.7.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrcareer/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>info@civicrm.org</email>
</maintainer>
<releaseDate>2018-04-30</releaseDate>
<version>1.7.6</version>
<releaseDate>2018-06-05</releaseDate>
<version>1.7.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
4 changes: 2 additions & 2 deletions hrcase/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<author>CiviCRM LLC</author>
<email>info@civicrm.org</email>
</maintainer>
<releaseDate>2018-04-30</releaseDate>
<version>1.7.6</version>
<releaseDate>2018-06-05</releaseDate>
<version>1.7.7</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down
Loading

0 comments on commit bb03bbe

Please sign in to comment.