Verified Commit c6a34c95 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Reminder) - Only create subTask if prolongation

Only create a subTask if prolongation is required.
Showing with 15 additions and 4 deletions
+15 -4
...@@ -226,7 +226,7 @@ class taskReminder extends simplePlugin ...@@ -226,7 +226,7 @@ class taskReminder extends simplePlugin
function updateFieldsChoices () function updateFieldsChoices ()
{ {
// Update the available supann states // Update the available supann states
$subStatesList = $this->subStates[$this->attributesAccess['fdTasksReminderState']->getValue()] ?? []; $subStatesList = $this->subStates[$this->attributesAccess['fdTasksReminderState']->getValue()] ?? [];
$subStatesNextList = $this->subStates[$this->attributesAccess['fdTasksReminderNextState']->getValue()] ?? []; $subStatesNextList = $this->subStates[$this->attributesAccess['fdTasksReminderNextState']->getValue()] ?? [];
// Update subStates // Update subStates
...@@ -280,11 +280,22 @@ class taskReminder extends simplePlugin ...@@ -280,11 +280,22 @@ class taskReminder extends simplePlugin
function generateSlaveTasks ($monitoredDN) function generateSlaveTasks ($monitoredDN)
{ {
// The attribute required to be search in createSlaveTasks // The attribute required to be search in createSlaveTasks
$attributeType = 'fdTasksGranularDN'; $attributeType = 'fdTasksGranularDN';
$attrs['ref'] = $this->dn; $firstCall['helper']['reminderTime'] = $this->attributesAccess['fdTasksReminderFirstCall']->getValue();
// Call the method from parent tasks object (first tab) to create sub-tasks. listOfDN keys contains the UID of the users. // Call the method from parent tasks object (first tab) to create sub-tasks. listOfDN keys contains the UID of the users.
$this->parent->getBaseObject()->createSlaveTasks(array_keys($monitoredDN), $attributeType, $attrs, 'Reminder'); // Create the first sub task with primary call
$this->parent->getBaseObject()->createSlaveTasks($monitoredDN, $attributeType, $firstCall, 'Reminder');
// Create the second sub task with secondary call (if present).
if (!empty($this->attributesAccess['fdTasksReminderSecondCall']->getValue() &&
$this->attributesAccess['fdTasksReminderAccountProlongation']->getValue())) {
$secondCall['helper']['reminderTime'] = $this->attributesAccess['fdTasksReminderSecondCall']->getValue();
$this->parent->getBaseObject()->createSlaveTasks($monitoredDN, $attributeType, $secondCall, 'Reminder');
}
} }
/** /**
......
Supports Markdown
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