public function releaseAll($reason = '', $cost = 0)
{
/*
* Only allow the previous state of on-hold
*/
$this->validatePreviousState([$this::STATE_INVENTORY_ON_HOLD], $this::STATE_INVENTORY_RELEASED);
$released = $this->getAttribute('quantity');
$this->setAttribute('quantity', 0);
$this->setAttribute('state', $this::STATE_INVENTORY_RELEASED);
if (empty($reason)) {
$reason = $this->getTransactionReason('released');
}
return $this->processStockPutAndSave($released, 'inventory.transaction.released', $reason, $cost);
}