本文整理汇总了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;
}
示例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;
}
示例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;
}