// set activity sets
if (isset($xml->ActivitySets)) {
$definition['activitySets'] = array();
+ $definition['timelineActivityTypes'] = array();
+
foreach ($xml->ActivitySets->ActivitySet as $activitySetXML) {
// parse basic properties
$activitySet = array();
if (isset($activitySetXML->ActivityTypes)) {
$activitySet['activityTypes'] = array();
foreach ($activitySetXML->ActivityTypes->ActivityType as $activityTypeXML) {
- $activitySet['activityTypes'][] = json_decode(json_encode($activityTypeXML), TRUE);
+ $activityType = json_decode(json_encode($activityTypeXML), TRUE);
+ $activitySet['activityTypes'][] = $activityType;
+ if ($activitySetXML->timeline) {
+ $definition['timelineActivityTypes'][] = $activityType;
+ }
}
}
$definition['activitySets'][] = $activitySet;
$scope.caseType.definition.caseRoles = $scope.caseType.definition.caseRoles || [];
$scope.caseType.definition.statuses = $scope.caseType.definition.statuses || [];
+ $scope.caseType.definition.timelineActivityTypes = $scope.caseType.definition.timelineActivityTypes || [];
+
$scope.selectedStatuses = {};
_.each(apiCalls.caseStatuses.values, function (status) {
$scope.selectedStatuses[status.name] = !$scope.caseType.definition.statuses.length || $scope.caseType.definition.statuses.indexOf(status.name) > -1;
}
function addActivityToSet(activitySet, activityTypeName) {
- activitySet.activityTypes.push({
- name: activityTypeName,
- label: $scope.activityTypes[activityTypeName].label,
- status: 'Scheduled',
- reference_activity: 'Open Case',
- reference_offset: '1',
- reference_select: 'newest'
- });
+ var activity = {
+ name: activityTypeName,
+ label: $scope.activityTypes[activityTypeName].label,
+ status: 'Scheduled',
+ reference_activity: 'Open Case',
+ reference_offset: '1',
+ reference_select: 'newest'
+ };
+ activitySet.activityTypes.push(activity);
+ if(typeof activitySet.timeline !== "undefined" && activitySet.timeline == "1") {
+ $scope.caseType.definition.timelineActivityTypes.push(activity);
+ }
+ }
+
+ function resetTimelineActivityTypes() {
+ $scope.caseType.definition.timelineActivityTypes = [];
+ angular.forEach($scope.caseType.definition.activitySets, function(activitySet) {
+ angular.forEach(activitySet.activityTypes, function(activityType) {
+ $scope.caseType.definition.timelineActivityTypes.push(activityType);
+ });
+ });
}
function createActivity(name, callback) {
var idx = _.indexOf(array, item);
if (idx != -1) {
array.splice(idx, 1);
+ resetTimelineActivityTypes();
}
};
if (!$scope.isForkable()) {
CRM.alert(ts('The CiviCase XML file for this case-type prohibits editing the definition.'));
}
+
});
crmCaseType.controller('CaseTypeListCtrl', function($scope, crmApi, caseTypes) {
ui-jq="select2"
ui-options="{dropdownAutoWidth : true}"
ng-model="activity.reference_activity"
- ng-options="activityType.name as activityType.label for activityType in activitySet.activityTypes"
+ ng-options="activityType.name as activityType.label for activityType in caseType.definition.timelineActivityTypes"
>
<option value="">-- Case Start --</option>
</select>
'activitySets' => array(),
'activityTypes' => array(),
'caseRoles' => array(),
+ 'timelineActivityTypes' => array(),
)),
'xml' => file_get_contents(__DIR__ . '/xml/empty-lists.xml'),
);
),
),
),
+ 'timelineActivityTypes' => array(
+ array('name' => 'Open Case', 'status' => 'Completed'),
+ ),
'caseRoles' => array(
array('name' => 'First role', 'creator' => 1, 'manager' => 1),
),
),
),
),
+ 'timelineActivityTypes' => array(
+ array('name' => 'Open Case', 'status' => 'Completed'),
+ array(
+ 'name' => 'Meeting',
+ 'reference_activity' => 'Open Case',
+ 'reference_offset' => 1,
+ 'reference_select' => 'newest',
+ ),
+ ),
'caseRoles' => array(
array('name' => 'First role', 'creator' => 1, 'manager' => 1),
array('name' => 'Second role'),
),
),
),
+ 'timelineActivityTypes' => array(
+ array('name' => 'Open Case', 'status' => 'Completed'),
+ ),
'caseRoles' => array(
array('name' => 'First role', 'creator' => 1, 'manager' => 1),
),