Esempio n. 1
0
                $arZipList = $_REQUEST["ZIP"];
                CSaleLocation::SetLocationZIP($ID, $arZipList);
            }
            //			die();
            if (strlen($strError) <= 0) {
                LocalRedirect(isset($_POST['apply']) || strlen($strError) > 0 ? CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LOCATIONS_EDIT'], array('loc_id' => $ID)) : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LOCATIONS_LIST'], array('loc_id' => $ID)));
            }
        }
        if (strlen($strError) > 0) {
            ShowError($strError);
        }
    } elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['delete'])) {
        $locID = isset($arParams['LOC_ID']) ? intval($arParams['LOC_ID']) : 0;
        $arLoc = $locID > 0 ? CCrmLocations::GetByID($locID) : null;
        if ($arLoc) {
            if (!CSaleLocation::Delete($locID)) {
                $errorMsg = '';
                if ($ex = $APPLICATION->GetException()) {
                    $errorMsg = $ex->GetString();
                } else {
                    $errorMsg = GetMessage('CRM_LOC_DELETE_UNKNOWN_ERROR');
                }
                ShowError($errorMsg);
            } else {
                LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LOCATIONS_LIST'], array()));
            }
        }
    }
}
$arResult['FIELDS'] = array();
/* LOCATION PARAMS SECTION*/