コード例 #1
0
ファイル: price.php プロジェクト: k-kalashnikov/geekcon_new
 function Add($arFields, $boolRecalc = false)
 {
     global $DB;
     if (!CPrice::CheckFields("ADD", $arFields, 0)) {
         return false;
     }
     $boolBase = false;
     $arFields['RECALC'] = $boolRecalc === true ? true : false;
     $events = GetModuleEvents("catalog", "OnBeforePriceAdd");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     if (!empty($arFields['RECALC']) && $arFields['RECALC'] === true) {
         CPrice::ReCountFromBase($arFields, $boolBase);
     }
     $arInsert = $DB->PrepareInsert("b_catalog_price", $arFields);
     $strSql = "INSERT INTO b_catalog_price(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = IntVal($DB->LastID());
     if ($ID > 0 && $boolBase == true) {
         CPrice::ReCountForBase($arFields);
     }
     $events = GetModuleEvents("catalog", "OnPriceAdd");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     // strange copy-paste bug
     $events = GetModuleEvents("sale", "OnPriceAdd");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
コード例 #2
0
ファイル: price.php プロジェクト: DarneoStudio/bitrix
 function Add($arFields, $boolRecalc = false)
 {
     global $DB;
     $boolBase = false;
     $arFields['RECALC'] = $boolRecalc === true;
     foreach (GetModuleEvents("catalog", "OnBeforePriceAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields));
     }
     if (!CPrice::CheckFields("ADD", $arFields, 0)) {
         return false;
     }
     if (isset($arFields['RECALC']) && $arFields['RECALC'] === true) {
         CPrice::ReCountFromBase($arFields, $boolBase);
         if (!$boolBase && $arFields['EXTRA_ID'] <= 0) {
             return false;
         }
     }
     $arInsert = $DB->PrepareInsert("b_catalog_price", $arFields);
     $strSql = "INSERT INTO b_catalog_price(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = (int) $DB->LastID();
     if ($ID > 0 && $boolBase) {
         CPrice::ReCountForBase($arFields);
     }
     foreach (GetModuleEvents("catalog", "OnPriceAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     // strange copy-paste bug
     foreach (GetModuleEvents("sale", "OnPriceAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
コード例 #3
0
ファイル: price.php プロジェクト: k-kalashnikov/geekcon_new
 function Update($ID, $arFields, $boolRecalc = false)
 {
     global $DB;
     $ID = IntVal($ID);
     if ($ID <= 0) {
         return False;
     }
     if (!CPrice::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     }
     $boolBase = false;
     $arFields['RECALC'] = $boolRecalc === true ? true : false;
     $db_events = GetModuleEvents("catalog", "OnBeforePriceUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     if (!empty($arFields['RECALC']) && $arFields['RECALC'] === true) {
         CPrice::ReCountFromBase($arFields, $boolBase);
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_price", $arFields);
     $strSql = "UPDATE b_catalog_price SET " . $strUpdate . " WHERE ID = " . $ID . " ";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($boolBase == true) {
         CPrice::ReCountForBase($arFields);
     }
     $events = GetModuleEvents("catalog", "OnPriceUpdate");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     return $ID;
 }
コード例 #4
0
ファイル: price.php プロジェクト: ASDAFF/entask.ru
	function Update($ID, $arFields,$boolRecalc = false)
	{
		global $DB;

		$ID = intval($ID);
		if ($ID <= 0)
			return false;

		$boolBase = false;
		$arFields['RECALC'] = ($boolRecalc === true ? true : false);

		foreach (GetModuleEvents("catalog", "OnBeforePriceUpdate", true) as $arEvent)
		{
			if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields))===false)
				return false;
		}

		if (!CPrice::CheckFields("UPDATE", $arFields, $ID))
			return false;

		if (isset($arFields['RECALC']) && $arFields['RECALC'] === true)
		{
			CPrice::ReCountFromBase($arFields, $boolBase);
			if (!$boolBase && 0 >= $arFields['EXTRA_ID'])
			{
				return false;
			}
		}

		$strUpdate = $DB->PrepareUpdate("b_catalog_price", $arFields);
		if (!empty($strUpdate))
		{
			$strSql = "UPDATE b_catalog_price SET ".$strUpdate." WHERE ID = ".$ID;
			$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		}

		if ($boolBase)
		{
			CPrice::ReCountForBase($arFields);
		}

		foreach (GetModuleEvents("catalog", "OnPriceUpdate", true) as $arEvent)
		{
			ExecuteModuleEventEx($arEvent, array($ID, $arFields));
		}

		return $ID;
	}