issue #2227 like for date_posted, display all presets for date_created

This commit is contained in:
plegall
2024-09-20 14:21:28 +02:00
parent 49b2ab3855
commit a3e9ed23ce
9 changed files with 18 additions and 17 deletions
+1 -1
View File
@@ -485,11 +485,11 @@ SELECT
$has_filters_filled = true;
$options = array(
'24h' => '24 HOUR',
'7d' => '7 DAY',
'30d' => '30 DAY',
'3m' => '3 MONTH',
'6m' => '6 MONTH',
'12m' => '12 MONTH',
);
if (isset($options[ $search['fields']['date_created']['preset'] ]) and 'custom' != $search['fields']['date_created']['preset'])
+7 -10
View File
@@ -229,11 +229,11 @@ SELECT
{
$query = '
SELECT
SUBDATE(NOW(), INTERVAL 24 HOUR) AS 24h,
SUBDATE(NOW(), INTERVAL 7 DAY) AS 7d,
SUBDATE(NOW(), INTERVAL 30 DAY) AS 30d,
SUBDATE(NOW(), INTERVAL 3 MONTH) AS 3m,
SUBDATE(NOW(), INTERVAL 6 MONTH) AS 6m
SUBDATE(NOW(), INTERVAL 6 MONTH) AS 6m,
SUBDATE(NOW(), INTERVAL 12 MONTH) AS 12m
;';
$thresholds = query2array($query)[0];
@@ -285,23 +285,20 @@ SELECT
}
$label_for_threshold = array(
'24h' => l10n('last 24 hours'),
'7d' => l10n('last 7 days'),
'30d' => l10n('last 30 days'),
'3m' => l10n('last 3 months'),
'6m' => l10n('last 6 months'),
'12m' => l10n('last 12 months'),
);
$counters = array();
foreach (array_keys($label_for_threshold) as $threshold)
{
if (isset($date_created['pre_counters'][$threshold]))
{
$counters[$threshold] = array(
'label' => $label_for_threshold[$threshold],
'counter' => $date_created['pre_counters'][$threshold],
);
}
$counters[$threshold] = array(
'label' => $label_for_threshold[$threshold],
'counter' => $date_created['pre_counters'][$threshold] ?? 0,
);
}
foreach (array_keys($date_created['list_of_dates']) as $y)
+1 -1
View File
@@ -927,7 +927,7 @@ function ws_images_filteredSearch_create($params, $service)
if (isset($params['date_created_preset']))
{
if (!preg_match('/^(24h|7d|30d|3m|6m|custom|)$/', $params['date_created_preset']))
if (!preg_match('/^(7d|30d|3m|6m|12m|custom|)$/', $params['date_created_preset']))
{
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid parameter date_created_preset');
}