Merge branch 'Preorder/add-statusflag-history-to-export' into 'master'

added history timestamps to export

See merge request fronk/thetool!1173
This commit is contained in:
Luca Haid
2025-04-07 11:01:29 +00:00

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 = [];