Example #1
0
 protected static function getByDeliveryId($deliveryId)
 {
     static $hitCache = array();
     if (isset($hitCache[$deliveryId])) {
         return $hitCache[$deliveryId];
     }
     $result = array();
     $dbRes = Table::getList(array("order" => array("SORT" => "ASC", "NAME" => "ASC"), "filter" => array("=DELIVERY_ID" => $deliveryId, "=ACTIVE" => "Y", "=CLASS_NAME" => self::getClassesList()), "select" => array("*", "CURRENCY" => "DELIVERY_SERVICE.CURRENCY")));
     while ($row = $dbRes->fetch()) {
         $result[$row["ID"]] = $row;
     }
     $hitCache[$deliveryId] = $result;
     return $result;
 }
Example #2
0
 /**
  * Function formats delivery system info in arResult
  * @return void
  */
 protected function formatResultDeliverySystem()
 {
     $arResult =& $this->arResult;
     foreach ($arResult['SHIPMENT'] as &$shipment) {
         if (!empty($shipment["DELIVERY_ID"])) {
             $shipment["DELIVERY"]["NAME"] = htmlspecialcharsEx($shipment["DELIVERY"]["NAME"]);
         }
         $res = \Bitrix\Sale\Delivery\ExtraServices\Table::getList(array('filter' => array("=DELIVERY_ID" => $shipment['DELIVERY_ID'], "=CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store', "=CODE" => 'BITRIX_STORE_PICKUP')));
         $store = $res->fetch();
         if ($store) {
             $dbRes = \Bitrix\Sale\Internals\ShipmentExtraServiceTable::getList(array('filter' => array('=SHIPMENT_ID' => $shipment['ID'], '=EXTRA_SERVICE_ID' => $store['ID'])));
             if ($row = $dbRes->fetch()) {
                 $shipment['STORE_ID'] = $row["VALUE"];
             }
         }
     }
     unset($shipment);
     if (!empty($arResult["DELIVERY"])) {
         if (!empty($arResult['DELIVERY_STORE_LIST'])) {
             $arResult["DELIVERY"]['STORE_LIST'] = $arResult['DELIVERY_STORE_LIST'];
             unset($arResult['DELIVERY_STORE_LIST']);
         }
     }
 }
$ID = intval($_GET['ID']);
$strError = "";
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "delete_extra_service" && isset($_REQUEST["ES_ID"])) {
    if (intval($_REQUEST["ES_ID"] > 0)) {
        $res = ExtraServices\Table::delete(intval($_REQUEST["ES_ID"]));
        if (!$res->isSuccess()) {
            $strError .= Loc::getMessage("SALE_ESDE_ERROR_DELETE") . ' ' . implode("<br>\n", $res->getErrorMessages());
        }
    } else {
        $strError .= Loc::getMessage("SALE_ESDE_ERROR_ID");
    }
}
$tableId = 'table_delivery_extra_service';
$oSort = new \CAdminSorting($tableId);
$lAdmin = new \CAdminList($tableId, $oSort);
$res = \Bitrix\Sale\Delivery\ExtraServices\Table::getList(array('filter' => array('DELIVERY_ID' => $ID, '=CLASS_NAME' => ExtraServices\Manager::getClassesList()), 'select' => array('ID', 'CODE', 'NAME', 'DESCRIPTION', 'CLASS_NAME', 'RIGHTS', 'ACTIVE', 'SORT'), 'order' => array('SORT' => 'ASC', 'ID' => 'DESC')));
$data = $res->fetchAll();
$dbRes = new \CDBResult();
$dbRes->InitFromArray($data);
$dbRecords = new \CAdminResult($dbRes, $tableId);
$dbRecords->NavStart();
$lAdmin->NavText($dbRecords->GetNavPrint(Loc::getMessage('SALE_ESDL_LIST')));
$header = array(array('id' => 'ID', 'content' => Loc::getMessage('SALE_ESDL_COL_ID'), "sort" => "", 'default' => true), array('id' => 'CODE', 'content' => Loc::getMessage('SALE_ESDL_COL_CODE'), "sort" => "", 'default' => false), array('id' => 'NAME', 'content' => Loc::getMessage('SALE_ESDL_COL_NAME'), "sort" => "", 'default' => true), array('id' => 'SORT', 'content' => Loc::getMessage('SALE_ESDL_COL_SORT'), "sort" => "", 'default' => true), array('id' => 'RIGHTS', 'content' => Loc::getMessage('SALE_ESDL_COL_RIGHTS'), "sort" => "", 'default' => false), array('id' => 'ACTIVE', 'content' => Loc::getMessage('SALE_ESDL_COL_ACTIVE'), "sort" => "", 'default' => true), array('id' => 'CLASS_NAME', 'content' => Loc::getMessage('SALE_ESDL_COL_CLASS_NAME'), "sort" => "", 'default' => true), array('id' => 'DESCRIPTION', 'content' => Loc::getMessage('SALE_ESDL_COL_DESCRIPTION'), "sort" => "", 'default' => true));
$lAdmin->AddHeaders($header);
while ($record = $dbRecords->Fetch()) {
    $link = 'sale_delivery_eservice_edit.php?ID=' . $record['ID'] . '&lang=' . LANGUAGE_ID . '&' . $tabControl->ActiveTabParam() . '&back_url=' . urlencode($APPLICATION->GetCurPageParam());
    $row =& $lAdmin->AddRow($record['ID'], $record, $link, '');
    $row->AddField('ID', '<a href="' . $link . '">' . $record['ID'] . '</a>');
    $row->AddField('CODE', $record['CODE']);
    $row->AddField('NAME', $record['NAME']);
    $row->AddField('SORT', $record['SORT']);