added new custom 300 table

This commit is contained in:
Luca Haid
2025-07-09 15:35:59 +02:00
parent 588cf60bc0
commit 40fcff65f5
4 changed files with 185 additions and 1 deletions

View File

@@ -948,6 +948,15 @@ class PreorderModel
}
}
if (array_key_exists("billed", $filter)) {
$billed = $filter['billed'];
if ($billed == 0 || $billed === null) {
$where .= " AND (tt_preorder.billed IS NULL OR tt_preorder.billed = 0)";
} elseif ($billed) {
$where .= " AND tt_preorder.billed > 0";
}
}
if (array_key_exists("plz", $filter)) {
$plz = FronkDB::singleton()->escape($filter['plz']);
if ($plz) {
@@ -1255,5 +1264,42 @@ class PreorderModel
return 0;
}
public static function getAll300CustomPreorders() {
$sql = "SELECT
p.id AS preorder_id,
p.ucode,
p.email AS preorder_email,
p.type AS preorder_type,
p.preordercampaign_id,
pc.name AS campaign_name,
ps_current.code AS current_status_code,
ps_current.name AS current_status_name,
psnl.email AS notification_logged_email,
psnl.email_type AS notification_type_logged,
FROM_UNIXTIME(psnl.create) AS notification_log_timestamp
FROM
PreorderStatusnotificationLog psnl
INNER JOIN
Preorder p ON psnl.preorder_id = p.id
INNER JOIN
Preordercampaign pc ON p.preordercampaign_id = pc.id
INNER JOIN
Preorderstatus ps_current ON p.status_id = ps_current.id
WHERE
psnl.email_type = '300-custom'
ORDER BY
psnl.create DESC;";
$db = FronkDB::singleton();
$res = $db->query($sql);
$items = [];
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = $data;
}
}
return $items;
}
}