当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleOrder::SetAccountNumber方法代码示例

本文整理汇总了PHP中CSaleOrder::SetAccountNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrder::SetAccountNumber方法的具体用法?PHP CSaleOrder::SetAccountNumber怎么用?PHP CSaleOrder::SetAccountNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleOrder的用法示例。


在下文中一共展示了CSaleOrder::SetAccountNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Add

 function Add($arFields)
 {
     global $DB, $USER_FIELD_MANAGER, $CACHE_MANAGER;
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSaleOrder::CheckFields("ADD", $arFields)) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeOrderAdd", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
             return false;
         }
     }
     $arInsert = $DB->PrepareInsert("b_sale_order", $arFields);
     if (!array_key_exists("DATE_STATUS", $arFields)) {
         $arInsert[0] .= ", DATE_STATUS";
         $arInsert[1] .= ", " . $DB->GetNowFunction();
     }
     if (!array_key_exists("DATE_INSERT", $arFields)) {
         $arInsert[0] .= ", DATE_INSERT";
         $arInsert[1] .= ", " . $DB->GetNowFunction();
     }
     if (!array_key_exists("DATE_UPDATE", $arFields)) {
         $arInsert[0] .= ", DATE_UPDATE";
         $arInsert[1] .= ", " . $DB->GetNowFunction();
     }
     foreach ($arFields1 as $key => $value) {
         if (strlen($arInsert[0]) > 0) {
             $arInsert[0] .= ", ";
             $arInsert[1] .= ", ";
         }
         $arInsert[0] .= $key;
         $arInsert[1] .= $value;
     }
     $strSql = "INSERT INTO b_sale_order(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $ID = IntVal($DB->LastID());
     CSaleOrder::SetAccountNumber($ID);
     CSaleOrderChange::AddRecord($ID, "ORDER_ADDED");
     $USER_FIELD_MANAGER->Update("ORDER", $ID, $arFields);
     foreach (GetModuleEvents("sale", "OnOrderAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     if (defined("CACHED_b_sale_order")) {
         $CACHE_MANAGER->Read(CACHED_b_sale_order, "sale_orders");
         $CACHE_MANAGER->SetImmediate("sale_orders", true);
     }
     return $ID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:54,代码来源:order.php

示例2: Add

 function Add($arFields)
 {
     global $DB, $USER_FIELD_MANAGER, $CACHE_MANAGER, $APPLICATION;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!empty($arFields['TAX_LIST']) && is_array($arFields['TAX_LIST'])) {
         $arFields1['TAX_LIST'] = $arFields['TAX_LIST'];
     }
     if (!empty($arFields['ORDER_PROP']) && is_array($arFields['TAX_LIST'])) {
         $arFields1['ORDER_PROP'] = $arFields['ORDER_PROP'];
     }
     if (!empty($arFields['DELIVERY_PRICE']) && floatval($arFields['DELIVERY_PRICE']) > 0) {
         $arFields1['DELIVERY_PRICE'] = $arFields['DELIVERY_PRICE'];
     }
     if (array_key_exists('ONLY_FULL_PAY_FROM_ACCOUNT', $arFields)) {
         $arFields1['ONLY_FULL_PAY_FROM_ACCOUNT'] = $arFields['ONLY_FULL_PAY_FROM_ACCOUNT'];
     }
     unset($arFields['DELIVERY_PRICE']);
     unset($arFields['TAX_LIST']);
     if (!CSaleOrder::CheckFields("ADD", $arFields)) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeOrderAdd", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
             return false;
         }
     }
     if ($isOrderConverted == 'Y') {
         if (!empty($arFields1)) {
             $arFields1 = \Bitrix\Sale\Compatible\OrderCompatibility::backRawField(\Bitrix\Sale\Compatible\OrderCompatibility::ENTITY_ORDER, $arFields1);
         }
         $result = \Bitrix\Sale\Compatible\OrderCompatibility::add(array_merge($arFields, $arFields1));
         if ($result->isSuccess(true)) {
             $ID = $result->getId();
         } else {
             foreach ($result->getErrorMessages() as $error) {
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
     } else {
         $arInsert = $DB->PrepareInsert("b_sale_order", $arFields);
         if (!array_key_exists("DATE_STATUS", $arFields)) {
             $arInsert[0] .= ", DATE_STATUS";
             $arInsert[1] .= ", " . $DB->GetNowFunction();
         }
         if (!array_key_exists("DATE_INSERT", $arFields)) {
             $arInsert[0] .= ", DATE_INSERT";
             $arInsert[1] .= ", " . $DB->GetNowFunction();
         }
         if (!array_key_exists("DATE_UPDATE", $arFields)) {
             $arInsert[0] .= ", DATE_UPDATE";
             $arInsert[1] .= ", " . $DB->GetNowFunction();
         }
         foreach ($arFields1 as $key => $value) {
             if (strlen($arInsert[0]) > 0) {
                 $arInsert[0] .= ", ";
                 $arInsert[1] .= ", ";
             }
             $arInsert[0] .= $key;
             $arInsert[1] .= $value;
         }
         $strSql = "INSERT INTO b_sale_order(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $ID = IntVal($DB->LastID());
         CSaleOrder::SetAccountNumber($ID);
     }
     CSaleOrderChange::AddRecord($ID, "ORDER_ADDED");
     $USER_FIELD_MANAGER->Update("ORDER", $ID, $arFields);
     if ($isOrderConverted != 'Y') {
         foreach (GetModuleEvents("sale", "OnOrderAdd", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($ID, $arFields));
         }
     }
     if (defined("CACHED_b_sale_order")) {
         $CACHE_MANAGER->Read(CACHED_b_sale_order, "sale_orders");
         $CACHE_MANAGER->SetImmediate("sale_orders", true);
     }
     return $ID;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:86,代码来源:order.php


注:本文中的CSaleOrder::SetAccountNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。