當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCatalogDiscountSave::CheckFields方法代碼示例

本文整理匯總了PHP中CCatalogDiscountSave::CheckFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogDiscountSave::CheckFields方法的具體用法?PHP CCatalogDiscountSave::CheckFields怎麽用?PHP CCatalogDiscountSave::CheckFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCatalogDiscountSave的用法示例。


在下文中一共展示了CCatalogDiscountSave::CheckFields方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Add

 public function Add($arFields, $boolCalc = false)
 {
     global $DB;
     if (!CCatalogDiscountSave::CheckFields("ADD", $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_catalog_discount", $arFields);
     $strSql = "INSERT INTO b_catalog_discount(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = intval($DB->LastID());
     if ($ID > 0) {
         foreach ($arFields['RANGES'] as &$arRange) {
             $arRange['DISCOUNT_ID'] = $ID;
             $arInsert = $DB->PrepareInsert("b_catalog_disc_save_range", $arRange);
             $strSql = "INSERT INTO b_catalog_disc_save_range(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         foreach ($arFields['GROUP_IDS'] as &$intGroupID) {
             $strSql = "INSERT INTO b_catalog_disc_save_group(DISCOUNT_ID,GROUP_ID) VALUES(" . $ID . "," . $intGroupID . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         $boolCalc = $boolCalc === true ? true : false;
         if ($boolCalc) {
             CCatalogDiscountSave::UserDiscountCalc($ID, $arFields, false);
         }
     }
     return $ID;
 }
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:28,代碼來源:discount_save.php

示例2: Update

 public function Update($intID, $arFields, $boolCalc = false)
 {
     global $DB;
     $intID = (int) $intID;
     if ($intID <= 0) {
         return false;
     }
     if (!CCatalogDiscountSave::CheckFields('UPDATE', $arFields, $intID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_discount", $arFields);
     if (!empty($strUpdate)) {
         $strSql = "update b_catalog_discount SET " . $strUpdate . " where ID = " . $intID . " and TYPE = " . self::ENTITY_ID;
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     if (!empty($arFields['RANGES'])) {
         $DB->Query("delete from b_catalog_disc_save_range where DISCOUNT_ID = " . $intID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         foreach ($arFields['RANGES'] as &$arRange) {
             $arRange['DISCOUNT_ID'] = $intID;
             $arInsert = $DB->PrepareInsert("b_catalog_disc_save_range", $arRange);
             $strSql = "insert into b_catalog_disc_save_range(" . $arInsert[0] . ") values(" . $arInsert[1] . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         unset($arRange);
     }
     if (!empty($arFields['GROUP_IDS'])) {
         $DB->Query("delete from b_catalog_disc_save_group where DISCOUNT_ID = " . $intID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         foreach ($arFields['GROUP_IDS'] as &$intGroupID) {
             $strSql = "insert into b_catalog_disc_save_group(DISCOUNT_ID,GROUP_ID) values(" . $intID . "," . $intGroupID . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         unset($intGroupID);
     }
     $boolCalc = $boolCalc === true;
     if ($boolCalc) {
         CCatalogDiscountSave::UserDiscountCalc($intID, $arFields, false);
     }
     return $intID;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:39,代碼來源:discount_save.php

示例3: Update

 public function Update($intID, $arFields, $boolCalc = false)
 {
     global $DB;
     global $stackCacheManager;
     global $USER;
     $intID = intval($intID);
     if ($intID <= 0) {
         return false;
     }
     $arFields1 = array();
     if (array_key_exists('CREATED_BY', $arFields)) {
         unset($arFields['CREATED_BY']);
     }
     if (array_key_exists('DATE_CREATE', $arFields)) {
         unset($arFields['DATE_CREATE']);
     }
     if (array_key_exists('TIMESTAMP_X', $arFields)) {
         unset($arFields['TIMESTAMP_X']);
     }
     if (isset($USER) && $USER instanceof CUser && 'CUser' == get_class($USER)) {
         if (!array_key_exists('MODIFIED_BY', $arFields) || intval($arFields["MODIFIED_BY"]) <= 0) {
             $arFields["MODIFIED_BY"] = intval($USER->GetID());
         }
     }
     $arFields1['TIMESTAMP_X'] = $DB->GetNowFunction();
     if (!CCatalogDiscountSave::CheckFields('UPDATE', $arFields, $intID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_discount", $arFields);
     if (!empty($strUpdate)) {
         foreach ($arFields1 as $key => $value) {
             if (strlen($strUpdate) > 0) {
                 $strUpdate .= ", ";
             }
             $strUpdate .= $key . "=" . $value . " ";
         }
         $strSql = "UPDATE b_catalog_discount SET " . $strUpdate . " WHERE ID = " . $intID . " AND TYPE = " . DISCOUNT_TYPE_SAVE;
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     if (!empty($arFields['RANGES'])) {
         $DB->Query("delete from b_catalog_disc_save_range where DISCOUNT_ID = " . $intID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         foreach ($arFields['RANGES'] as &$arRange) {
             $arRange['DISCOUNT_ID'] = $intID;
             $arInsert = $DB->PrepareInsert("b_catalog_disc_save_range", $arRange);
             $strSql = "INSERT INTO b_catalog_disc_save_range(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         if (isset($arRange)) {
             unset($arRange);
         }
     }
     if (!empty($arFields['GROUP_IDS'])) {
         $DB->Query("delete from b_catalog_disc_save_group where DISCOUNT_ID = " . $intID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         foreach ($arFields['GROUP_IDS'] as &$intGroupID) {
             $strSql = "INSERT INTO b_catalog_disc_save_group(DISCOUNT_ID,GROUP_ID) VALUES(" . $intID . "," . $intGroupID . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         if (isset($intGroupID)) {
             unset($intGroupID);
         }
     }
     $boolCalc = $boolCalc === true ? true : false;
     if ($boolCalc) {
         CCatalogDiscountSave::UserDiscountCalc($ID, $arFields, false);
     }
     return $intID;
 }
開發者ID:k-kalashnikov,項目名稱:geekcon_new,代碼行數:67,代碼來源:discount_save.php


注:本文中的CCatalogDiscountSave::CheckFields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。