示例#1
0
     }
     $filter = array('CHECK_PERMISSIONS' => 'N');
     if ($lastItemID > 0) {
         $filter['>ID'] = $lastItemID;
     }
     $dbResult = CCrmDeal::GetListEx(array('ID' => 'ASC'), $filter, false, array('nTopCount' => 10), array('ID'));
     $itemIDs = array();
     $itemQty = 0;
     if (is_object($dbResult)) {
         while ($fields = $dbResult->Fetch()) {
             $itemIDs[] = intval($fields['ID']);
             $itemQty++;
         }
     }
     if ($itemQty > 0) {
         CCrmDeal::RebuildEntityAccessAttrs($itemIDs);
         $progressData['TOTAL_ITEMS'] = $totalItemQty;
         $processedItemQty += $itemQty;
         $progressData['PROCESSED_ITEMS'] = $processedItemQty;
         $progressData['LAST_ITEM_ID'] = $itemIDs[$itemQty - 1];
         COption::SetOptionString('crm', '~CRM_REBUILD_DEAL_ATTR_PROGRESS', serialize($progressData));
         __CrmConfigPermsEndResonse(array('STATUS' => 'PROGRESS', 'PROCESSED_ITEMS' => $processedItemQty, 'TOTAL_ITEMS' => $totalItemQty, 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_PROGRESS_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty, '#TOTAL_ITEMS#' => $totalItemQty))));
     } else {
         COption::RemoveOption('crm', '~CRM_REBUILD_DEAL_ATTR');
         COption::RemoveOption('crm', '~CRM_REBUILD_DEAL_ATTR_PROGRESS');
         __CrmConfigPermsEndResonse(array('STATUS' => 'COMPLETED', 'PROCESSED_ITEMS' => $processedItemQty, 'TOTAL_ITEMS' => $totalItemQty, 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_COMPLETED_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty))));
     }
 } elseif ($entityTypeID === CCrmOwnerType::Lead) {
     if (!CCrmLead::CheckUpdatePermission(0)) {
         __CrmConfigPermsEndResonse(array('ERROR' => 'Access denied.'));
     }