1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
store_docs_element.php
См. документацию.
1<?php
2
4
6
8{
9 protected static function CheckFields($action, &$arFields)
10 {
11 if((($action == 'ADD') || isset($arFields["DOC_ID"])) && intval($arFields["DOC_ID"]) <= 0)
12 {
13 return false;
14 }
15 if((isset($arFields["ELEMENT_ID"])) && intval($arFields["ELEMENT_ID"]) <= 0)
16 {
17 return false;
18 }
19 if((isset($arFields["PURCHASING_PRICE"])))
20 {
21 $arFields["PURCHASING_PRICE"] = preg_replace("|\s|", '', $arFields["PURCHASING_PRICE"]);
22 }
23
24 return true;
25 }
26
27 public static function update($id, $arFields)
28 {
29 $id = intval($id);
30
31 foreach(GetModuleEvents("catalog", "OnBeforeCatalogStoreDocsElementUpdate", true) as $arEvent)
32 if(ExecuteModuleEventEx($arEvent, array($id, &$arFields)) === false)
33 return false;
34
35 if($id < 0 || !self::CheckFields('UPDATE',$arFields))
36 return false;
37 global $DB;
38 $strUpdate = $DB->PrepareUpdate("b_catalog_docs_element", $arFields);
39 $strSql = "UPDATE b_catalog_docs_element SET ".$strUpdate." WHERE ID = ".$id;
40 if(!$DB->Query($strSql, true))
41 return false;
42
43 foreach(GetModuleEvents("catalog", "OnCatalogStoreDocsElementUpdate", true) as $arEvent)
44 ExecuteModuleEventEx($arEvent, array($id, $arFields));
45 return true;
46 }
47
48 public static function delete($id)
49 {
50 global $DB;
51 $id = intval($id);
52 if($id > 0)
53 {
54 foreach(GetModuleEvents("catalog", "OnBeforeCatalogStoreDocsElementDelete", true) as $arEvent)
55 if(ExecuteModuleEventEx($arEvent, array($id)) === false)
56 return false;
57
58 $DB->Query("DELETE FROM b_catalog_docs_barcode WHERE DOC_ELEMENT_ID = ".$id." ", true);
59 $DB->Query("DELETE FROM b_catalog_docs_element WHERE ID = ".$id." ", true);
60
61 foreach(GetModuleEvents("catalog", "OnCatalogStoreDocsElementDelete", true) as $arEvent)
62 ExecuteModuleEventEx($arEvent, array($id));
63
64 return true;
65 }
66 return false;
67 }
68
76 public static function OnDocumentBarcodeDelete($id): bool
77 {
78 $id = (int)$id;
80
81 foreach(GetModuleEvents("catalog", "OnDocumentElementDelete", true) as $event)
82 {
84 }
85
86 return true;
87 }
88}
static update($id, $arFields)
Определения store_docs_element.php:27
static OnDocumentBarcodeDelete($id)
Определения store_docs_element.php:76
static CheckFields($action, &$arFields)
Определения store_docs_element.php:9
$arFields
Определения dblapprove.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
global $DB
Определения cron_frame.php:29
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
$event
Определения prolog_after.php:141
$action
Определения file_dialog.php:21