Esempio n. 1
0
 public static function convertConfigHandlerToSidAgent()
 {
     \Bitrix\Sale\Delivery\Services\Manager::getHandlersClassNames();
     $initedHandlers = \Bitrix\Sale\Delivery\Services\Automatic::getRegisteredHandlers("HANDLER");
     $filter = array('=CLASS_NAME' => '\\Bitrix\\Sale\\Delivery\\Services\\Automatic');
     $res = Bitrix\Sale\Delivery\Services\Table::getList(array('filter' => $filter, 'select' => array("ID", "CODE", "CONFIG")));
     while ($params = $res->fetch()) {
         if (!empty($params["CONFIG"]["MAIN"]["SID"])) {
             continue;
         }
         $config = $params["CONFIG"];
         if (!empty($initedHandlers[$config["MAIN"]["HANDLER"]]["SID"])) {
             $config["MAIN"]["SID"] = $initedHandlers[$config["MAIN"]["HANDLER"]]["SID"];
         } else {
             $config["MAIN"]["SID"] = "";
         }
         unset($config["MAIN"]["HANDLER"]);
         Bitrix\Sale\Delivery\Services\Table::update($params["ID"], array("CONFIG" => $config));
     }
     return "";
 }
    $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) {
        $key = array_search($class, $classNamesList);
        if ($key !== false) {
            unset($classNamesList[$key]);
        }
    }
}
/* if we have only one class - let's fix it */
if (empty($fields["CLASS_NAME"]) && count($classNamesList) == 1) {
    $fields["CLASS_NAME"] = current($classNamesList);
}
$isGroup = $fields["CLASS_NAME"] == '\\Bitrix\\Sale\\Delivery\\Services\\Group';
$service = null;
if (isset($fields["CLASS_NAME"]) && strlen($fields["CLASS_NAME"]) > 0) {
Esempio n. 3
0
 /**
  * @return array profiles handlers class names
  */
 public static function getChildrenClassNames()
 {
     $classNamesList = Manager::getHandlersClassNames();
     unset($classNamesList[array_search('\\Bitrix\\Sale\\Delivery\\Services\\Group', $classNamesList)]);
     unset($classNamesList[array_search('\\Bitrix\\Sale\\Delivery\\Services\\AutomaticProfile', $classNamesList)]);
     return $classNamesList;
 }
echo Loc::getMessage("SALE_SDL_NO");
?>
</option>
			</select>
		</td>
	</tr>
	<tr>
		<td><?php 
echo Loc::getMessage("SALE_SDL_FILTER_CLASS_NAME");
?>
:</td>
		<td>
			<select name="filter_class_name">
				<option value=""></option>
				<?php 
foreach (\Bitrix\Sale\Delivery\Services\Manager::getHandlersClassNames() as $className) {
    ?>
					<?php 
    if (is_callable($className . "::getClassTitle")) {
        ?>
						<option value="<?php 
        echo htmlspecialcharsbx($className);
        ?>
" <?php 
        echo isset($filter["=CLASS_NAME"]) && $className == $filter["=CLASS_NAME"] ? " selected" : "";
        ?>
><?php 
        echo htmlspecialcharsbx($className::getClassTitle());
        ?>
</option>
					<?php