Exemplo n.º 1
0
 public function prepareFieldsForSaving(array $fields)
 {
     $parentAutoConfig = $this->parentAutomatic->getConfigValues();
     if (isset($fields["CONFIG"]) && is_array($fields["CONFIG"])) {
         $fields["CONFIG"] = array_merge($parentAutoConfig, $fields["CONFIG"]);
     }
     $configMain = $fields["CONFIG"]["MAIN"];
     $handler = $this->parentHandlerInitParams;
     if (isset($handler["DBSETSETTINGS"]) && is_callable($handler["DBSETSETTINGS"])) {
         $oldSettings = $fields["CONFIG"];
         unset($oldSettings["MAIN"]);
         if (is_array($oldSettings)) {
             $oldSettings = Automatic::convertNewSettingsToOld($oldSettings);
         }
         if (!($strOldSettings = call_user_func($handler["DBSETSETTINGS"], $oldSettings))) {
             throw new SystemException("Can't save delivery services's old settings");
         }
     } else {
         $strOldSettings = "";
     }
     $strOldSettings = serialize($strOldSettings);
     $fields["CONFIG"] = array("MAIN" => $configMain);
     $fields["CONFIG"]["MAIN"]["OLD_SETTINGS"] = $strOldSettings;
     $fields = parent::prepareFieldsForSaving($fields);
     $fields["CODE"] = $this->parentAutomatic->getSid() . ":" . $this->profileId;
     return $fields;
 }