Esempio n. 1
0
         } else {
             // Fix for issue #26628
             $arFilterDel += $arFilter;
         }
         if (!$isAdmin) {
             $arFilterDel['!=STATUS_ID'] = 'CONVERTED';
         }
         $obRes = CCrmLead::GetListEx(array(), $arFilterDel, false, false, array('ID'));
         while ($arLead = $obRes->Fetch()) {
             $ID = $arLead['ID'];
             $arEntityAttr = $CCrmPerms->GetEntityAttr('LEAD', array($ID));
             if (!$CCrmPerms->CheckEnityAccess('LEAD', 'DELETE', $arEntityAttr[$ID])) {
                 continue;
             }
             $DB->StartTransaction();
             if ($CCrmBizProc->Delete($ID, $arEntityAttr[$ID]) && $CCrmLead->Delete($ID, array('CHECK_DEPENDENCIES' => true, 'PROCESS_BIZPROC' => false))) {
                 $DB->Commit();
             } else {
                 $arErrors[] = $CCrmLead->LAST_ERROR;
                 $DB->Rollback();
             }
         }
     }
 } elseif ($actionData['NAME'] == 'edit') {
     if (isset($actionData['FIELDS']) && is_array($actionData['FIELDS'])) {
         foreach ($actionData['FIELDS'] as $ID => $arSrcData) {
             $arEntityAttr = $CCrmPerms->GetEntityAttr('LEAD', array($ID));
             if (!$CCrmPerms->CheckEnityAccess('LEAD', 'WRITE', $arEntityAttr[$ID])) {
                 continue;
             }
             $dbLead = CCrmLead::GetListEx(array(), array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('STATUS_ID'), array());
Esempio n. 2
0
         $arFilterDel = array();
         if (!$actionData['ALL_ROWS']) {
             $arFilterDel = array('ID' => $actionData['ID']);
         } else {
             // Fix for issue #26628
             $arFilterDel += $arFilter;
         }
         $obRes = CCrmContact::GetListEx(array(), $arFilterDel, false, false, array('ID'));
         while ($arContact = $obRes->Fetch()) {
             $ID = $arContact['ID'];
             $arEntityAttr = $CCrmPerms->GetEntityAttr('CONTACT', array($ID));
             if (!$CCrmPerms->CheckEnityAccess('CONTACT', 'DELETE', $arEntityAttr[$ID])) {
                 continue;
             }
             $DB->StartTransaction();
             if ($CCrmBizProc->Delete($ID, $arEntityAttr[$ID]) && $CCrmContact->Delete($ID, array('PROCESS_BIZPROC' => false))) {
                 $DB->Commit();
             } else {
                 $DB->Rollback();
             }
         }
     }
 } elseif ($actionData['NAME'] == 'edit') {
     if (isset($actionData['FIELDS']) && is_array($actionData['FIELDS'])) {
         foreach ($actionData['FIELDS'] as $ID => $arSrcData) {
             $arEntityAttr = $CCrmPerms->GetEntityAttr('CONTACT', array($ID));
             if (!$CCrmPerms->CheckEnityAccess('CONTACT', 'WRITE', $arEntityAttr[$ID])) {
                 continue;
             }
             $arUpdateData = array();
             reset($arResult['HEADERS']);
Esempio n. 3
0
                 if (CCrmContact::CheckReadPermission($ID)) {
                     LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $ID)));
                 }
             }
             //save
             LocalRedirect(isset($_REQUEST['backurl']) && $_REQUEST['backurl'] !== '' ? $_REQUEST['backurl'] : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_LIST'], array()));
         }
     }
 } else {
     if (isset($_GET['delete']) && check_bitrix_sessid()) {
         if ($isEditMode) {
             $arResult['ERROR_MESSAGE'] = '';
             if (!CCrmContact::CheckDeletePermission($arParams['ELEMENT_ID'], $userPermissions)) {
                 $arResult['ERROR_MESSAGE'] .= GetMessage('CRM_PERMISSION_DENIED') . '<br />';
             }
             $bDeleteError = !$CCrmBizProc->Delete($arResult['ELEMENT']['ID'], $arEntityAttr[$arParams['ELEMENT_ID']]);
             if ($bDeleteError) {
                 $arResult['ERROR_MESSAGE'] .= $CCrmBizProc->LAST_ERROR;
             }
             if (empty($arResult['ERROR_MESSAGE']) && !$CCrmContact->Delete($arResult['ELEMENT']['ID'], array('PROCESS_BIZPROC' => false))) {
                 $arResult['ERROR_MESSAGE'] = GetMessage('CRM_DELETE_ERROR');
             }
             if (empty($arResult['ERROR_MESSAGE'])) {
                 LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_LIST']));
             } else {
                 ShowError($arResult['ERROR_MESSAGE']);
                 return;
             }
         } else {
             ShowError(GetMessage('CRM_DELETE_ERROR'));
             return;