public function set_status($new_status, $note = '', $manual_update = false)
{
$result = parent::set_status($new_status);
if (!empty($result['from']) && $result['from'] !== $result['to']) {
$this->status_transition = array('from' => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $result['from'], 'to' => $result['to'], 'note' => $note, 'manual' => (bool) $manual_update);
if ('pending' === $result['from'] && !$manual_update) {
$this->set_date_paid(current_time('timestamp'));
}
if ('completed' === $result['to']) {
$this->set_date_completed(current_time('timestamp'));
}
}
return $result;
}