Example #1
0
 protected function innerDelete($ID, &$errors)
 {
     if (!CCrmProduct::CheckDeletePermission($ID)) {
         $errors[] = 'Access denied.';
         return false;
     }
     $result = CCrmProductSection::Delete($ID);
     if ($result !== true) {
         $errors[] = CCrmProductSection::GetLastError();
     }
     return $result;
 }
Example #2
0
             } else {
                 if ($elementType === 'S') {
                     $result = CCrmProductSection::Delete($ID) || CCrmProductSection::GetLastErrorCode() === CCrmProductSection::ERR_SECTION_NOT_FOUND;
                 }
             }
             if ($result) {
                 $DB->Commit();
             } else {
                 if ($errorMessage !== '') {
                     $errorMessage .= '<br />';
                 }
                 if ($elementType === 'P') {
                     $errorMessage .= CCrmProduct::GetLastError();
                 } else {
                     if ($elementType === 'S') {
                         $errorMessage .= CCrmProductSection::GetLastError();
                     }
                 }
                 $DB->Rollback();
             }
         }
     }
     if (strlen($errorMessage) > 0) {
         $errorID = uniqid('crm_err_');
         $_SESSION[$errorID] = $errorMessage;
         LocalRedirect(CHTTP::urlAddParams($APPLICATION->GetCurPage(), array('error' => $errorID)));
     }
     if (!$actionData['AJAX_CALL']) {
         LocalRedirect($bInternal ? '?' . $arParams['FORM_ID'] . '_active_tab=tab_product' : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCT_LIST'], array('section_id' => $sectionID)));
     }
 }