feat(legacy): add current date macro to string block criteria (#3013)
### Description It is useful to be able to automatically filter tracks to a certain date or day when scheduling tracks for playback. This adds the ability to do just that in any string filter with the `date{format}` macro. Closes: #3012
This commit is contained in:
parent
13a8e38beb
commit
451652bc40
2 changed files with 16 additions and 0 deletions
|
@ -1612,6 +1612,19 @@ SQL;
|
|||
return $storedCrit;
|
||||
}
|
||||
|
||||
private function resolveDate($value)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return preg_replace_callback(
|
||||
'/now{(.*?)}/',
|
||||
fn ($matches) => date($matches[1]),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
// this function return list of propel object
|
||||
public function getListofFilesMeetCriteria($showLimit = null)
|
||||
{
|
||||
|
@ -1677,6 +1690,8 @@ SQL;
|
|||
$spCriteriaExtra = $criteria['extra'];
|
||||
}
|
||||
|
||||
$spCriteriaValue = $this->resolveDate($spCriteriaValue);
|
||||
|
||||
if ($spCriteriaModifier == 'starts with') {
|
||||
$spCriteriaValue = "{$spCriteriaValue}%";
|
||||
} elseif ($spCriteriaModifier == 'ends with') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue