Ejemplo n.º 1
0
 public function validateParamsKpiReport(&$params)
 {
     if (!isset($params[ReportFilterFields::ORGANIZATION])) {
         $params[ReportFilterFields::ORGANIZATION] = \App::getOrgUserLogged()->id;
     }
     if (Mapper\OrganizationMapper::getTypeByOrgId($params[ReportFilterFields::ORGANIZATION]) !== Model\Organization\OrgServiceProviderModel::ORG_TYPE) {
         throw new InvalidArgumentException('Invalid parameter value: ' . ReportFilterFields::ORGANIZATION . '. Organization must be a provider.');
     }
     if (isset($params['groupBy']) && !in_array($params['groupBy'], ReportModel::getKpiGroups())) {
         throw new InvalidArgumentException('Invalid groupBy ' . $params['groupBy']);
     }
 }