}
 if (isset($_POST["PARAMS"], $_POST["PARAMS"]["PARAMS"])) {
     $fields["PARAMS"] = $_POST["PARAMS"]["PARAMS"];
 }
 if (isset($_POST["RIGHTS"])) {
     $fields["RIGHTS"] = $_POST["RIGHTS"];
 } else {
     $fields["RIGHTS"] = array("Y", "N", "N");
 }
 if ($isItSavingProcess) {
     if ($fields["DELIVERY_ID"] > 0) {
         $fields = ExtraServices\Manager::prepareParamsToSave($fields);
         if ($ID > 0) {
             $res = ExtraServices\Table::update($ID, $fields);
         } else {
             $res = ExtraServices\Table::add($fields);
         }
         if (!$res->isSuccess()) {
             $strError .= Loc::getMessage("SALE_ESDE_ERROR_SAVE") . ": " . implode("<br>", $res->getErrorMessages());
         } elseif ($ID <= 0) {
             $ID = $res->getId();
         }
     } else {
         $strError .= Loc::getMessage("SALE_ESDE_ERROR_ID") . '.<br>\\n';
     }
     if (strlen($strError) <= 0) {
         if (strlen($_POST["apply"]) > 0) {
             LocalRedirect($APPLICATION->GetCurPageParam("ID=" . $ID, array('ID')));
         } elseif (strlen($_POST["save"]) > 0) {
             LocalRedirect(isset($_REQUEST["back_url"]) ? $_REQUEST["back_url"] : "sale_delivery_service_edit.php?lang=" . LANG . "&ID=" . $fields["DELIVERY_ID"]);
         }
示例#2
0
 public static function saveStores($deliveryId, array $storesList)
 {
     $result = new Result();
     $storesFields = self::getStoresFields($deliveryId);
     if (!empty($storesFields)) {
         $res = Table::update($storesFields["ID"], array("PARAMS" => array("STORES" => $storesList)));
     } else {
         $res = Table::add(array("CODE" => self::STORE_PICKUP_CODE, "NAME" => Loc::getMessage("DELIVERY_SERVICE_MANAGER_ES_NAME"), "DESCRIPTION" => Loc::getMessage("DELIVERY_SERVICE_MANAGER_ES_DESCRIPTION"), "CLASS_NAME" => self::STORE_PICKUP_CLASS, "DELIVERY_ID" => $deliveryId, "RIGHTS" => "YYY", "PARAMS" => array("STORES" => $storesList)));
     }
     if (!$res->isSuccess()) {
         foreach ($res->getErrors() as $error) {
             $result->addError($error);
         }
     }
     return $result;
 }