Exemplo n.º 1
0
 protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
 {
     if (!CCrmProduct::CheckUpdatePermission($ID)) {
         $errors[] = 'Access denied.';
         return false;
     }
     $result = CCrmProductSection::Update($ID, $fields);
     if ($result !== true) {
         $errors[] = CCrmProductSection::GetLastError();
     }
     return $result;
 }
Exemplo n.º 2
0
 if ($actionData['NAME'] == 'edit' && $arResult['CAN_EDIT']) {
     if (isset($actionData['FIELDS']) && is_array($actionData['FIELDS'])) {
         foreach ($actionData['FIELDS'] as $ID => $arSrcData) {
             $type = substr($ID, 0, 1);
             $ID = intval(substr($ID, 1));
             if ($type === 'S') {
                 $arUpdateData = array();
                 reset($arResult['HEADERS']);
                 foreach ($arResult['HEADERS'] as $arHead) {
                     if (isset($arHead['editable']) && $arHead['editable'] == true && isset($arSrcData[$arHead['id']])) {
                         $arUpdateData[$arHead['id']] = $arSrcData[$arHead['id']];
                     }
                 }
                 if (!empty($arUpdateData)) {
                     $DB->StartTransaction();
                     if (CCrmProductSection::Update($ID, $arUpdateData)) {
                         $DB->Commit();
                     } else {
                         if ($errorMessage !== '') {
                             $errorMessage .= '<br />';
                         }
                         $errorMessage .= CCrmProduct::GetLastError();
                     }
                 }
             } else {
                 $arUpdateData = array();
                 reset($arResult['HEADERS']);
                 foreach ($arResult['HEADERS'] as $arHead) {
                     if (isset($arHead['editable']) && $arHead['editable'] == true && isset($arSrcData[$arHead['id']])) {
                         $arUpdateData[$arHead['id']] = $arSrcData[$arHead['id']];
                     }