示例#1
0
         $arGroup["ID"] = IntVal($arGroup["ID"]);
         if ($arGroup["ID"] == 1 || $arGroup["ID"] == 2 || !in_array($arGroup["ID"], $arSaleManagerGroups)) {
             continue;
         }
         $arPerms[] = array("GROUP_ID" => $arGroup["ID"], "PERM_VIEW" => ${"PM_DELETE_" . $arGroup["ID"]} == "Y" || ${"PM_UPDATE_" . $arGroup["ID"]} == "Y" || ${"PM_PAYMENT_" . $arGroup["ID"]} == "Y" || ${"PM_DELIVERY_" . $arGroup["ID"]} == "Y" || ${"PM_CANCEL_" . $arGroup["ID"]} == "Y" ? "Y" : ${"PM_VIEW_" . $arGroup["ID"]}, "PERM_CANCEL" => ${"PM_CANCEL_" . $arGroup["ID"]}, "PERM_DELIVERY" => ${"PM_DELIVERY_" . $arGroup["ID"]}, "PERM_PAYMENT" => ${"PM_PAYMENT_" . $arGroup["ID"]}, "PERM_STATUS" => ${"PM_STATUS_" . $arGroup["ID"]}, "PERM_STATUS_FROM" => ${"PM_STATUS_FROM_" . $arGroup["ID"]}, "PERM_UPDATE" => ${"PM_UPDATE_" . $arGroup["ID"]}, "PERM_DELETE" => ${"PM_DELETE_" . $arGroup["ID"]});
     }
     $arFields["PERMS"] = $arPerms;
     if (strlen($ID) > 0) {
         if (!CSaleStatus::Update($ID, $arFields)) {
             $strError .= GetMessage("ERROR_EDIT_STATUS") . "<br>";
             if ($ex = $APPLICATION->GetException()) {
                 $strError .= $ex->GetString() . ".<br>";
             }
         }
     } else {
         $ID = CSaleStatus::Add($arFields);
         if (strlen($ID) <= 0) {
             $strError .= GetMessage("ERROR_ADD_STATUS") . "<br>";
             if ($ex = $APPLICATION->GetException()) {
                 $strError .= $ex->GetString() . ".<br>";
             }
         } else {
             CSaleStatus::CreateMailTemplate($ID);
         }
     }
 }
 if (strlen($strError) > 0) {
     $bInitVars = True;
 }
 if (strlen($save) > 0 && strlen($strError) <= 0) {
     LocalRedirect("sale_status.php?lang=" . LANG . GetFilterParams("filter_", false));
示例#2
0
 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_sale_basket", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     ModuleManager::registerModule('sale');
     $eventManager = \Bitrix\Main\EventManager::getInstance();
     $eventManager->registerEventHandlerCompatible('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout');
     RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin");
     RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout");
     RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php");
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale");
     RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount");
     RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu");
     RegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer");
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr", 300);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr", 1100);
     //pulling for mobile orders
     RegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete", 100);
     RegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd", 100);
     RegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate", 100);
     // sale product2product
     RegisterModuleDependences("sale", "OnBasketOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleOrderAdd", 100);
     RegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler", 100);
     CAgent::AddAgent("\\Bitrix\\Sale\\Product2ProductTable::deleteOldProducts(10);", "sale", "N", 10 * 24 * 3600, "", "Y");
     COption::SetOptionString("sale", "viewed_capability", "N");
     COption::SetOptionString("sale", "viewed_count", 10);
     COption::SetOptionString("sale", "viewed_time", 5);
     COption::SetOptionString("sale", "p2p_status_list", serialize(array("N", "P", "F", "F_CANCELED", "F_DELIVERY", "F_PAY", "F_OUT")));
     CAgent::AddAgent("CSaleRecurring::AgentCheckRecurring();", "sale", "N", 7200, "", "Y");
     CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y");
     CAgent::AddAgent("CSaleViewedProduct::ClearViewed();", "sale", "N", 86400, "", "Y");
     CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", 259200, "", "Y");
     COption::SetOptionString("sale", "product_reserve_clear_period", "3");
     if (CModule::IncludeModule("sale")) {
         $dbStatusList = CSaleStatus::GetList(array(), array(), false, false, array());
         if (!($arStatusList = $dbStatusList->Fetch())) {
             $arLandDataN = array();
             $arLandDataF = array();
             $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ACTIVE' => 'Y')));
             while ($language = $languageIterator->fetch()) {
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/status.php", $language['ID']);
                 $arLandDataN[] = array("LID" => $language['ID'], "NAME" => GetMessage("SIM_ACCEPTED"), "DESCRIPTION" => GetMessage("SIM_ACCEPTED_DESCR"));
                 $arLandDataF[] = array("LID" => $language['ID'], "NAME" => GetMessage("SIM_FINISHED"), "DESCRIPTION" => GetMessage("SIM_FINISHED_DESCR"));
             }
             unset($language, $languageIterator);
             CSaleStatus::Add(array("ID" => "N", "SORT" => 100, "LANG" => $arLandDataN));
             CSaleStatus::Add(array("ID" => "F", "SORT" => 200, "LANG" => $arLandDataF));
         }
         // enabling location pro
         COption::SetOptionString("sale", "sale_locationpro_migrated", "Y");
         COption::SetOptionString("sale", "sale_locationpro_enabled", "Y");
         if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
             // this will create at least base types if we are at Bitrix24
             include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/sale/lib/location/migration/migrate.php";
             \Bitrix\Sale\Location\Migration\CUpdaterLocationPro::createBaseTypes();
         }
         CSaleYMHandler::install();
     }
     return true;
 }
