Exemple #1
0
 /**
  * @deprecated
  */
 public static function Delete($ID)
 {
     $newId = \Bitrix\Sale\Delivery\Services\Table::getIdByCode($ID);
     try {
         $res = \Bitrix\Sale\Delivery\Services\Table::delete($newId);
     } catch (\Bitrix\Main\SystemException $e) {
         $GLOBALS["APPLICATION"]->ThrowException($e->getMessage());
         return false;
     }
     return new CDBResult($res);
 }
 /** @deprecated */
 public static function Reset($sid)
 {
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList(array("filter" => array("LOGIC" => "OR", "=CODE" => $sid, "CODE" => $sid . ":%"), "select" => array("ID")));
     try {
         while ($service = $dbRes->fetch()) {
             \Bitrix\Sale\Delivery\Services\Table::delete($service["ID"]);
         }
     } catch (\Bitrix\Main\SystemException $e) {
         $GLOBALS["APPLICATION"]->ThrowException($e->getMessage());
         return false;
     }
     return true;
 }
$showFieldsList = \Bitrix\Sale\Delivery\Services\Table::getMap();
/* saving or updating Extra service & restrictions */
if ($ID > 0 && ($_SERVER['REQUEST_METHOD'] != "POST" || $isItSavingProcess)) {
    $dbRes = \Bitrix\Sale\Delivery\Services\Table::getById($ID);
    if (!($fields = $dbRes->fetch())) {
        $strError .= str_replace("#ID#", $ID, Loc::getMessage("SALE_DSE_ERROR_ID")) . "<br>";
    }
}
/* If action is copying */
if ($_REQUEST["action"] == "copy") {
    $ID = 0;
    unset($fields["ID"]);
} elseif ($_REQUEST["action"] == "profile_delete") {
    $idProf = isset($_REQUEST["ID_PROF"]) ? intval($_REQUEST["ID_PROF"]) : 0;
    if ($idProf > 0) {
        $res = \Bitrix\Sale\Delivery\Services\Table::delete($idProf);
        if (!$res->isSuccess()) {
            $strError .= implode("<br>\n", $res->getErrorMessages()) . "<br>";
        }
    } else {
        $strError .= Loc::getMessage("SALE_DSE_PROFILE_DEL_ERROR", array("#ID#" => $idProf)) . "<br>";
    }
}
/* Ask parent service witch class_names for children are allowed */
if (intval($fields["PARENT_ID"]) > 0) {
    $parentService = Services\Manager::getService($fields["PARENT_ID"]);
    $classNamesList = $parentService->getChildrenClassNames();
} else {
    $classNamesList = Services\Manager::getHandlersClassNames();
    $classesToExclude = array('\\Bitrix\\Sale\\Delivery\\Services\\AutomaticProfile', '\\Bitrix\\Sale\\Delivery\\Services\\Group');
    foreach ($classesToExclude as $class) {