added new filter
This commit is contained in:
@@ -566,6 +566,29 @@ class PreorderModel
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
|
||||
if (isset($filter['status']) && !empty($filter['status']) && (!empty($filter['create_from']) || !empty($filter['create_to']))) {
|
||||
$historyConditions = [
|
||||
"`key` = 'status_id'",
|
||||
"new_value = " . intval($filter['status'][0])
|
||||
];
|
||||
|
||||
if (!empty($filter['create_from']) && ($date = DateTime::createFromFormat('d.m.Y', $filter['create_from']))) {
|
||||
$historyConditions[] = "`create` >= " . $date->setTime(0, 0)->getTimestamp();
|
||||
}
|
||||
|
||||
if (!empty($filter['create_to']) && ($date = DateTime::createFromFormat('d.m.Y', $filter['create_to']))) {
|
||||
$historyConditions[] = "`create` <= " . $date->setTime(23, 59, 59)->getTimestamp();
|
||||
}
|
||||
|
||||
$filter['add-where'] = "AND tt_preorder.id IN (
|
||||
SELECT preorder_id FROM `" . FRONKDB_DBNAME . "`.PreorderHistory
|
||||
WHERE " . implode(' AND ', $historyConditions) . "
|
||||
)";
|
||||
|
||||
unset($filter['status_id'], $filter['create_from'], $filter['create_to']);
|
||||
}
|
||||
|
||||
$where = "1=1 ";
|
||||
|
||||
if (array_key_exists("deleted", $filter)) {
|
||||
|
||||
Reference in New Issue
Block a user