public function receivedAll($reason = '', $cost = 0)
{
/*
* Only allow the previous state of ordered
*/
$this->validatePreviousState([$this::STATE_ORDERED_PENDING], $this::STATE_ORDERED_RECEIVED);
$received = $this->getAttribute('quantity');
$this->setAttribute('quantity', 0);
$this->setAttribute('state', $this::STATE_ORDERED_RECEIVED);
if (empty($reason)) {
$reason = $this->getTransactionReason('received');
}
return $this->processStockPutAndSave($received, 'inventory.transaction.received', $reason, $cost);
}