示例#3
0
 protected function addOStatus()
 {
     $lang_er = array();
     foreach ($this->lang_ids as $lang) {
         $lang_er[] = array("LID" => $lang, "NAME" => Loc::getMessage("DEVTM_ERIP_STATUS_ER_NAME"), "DESCRIPTION" => Loc::getMessage("DEVTM_ERIP_STATUS_ER_DESC"));
     }
     if (empty($lang_er)) {
         return false;
     }
     return CSaleStatus::Add(array("ID" => "ER", "SORT" => 100, "LANG" => $lang_er, "NOTIFY" => "N"));
 }
示例#4
0
	function InstallDB()
	{
		global $DB, $DBType, $APPLICATION;
		$this->errors = false;

		if(!$DB->Query("SELECT 'x' FROM b_sale_basket", true))
		{
			$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/install/db/".$DBType."/install.sql");
		}

		if($this->errors !== false)
		{
			$APPLICATION->ThrowException(implode("", $this->errors));
			return false;
		}

		RegisterModule("sale");
		RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin");
		RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout");
		RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete");
		RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete");
		RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete");

		RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete");
		RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete");
		RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete");
		RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete");
		RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete");
		RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete");

		RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete");
		RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete");
		RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete");

		RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php");

		RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes');

		RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete");
		RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete");
		RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale");

		RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount");

		RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu");

		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100);
		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200);
		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300);
		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000);
		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000);

		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr", 100);
		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr", 200);
		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr", 300);
		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr", 1000);
		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr", 1100);

		//pulling for mobile orders
		RegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete", 100);
		RegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd", 100);
		RegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate", 100);

		// sale product2product
		RegisterModuleDependences("sale", "OnBasketOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleOrderAdd", 100);
		RegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler", 100);
		RegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler", 100);
		RegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler", 100);
		RegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler", 100);
		RegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler", 100);
		CAgent::AddAgent("\\Bitrix\\Sale\\Product2ProductTable::deleteOldProducts(10);", "sale", "N", 10 * 24 * 3600, "", "Y");

		COption::SetOptionString("sale", "viewed_capability", "N");
		COption::SetOptionString("sale", "viewed_count", 10);
		COption::SetOptionString("sale", "viewed_time", 5);

		COption::SetOptionString("sale", "p2p_status_list", serialize(array(
			"N", "P", "F", "F_CANCELED", "F_DELIVERY", "F_PAY", "F_OUT"
		)));

		CAgent::AddAgent("CSaleRecurring::AgentCheckRecurring();", "sale", "N", 7200, "", "Y");
		CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y");
		CAgent::AddAgent("CSaleViewedProduct::ClearViewed();", "sale", "N", 86400, "", "Y");

		CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", 259200, "", "Y");
		COption::SetOptionString("sale", "product_reserve_clear_period", "3");

		if (CModule::IncludeModule("sale"))
		{
			$dbStatusList = CSaleStatus::GetList(array(), array(), false, false, array());
			if (!($arStatusList = $dbStatusList->Fetch()))
			{
				$arLandDataN = array();
				$arLandDataF = array();

				$dbLangs = CLanguage::GetList(($b = ""), ($o = ""), array("ACTIVE" => "Y"));
				while ($arLangs = $dbLangs->Fetch())
				{
					IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/status.php", $arLangs["LID"]);

					$arLandDataN[] = array(
							"LID" => $arLangs["LID"],
							"NAME" => GetMessage("SIM_ACCEPTED"),
							"DESCRIPTION" => GetMessage("SIM_ACCEPTED_DESCR")
						);

					$arLandDataF[] = array(
							"LID" => $arLangs["LID"],
							"NAME" => GetMessage("SIM_FINISHED"),
							"DESCRIPTION" => GetMessage("SIM_FINISHED_DESCR")
						);
				}

				CSaleStatus::Add(
						array(
								"ID" => "N",
								"SORT" => 100,
								"LANG" => $arLandDataN
							)
					);

				CSaleStatus::Add(
						array(
								"ID" => "F",
								"SORT" => 200,
								"LANG" => $arLandDataF
							)
					);
			}

			CSaleYMHandler::install();
		}

		return true;
	}
