Skip to content

Commit

Permalink
Merge pull request #10 from creecros/creecros-patch-1
Browse files Browse the repository at this point in the history
Task Email Due option to send to creator, assignee or both
  • Loading branch information
creecros authored Apr 17, 2019
2 parents 431141e + 6c788a3 commit 8f6d970
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Action/TaskEmailDue.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function getActionRequiredParameters()
return array(
'subject' => t('Email subject'),
'duration' => t('Duration in days'),
'send_to' => array('assignee' => t('Send to Assignee'), 'creator' => t('Send to Creator'), 'both' => t('Send to Both')),
);
}
/**
Expand Down Expand Up @@ -74,6 +75,10 @@ public function doAction(array $data)
$results = array();
$max = $this->getParam('duration') * 86400;


if ($this->getParam('send_to') !== null) { $send_to = $this->getParam('send_to'); } else { $send_to = 'both'; }

if ($send_to == 'assignee' || $send_to == 'both') {
foreach ($data['tasks'] as $task) {
$last_emailed = $this->taskMetadataModel->get($task['id'], 'task_last_emailed_toassignee', time() - 86400);
$last_email_span = time() - $last_emailed;
Expand All @@ -94,7 +99,9 @@ public function doAction(array $data)
}

}
}

if ($send_to == 'creator' || $send_to == 'both') {
foreach ($data['tasks'] as $task) {
$last_emailed = $this->taskMetadataModel->get($task['id'], 'task_last_emailed_tocreator', time() - 86400);
$last_email_span = time() - $last_emailed;
Expand All @@ -116,6 +123,7 @@ public function doAction(array $data)
}

}
}

return in_array(true, $results, true);
}
Expand Down
2 changes: 1 addition & 1 deletion Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getPluginAuthor()

public function getPluginVersion()
{
return '1.0.7';
return '1.1.0';
}

public function getPluginDescription()
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ This plugin will add 4 new automatic actions to Kanboard.

*4.) Send email of an impending subtask due date to assigned user*
* This requires the [Subtask Due Date Plugin](https://github.com/eSkiSo/Subtaskdate) to function.
* use Release 0.0.2 if you do not need #4

## Send Email to Assignee

Expand All @@ -34,7 +33,7 @@ This Automatic Action will allow you to send by email, a task to the creator.

## Send email of an impending due date

this action will send an email of an impending due date to both creator and assignee. Duration is defined by user, i.e. 1 day would start sending emails of tasks when there is less than 1 day before due date.
this action will send an email of an impending due date to either the task creator, assignee or both. Duration is defined by user, i.e. 1 day would start sending emails of tasks when there is less than 1 day before due date.

## Send email of an impending subtask due date

Expand Down

0 comments on commit 8f6d970

Please sign in to comment.