diff options
32 files changed, 83 insertions, 36 deletions
@@ -9,10 +9,12 @@ Breaking changes: New features: * Add predefined templates for task descriptions +* Romanian translation Improvements: * Improve iCalendar feed to include tasks with start/end date and due date with a time +* Check if the start date is before due date * You can get an archive of Kanboard by using the download button in Github or the command git archive Version 1.0.48 (October 23, 2017) diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 47b83f9b..d34ee504 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index 019faca1..f1cd7d4e 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index fc3c4152..6b60b424 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index e1ef628c..dee65fe5 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index c65c0548..483467ec 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 044fe3ad..58af4681 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index fa2933f2..bff3eafa 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 28d73cba..12b35244 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index bb551eb8..e461004f 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1356,4 +1356,5 @@ return array( 'Template removed successfully.' => 'Modèle supprimé avec succès.', 'Unable to remove this template.' => 'Impossible de supprimer ce modèle.', 'Template for the task description' => 'Modèle pour la description des tâches', + 'The start date is greater than the end date' => 'La date de début est plus grande que la date d\'échéance', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index adfde704..2a1c8f18 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 65ccdc42..2c5b3ce7 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 9ee0a603..e1d9491b 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index b2fdb4fe..dd321ba7 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 34243a90..c356dfa5 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index 41aa9779..17f771e2 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index ebc9a05f..92b58360 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 73326c35..50fedcc7 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index c4214610..3d9ba67c 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index c782b90f..6873b233 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 50ccbfc7..0adf1d28 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index 51691bea..9faabf36 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php index f4c1e84b..14ecf78f 100644 --- a/app/Locale/ro_RO/translations.php +++ b/app/Locale/ro_RO/translations.php @@ -22,7 +22,7 @@ return array( 'Dark Grey' => 'Gri închis', 'Pink' => 'Roz', 'Teal' => 'Turcoaz', - 'Cyan'=> 'Bleu', + 'Cyan' => 'Bleu', 'Lime' => 'Lime', 'Light Green' => 'Verde deschis', 'Amber' => 'Ambră', @@ -685,8 +685,8 @@ return array( 'Search by color: ' => 'Caută după culoare: ', 'Search by category: ' => 'Caută după categorie: ', 'Search by description: ' => 'Caută după descriere: ', - 'Average time spent into each column' => 'Timp mediu petrecut în fiecare coloană', 'Search by due date: ' => 'Caută după dată scadentă: ', + 'Average time spent into each column' => 'Timp mediu petrecut în fiecare coloană', 'Average time spent' => 'Timp mediu utilizat', 'This chart show the average time spent into each column for the last %d tasks.' => 'Acest grafic arată timpul mediu petrecut în fiecare coloană pentru ultimele %d sarcini.', 'Average Lead and Cycle time' => 'Durată medie de Avans si Ciclu', @@ -1355,5 +1355,6 @@ return array( 'Unable to update this template.' => 'Nu am putut actualiza modelul.', 'Template removed successfully.' => 'Model șters.', 'Unable to remove this template.' => 'Nu am putut șterge modelul.', - 'Description Templates' => 'Modele de descriere', + // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index b10a571e..49b93ebb 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index d6174448..714e0338 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 7073ef3f..1c807d04 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index b55cffef..0c21a0c2 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index c9ea395a..9dd3523b 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index dc182b5e..b636d1d4 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -1362,4 +1362,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index eb415d5f..8758b0de 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1356,4 +1356,5 @@ return array( // 'Template removed successfully.' => '', // 'Unable to remove this template.' => '', // 'Template for the task description' => '', + // 'The start date is greater than the end date' => '', ); diff --git a/app/Validator/TaskValidator.php b/app/Validator/TaskValidator.php index fced763a..21f1abde 100644 --- a/app/Validator/TaskValidator.php +++ b/app/Validator/TaskValidator.php @@ -49,6 +49,20 @@ class TaskValidator extends BaseValidator ); } + public function validateStartAndDueDate(array $values) + { + if (!empty($values['date_started']) && !empty($values['date_due'])) { + $startDate = $this->dateParser->getTimestamp($values['date_started']); + $endDate = $this->dateParser->getTimestamp($values['date_due']); + + if ($startDate > $endDate) { + return array(false, array('date_started' => array(t('The start date is greater than the end date')))); + } + } + + return array(true, array()); + } + /** * Validate task creation * @@ -64,11 +78,14 @@ class TaskValidator extends BaseValidator ); $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + $result = $v->execute(); + $errors = $v->getErrors(); - return array( - $v->execute(), - $v->getErrors() - ); + if ($result) { + list($result, $errors) = $this->validateStartAndDueDate($values); + } + + return array($result, $errors); } /** @@ -133,11 +150,14 @@ class TaskValidator extends BaseValidator ); $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + $result = $v->execute(); + $errors = $v->getErrors(); - return array( - $v->execute(), - $v->getErrors() - ); + if ($result) { + list($result, $errors) = $this->validateStartAndDueDate($values); + } + + return array($result, $errors); } /** @@ -154,11 +174,14 @@ class TaskValidator extends BaseValidator ); $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + $result = $v->execute(); + $errors = $v->getErrors(); - return array( - $v->execute(), - $v->getErrors() - ); + if ($result) { + list($result, $errors) = $this->validateStartAndDueDate($values); + } + + return array($result, $errors); } /** @@ -184,27 +207,6 @@ class TaskValidator extends BaseValidator } /** - * Validate time tracking modification (form) - * - * @access public - * @param array $values Form values - * @return array $valid, $errors [0] = Success or not, [1] = List of errors - */ - public function validateTimeModification(array $values) - { - $rules = array( - new Validators\Required('id', t('The id is required')), - ); - - $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); - - return array( - $v->execute(), - $v->getErrors() - ); - } - - /** * Validate task email creation * * @access public diff --git a/tests/units/Validator/TaskValidatorTest.php b/tests/units/Validator/TaskValidatorTest.php index 0c7fead7..fd5e41fe 100644 --- a/tests/units/Validator/TaskValidatorTest.php +++ b/tests/units/Validator/TaskValidatorTest.php @@ -67,4 +67,18 @@ class TaskValidatorTest extends Base $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'swimlane_id' => 0)); $this->assertFalse($result[0]); } + + public function testStartAndDueDateFields() + { + $taskValidator = new TaskValidator($this->container); + + $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '09/11/2017 10:50', 'date_started' => '09/11/2017 9:50')); + $this->assertTrue($result[0]); + + $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '09/11/2017 10:50', 'date_started' => '09/11/2017 10:50')); + $this->assertTrue($result[0]); + + $result = $taskValidator->validateCreation(array('project_id' => 1, 'title' => 'test', 'date_due' => '09/11/2017 10:50', 'date_started' => '09/11/2017 11:50')); + $this->assertFalse($result[0]); + } } |