%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.129.195.209 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/general/ |
Upload File : |
<?php use Bitrix\Main\Localization\Loc; Loc::loadMessages(__FILE__); class CAllCatalogContractor { protected static function checkFields($action, &$arFields) { $personType = intval($arFields["PERSON_TYPE"]); if($personType == CONTRACTOR_JURIDICAL && is_set($arFields, "COMPANY") && $arFields["COMPANY"] == '') { $GLOBALS["APPLICATION"]->ThrowException(Loc::getMessage("CC_EMPTY_COMPANY")); return false; } if (((($action == 'ADD' || is_set($arFields, "PERSON_NAME")) && $arFields["PERSON_NAME"] == '') && $personType == CONTRACTOR_INDIVIDUAL)) { $GLOBALS["APPLICATION"]->ThrowException(Loc::getMessage("CC_WRONG_PERSON_LASTNAME")); return false; } if (($action == 'UPDATE') && is_set($arFields, "ID")) unset($arFields["ID"]); return true; } public static function update($id, $arFields) { global $DB; $id = intval($id); if(array_key_exists('DATE_CREATE', $arFields)) unset($arFields['DATE_CREATE']); if(array_key_exists('DATE_MODIFY', $arFields)) unset($arFields['DATE_MODIFY']); if(array_key_exists('CREATED_BY', $arFields)) unset($arFields['CREATED_BY']); $arFields['~DATE_MODIFY'] = $DB->GetNowFunction(); if($id <= 0 || !self::checkFields('UPDATE', $arFields)) return false; $strUpdate = $DB->PrepareUpdate("b_catalog_contractor", $arFields); if(!empty($strUpdate)) { $strSql = "UPDATE b_catalog_contractor SET ".$strUpdate." WHERE ID = ".$id." "; $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); } return $id; } public static function delete($id) { global $DB; $id = intval($id); if($id > 0) { $dbDocument = CCatalogDocs::getList(array(), array("CONTRACTOR_ID" => $id)); if($arDocument = $dbDocument->Fetch()) { $GLOBALS["APPLICATION"]->ThrowException(Loc::getMessage("CC_CONTRACTOR_HAVE_DOCS_EXT")); return false; } return $DB->Query("DELETE FROM b_catalog_contractor WHERE ID = ".$id." ", true); } return false; } }