Exemple #1
0
 }
 if (strlen($_POST["LOGIN"]) <= 0) {
     $errorMessage .= GetMessage("BPWC_WNC_EMPTY_LOGIN") . "<br>";
 }
 if (strlen($_POST["SERVER"]) <= 0) {
     $errorMessage .= GetMessage("BPWC_WNC_EMPTY_URL") . "<br>";
 }
 if (strlen($_POST["PASSWORD"]) <= 0 && $arParams["ID"] <= 0) {
     $errorMessage .= GetMessage("BPWC_WNC_EMPTY_PASSWORD") . "<br>";
 }
 $arLimitationSettings = CCrmExternalSale::GetLimitationSettings();
 if ($arLimitationSettings["MAX_DAYS"] > 0 && $arResult["BP"]["IMPORT_PERIOD"] > $arLimitationSettings["MAX_DAYS"]) {
     $arResult["BP"]["IMPORT_PERIOD"] = $arResult["BP"]["~IMPORT_PERIOD"] = $arLimitationSettings["MAX_DAYS"];
 }
 if ($arLimitationSettings["MAX_SHOPS"] > 0 && $arParams["ID"] <= 0) {
     $cnt = CCrmExternalSale::Count();
     if ($cnt >= $arLimitationSettings["MAX_SHOPS"]) {
         $errorMessage .= GetMessage("BPWC_WNC_MAX_SHOPS") . "<br>";
     }
 }
 if (strlen($errorMessage) <= 0) {
     $arFields = array("NAME" => $arResult["BP"]["~NAME"], "ACTIVE" => $arResult["BP"]["~ACTIVE"], "LOGIN" => $arResult["BP"]["~LOGIN"], "IMPORT_SIZE" => $arResult["BP"]["~IMPORT_SIZE"], "IMPORT_PERIOD" => $arResult["BP"]["~IMPORT_PERIOD"], "IMPORT_PROBABILITY" => $arResult["BP"]["~IMPORT_PROBABILITY"], "IMPORT_RESPONSIBLE" => $arResult["BP"]["~IMPORT_RESPONSIBLE"], "IMPORT_PUBLIC" => $arResult["BP"]["~IMPORT_PUBLIC"], "IMPORT_PREFIX" => $arResult["BP"]["~IMPORT_PREFIX"], "IMPORT_ERRORS" => 0, "SCHEME" => $arResult["BP"]["~SCHEME"], "SERVER" => $arResult["BP"]["~SERVER"], "PORT" => $arResult["BP"]["~PORT"], "IMPORT_GROUP_ID" => $arResult["BP"]["~IMPORT_GROUP_ID"], "COOKIE" => false);
     if (strlen($_POST["SERVER"]) > 0) {
         $arCrmUrl = parse_url($_POST["SERVER"]);
         $crmUrlHost = $arCrmUrl["host"] ? $arCrmUrl["host"] : $arCrmUrl["path"];
         $crmUrlScheme = $arCrmUrl["scheme"] ? strtolower($arCrmUrl["scheme"]) : strtolower($_POST["SCHEME"]);
         if (!in_array($crmUrlScheme, array('http', 'https'))) {
             $crmUrlScheme = 'http';
         }
         $crmUrlPort = $arCrmUrl["port"] ? intval($arCrmUrl["port"]) : intval($_POST["PORT"]);
         if ($crmUrlPort <= 0) {