summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrenothing <261274+renothing@users.noreply.github.com>2019-07-09 10:48:24 +0800
committerFrédéric Guillot <fred@kanboard.net>2019-07-08 19:48:24 -0700
commitd3d55224329681722b52a84b31f141bf78aaa134 (patch)
treeda51edcae81ff95a6f73d028e256df33cb5853bf
parent91d703eb8dd627659712e2c87fffab6140ec9aec (diff)
Automatically update the start date when a task move away from a column
-rw-r--r--app/Action/TaskUpdateStartDateOnMoveColumn.php96
-rw-r--r--app/Locale/bs_BA/translations.php1
-rw-r--r--app/Locale/ca_ES/translations.php1
-rw-r--r--app/Locale/cs_CZ/translations.php1
-rw-r--r--app/Locale/da_DK/translations.php1
-rw-r--r--app/Locale/de_DE/translations.php1
-rw-r--r--app/Locale/el_GR/translations.php1
-rw-r--r--app/Locale/es_ES/translations.php1
-rw-r--r--app/Locale/fi_FI/translations.php1
-rw-r--r--app/Locale/fr_FR/translations.php1
-rw-r--r--app/Locale/hr_HR/translations.php1
-rw-r--r--app/Locale/hu_HU/translations.php1
-rw-r--r--app/Locale/id_ID/translations.php1
-rw-r--r--app/Locale/it_IT/translations.php1
-rw-r--r--app/Locale/ja_JP/translations.php1
-rw-r--r--app/Locale/ko_KR/translations.php1
-rw-r--r--app/Locale/my_MY/translations.php1
-rw-r--r--app/Locale/nb_NO/translations.php1
-rw-r--r--app/Locale/nl_NL/translations.php1
-rw-r--r--app/Locale/pl_PL/translations.php1
-rw-r--r--app/Locale/pt_BR/translations.php1
-rw-r--r--app/Locale/pt_PT/translations.php1
-rw-r--r--app/Locale/ro_RO/translations.php1
-rw-r--r--app/Locale/ru_RU/translations.php1
-rw-r--r--app/Locale/sk_SK/translations.php1
-rw-r--r--app/Locale/sr_Latn_RS/translations.php1
-rw-r--r--app/Locale/sv_SE/translations.php1
-rw-r--r--app/Locale/th_TH/translations.php1
-rw-r--r--app/Locale/tr_TR/translations.php1
-rw-r--r--app/Locale/uk_UA/translations.php1
-rw-r--r--app/Locale/vi_VN/translations.php1
-rw-r--r--app/Locale/zh_CN/translations.php5
-rw-r--r--app/Locale/zh_TW/translations.php1
-rw-r--r--app/ServiceProvider/ActionProvider.php2
-rw-r--r--tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php98
35 files changed, 230 insertions, 2 deletions
diff --git a/app/Action/TaskUpdateStartDateOnMoveColumn.php b/app/Action/TaskUpdateStartDateOnMoveColumn.php
new file mode 100644
index 00000000..8a00bbab
--- /dev/null
+++ b/app/Action/TaskUpdateStartDateOnMoveColumn.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace Kanboard\Action;
+
+use Kanboard\Model\TaskModel;
+
+/**
+ * Set the start date when task move away from certain column
+ *
+ * @package Kanboard\Action
+ */
+class TaskUpdateStartDateOnMoveColumn extends Base
+{
+ /**
+ * Get automatic action description
+ *
+ * @access public
+ * @return string
+ */
+ public function getDescription()
+ {
+ return t('Automatically update the start date when task move away from certain 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(
+ 'project_id',
+ 'column_id',
+ ),
+ );
+ }
+
+ /**
+ * Execute the action (set the task date_started)
+ *
+ * @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)
+ {
+ $values = array(
+ 'id' => $data['task_id'],
+ 'date_started' => time(),
+ );
+
+ return $this->taskModificationModel->update($values, 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 empty($data['task']['date_started']) && $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 9b6a0ee7..ead3718e 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php
index 824c3912..c9d544b1 100644
--- a/app/Locale/ca_ES/translations.php
+++ b/app/Locale/ca_ES/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index a6f999c9..5d2ab3b2 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index 9944b1af..38e94cf6 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -1403,6 +1403,7 @@ return array(
'%s moved the task #%d "%s" to the project "%s"' => '%s flyttede opgave #%d "%s" til projekt "%s"',
'Task #%d "%s" has been moved to the project "%s"' => 'Opgave #%d "%s" er flyttet til projekt "%s"',
'Move the task to another column when the due date is less than a certain number of days' => 'Flytte opgave til anden kolonne når afleveringsdato er mindre end et bestemt antal dage',
+ // 'Automatically update the start date when task move away from certain column' => '',
'HTTP Client:' => 'HTTP klient:',
'XBT - bitcoin' => 'XBT - bitcoin',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 69277aa3..54a118b6 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index 70669d9f..c69b29da 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index d61a119c..f3e43c10 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 8724e525..b047f52a 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 3d87d0d4..fe5ad29d 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1403,6 +1403,7 @@ return array(
'%s moved the task #%d "%s" to the project "%s"' => '%s a déplacé la tâche #%d « %s » vers le projet « %s »',
'Task #%d "%s" has been moved to the project "%s"' => 'La tâche #%d « %s » a été déplacée vers le projet « %s »',
'Move the task to another column when the due date is less than a certain number of days' => 'Déplaçer la tâche dans une autre colonne lorsque la date d\'échéance est inférieure à un certain nombre de jour',
+ 'Automatically update the start date when task move away from certain column' => 'Mettre à jour automatiquement la date de début lorsque la tâche change de colonne',
'HTTP Client:' => 'Client HTTP :',
'XBT - bitcoin' => 'XBT - Bitcoin',
);
diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php
index aab68b01..84a21a44 100644
--- a/app/Locale/hr_HR/translations.php
+++ b/app/Locale/hr_HR/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 6639de62..610e5a3c 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 980dc0eb..b8e315e2 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 574be27a..962bd5ca 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index ffbdca5d..a5447419 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -1403,6 +1403,7 @@ return array(
'%s moved the task #%d "%s" to the project "%s"' => '%s がタスク #%d "%s" をプロジェクト "%s" に移動しました',
'Task #%d "%s" has been moved to the project "%s"' => 'タスク#%d "%s" はプロジェクト "%s" へ移動されました ',
'Move the task to another column when the due date is less than a certain number of days' => '期限までの日数が規定値以下になったら、タスクを別のカラムに移動する',
+ // 'Automatically update the start date when task move away from certain column' => '',
'HTTP Client:' => 'HTTPクライアント',
'XBT - bitcoin' => 'XBT - bitcoin',
);
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index bd221d19..79124cba 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index d825f348..937c2430 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index af6ecd3e..f180cf28 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 3ac6c32b..2186ffca 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 6e9e5d2c..ae5b003b 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 73a23331..abc0eb7a 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -1403,6 +1403,7 @@ return array(
'%s moved the task #%d "%s" to the project "%s"' => '%s moveu a tarefa #%d "%s" para o projeto "%s"',
'Task #%d "%s" has been moved to the project "%s"' => 'Tarefa #%d "%s" foi movida para o projeto "%s"',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index 2d3b554a..c47035bd 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php
index 2062542a..b4ccebb9 100644
--- a/app/Locale/ro_RO/translations.php
+++ b/app/Locale/ro_RO/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index ffc14849..ddc2977a 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/sk_SK/translations.php b/app/Locale/sk_SK/translations.php
index e8f0f555..ef951095 100644
--- a/app/Locale/sk_SK/translations.php
+++ b/app/Locale/sk_SK/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 20527c57..6f5d8725 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 17f3c846..d7c2d02b 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index d733d921..587b21ee 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index ba15f9ff..f3e3655d 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/uk_UA/translations.php b/app/Locale/uk_UA/translations.php
index 7ad7f098..830ce912 100644
--- a/app/Locale/uk_UA/translations.php
+++ b/app/Locale/uk_UA/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php
index 92d598a1..c09d50e5 100644
--- a/app/Locale/vi_VN/translations.php
+++ b/app/Locale/vi_VN/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index bc914864..1ca66bdb 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1398,11 +1398,12 @@ return array(
'Reorder this column by assignee and priority (DESC)' => '按指派和优先级倒序重排',
'Reorder this column by assignee (A-Z)' => '按指派重排(A-Z)',
'Reorder this column by assignee (Z-A)' => '按指派倒序重排(Z-A)',
- // 'Reorder this column by due date (ASC)' => '',
- // 'Reorder this column by due date (DESC)' => '',
+ 'Reorder this column by due date (ASC)' => '按逾期时间顺序重排(ASC)',
+ 'Reorder this column by due date (DESC)' => '按逾期时间倒序重排(DESC)',
'%s moved the task #%d "%s" to the project "%s"' => '%s 已将任务 #%d "%s" 移动到项目"%s" ',
'Task #%d "%s" has been moved to the project "%s"' => '任务 #%d "%s" 已被移动到项目 "%s"',
'Move the task to another column when the due date is less than a certain number of days' => '当任务即将在指定天数内超期时移动到另一栏',
+ 'Automatically update the start date when task move away from certain column' => '当任务离开指定栏目时自动开始计时',
'HTTP Client:' => 'HTTP客户端',
'XBT - bitcoin' => 'XBT - 比特币',
);
diff --git a/app/Locale/zh_TW/translations.php b/app/Locale/zh_TW/translations.php
index a9d6b668..7eb35b8f 100644
--- a/app/Locale/zh_TW/translations.php
+++ b/app/Locale/zh_TW/translations.php
@@ -1403,6 +1403,7 @@ return array(
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when the due date is less than a certain number of days' => '',
+ // 'Automatically update the start date when task move away from certain column' => '',
// 'HTTP Client:' => '',
// 'XBT - bitcoin' => '',
);
diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php
index f089da57..bf36b469 100644
--- a/app/ServiceProvider/ActionProvider.php
+++ b/app/ServiceProvider/ActionProvider.php
@@ -41,6 +41,7 @@ use Kanboard\Action\TaskMoveColumnUnAssigned;
use Kanboard\Action\TaskMoveSwimlaneCategoryChange;
use Kanboard\Action\TaskOpen;
use Kanboard\Action\TaskUpdateStartDate;
+use Kanboard\Action\TaskUpdateStartDateOnMoveColumn;
use Kanboard\Action\TaskCloseNoActivity;
use Kanboard\Action\TaskCloseNoActivityColumn;
use Kanboard\Action\TaskCloseNotMovedColumn;
@@ -104,6 +105,7 @@ class ActionProvider implements ServiceProviderInterface
$container['actionManager']->register(new TaskMoveSwimlaneCategoryChange($container));
$container['actionManager']->register(new TaskOpen($container));
$container['actionManager']->register(new TaskUpdateStartDate($container));
+ $container['actionManager']->register(new TaskUpdateStartDateOnMoveColumn($container));
$container['actionManager']->register(new TaskAssignDueDateOnCreation($container));
$container['actionManager']->register(new TaskAssignColorSwimlane($container));
$container['actionManager']->register(new TaskAssignPrioritySwimlane($container));
diff --git a/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php b/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php
new file mode 100644
index 00000000..f95492d6
--- /dev/null
+++ b/tests/units/Action/TaskUpdateStartDateOnMoveColumnTest.php
@@ -0,0 +1,98 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Kanboard\Event\TaskEvent;
+use Kanboard\Model\TaskCreationModel;
+use Kanboard\Model\TaskFinderModel;
+use Kanboard\Model\ProjectModel;
+use Kanboard\Model\TaskModel;
+use Kanboard\Action\TaskUpdateStartDateOnMoveColumn;
+
+class TaskUpdateStartDateOnMoveColumnTest extends Base
+{
+ public function testChangeColumn()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 1)));
+ $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 2));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+
+ $event = new TaskEvent(array(
+ 'task_id' => $task['id'],
+ 'task' => array(
+ 'project_id' => $task['project_id'],
+ 'column_id' => $task['column_id'],
+ )
+ ));
+
+ $action = new TaskUpdateStartDateOnMoveColumn($this->container);
+ $action->setProjectId(1);
+ $action->setParam('column_id', 1);
+ $this->assertTrue($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertTrue($task['date_started'] > 0, 'task start date updated');
+ }
+
+ public function testWithWrongColumn()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 2)));
+ $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 1));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+
+ $event = new TaskEvent(array(
+ 'task_id' => $task['id'],
+ 'task' => array(
+ 'project_id' => $task['project_id'],
+ 'column_id' => $task['column_id'],
+ )
+ ));
+
+ $action = new TaskUpdateStartDateOnMoveColumn($this->container);
+ $action->setProjectId(1);
+ $action->setParam('column_id', 1);
+ $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
+ }
+
+ public function testWithStarted()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 1, 'date_started' => time())));
+ $this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('column_id' => 2));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+
+ $event = new TaskEvent(array(
+ 'task_id' => $task['id'],
+ 'task' => array(
+ 'project_id' => $task['project_id'],
+ 'column_id' => $task['column_id'],
+ 'date_started' => $task['date_started'],
+ )
+ ));
+
+ $action = new TaskUpdateStartDateOnMoveColumn($this->container);
+ $action->setProjectId(1);
+ $action->setParam('column_id', 1);
+ $this->assertFalse($action->execute($event, TaskModel::EVENT_MOVE_COLUMN));
+ }
+}