diff options
33 files changed, 303 insertions, 6 deletions
diff --git a/app/Action/StopSubtaskTimerMoveTaskColumn.php b/app/Action/StopSubtaskTimerMoveTaskColumn.php new file mode 100644 index 00000000..e6f9e436 --- /dev/null +++ b/app/Action/StopSubtaskTimerMoveTaskColumn.php @@ -0,0 +1,102 @@ +<?php + +namespace Kanboard\Action; + +use Kanboard\Model\TaskModel; +use Kanboard\Model\SubtaskModel; + +/** + * Stop the timer of all subtasks when moving a task to another column. + * + * @package Kanboard\Action + * @author Frederic Guillot + */ +class StopSubtaskTimerMoveTaskColumn extends Base +{ + /** + * Get automatic action description + * + * @access public + * @return string + */ + public function getDescription() + { + return t('Stop the timer of all subtasks when moving a task to another column'); + } + + /** + * Get the list of compatible events + * + * @access public + * @return array + */ + public function getCompatibleEvents() + { + return array( + TaskModel::EVENT_MOVE_COLUMN, + ); + } + + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ + public function getActionRequiredParameters() + { + return array( + 'column_id' => t('Column'), + ); + } + + /** + * Get the required parameter for the event + * + * @access public + * @return string[] + */ + public function getEventRequiredParameters() + { + return array( + 'task_id', + 'task' => array( + 'id', + 'column_id', + 'project_id', + ), + ); + } + + /** + * Execute the action (append to the task description). + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ + public function doAction(array $data) + { + $subtasks = $this->subtaskModel->getAll($data['task']['id']); + $results = array(); + + foreach ($subtasks as $subtask) { + $results[] = $this->subtaskModel->update(array('id' => $subtask['id'], 'status' => SubtaskModel::STATUS_DONE)); + $results[] = $this->subtaskTimeTrackingModel->logEndTime($subtask['id'], $subtask['user_id']); + } + + return !in_array(false, $results, true); + } + + /** + * Check if the event data meet the action condition + * + * @access public + * @param array $data Event data dictionary + * @return bool + */ + public function hasRequiredCondition(array $data) + { + return $data['task']['column_id'] == $this->getParam('column_id'); + } +} diff --git a/app/Action/SubtaskTimerMoveTaskColumn.php b/app/Action/SubtaskTimerMoveTaskColumn.php new file mode 100644 index 00000000..896f24b6 --- /dev/null +++ b/app/Action/SubtaskTimerMoveTaskColumn.php @@ -0,0 +1,107 @@ +<?php + +namespace Kanboard\Action; + +use Kanboard\Model\TaskModel; +use Kanboard\Model\SubtaskModel; + +/** + * Create a subtask and activate the timer when moving a task to another column. + * + * @package Kanboard\Action + * @author Frederic Guillot + */ +class SubtaskTimerMoveTaskColumn extends Base +{ + /** + * Get automatic action description + * + * @access public + * @return string + */ + public function getDescription() + { + return t('Add a subtask and activate the timer when moving a task to another column'); + } + + /** + * Get the list of compatible events + * + * @access public + * @return array + */ + public function getCompatibleEvents() + { + return array( + TaskModel::EVENT_MOVE_COLUMN, + ); + } + + /** + * Get the required parameter for the action (defined by the user) + * + * @access public + * @return array + */ + public function getActionRequiredParameters() + { + return array( + 'column_id' => t('Column'), + 'subtask' => t('Subtask Title'), + ); + } + + /** + * Get the required parameter for the event + * + * @access public + * @return string[] + */ + public function getEventRequiredParameters() + { + return array( + 'task_id', + 'task' => array( + 'id', + 'column_id', + 'project_id', + 'creator_id', + ), + ); + } + + /** + * Execute the action (append to the task description). + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ + public function doAction(array $data) + { + $subtaskID = $this->subtaskModel->create(array( + 'title' => $this->getParam('subtask'), + 'user_id' => $data['task']['creator_id'], + 'task_id' => $data['task']['id'], + 'status' => SubtaskModel::STATUS_INPROGRESS, + )); + + if ($subtaskID !== false) { + return $this->subtaskTimeTrackingModel->toggleTimer($subtaskID, $data['task']['creator_id'], SubtaskModel::STATUS_INPROGRESS); + } + + return false; + } + + /** + * Check if the event data meet the action condition + * + * @access public + * @param array $data Event data dictionary + * @return bool + */ + public function hasRequiredCondition(array $data) + { + return $data['task']['column_id'] == $this->getParam('column_id'); + } +} diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 805238d4..1e45ba9a 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index 98fc0a8f..08077e5a 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index 7e67a946..2b5ac006 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index c177c1c5..44e757ee 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 89901ec9..e777ed82 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1367,4 +1367,7 @@ return array( 'Time Spent' => 'Zeitaufwand', 'External Link' => 'externer Link', 'This feature enable the iCal feed, RSS feed and the public board view.' => 'Diese Funktion aktiviert den iCal Feed, RSS Feed und die öffentliche Board-Ansicht', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 4d6ee7fe..9e9ce77a 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 6a05fa00..0f1d1afc 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index f348c0b9..f5b678e2 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 89e41e7f..b084369b 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1367,4 +1367,7 @@ return array( 'Time Spent' => 'Temps passé', 'External Link' => 'Lien externe', 'This feature enable the iCal feed, RSS feed and the public board view.' => 'Cette fonctionalité active l\'abonnement iCal, le flux RSS et la vue publique du tableau.', + 'Stop the timer of all subtasks when moving a task to another column' => 'Arrêter le minuteur de toutes les sous-tâches lorsque la tâche est déplaçée dans une autre colonne', + 'Subtask Title' => 'Titre de la sous-tâche', + 'Add a subtask and activate the timer when moving a task to another column' => 'Ajouter une sous-tâche et activer le minuteur lorsque la tâche est déplaçé dans une autre colonne', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index 2a3a4d38..19a5c30a 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 8394ba8e..99ca6422 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 382c14ec..dc789467 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 74e4c10e..4d2fd7b4 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index b0803078..838de3f0 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index 1fe27e42..8dbbcc51 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 531c403d..6320ef22 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 67f8a58d..72829986 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index e5191f4f..376bcc2c 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 1c1c4dde..48f05297 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index fd9b0caa..47f8e1e3 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index 89c55f41..e6be176f 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php index f1c538d2..69c591b3 100644 --- a/app/Locale/ro_RO/translations.php +++ b/app/Locale/ro_RO/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index ffa0a447..6de8d946 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index cb1603c7..2a6b58f7 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index a79ad80f..2f50654b 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 7d476a9c..7a433b6d 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 78b26ec6..fb1ea088 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index 65d2f3e9..fec8143f 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -1015,12 +1015,6 @@ return array( 'Add a new action' => 'Thêm một hành động mới', 'Import from another project' => 'Nhập khẩu từ một dự án khác', 'There is no action at the moment.' => 'Hiện tại không có hành động nào.', - // 'Example: https://example.kanboard.org/ (used to generate absolute URLs)' => '', - // 'Actions duplicated successfully.' => '', - // 'Unable to duplicate actions.' => '', - // 'Add a new action' => '', - // 'Import from another project' => '', - // 'There is no action at the moment.' => '', 'Import actions from another project' => 'Nhập khẩu các hành động từ một dự án khác', 'There is no available project.' => 'Không có dự án sẵn có.', 'Local File' => 'Local File', @@ -1373,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index ff5a1ca3..4a57405b 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/Locale/zh_TW/translations.php b/app/Locale/zh_TW/translations.php index ee4708db..1b088a75 100644 --- a/app/Locale/zh_TW/translations.php +++ b/app/Locale/zh_TW/translations.php @@ -1367,4 +1367,7 @@ return array( // 'Time Spent' => '', // 'External Link' => '', // 'This feature enable the iCal feed, RSS feed and the public board view.' => '', + // 'Stop the timer of all subtasks when moving a task to another column' => '', + // 'Subtask Title' => '', + // 'Add a subtask and activate the timer when moving a task to another column' => '', ); diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php index 14b84c7a..73d7f171 100644 --- a/app/ServiceProvider/ActionProvider.php +++ b/app/ServiceProvider/ActionProvider.php @@ -41,6 +41,8 @@ use Kanboard\Action\TaskCloseNoActivityColumn; use Kanboard\Action\TaskCloseNotMovedColumn; use Kanboard\Action\TaskAssignColorSwimlane; use Kanboard\Action\TaskAssignPrioritySwimlane; +use Kanboard\Action\SubtaskTimerMoveTaskColumn; +use Kanboard\Action\StopSubtaskTimerMoveTaskColumn; /** * Action Provider @@ -96,6 +98,8 @@ class ActionProvider implements ServiceProviderInterface $container['actionManager']->register(new TaskAssignColorSwimlane($container)); $container['actionManager']->register(new TaskAssignPrioritySwimlane($container)); $container['actionManager']->register(new TaskAssignColorOnDueDate($container)); + $container['actionManager']->register(new SubtaskTimerMoveTaskColumn($container)); + $container['actionManager']->register(new StopSubtaskTimerMoveTaskColumn($container)); return $container; } |