Server IP : 85.193.89.191 / Your IP : 18.221.211.46 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/bitrix/modules/catalog/general/ |
Upload File : |
<?php use Bitrix\Catalog; IncludeModuleLangFile(__FILE__); class CCatalogStoreDocsBarcodeAll { protected static function checkFields($action, &$arFields) { if ((($action == 'ADD') || is_set($arFields, "BARCODE")) && ($arFields["BARCODE"] == '')) { $GLOBALS["APPLICATION"]->ThrowException(GetMessage("CP_EMPTY_BARCODE")); return false; } return true; } public static function update($id, $arFields) { $id=intval($id); foreach(GetModuleEvents("catalog", "OnBeforeCatalogStoreDocsBarcodeUpdate", true) as $arEvent) if(ExecuteModuleEventEx($arEvent, array($id, &$arFields)) === false) return false; if($id < 0 || !self::checkFields('UPDATE', $arFields)) return false; global $DB; $strUpdate = $DB->PrepareUpdate("b_catalog_docs_barcode", $arFields); $strSql = "UPDATE b_catalog_docs_barcode SET ".$strUpdate." WHERE ID = ".$id; if(!$DB->Query($strSql, true, "File: ".__FILE__."<br>Line: ".__LINE__)) return false; foreach(GetModuleEvents("catalog", "OnStoreDocsBarcodeUpdate", true) as $arEvent) ExecuteModuleEventEx($arEvent, array($id, $arFields)); return true; } public static function delete($id) { global $DB; $id = intval($id); if ($id > 0) { foreach(GetModuleEvents("catalog", "OnBeforeCatalogStoreDocsBarcodeDelete", true) as $arEvent) if(ExecuteModuleEventEx($arEvent, array($id)) === false) return false; $DB->Query("DELETE FROM b_catalog_docs_barcode WHERE ID = ".$id." ", true); foreach (GetModuleEvents("catalog", "OnCatalogStoreDocsBarcodeDelete", true) as $arEvent) ExecuteModuleEventEx($arEvent, array($id)); return true; } return false; } /** * @deprecated * @see Catalog\StoreDocumentBarcodeTable::deleteByDocument * * @param $id * @return bool */ public static function OnBeforeDocumentDelete($id): bool { $id = (int)$id; Catalog\StoreDocumentBarcodeTable::deleteByDocument($id); foreach(GetModuleEvents('catalog', 'OnDocumentBarcodeDelete', true) as $arEvent) { ExecuteModuleEventEx($arEvent, [$id]); } return true; } }