} // Prepares the associated data of an order.
$data =
$this->
getAssociatedData($data);
// Before we can create the status mail, we need to save the order data.
// Otherwise, the status mail would be created with the old order status and amount.
$statusBefore =
$order->
getOrderStatus();
$clearedBefore =
$order->
getPaymentStatus();
$invoiceShippingBefore =
$order->
getInvoiceShipping();
$invoiceShippingNetBefore =
$order->
getInvoiceShippingNet();
if (!
empty($data['clearedDate'
])) { try { $data['clearedDate'
] =
new DateTime($data['clearedDate'
]);
} catch (Exception
$e) { $data['clearedDate'
] = null;
} } if (isset($data['orderTime'
])) { unset($data['orderTime'
]);
}