Created
July 12, 2018 09:31
-
-
Save mamontov-cpp/eb037a44e553942e3079f291b9ae4887 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Обновляет координаты склада, если они не заданы, но известен адрес. | |
* | |
* @param int $id | |
* @param bool $forceUpdate принудительно обновить координаты склада | |
*/ | |
public static function updateGpsGeocode($id, $forceUpdate = false) | |
{ | |
$arStore = self::getGeoData($id); | |
$shouldUpdate = true; | |
if (!$forceUpdate) { | |
$shouldUpdate = (!$arStore["GPS_N"] && !$arStore["GPS_S"]); | |
} | |
if ($shouldUpdate && $arStore["ADDRESS"]) | |
{ | |
$arUpdate = self::loadGps($arStore["ADDRESS"]); | |
if ($arUpdate && Loader::includeModule("catalog")) | |
{ | |
\CCatalogStore::Update($id, $arUpdate); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment