diff options
author | Oliver Buchmann <o.buch91@gmail.com> | 2017-05-10 22:42:34 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2017-05-10 16:42:34 -0400 |
commit | daf39ee16aa15572b92f96bd7cc3705305a50b9d (patch) | |
tree | 570baefc579f9b7df1fa0dd4156148e746a5313c | |
parent | 136936ae3df66e8ffc49d721f0bb4de507506332 (diff) |
Change Due Date to Due Timestamp fixes #919 (#3249)
-rw-r--r-- | app/Console/TaskOverdueNotificationCommand.php | 2 | ||||
-rw-r--r-- | app/Helper/TaskHelper.php | 2 | ||||
-rw-r--r-- | app/Import/TaskImport.php | 2 | ||||
-rw-r--r-- | app/Model/TaskCreationModel.php | 2 | ||||
-rw-r--r-- | app/Model/TaskModificationModel.php | 2 | ||||
-rw-r--r-- | app/Template/board/task_footer.php | 2 | ||||
-rw-r--r-- | app/Template/notification/task_create.php | 2 | ||||
-rw-r--r-- | app/Template/notification/task_overdue.php | 2 | ||||
-rw-r--r-- | app/Template/project_user_overview/tasks.php | 2 | ||||
-rw-r--r-- | app/Template/task/changes.php | 2 | ||||
-rw-r--r-- | app/Template/task/details.php | 2 | ||||
-rw-r--r-- | app/Template/task_list/task_icons.php | 2 | ||||
-rw-r--r-- | app/Template/task_mail/email.php | 2 | ||||
-rw-r--r-- | tests/integration/OverdueTaskProcedureTest.php | 2 | ||||
-rw-r--r-- | tests/units/Action/TaskAssignDueDateOnCreationTest.php | 2 | ||||
-rw-r--r-- | tests/units/Export/TaskExportTest.php | 2 | ||||
-rw-r--r-- | tests/units/Model/TaskCreationModelTest.php | 8 | ||||
-rw-r--r-- | tests/units/Model/TaskModificationModelTest.php | 6 | ||||
-rw-r--r-- | tests/units/Model/TaskRecurrenceModelTest.php | 4 |
19 files changed, 25 insertions, 25 deletions
diff --git a/app/Console/TaskOverdueNotificationCommand.php b/app/Console/TaskOverdueNotificationCommand.php index 36276615..107ecc05 100644 --- a/app/Console/TaskOverdueNotificationCommand.php +++ b/app/Console/TaskOverdueNotificationCommand.php @@ -44,7 +44,7 @@ class TaskOverdueNotificationCommand extends BaseCommand $rows[] = array( $task['id'], $task['title'], - date('Y-m-d', $task['date_due']), + date('Y-m-d H:i', $task['date_due']), $task['project_id'], $task['project_name'], $task['assignee_name'] ?: $task['assignee_username'], diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 334f4f33..f3084759 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -208,7 +208,7 @@ class TaskHelper extends Base public function renderDueDateField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="9"'), $attributes); - return $this->helper->form->date(t('Due Date'), 'date_due', $values, $errors, $attributes); + return $this->helper->form->datetime(t('Due Date'), 'date_due', $values, $errors, $attributes); } public function renderPriority($priority) diff --git a/app/Import/TaskImport.php b/app/Import/TaskImport.php index f5ca9b0e..cabf6b0c 100644 --- a/app/Import/TaskImport.php +++ b/app/Import/TaskImport.php @@ -124,7 +124,7 @@ class TaskImport extends Base } if (! empty($row['date_due'])) { - $values['date_due'] = $this->dateParser->getTimestampFromIsoFormat($row['date_due']); + $values['date_due'] = $this->dateParser->getTimestamp($row['date_due']); } $this->helper->model->removeEmptyFields( diff --git a/app/Model/TaskCreationModel.php b/app/Model/TaskCreationModel.php index 95f62ee5..dbec2b12 100644 --- a/app/Model/TaskCreationModel.php +++ b/app/Model/TaskCreationModel.php @@ -58,7 +58,7 @@ class TaskCreationModel extends Base */ protected function prepare(array &$values) { - $values = $this->dateParser->convert($values, array('date_due')); + $values = $this->dateParser->convert($values, array('date_due'), true); $values = $this->dateParser->convert($values, array('date_started'), true); $this->helper->model->removeFields($values, array('another_task', 'duplicate_multiple_projects')); diff --git a/app/Model/TaskModificationModel.php b/app/Model/TaskModificationModel.php index 0ae29293..b10c0aa9 100644 --- a/app/Model/TaskModificationModel.php +++ b/app/Model/TaskModificationModel.php @@ -98,7 +98,7 @@ class TaskModificationModel extends Base */ protected function prepare(array &$values) { - $values = $this->dateParser->convert($values, array('date_due')); + $values = $this->dateParser->convert($values, array('date_due'), true); $values = $this->dateParser->convert($values, array('date_started'), true); $this->helper->model->removeFields($values, array('id')); diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index 1ad1c9f1..8829204a 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -65,7 +65,7 @@ <?php endif ?> "> <i class="fa fa-calendar"></i> - <?= $this->dt->date($task['date_due']) ?> + <?= $this->dt->datetime($task['date_due']) ?> </span> <?php endif ?> </div> diff --git a/app/Template/notification/task_create.php b/app/Template/notification/task_create.php index 6e80b26a..e56c252d 100644 --- a/app/Template/notification/task_create.php +++ b/app/Template/notification/task_create.php @@ -6,7 +6,7 @@ </li> <?php if ($task['date_due']): ?> <li> - <strong><?= t('Due date:').' '.$this->dt->date($task['date_due']) ?></strong> + <strong><?= t('Due date:').' '.$this->dt->datetime($task['date_due']) ?></strong> </li> <?php endif ?> <?php if (! empty($task['creator_username'])): ?> diff --git a/app/Template/notification/task_overdue.php b/app/Template/notification/task_overdue.php index 01ad0a01..2ad4c14d 100644 --- a/app/Template/notification/task_overdue.php +++ b/app/Template/notification/task_overdue.php @@ -19,7 +19,7 @@ <?= $this->text->e($task['title']) ?> <?php endif ?> </td> - <td style="border: 1px solid #eee;"><?= $this->dt->date($task['date_due']) ?></td> + <td style="border: 1px solid #eee;"><?= $this->dt->datetime($task['date_due']) ?></td> <td style="border: 1px solid #eee;"><?= $this->text->e($task['project_name']) ?></td> <td style="border: 1px solid #eee;"> <?php if (! empty($task['assignee_username'])): ?> diff --git a/app/Template/project_user_overview/tasks.php b/app/Template/project_user_overview/tasks.php index 8d682170..1e01a43f 100644 --- a/app/Template/project_user_overview/tasks.php +++ b/app/Template/project_user_overview/tasks.php @@ -36,7 +36,7 @@ <?= $this->dt->date($task['date_started']) ?> </td> <td> - <?= $this->dt->date($task['date_due']) ?> + <?= $this->dt->datetime($task['date_due']) ?> </td> </tr> <?php endforeach ?> diff --git a/app/Template/task/changes.php b/app/Template/task/changes.php index 2c2bf267..6aa3d49b 100644 --- a/app/Template/task/changes.php +++ b/app/Template/task/changes.php @@ -31,7 +31,7 @@ if (empty($task['date_due'])) { echo '<li>'.t('The due date have been removed').'</li>'; } else { - echo '<li>'.t('New due date: ').$this->dt->date($task['date_due']).'</li>'; + echo '<li>'.t('New due date: ').$this->dt->datetime($task['date_due']).'</li>'; } break; case 'description': diff --git a/app/Template/task/details.php b/app/Template/task/details.php index 24099a3c..a42e09d1 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -95,7 +95,7 @@ <?php if ($task['date_due']): ?> <li> <strong><?= t('Due date:') ?></strong> - <span><?= $this->dt->date($task['date_due']) ?></span> + <span><?= $this->dt->datetime($task['date_due']) ?></span> </li> <?php endif ?> <?php if ($task['time_estimated']): ?> diff --git a/app/Template/task_list/task_icons.php b/app/Template/task_list/task_icons.php index 6897c260..9545b1e1 100644 --- a/app/Template/task_list/task_icons.php +++ b/app/Template/task_list/task_icons.php @@ -39,7 +39,7 @@ <?php endif ?> "> <i class="fa fa-calendar"></i> - <?= $this->dt->date($task['date_due']) ?> + <?= $this->dt->datetime($task['date_due']) ?> </span> <?php endif ?> diff --git a/app/Template/task_mail/email.php b/app/Template/task_mail/email.php index 70db572e..ee85b1d1 100644 --- a/app/Template/task_mail/email.php +++ b/app/Template/task_mail/email.php @@ -9,7 +9,7 @@ </li> <?php if ($task['date_due']): ?> <li> - <strong><?= t('Due date:').' '.$this->dt->date($task['date_due']) ?></strong> + <strong><?= t('Due date:').' '.$this->dt->datetime($task['date_due']) ?></strong> </li> <?php endif ?> <?php if (! empty($task['creator_username'])): ?> diff --git a/tests/integration/OverdueTaskProcedureTest.php b/tests/integration/OverdueTaskProcedureTest.php index 65f52301..0e31afa0 100644 --- a/tests/integration/OverdueTaskProcedureTest.php +++ b/tests/integration/OverdueTaskProcedureTest.php @@ -19,7 +19,7 @@ class OverdueTaskProcedureTest extends BaseProcedureTest $this->assertNotFalse($this->app->createTask(array( 'title' => 'overdue task', 'project_id' => $this->projectId, - 'date_due' => date('Y-m-d', strtotime('-2days')), + 'date_due' => date('Y-m-d H:i', strtotime('-2days')), ))); } diff --git a/tests/units/Action/TaskAssignDueDateOnCreationTest.php b/tests/units/Action/TaskAssignDueDateOnCreationTest.php index 26c0584e..64625d2c 100644 --- a/tests/units/Action/TaskAssignDueDateOnCreationTest.php +++ b/tests/units/Action/TaskAssignDueDateOnCreationTest.php @@ -32,6 +32,6 @@ class TaskAssignDueDateOnCreationTest extends Base $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); - $this->assertEquals(date('Y-m-d', strtotime('+4days')), date('Y-m-d', $task['date_due'])); + $this->assertEquals(date('Y-m-d H:i', strtotime('+4days')), date('Y-m-d H:i', $task['date_due'])); } } diff --git a/tests/units/Export/TaskExportTest.php b/tests/units/Export/TaskExportTest.php index e8b347ac..8e0be433 100644 --- a/tests/units/Export/TaskExportTest.php +++ b/tests/units/Export/TaskExportTest.php @@ -70,7 +70,7 @@ class TaskExportTest extends Base $this->assertEquals('Yellow', $report[2][8]); $this->assertEquals('', $report[1][9]); - $this->assertEquals(date('m/d/Y').' 00:00', $report[2][9]); + $this->assertEquals(date('m/d/Y H:i'), $report[2][9]); $this->assertEquals(3, $report[1][21]); $this->assertEquals(0, $report[2][21]); diff --git a/tests/units/Model/TaskCreationModelTest.php b/tests/units/Model/TaskCreationModelTest.php index ce9996d9..7723bece 100644 --- a/tests/units/Model/TaskCreationModelTest.php +++ b/tests/units/Model/TaskCreationModelTest.php @@ -248,7 +248,7 @@ class TaskCreationModelTest extends Base public function testDateDue() { - $date = '2014-11-23'; + $date = '2014-11-23 14:30'; $timestamp = strtotime('+2days'); $projectModel = new ProjectModel($this->container); $taskCreationModel = new TaskCreationModel($this->container); @@ -262,12 +262,12 @@ class TaskCreationModelTest extends Base $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); $this->assertEquals(1, $task['id']); - $this->assertEquals($date, date('Y-m-d', $task['date_due'])); + $this->assertEquals($date, date('Y-m-d H:i', $task['date_due'])); $task = $taskFinderModel->getById(2); $this->assertNotEmpty($task); $this->assertEquals(2, $task['id']); - $this->assertEquals(date('Y-m-d 00:00', $timestamp), date('Y-m-d 00:00', $task['date_due'])); + $this->assertEquals(date('Y-m-d H:i', $timestamp), date('Y-m-d H:i', $task['date_due'])); $task = $taskFinderModel->getById(3); $this->assertEquals(3, $task['id']); @@ -398,6 +398,6 @@ class TaskCreationModelTest extends Base $task = $taskFinderModel->getById(1); $this->assertNotEmpty($task); - $this->assertEquals('2050-01-10 00:00', date('Y-m-d H:i', $task['date_due'])); + $this->assertEquals('2050-01-10 12:30', date('Y-m-d H:i', $task['date_due'])); } } diff --git a/tests/units/Model/TaskModificationModelTest.php b/tests/units/Model/TaskModificationModelTest.php index f70561b3..a716cf3d 100644 --- a/tests/units/Model/TaskModificationModelTest.php +++ b/tests/units/Model/TaskModificationModelTest.php @@ -195,15 +195,15 @@ class TaskModificationModelTest extends Base $task = $taskFinderModel->getById(1); $this->assertEquals(0, $task['date_due']); - $this->assertTrue($taskModificationModel->update(array('id' => 1, 'date_due' => '2014-11-24'))); + $this->assertTrue($taskModificationModel->update(array('id' => 1, 'date_due' => '2014-11-24 14:30'))); $task = $taskFinderModel->getById(1); - $this->assertEquals('2014-11-24', date('Y-m-d', $task['date_due'])); + $this->assertEquals('2014-11-24 14:30', date('Y-m-d H:i', $task['date_due'])); $this->assertTrue($taskModificationModel->update(array('id' => 1, 'date_due' => time()))); $task = $taskFinderModel->getById(1); - $this->assertEquals(date('Y-m-d'), date('Y-m-d', $task['date_due'])); + $this->assertEquals(date('Y-m-d H:i'), date('Y-m-d H:i', $task['date_due'])); } public function testChangeStartedDate() diff --git a/tests/units/Model/TaskRecurrenceModelTest.php b/tests/units/Model/TaskRecurrenceModelTest.php index 85d77bc2..56f6cf84 100644 --- a/tests/units/Model/TaskRecurrenceModelTest.php +++ b/tests/units/Model/TaskRecurrenceModelTest.php @@ -106,7 +106,7 @@ class TaskRecurrenceModelTest extends Base $this->assertNotEmpty($task); $this->assertEquals(TaskModel::RECURRING_STATUS_PROCESSED, $task['recurrence_status']); $this->assertEquals(2, $task['recurrence_child']); - $this->assertEquals(1436486400, $task['date_due'], '', 2); + $this->assertEquals(1436561776, $task['date_due'], '', 2); $task = $taskFinderModel->getById(2); $this->assertNotEmpty($task); @@ -116,7 +116,7 @@ class TaskRecurrenceModelTest extends Base $this->assertEquals(TaskModel::RECURRING_BASEDATE_TRIGGERDATE, $task['recurrence_basedate']); $this->assertEquals(1, $task['recurrence_parent']); $this->assertEquals(2, $task['recurrence_factor']); - $this->assertEquals($dateParser->removeTimeFromTimestamp(strtotime('+2 days')), $task['date_due'], '', 2); + $this->assertEquals(strtotime('+2 days'), $task['date_due'], '', 2); $tags = $taskTagModel->getList(2); $this->assertCount(2, $tags); |