Ejemplo n.º 1
0
     $gridOptions = new CCrmGridOptions($gridID);
     $gridFilter = $gridOptions->GetFilter(array());
     //Clear service fields
     if (isset($gridFilter['GRID_FILTER_APPLIED'])) {
         unset($gridFilter['GRID_FILTER_APPLIED']);
     }
     if (isset($gridFilter['GRID_FILTER_ID'])) {
         unset($gridFilter['GRID_FILTER_ID']);
     }
     if (is_array($gridFilter) && !empty($gridFilter)) {
         $dbEntities = null;
         if ($entityType === 'LEAD') {
             CCrmLead::PrepareFilter($gridFilter);
             $dbEntities = CCrmLead::GetListEx(array(), $gridFilter, false, false, array('ID'));
         } elseif ($entityType === 'DEAL') {
             CCrmDeal::PrepareFilter($gridFilter);
             $dbEntities = CCrmDeal::GetListEx(array(), $gridFilter, false, false, array('ID'));
         } elseif ($entityType === 'COMPANY') {
             CCrmCompany::PrepareFilter($gridFilter);
             $dbEntities = CCrmCompany::GetListEx(array(), $gridFilter, false, false, array('ID'));
         } elseif ($entityType === 'CONTACT') {
             CCrmContact::PrepareFilter($gridFilter);
             $dbEntities = CCrmContact::GetListEx(array(), $gridFilter, false, false, array('ID'));
         }
         if ($dbEntities) {
             while ($arEntity = $dbEntities->Fetch()) {
                 $arEntityID[] = $arEntity['ID'];
             }
         }
     }
 }