[CORE] - Tasks - Allow subtasks to received helper information as form of references
[CORE] - Tasks - Allow subtasks to received helper information as form of references
[CORE] - Tasks - Allow subtasks to received helper information as form of references
When a subTask is created, it contains very little information. Mainly the DN requiring modification or verification and the link towards its main tasks allowing to verify all options and logic of the tasks at hand.
In the concept of reminder, it is required to create two subTask for one main task. In order to support this logic and have a difference between subTasks of the main tasks, we must send new information to that subTask.
To keep it as generic as possible, a new attribute : fdTasksGranularHelper will be able to contain any reference towards required information of the main task to allow the logic in the backend to be functional.
This can be any information.
For reminder, it will contain the reference of the "first call" and "second call". One for the first SubTask and the latter for the second SubTask.
In core we can add a new reference such as this :
"fdTasksGranularRef" => !empty($attrs['ref'][$dn]) ? array_values($attrs['ref'][$dn]) : [],
"fdTasksGranularHelper" => !empty($attrs['helper']) ? array_values($attrs['helper']) : [],
In the creation of the subTasks (by plugins) we can simply pass that attrs to the creation of the subTasks, example :
$firstCall['helper']['reminderTime'] = $this->attributesAccess['fdTasksReminderFirstCall']->getValue();
// Create the first sub task with primary call
$this->parent->getBaseObject()->createSlaveTasks($monitoredDN, $attributeType, $firstCall, 'Reminder');
Note that one information is allowed, the key helper is required and any key after containing the value to be saved.