/** * Will update payment status to "Paid if there is no outstanding amount". */ function updatePaymentStatus() { if ($this->Total() > 0 && $this->TotalOutstanding() <= 0) { //TODO: only run this if it is setting to Paid, and not cancelled or similar $this->Status = 'Paid'; $this->write(); $logEntry = new OrderStatusLog(); $logEntry->OrderID = $this->ID; $logEntry->Status = 'Paid'; $logEntry->write(); } }