protected function innerAdd(&$fields, &$errors, array $params = null) { /** @global CMain $APPLICATION */ global $APPLICATION; if (!CCrmStatus::CheckCreatePermission()) { $errors[] = 'Access denied.'; return false; } $statusInvoice = new CCrmStatusInvoice('INVOICE_STATUS'); $result = $statusInvoice->Add($fields); if ($result === false) { if ($e = $APPLICATION->GetException()) { $errors[] = $e->GetString(); } else { $errors[] = 'Error on creating status.'; } } else { $result = ord($result); } return $result; }