static function getNextAvailableManualId($company_id = NULL) { global $current_company; if ($company_id == '' and is_object($current_company)) { $company_id = $current_company->getId(); } elseif ($company_id == '' and isset($this) and is_object($this)) { $company_id = $this->getCompany(); } $blf = new BranchListFactory(); $blf->getHighestManualIDByCompanyId($company_id); if ($blf->getRecordCount() > 0) { $next_available_manual_id = $blf->getCurrent()->getManualId() + 1; } else { $next_available_manual_id = 1; } return $next_available_manual_id; }