Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e38901

Browse files
committed
issue: Date Column Interval
This addresses an issue where having multiple Interval values for a single Date column (like DueDate) throws a fatal error. This is due to the system expecting the interval to be a string not an array. This adds a cast to each place we use the interval to ensure it's a string to avoid fatal errors.
1 parent 3ff35ad commit 1e38901

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

include/class.forms.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,26 +2569,26 @@ function getSearchQ($method, $value, $name=false) {
25692569
"{$name}__lte" => $right->format('Y-m-d H:i:s'),
25702570
));
25712571
case 'ndaysago':
2572-
$int = $intervals[$value['int'] ?: 'd'] ?: 'DAY';
2572+
$int = $intervals[(string) $value['int'] ?: 'd'] ?: 'DAY';
25732573
$interval = new SqlInterval($int, $value['until']);
25742574
return new Q(array(
25752575
"{$name}__range" => array($now->minus($interval), $now),
25762576
));
25772577
case 'ndays':
2578-
$int = $intervals[$value['int'] ?: 'd'] ?: 'DAY';
2578+
$int = $intervals[(string) $value['int'] ?: 'd'] ?: 'DAY';
25792579
$interval = new SqlInterval($int, $value['until']);
25802580
return new Q(array(
25812581
"{$name}__range" => array($now, $now->plus($interval)),
25822582
));
25832583
// Distant past and future ranges
25842584
case 'distpast':
2585-
$int = $intervals[$value['int'] ?: 'd'] ?: 'DAY';
2585+
$int = $intervals[(string) $value['int'] ?: 'd'] ?: 'DAY';
25862586
$interval = new SqlInterval($int, $value['until']);
25872587
return new Q(array(
25882588
"{$name}__lte" => $now->minus($interval),
25892589
));
25902590
case 'distfut':
2591-
$int = $intervals[$value['int'] ?: 'd'] ?: 'DAY';
2591+
$int = $intervals[(string) $value['int'] ?: 'd'] ?: 'DAY';
25922592
$interval = new SqlInterval($int, $value['until']);
25932593
return new Q(array(
25942594
"{$name}__gte" => $now->plus($interval),

0 commit comments

Comments
 (0)