Example #1
0
 function Add($arFields)
 {
     global $DB;
     if (!CExtra::CheckFields('ADD', $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_catalog_extra", $arFields);
     $strSql = "INSERT INTO b_catalog_extra(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = intval($DB->LastID());
     CExtra::ClearCache();
     return $ID;
 }
Example #2
0
 function Add($arFields)
 {
     global $DB;
     if (!CExtra::CheckFields('ADD', $arFields, 0)) {
         return false;
     }
     $intID = '';
     if (!CExtra::PrepareInsert($arFields, $intID)) {
         return false;
     }
     $res = $DB->Insert('b_catalog_extra', $arFields, "File: " . __FILE__ . "<br>Line: " . __LINE__, false, $intID);
     unset($GLOBALS["MAIN_EXTRA_LIST_CACHE"]);
     return $res;
 }
Example #3
0
 function Update($ID, $arFields)
 {
     global $DB;
     $ID = intval($ID);
     if (!CExtra::CheckFields('UPDATE', $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_extra", $arFields);
     $strSql = "UPDATE b_catalog_extra SET " . $strUpdate . " WHERE ID = '" . intval($ID) . "'";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (!empty($arFields["RECALCULATE"]) && $arFields["RECALCULATE"] == "Y") {
         CPrice::ReCalculate("EXTRA", $ID, $arFields["PERCENTAGE"]);
     }
     unset($GLOBALS["MAIN_EXTRA_LIST_CACHE"]);
     return true;
 }
Example #4
0
 function Update($ID, $arFields)
 {
     global $DB;
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     if (!CExtra::CheckFields('UPDATE', $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_extra", $arFields);
     if (!empty($strUpdate)) {
         $strSql = "UPDATE b_catalog_extra SET " . $strUpdate . " WHERE ID = " . $ID;
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if (isset($arFields['RECALCULATE']) && 'Y' == $arFields['RECALCULATE']) {
             CPrice::ReCalculate('EXTRA', $ID, $arFields['PERCENTAGE']);
         }
         CExtra::ClearCache();
     }
     return true;
 }