added history timestamps to export

This commit is contained in:
Luca Haid
2025-04-07 13:01:17 +02:00
parent eb611a4f29
commit ada64d6de3

View File

@@ -12,6 +12,7 @@ if(!$no_filename) {
$status_flags_header = [];
foreach(PreorderStatusflagModel::getAll() as $sflag) {
$status_flags_header[$sflag->code] = $sflag->code;
$status_flags_header[$sflag->code . " Datum"] = $sflag->code . " Datum";
}
?>
@@ -35,6 +36,16 @@ while($data = mysqli_fetch_object($res)):
$statusflags = [];
foreach($preorder->statusflags as $sflag) {
$statusflags[$sflag->code] = $sflag->value->value ? 1 : 0;
if($sflag->value->value) {
$historyEntry = PreorderHistoryModel::getFirst([
"preorder_id" => $preorder->id,
"key" => "preorderstatusflag-".$sflag->id."-value",
"new_value" => 1
]);
$statusflags[$sflag->code . " Datum"] = ($historyEntry) ? date("Y-m-d H:i:s", $historyEntry->create) : "";
} else {
$statusflags[$sflag->code . " Datum"] = "";
}
}
$discounts = [];