public static function checkLocationIsAboveCity($locationId) { if (strlen($locationId)) { $tail = CSaleLocation::getLocationCityTail(); if (!empty($tail)) { $location = Location\LocationTable::getList(array('select' => array('TYPE_ID'), 'filter' => array('LOGIC' => 'OR', array('=ID' => intval($locationId)), array('=CODE' => $locationId))))->fetch(); if (!isset($tail[$location['TYPE_ID']])) { // is not a city and not a descendant of it return true; } } } return false; }