Fixed Preorder order_date saving and getting setup price

This commit is contained in:
Frank Schubert
2025-08-06 14:10:18 +02:00
parent b4cdbd0b6b
commit 2adf180c09
4 changed files with 22 additions and 7 deletions

View File

@@ -18,6 +18,8 @@ define("MFBASE_BYPASS_LOGIN", true);
$db = FronkDB::singleton();
$db = $db->link;
$log = mfLoghandler::singleton();
function logMessage($message): void {
echo "[" . date("Y-m-d H:i:s") . "] " . $message . "\n";
}

View File

@@ -3,6 +3,7 @@
global $db;
require_once __DIR__.'/init.php';
$earliest_order_date = new DateTime("2025-05-01");
$earliest_order_date->setTimezone(new DateTimeZone("Europe/Vienna"));
@@ -37,6 +38,7 @@ WHERE p.type = 'order'
AND psnl.id IS NULL -- No existing '300-custom-new-order' notification
AND p.create > ".$earliest_order_date->getTimestamp()." -- no older than \$earliest_order_date
AND p.create < (UNIX_TIMESTAMP(NOW()) - 7200) -- Only consider preorders older than 2 hours
AND p.id=22456
ORDER BY p.id ASC;";
$res = $db->query($sql);
@@ -118,8 +120,10 @@ while($row = $res->fetch_assoc()) {
} else {
$order_date = new DateTime('@'.$preorder->create);
}
$order_date->setTime(4,0,0);
$order_date->setTimezone(new DateTimeZone("Europe/Vienna"));
$order_date->setTime(4,0,0);
$product = PreorderProduct::getFirst(["type" => "enduser_setup"]);
if(!$product) {
@@ -144,6 +148,8 @@ while($row = $res->fetch_assoc()) {
$price_setup *= 1.2;
}
$log->debug(__FILE__.": Sending template $template_embed_name for Preorder ".$preorder->id." OAID ".$preorder->oaid);
sendPreorderEmail(
$mailtemplate,
$preordercampaign,