summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Filter/BaseDateRangeFilter.php8
-rw-r--r--app/Filter/TaskCompletionDateRangeFilter.php38
-rw-r--r--app/Filter/TaskModificationDateRangeFilter.php38
-rw-r--r--app/ServiceProvider/FilterProvider.php8
-rw-r--r--vendor/composer/autoload_classmap.php2
-rw-r--r--vendor/composer/autoload_static.php2
6 files changed, 92 insertions, 4 deletions
diff --git a/app/Filter/BaseDateRangeFilter.php b/app/Filter/BaseDateRangeFilter.php
index 336f8c8e..fcff0d4c 100644
--- a/app/Filter/BaseDateRangeFilter.php
+++ b/app/Filter/BaseDateRangeFilter.php
@@ -42,10 +42,10 @@ abstract class BaseDateRangeFilter extends BaseFilter
protected function applyDateFilter($field)
{
$dates = explode('..', $this->value);
-
- if(count($dates)=== 2){
- $timestampFrom = $this->dateParser->getTimestamp($dates[0]);
- $timestampTo = $this->dateParser->getTimestamp($dates[1]);
+
+ if(count($dates)=== 2){
+ $timestampFrom = $this->dateParser->getTimestamp($dates[0]." 00:00");
+ $timestampTo = $this->dateParser->getTimestamp($dates[1]." 00:00");
$this->query->gte($field, $timestampFrom);
$this->query->lte($field, $timestampTo + 86399);
diff --git a/app/Filter/TaskCompletionDateRangeFilter.php b/app/Filter/TaskCompletionDateRangeFilter.php
new file mode 100644
index 00000000..9272cc1e
--- /dev/null
+++ b/app/Filter/TaskCompletionDateRangeFilter.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Filter;
+
+use Kanboard\Core\Filter\FilterInterface;
+use Kanboard\Model\TaskModel;
+
+/**
+ * Filter tasks by completion date
+ *
+ * @package filter
+ * @author Kamil Ściana
+ */
+class TaskCompletionDateRangeFilter extends BaseDateRangeFilter implements FilterInterface
+{
+ /**
+ * Get search attribute
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getAttributes()
+ {
+ return array('completedRange');
+ }
+
+ /**
+ * Apply filter
+ *
+ * @access public
+ * @return FilterInterface
+ */
+ public function apply()
+ {
+ $this->applyDateFilter(TaskModel::TABLE.'.date_completed');
+ return $this;
+ }
+}
diff --git a/app/Filter/TaskModificationDateRangeFilter.php b/app/Filter/TaskModificationDateRangeFilter.php
new file mode 100644
index 00000000..3daa2b59
--- /dev/null
+++ b/app/Filter/TaskModificationDateRangeFilter.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Filter;
+
+use Kanboard\Core\Filter\FilterInterface;
+use Kanboard\Model\TaskModel;
+
+/**
+ * Filter tasks by modification date
+ *
+ * @package filter
+ * @author Kamil Ściana
+ */
+class TaskModificationDateRangeFilter extends BaseDateRangeFilter implements FilterInterface
+{
+ /**
+ * Get search attribute
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getAttributes()
+ {
+ return array('updatedRange', 'modifiedRange');
+ }
+
+ /**
+ * Apply filter
+ *
+ * @access public
+ * @return FilterInterface
+ */
+ public function apply()
+ {
+ $this->applyDateFilter(TaskModel::TABLE.'.date_modification');
+ return $this;
+ }
+}
diff --git a/app/ServiceProvider/FilterProvider.php b/app/ServiceProvider/FilterProvider.php
index c61d2284..392c6c92 100644
--- a/app/ServiceProvider/FilterProvider.php
+++ b/app/ServiceProvider/FilterProvider.php
@@ -15,6 +15,7 @@ use Kanboard\Filter\TaskColorFilter;
use Kanboard\Filter\TaskColumnFilter;
use Kanboard\Filter\TaskCommentFilter;
use Kanboard\Filter\TaskCompletionDateFilter;
+use Kanboard\Filter\TaskCompletionDateRangeFilter;
use Kanboard\Filter\TaskCreationDateFilter;
use Kanboard\Filter\TaskCreationDateRangeFilter;
use Kanboard\Filter\TaskCreatorFilter;
@@ -24,6 +25,7 @@ use Kanboard\Filter\TaskStartDateFilter;
use Kanboard\Filter\TaskIdFilter;
use Kanboard\Filter\TaskLinkFilter;
use Kanboard\Filter\TaskModificationDateFilter;
+use Kanboard\Filter\TaskModificationDateRangeFilter;
use Kanboard\Filter\TaskMovedDateFilter;
use Kanboard\Filter\TaskMovedDateRangeFilter;
use Kanboard\Filter\TaskPriorityFilter;
@@ -166,6 +168,9 @@ class FilterProvider implements ServiceProviderInterface
->withFilter(TaskCompletionDateFilter::getInstance()
->setDateparser($c['dateParser'])
)
+ ->withFilter(TaskCompletionDateRangeFilter::getInstance()
+ ->setDateparser($c['dateParser'])
+ )
->withFilter(new TaskIdFilter())
->withFilter(TaskLinkFilter::getInstance()
->setDatabase($c['db'])
@@ -173,6 +178,9 @@ class FilterProvider implements ServiceProviderInterface
->withFilter(TaskModificationDateFilter::getInstance()
->setDateParser($c['dateParser'])
)
+ ->withFilter(TaskModificationDateRangeFilter::getInstance()
+ ->setDateParser($c['dateParser'])
+ )
->withFilter(TaskMovedDateFilter::getInstance()
->setDateParser($c['dateParser'])
)
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index 780def81..6cce0228 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -448,6 +448,7 @@ return array(
'Kanboard\\Filter\\TaskColumnFilter' => $baseDir . '/app/Filter/TaskColumnFilter.php',
'Kanboard\\Filter\\TaskCommentFilter' => $baseDir . '/app/Filter/TaskCommentFilter.php',
'Kanboard\\Filter\\TaskCompletionDateFilter' => $baseDir . '/app/Filter/TaskCompletionDateFilter.php',
+ 'Kanboard\\Filter\\TaskCompletionDateRangeFilter' => $baseDir . '/app/Filter/TaskCompletionDateRangeFilter.php',
'Kanboard\\Filter\\TaskCreationDateFilter' => $baseDir . '/app/Filter/TaskCreationDateFilter.php',
'Kanboard\\Filter\\TaskCreationDateRangeFilter' => $baseDir . '/app/Filter/TaskCreationDateRangeFilter.php',
'Kanboard\\Filter\\TaskCreatorFilter' => $baseDir . '/app/Filter/TaskCreatorFilter.php',
@@ -458,6 +459,7 @@ return array(
'Kanboard\\Filter\\TaskIdFilter' => $baseDir . '/app/Filter/TaskIdFilter.php',
'Kanboard\\Filter\\TaskLinkFilter' => $baseDir . '/app/Filter/TaskLinkFilter.php',
'Kanboard\\Filter\\TaskModificationDateFilter' => $baseDir . '/app/Filter/TaskModificationDateFilter.php',
+ 'Kanboard\\Filter\\TaskModificationDateRangeFilter' => $baseDir . '/app/Filter/TaskModificationDateRangeFilter.php',
'Kanboard\\Filter\\TaskMovedDateFilter' => $baseDir . '/app/Filter/TaskMovedDateFilter.php',
'Kanboard\\Filter\\TaskMovedDateRangeFilter' => $baseDir . '/app/Filter/TaskMovedDateRangeFilter.php',
'Kanboard\\Filter\\TaskPriorityFilter' => $baseDir . '/app/Filter/TaskPriorityFilter.php',
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 0d496e8a..c5d6f7a8 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -559,6 +559,7 @@ class ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e
'Kanboard\\Filter\\TaskColumnFilter' => __DIR__ . '/../..' . '/app/Filter/TaskColumnFilter.php',
'Kanboard\\Filter\\TaskCommentFilter' => __DIR__ . '/../..' . '/app/Filter/TaskCommentFilter.php',
'Kanboard\\Filter\\TaskCompletionDateFilter' => __DIR__ . '/../..' . '/app/Filter/TaskCompletionDateFilter.php',
+ 'Kanboard\\Filter\\TaskCompletionDateRangeFilter' => __DIR__ . '/../..' . '/app/Filter/TaskCompletionDateRangeFilter.php',
'Kanboard\\Filter\\TaskCreationDateFilter' => __DIR__ . '/../..' . '/app/Filter/TaskCreationDateFilter.php',
'Kanboard\\Filter\\TaskCreationDateRangeFilter' => __DIR__ . '/../..' . '/app/Filter/TaskCreationDateRangeFilter.php',
'Kanboard\\Filter\\TaskCreatorFilter' => __DIR__ . '/../..' . '/app/Filter/TaskCreatorFilter.php',
@@ -569,6 +570,7 @@ class ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e
'Kanboard\\Filter\\TaskIdFilter' => __DIR__ . '/../..' . '/app/Filter/TaskIdFilter.php',
'Kanboard\\Filter\\TaskLinkFilter' => __DIR__ . '/../..' . '/app/Filter/TaskLinkFilter.php',
'Kanboard\\Filter\\TaskModificationDateFilter' => __DIR__ . '/../..' . '/app/Filter/TaskModificationDateFilter.php',
+ 'Kanboard\\Filter\\TaskModificationDateRangeFilter' => __DIR__ . '/../..' . '/app/Filter/TaskModificationDateRangeFilter.php',
'Kanboard\\Filter\\TaskMovedDateFilter' => __DIR__ . '/../..' . '/app/Filter/TaskMovedDateFilter.php',
'Kanboard\\Filter\\TaskMovedDateRangeFilter' => __DIR__ . '/../..' . '/app/Filter/TaskMovedDateRangeFilter.php',
'Kanboard\\Filter\\TaskPriorityFilter' => __DIR__ . '/../..' . '/app/Filter/TaskPriorityFilter.php',