Skip to content

Commit

Permalink
Portfolio: Add filter by creation date - refs BT#18201
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Sep 8, 2022
1 parent 8620d43 commit c7fdba5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main/inc/lib/PortfolioController.php
Expand Up @@ -2406,6 +2406,8 @@ private function createFormTagFilter(bool $listByUser = false): FormValidator
FormValidator::LAYOUT_BOX
);

$frmTagList->addDatePicker('date', get_lang('CreationDate'));

/** @var SelectAjax $txtTags */
$txtTags = $frmTagList->addSelectAjax(
'tags',
Expand Down Expand Up @@ -2545,6 +2547,13 @@ private function getItemsForIndex(
if ($frmFilterList && $frmFilterList->validate()) {
$values = $frmFilterList->exportValues();

if (!empty($values['date'])) {
$queryBuilder
->andWhere('pi.creationDate >= :date')
->setParameter(':date', api_get_utc_datetime($values['date'], false, true))
;
}

if (!empty($values['tags'])) {
$queryBuilder
->innerJoin(ExtraFieldRelTag::class, 'efrt', Join::WITH, 'efrt.itemId = pi.id')
Expand Down

0 comments on commit c7fdba5

Please sign in to comment.