summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Model/TaskPosition.php4
-rw-r--r--app/ServiceProvider/EventDispatcherProvider.php2
-rw-r--r--app/Subscriber/TaskMovedDateSubscriber.php24
3 files changed, 26 insertions, 4 deletions
diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPosition.php
index b8d9d7bf..1e49543a 100644
--- a/app/Model/TaskPosition.php
+++ b/app/Model/TaskPosition.php
@@ -31,10 +31,6 @@ class TaskPosition extends Base
if ($result) {
- if ($original_task['column_id'] != $column_id) {
- $this->db->table(Task::TABLE)->eq('id', $task_id)->update(array('date_moved' => time()));
- }
-
if ($original_task['swimlane_id'] != $swimlane_id) {
$this->calculateAndSave($project_id, 0, $column_id, 1, $original_task['swimlane_id']);
}
diff --git a/app/ServiceProvider/EventDispatcherProvider.php b/app/ServiceProvider/EventDispatcherProvider.php
index f65a9dca..ec382206 100644
--- a/app/ServiceProvider/EventDispatcherProvider.php
+++ b/app/ServiceProvider/EventDispatcherProvider.php
@@ -13,6 +13,7 @@ use Subscriber\ProjectDailySummarySubscriber;
use Subscriber\ProjectModificationDateSubscriber;
use Subscriber\WebhookSubscriber;
use Subscriber\SubtaskTimesheetSubscriber;
+use Subscriber\TaskMovedDateSubscriber;
class EventDispatcherProvider implements ServiceProviderInterface
{
@@ -27,6 +28,7 @@ class EventDispatcherProvider implements ServiceProviderInterface
$container['dispatcher']->addSubscriber(new WebhookSubscriber($container));
$container['dispatcher']->addSubscriber(new NotificationSubscriber($container));
$container['dispatcher']->addSubscriber(new SubtaskTimesheetSubscriber($container));
+ $container['dispatcher']->addSubscriber(new TaskMovedDateSubscriber($container));
// Automatic actions
$container['action']->attachEvents();
diff --git a/app/Subscriber/TaskMovedDateSubscriber.php b/app/Subscriber/TaskMovedDateSubscriber.php
new file mode 100644
index 00000000..0e36acfa
--- /dev/null
+++ b/app/Subscriber/TaskMovedDateSubscriber.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Subscriber;
+
+use Event\TaskEvent;
+use Model\Task;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+
+class TaskMovedDateSubscriber extends Base implements EventSubscriberInterface
+{
+ public static function getSubscribedEvents()
+ {
+ return array(
+ Task::EVENT_MOVE_COLUMN => array('execute', 0),
+ );
+ }
+
+ public function execute(TaskEvent $event)
+ {
+ if (isset($event['task_id'])) {
+ $this->container['db']->table(Task::TABLE)->eq('id', $event['task_id'])->update(array('date_moved' => time()));
+ }
+ }
+}