示例#5
0
            }
            $oneLang = array('LID' => $language);
            if ($nameExist) {
                $oneLang['NAME'] = $statusLangFiles[$language]['CRM_STATUS_' . $statusId];
            }
            if ($descrExist) {
                $oneLang['DESCRIPTION'] = $statusLangFiles[$language]['CRM_STATUS_' . $statusId . '_DESCR'];
            }
            $langData[] = $oneLang;
            unset($oneLang, $descrExist, $nameExist);
        }
        unset($language);
        if ($statusId === 'N' && isset($arExistStatuses[$statusId])) {
            CSaleStatus::Update($statusId, array('SORT' => $statusSort, 'LANG' => $langData));
        } else {
            CSaleStatus::Add(array('ID' => $statusId, 'SORT' => $statusSort, 'LANG' => $langData));
        }
    }
    unset($statusLangFiles);
}
//Create person types
$companyPTID = $contactPTID = 0;
$dbPerson = CSalePersonType::GetList(array(), array("LID" => $currentSiteID, "PERSON_TYPE_ID" => array('CRM_COMPANY', 'CRM_CONTACT')));
while ($arPerson = $dbPerson->Fetch()) {
    if ($arPerson["NAME"] == 'CRM_COMPANY') {
        $companyPTID = $arPerson["ID"];
    } elseif ($arPerson["NAME"] == 'CRM_CONTACT') {
        $contactPTID = $arPerson["ID"];
    }
}
if ($companyPTID <= 0) {
示例#6
0
 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_sale_basket", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     RegisterModule("sale");
     RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin");
     RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout");
     RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php");
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale");
     RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount");
     RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu");
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300);
     //		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketProps", "GetControlDescr", 400);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000);
     //		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketProductFields", "GetControlDescr", 1100);
     //		RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketProductProps", "GetControlDescr", 1200);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr", 300);
     //		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGiftsGroup", "GetControlDescr", 400);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr", 1100);
     //		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketProductFields", "GetControlDescr", 1200);
     //		RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketProductProps", "GetControlDescr", 1300);
     //pulling for mobile orders
     RegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete", 100);
     RegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd", 100);
     RegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate", 100);
     CAgent::AddAgent("CSaleRecurring::AgentCheckRecurring();", "sale", "N", 7200, "", "Y");
     CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y");
     CAgent::AddAgent("CSaleViewedProduct::ClearViewed();", "sale", "N", 86400, "", "Y");
     if (CModule::IncludeModule("sale")) {
         $dbStatusList = CSaleStatus::GetList(array(), array(), false, false, array());
         if (!($arStatusList = $dbStatusList->Fetch())) {
             $arLandDataN = array();
             $arLandDataF = array();
             $dbLangs = CLanguage::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
             while ($arLangs = $dbLangs->Fetch()) {
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/status.php", $arLangs["LID"]);
                 $arLandDataN[] = array("LID" => $arLangs["LID"], "NAME" => GetMessage("SIM_ACCEPTED"), "DESCRIPTION" => GetMessage("SIM_ACCEPTED_DESCR"));
                 $arLandDataF[] = array("LID" => $arLangs["LID"], "NAME" => GetMessage("SIM_FINISHED"), "DESCRIPTION" => GetMessage("SIM_FINISHED_DESCR"));
             }
             CSaleStatus::Add(array("ID" => "N", "SORT" => 100, "LANG" => $arLandDataN));
             CSaleStatus::Add(array("ID" => "F", "SORT" => 200, "LANG" => $arLandDataF));
         }
     }
     return true;
 }
 /**
  * Adds new sale order status
  * @param array $arFields Array with status properties.
  * @return int|bool Returns the new status id or false if addition failed.
  */
 public function Add($arFields)
 {
     if (!CModule::IncludeModule('sale')) {
         return false;
     }
     if (!isset($arFields['NAME'])) {
         return false;
     }
     $arStatus = array('ID' => self::getNewId(), 'LANG' => self::getStatusLang($arFields['NAME']));
     if (isset($arFields['SORT'])) {
         $arStatus['SORT'] = $arFields['SORT'];
     }
     return CSaleStatus::Add($arStatus);
 }