Example #1
0
                     $strError .= GetMessage("CRM_LOC_UPDATE_UNKNOWN_ERROR") . "<br>";
                 }
             }
         } else {
             $ID = CSaleLocation::Add($arFields);
             if (IntVal($ID) <= 0) {
                 if ($ex = $APPLICATION->GetException()) {
                     $strError = $ex->GetString() . "<br>";
                 } else {
                     $strError .= GetMessage("CRM_LOC_ADD_UNKNOWN_ERROR") . "<br>";
                 }
             }
         }
         if ($ID > 0 && strlen($strError) <= 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 = '';