예제 #1
0
 protected static function convertDeliveryIds($oldDeliveryIds = array(), $oldProfiles = array())
 {
     if (!is_array($oldDeliveryIds)) {
         $oldDeliveryIds = trim(strval($oldDeliveryIds)) != "" ? array($oldDeliveryIds) : array();
     }
     if (!is_array($oldProfiles)) {
         $oldProfiles = trim(strval($oldProfiles)) != "" ? array($oldProfiles) : array();
     }
     if (empty($oldDeliveryIds) && empty($oldProfiles)) {
         return array();
     }
     $qParams = array("LOGIC" => "AND");
     if (!empty($oldDeliveryIds)) {
         $params = array("LOGIC" => "OR", "%CODE" => array());
         foreach ($oldDeliveryIds as $id) {
             $params["%CODE"][] = $id . ":";
             $params["%CODE"][] = $id;
         }
         $qParams[] = $params;
     }
     if (!empty($oldProfiles)) {
         $params = array("LOGIC" => "OR", "%CODE" => array());
         foreach ($oldProfiles as $id) {
             $params["%CODE"][] = ":" . $id;
         }
         $qParams[] = $params;
     }
     $res = Delivery\Services\Table::getList(array('filter' => $qParams, 'select' => array("ID")));
     $result = array();
     while ($delivery = $res->fetch()) {
         $result[] = $delivery["ID"];
     }
     return $result;
 }
예제 #2
0
 /**
  * Return html for choose group control.
  *
  * @param int|string $selectedGroupId			Selected group.
  * @param string $name							Group name.
  * @param string $addParams						Additional params for select tag.
  * @param bool $anyGroup						Allowed select any group.
  * @return string
  */
 public static function getGroupChooseControl($selectedGroupId, $name, $addParams = "", $anyGroup = false)
 {
     $groups = array();
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList(array("filter" => array("=CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Services\\Group'), "select" => array("ID", "NAME", "PARENT_ID"), "order" => array("PARENT_ID" => "ASC", "NAME" => "ASC")));
     while ($group = $dbRes->fetch()) {
         $groups[$group["ID"]] = $group;
     }
     //$groups = self::createTreeFromGroups($groups);
     $result = '<select name=' . $name . ' id="sale_delivery_group_choose"' . $addParams . '>';
     if ($anyGroup) {
         $result .= '<option value="-1"' . ($selectedGroupId == "-1" ? ' selected' : '') . '>' . Loc::getMessage('SALE_DELIVERY_HELPER_ANY_LEVEL') . '</option>';
     }
     $result .= '<option value="0"' . ($selectedGroupId == 0 ? ' selected' : '') . '>' . Loc::getMessage('SALE_DELIVERY_HELPER_UPPER_LEVELL') . '</option>';
     foreach ($groups as $groupId => $group) {
         $result .= '<option value="' . $groupId . '"' . ($selectedGroupId == $groupId ? ' selected' : '') . '>' . htmlspecialcharsbx($group["NAME"]) . '</option>';
     }
     $result .= '</select>';
     return $result;
 }
예제 #3
0
 protected function getChildren($parentId = 0)
 {
     $result = array();
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList(array("filter" => array("PARENT_ID" => $parentId), "select" => array("ID", "NAME", "DESCRIPTION", "CLASS_NAME"), "order" => array("NAME" => "ASC")));
     while ($service = $dbRes->fetch()) {
         $canHasChildren = is_callable($service["CLASS_NAME"] . '::canHasChildren') ? $service["CLASS_NAME"]::canHasChildren() : false;
         $children = $canHasChildren ? $this->getChildren($service["ID"]) : array();
         foreach ($children as $key => $child) {
             if (!$child["can_has_children"]) {
                 unset($children[$key]);
             }
         }
         $item = array("text" => htmlspecialcharsbx($service["NAME"]), "title" => htmlspecialcharsbx($service["DESCRIPTION"]), "url" => "sale_delivery_service_list.php?lang=" . LANGUAGE_ID . "&filter_group=" . $service["ID"], "page_icon" => "sale_page_icon", "can_has_children" => $canHasChildren, "more_url" => array("sale_delivery_service_edit.php?lang=" . LANGUAGE_ID . "&PARENT_ID=" . $service["ID"]));
         if ($canHasChildren && !empty($children)) {
             $item["items"] = $children;
             $item["dynamic"] = true;
             $item["items_id"] = "menu_sale_delivery_" . $service["ID"];
         }
         $result[] = $item;
     }
     return $result;
 }
예제 #4
0
 /** @deprecated */
 public static function ResetAll()
 {
     $serviceRes = \Bitrix\Sale\Delivery\Services\Table::getList(array('filter' => array("=CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Services\\Automatic'), 'select' => array("CODE")));
     while ($service = $serviceRes->fetch()) {
         self::Reset($service["CODE"]);
     }
     return;
 }
예제 #5
0
 /**
  * @param array $arOrder
  * @param array $arFilter
  * @param bool $arGroupBy
  * @param bool $arNavStartParams
  * @param array $arSelectFields
  * @return \CDBResult
  * @throws \Bitrix\Main\ArgumentException
  * @deprecated
  */
 public static function GetList($arOrder = array("SORT" => "ASC", "NAME" => "ASC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array('*'))
 {
     if (empty($arSelectFields)) {
         $arSelectFields = array('*');
     }
     $params = array('order' => $arOrder, 'filter' => self::convertFilterOldToNew($arFilter), 'group' => self::convertGroupOldToNew($arGroupBy), 'select' => self::convertSelectOldToNew($arSelectFields));
     $services = array();
     $params['filter']['=CLASS_NAME'] = '\\Bitrix\\Sale\\Delivery\\Services\\Configurable';
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList($params);
     if (isset($arFilter["WEIGHT"]) && DoubleVal($arFilter["WEIGHT"]) > 0) {
         if (!isset($arFilter["WEIGHT_FROM"]) || floatval($arFilter["WEIGHT"]) > floatval($arFilter["WEIGHT_FROM"])) {
             $arFilter["+<=WEIGHT_FROM"] = $arFilter["WEIGHT"];
         }
         if (!isset($arFilter["WEIGHT_TO"]) || floatval($arFilter["WEIGHT"]) < floatval($arFilter["WEIGHT_TO"])) {
             $arFilter["+>=WEIGHT_TO"] = $arFilter["WEIGHT"];
         }
     }
     if (isset($arFilter["ORDER_PRICE"]) && IntVal($arFilter["ORDER_PRICE"]) > 0) {
         if (!isset($arFilter["ORDER_PRICE_FROM"]) || floatval($arFilter["ORDER_PRICE"]) > floatval($arFilter["ORDER_PRICE_FROM"])) {
             $arFilter["+<=ORDER_PRICE_FROM"] = $arFilter["ORDER_PRICE"];
         }
         if (!isset($arFilter["ORDER_PRICE_TO"]) || floatval($arFilter["ORDER_PRICE"]) < floatval($arFilter["ORDER_PRICE_TO"])) {
             $arFilter["+>=ORDER_PRICE_TO"] = $arFilter["ORDER_PRICE"];
         }
     }
     while ($service = $dbRes->fetch()) {
         $dbRstrRes = \Bitrix\Sale\Delivery\Restrictions\Table::getList(array('filter' => array("=DELIVERY_ID" => $service["ID"])));
         while ($restr = $dbRstrRes->fetch()) {
             if (!self::checkRestrictionFilter($restr, $arFilter)) {
                 continue 2;
             }
             $service = self::getSelectedRestrictionField($service, $restr, $arSelectFields);
         }
         $selectAsterisk = in_array('*', $arSelectFields);
         $mofifiedFields = array("LID", "WEIGHT_FROM", "WEIGHT_TO", "ORDER_PRICE_FROM", "ORDER_PRICE_TO", "ORDER_CURRENCY");
         foreach ($mofifiedFields as $field) {
             if (($selectAsterisk || in_array($field, $arSelectFields)) && !array_key_exists($field, $service)) {
                 $service[$field] = "";
             }
         }
         if ($selectAsterisk || in_array("PERIOD_FROM", $arSelectFields)) {
             $service["PERIOD_FROM"] = $service["CONFIG"]["MAIN"]["PERIOD"]["FROM"];
         }
         if ($selectAsterisk || in_array("PERIOD_TO", $arSelectFields)) {
             $service["PERIOD_TO"] = $service["CONFIG"]["MAIN"]["PERIOD"]["TO"];
         }
         if ($selectAsterisk || in_array("PERIOD_TYPE", $arSelectFields)) {
             $service["PERIOD_TYPE"] = $service["CONFIG"]["MAIN"]["PERIOD"]["TYPE"];
         }
         if ($selectAsterisk || in_array("PRICE", $arSelectFields)) {
             $service["CLASS_NAME"] = '\\Bitrix\\Sale\\Delivery\\Services\\Configurable';
             $tmpSrv = \Bitrix\Sale\Delivery\Services\Manager::createServiceObject($service);
             $res = $tmpSrv->calculate();
             $service["PRICE"] = $res->getPrice();
         }
         if ($selectAsterisk || in_array("STORE", $arSelectFields)) {
             $stores = \Bitrix\Sale\Delivery\ExtraServices\Manager::getStoresList($service["ID"]);
             $service["STORE"] = count($stores) > 0 ? serialize($stores) : "";
         }
         if (intval($service["CODE"]) > 0) {
             $service["ID"] = $service["CODE"];
         }
         unset($service["CODE"], $service["CLASS_NAME"], $service["CONFIG"], $service["PARENT_ID"]);
         $services[] = $service;
     }
     $result = new \CDBResult();
     $result->InitFromArray($services);
     return $result;
 }
예제 #6
0
 public static function getByParentId($parentId)
 {
     static $hitCache = array();
     if (isset($hitCache[$parentId])) {
         return $hitCache[$parentId];
     }
     $result = array();
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList(array('filter' => array("PARENT_ID" => $parentId)));
     while ($child = $dbRes->fetch()) {
         $result[$child["ID"]] = $child;
     }
     $hitCache[$parentId] = $result;
     return $result;
 }
예제 #7
0
 public static function getGroupId($name)
 {
     $result = 0;
     $res = Table::getList(array('select' => array("ID"), 'filter' => array("=NAME" => $name, "=CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Services\\Group')));
     if ($group = $res->fetch()) {
         $result = $group["ID"];
     } else {
         $res = Table::add(array("NAME" => $name, "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Services\\Group', "ACTIVE" => "Y"));
         if ($res->isSuccess()) {
             $result = $res->getId();
         } else {
             throw new SystemException(implode("<br>\n", $res->getErrorMessages()));
         }
     }
     return $result;
 }
예제 #8
0
if ($service && $showRestrictions && $ID > 0) {
    $aTabs[] = array("DIV" => "edit_restriction", "TAB" => Loc::getMessage("SALE_DSE_TAB_RESTRICTIONS"), "ICON" => "sale", "TITLE" => Loc::getMessage("SALE_DSE_TAB_RESTRICTIONS_DESCR"));
}
if ($showExtraServices && $ID > 0) {
    $aTabs[] = array("DIV" => "edit_extraservices", "TAB" => Loc::getMessage("SALE_DSE_TAB_EXTRA_SERVICES"), "ICON" => "sale", "TITLE" => Loc::getMessage("SALE_DSE_TAB_EXTRA_SERVICES_DESCR"));
}
if ($service && $ID > 0 && strlen($service->getTrackingClass()) > 0) {
    $aTabs[] = array("DIV" => "edit_tracking", "TAB" => Loc::getMessage("SALE_DSE_TAB_TRACKING"), "ICON" => "sale", "TITLE" => Loc::getMessage("SALE_DSE_TAB_TRACKING_DESCR"));
}
$tabControl = new CAdminTabControl("tabControl", $aTabs);
/* Profiles */
if ($canHasProfiles) {
    $sTableIDSubService = "tbl_sale_delivery_subservice";
    $oSortSubService = new CAdminSorting($sTableIDSubService);
    $lAdminSubServices = new CAdminList($sTableIDSubService, $oSortSubService);
    $dbSubServicesRes = \Bitrix\Sale\Delivery\Services\Table::getList(array("filter" => array("PARENT_ID" => $ID), "select" => array("ID", "NAME", "ACTIVE", "LOGOTIP", "PARENT_ID"), "order" => isset($_REQUEST["by"]) && isset($_REQUEST["order"]) ? array($_REQUEST["by"] => $_REQUEST["order"]) : array("NAME" => "ASC")));
    $profilesList = new CAdminResult($dbSubServicesRes, $sTableIDSubService);
    $profilesList->NavStart();
    $lAdminSubServices->NavText($profilesList->GetNavPrint("PROFILES"));
    $profileHeader = array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => Loc::getMessage("SALE_DSE_PROF_HEAD_NAME"), "sort" => "NAME", "default" => true), array("id" => "ACTIVE", "content" => Loc::getMessage("SALE_DSE_PROF_HEAD_ACTIVE"), "sort" => "ACTIVE", "default" => true), array("id" => "LOGOTIP", "content" => Loc::getMessage("SALE_DSE_PROF_HEAD_LOGOTIP"), "sort" => "LOGOTIP", "default" => true));
    $lAdminSubServices->AddHeaders($profileHeader);
    while ($profileParams = $profilesList->NavNext(true, "f_")) {
        $actUrl = "sale_delivery_service_edit.php?lang=" . LANG . "&PARENT_ID=" . $f_PARENT_ID . "&ID=" . $f_ID . '&' . $tabControl->ActiveTabParam() . "&back_url=" . urlencode($APPLICATION->GetCurPageParam());
        $row =& $lAdminSubServices->AddRow($f_ID, $profileParams, $actUrl, Loc::getMessage("SALE_DSE_EDIT_DESCR"));
        $row->AddField("NAME", '<a href="' . $actUrl . '" class="adm-list-table-icon-link">' . '<span class="adm-list-table-link">' . $f_NAME . '</span>' . '</a>');
        $row->AddField("ID", $f_ID);
        $logoHtml = intval($f_LOGOTIP) > 0 ? CFile::ShowImage(CFile::GetFileArray($f_LOGOTIP), 150, 150, "border=0", "", false) : "";
        $row->AddField("LOGOTIP", $logoHtml);
        $row->AddField("ACTIVE", $f_ACTIVE == "Y" ? Loc::getMessage("SALE_DSE_YES") : Loc::getMessage("SALE_DSE_NO"));
        $row->AddField("CLASS_NAME", $f_CLASS_NAME);
        $arActions = array();
예제 #9
0
    $deliveryIds = $_POST["DELIVERY_HANDLERS"];
} else {
    $deliveryIds = array();
}
?>
		<tr>
			<td width="40%">
				<?php 
echo GetMessage('SPS_DELIVERY_HANDLERS');
?>
:
			</td>
			<td width="60%">
				<select multiple="multiple" size="5" name="DELIVERY_HANDLERS[]">
					<?php 
$dbDelivery = \Bitrix\Sale\Delivery\Services\Table::getList(array('order' => array("SORT" => "ASC", "PARENT_NAME" => "ASC", "NAME" => "ASC"), 'filter' => array("ACTIVE" => "Y", "!=CLASS_NAME" => array('\\Bitrix\\Sale\\Delivery\\Services\\EmptyDeliveryService', '\\Bitrix\\Sale\\Delivery\\Services\\Group')), 'select' => array('ID', 'NAME', 'PARENT', 'PARENT_ID', 'PARENT_NAME' => 'PARENT.NAME')));
while ($arDelivery = $dbDelivery->fetch()) {
    echo '<option value="' . $arDelivery["ID"] . '"' . (is_array($deliveryIds) && in_array($arDelivery["ID"], $deliveryIds) ? " selected" : "") . '>' . (strlen($arDelivery["PARENT_NAME"]) > 0 ? htmlspecialcharsbx($arDelivery["PARENT_NAME"]) . ":" : "") . htmlspecialcharsbx($arDelivery["NAME"]) . ' [' . $arDelivery["ID"] . ']' . '</option>';
}
?>
				</select>
			</td>
		</tr>
	<?php 
$tabControl->EndTab();
$tabControl->Buttons(array("disabled" => $saleModulePermissions < "W", "back_url" => "/bitrix/admin/sale_pay_system.php?lang=" . LANG . GetFilterParams("filter_")));
$tabControl->End();
?>
</form>
<script type="text/javascript">
	function psToggleNextSiblings(obj, siblNumber, hide)
예제 #10
0
 /**
  * @param bool|string $strControlID
  * @return array|bool
  */
 public static function GetControls($strControlID = false)
 {
     $arSalePersonTypes = array();
     $arFilter = array();
     if (static::$boolInit) {
         if (isset(static::$arInitParams['SITE_ID'])) {
             $arFilter['LID'] = static::$arInitParams['SITE_ID'];
         }
     }
     $rsPersonTypes = CSalePersonType::GetList(array(), $arFilter, false, false, array('ID', 'NAME', 'LIDS'));
     while ($arPersonType = $rsPersonTypes->Fetch()) {
         $arPersonType['ID'] = intval($arPersonType['ID']);
         $arSalePersonTypes[$arPersonType['ID']] = $arPersonType['NAME'] . '(' . implode(' ', $arPersonType['LIDS']) . ')';
     }
     $arSalePaySystemList = array();
     $arFilter = array();
     $rsPaySystems = CSalePaySystem::GetList(array(), $arFilter, false, false, array('ID', 'NAME'));
     while ($arPaySystem = $rsPaySystems->Fetch()) {
         $arSalePaySystemList[$arPaySystem['ID']] = $arPaySystem['NAME'];
     }
     $linearDeliveryList = array();
     $deliveryList = array();
     $deliveryIterator = Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'CODE', 'NAME', 'PARENT_ID'), 'order' => array('PARENT_ID' => 'ASC', 'SORT' => 'ASC', 'NAME' => 'ASC')));
     while ($delivery = $deliveryIterator->fetch()) {
         $deliveryId = (int) $delivery['ID'];
         $parentId = (int) $delivery['PARENT_ID'];
         if ($parentId > 0) {
             if (isset($deliveryList[$parentId])) {
                 $deliveryList[$parentId]['PROFILES'][$deliveryId] = array('ID' => $deliveryId, 'TITLE' => $delivery['NAME']);
             }
         } else {
             $deliveryList[$deliveryId] = array('ID' => $deliveryId, 'TITLE' => $delivery['NAME'], 'PROFILES' => array());
         }
         unset($parentId, $deliveryId);
     }
     unset($delivery, $deliveryIterator);
     if (!empty($deliveryList)) {
         foreach ($deliveryList as &$delivery) {
             if (empty($delivery['PROFILES'])) {
                 $linearDeliveryList[$delivery['ID']] = $delivery['TITLE'];
             } else {
                 foreach ($delivery['PROFILES'] as $profile) {
                     $linearDeliveryList[$profile['ID']] = $profile['TITLE'];
                 }
                 unset($profile);
             }
         }
         unset($delivery);
     }
     unset($deliveryList);
     $arLabels = array(BT_COND_LOGIC_EQ => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_EQ_LABEL'), BT_COND_LOGIC_NOT_EQ => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_NOT_EQ_LABEL'), BT_COND_LOGIC_GR => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_GR_LABEL'), BT_COND_LOGIC_LS => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_LS_LABEL'), BT_COND_LOGIC_EGR => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_EGR_LABEL'), BT_COND_LOGIC_ELS => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_ELS_LABEL'));
     $arLabelsWeight = array(BT_COND_LOGIC_EQ => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_EQ_LABEL'), BT_COND_LOGIC_NOT_EQ => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_NOT_EQ_LABEL'), BT_COND_LOGIC_GR => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_GR_LABEL'), BT_COND_LOGIC_LS => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_LS_LABEL'), BT_COND_LOGIC_EGR => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_EGR_LABEL'), BT_COND_LOGIC_ELS => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_ELS_LABEL'));
     $arControlList = array('CondSaleOrderSumm' => array('ID' => 'CondSaleOrderSumm', 'FIELD' => 'ORDER_PRICE', 'FIELD_TYPE' => 'double', 'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_ORDER_SUMM_LABEL_EXT'), 'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_ORDER_SUMM_PREFIX_EXT'), 'LOGIC' => static::GetLogicEx(array_keys($arLabels), $arLabels), 'JS_VALUE' => array('type' => 'input')), 'CondSalePersonType' => array('ID' => 'CondSalePersonType', 'FIELD' => 'PERSON_TYPE_ID', 'FIELD_TYPE' => 'int', 'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PERSON_TYPE_LABEL'), 'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PERSON_TYPE_PREFIX'), 'LOGIC' => static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)), 'JS_VALUE' => array('type' => 'select', 'multiple' => 'Y', 'values' => $arSalePersonTypes, 'show_value' => 'Y'), 'PHP_VALUE' => array('VALIDATE' => 'list')), 'CondSalePaySystem' => array('ID' => 'CondSalePaySystem', 'FIELD' => 'PAY_SYSTEM_ID', 'FIELD_TYPE' => 'int', 'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PAY_SYSTEM_LABEL'), 'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PAY_SYSTEM_PREFIX'), 'LOGIC' => static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)), 'JS_VALUE' => array('type' => 'select', 'multiple' => 'Y', 'values' => $arSalePaySystemList, 'show_value' => 'Y'), 'PHP_VALUE' => array('VALIDATE' => 'list')), 'CondSaleDelivery' => array('ID' => 'CondSaleDelivery', 'FIELD' => 'DELIVERY_ID', 'FIELD_TYPE' => 'string', 'FIELD_LENGTH' => 50, 'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_DELIVERY_LABEL'), 'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_DELIVERY_PREFIX'), 'LOGIC' => static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)), 'JS_VALUE' => array('type' => 'select', 'multiple' => 'Y', 'values' => $linearDeliveryList, 'show_value' => 'Y'), 'PHP_VALUE' => array('VALIDATE' => 'list')), 'CondSaleOrderWeight' => array('ID' => 'CondSaleOrderWeight', 'FIELD' => 'ORDER_WEIGHT', 'FIELD_TYPE' => 'double', 'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_SALE_ORDER_WEIGHT_LABEL'), 'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_SALE_ORDER_WEIGHT_PREFIX'), 'LOGIC' => static::GetLogicEx(array_keys($arLabelsWeight), $arLabelsWeight), 'JS_VALUE' => array('type' => 'input')));
     foreach ($arControlList as &$control) {
         $control['EXECUTE_MODULE'] = 'sale';
         $control['MODULE_ID'] = 'sale';
         $control['MODULE_ENTITY'] = 'sale';
         $control['ENTITY'] = 'ORDER';
         $control['MULTIPLE'] = 'N';
         $control['GROUP'] = 'N';
     }
     unset($control);
     if ($strControlID === false) {
         return $arControlList;
     } elseif (isset($arControlList[$strControlID])) {
         return $arControlList[$strControlID];
     } else {
         return false;
     }
 }
예제 #11
0
                $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
                $res = \Bitrix\Sale\Delivery\Services\Table::update($ID, $arFields);
                if (!$res->isSuccess()) {
                    if ($errors = $res->getErrors()) {
                        $lAdmin->AddGroupError(implode("<br>/n", $errors), $ID);
                    } else {
                        $lAdmin->AddGroupError(Loc::getMessage("SALE_SDL_ERROR_UPDATE"), $ID);
                    }
                } else {
                    \Bitrix\Sale\Delivery\Services\Table::setChildrenFieldsValues($ID, $arFields);
                }
                break;
        }
    }
}
$dbResultList = \Bitrix\Sale\Delivery\Services\Table::getList(array('order' => array($by => $order), 'filter' => $filter));
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("SALE_SDL_PRLIST")));
$lAdmin->AddHeaders(array(array("id" => "NAME", "content" => Loc::getMessage("SALE_SDL_NAME"), "sort" => "NAME", "default" => true), array("id" => "GROUP_NAME", "content" => Loc::getMessage("SALE_SDL_GROUP_NAME"), "sort" => "PARENT.NAME", "default" => true), array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "LOGOTIP", "content" => Loc::getMessage("SALE_SDL_LOGOTIP"), "sort" => "", "default" => true), array("id" => "DESCRIPTION", "content" => Loc::getMessage("SALE_SDL_DESCRIPTION"), "sort" => "", "default" => false), array("id" => "SORT", "content" => Loc::getMessage("SALE_SDL_SORT"), "sort" => "SORT", "default" => true), array("id" => "ACTIVE", "content" => Loc::getMessage("SALE_SDL_ACTIVE"), "sort" => "ACTIVE", "default" => true), array("id" => "CLASS_NAME", "content" => Loc::getMessage("SALE_SDL_CLASS_NAME"), "sort" => "CLASS_NAME", "default" => false)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
$backUrl = urlencode($APPLICATION->GetCurPageParam("", array("mode")));
while ($service = $dbResultList->NavNext(true, "f_")) {
    if (is_callable($service["CLASS_NAME"] . '::canHasChildren') && $service["CLASS_NAME"]::canHasChildren()) {
        $actUrl = "sale_delivery_service_list.php?lang=" . LANG . "&filter_group=" . $f_ID;
        $row =& $lAdmin->AddRow($f_ID, $service, $actUrl, GetMessage("SALE_SALE_EDIT_DESCR"));
        $row->AddField("NAME", '<a href="' . $actUrl . '" class="adm-list-table-icon-link">' . '<span class="adm-submenu-item-link-icon adm-list-table-icon sale_section_icon"></span>' . '<span class="adm-list-table-link">' . $f_NAME . '</span>' . '</a>');
    } else {
        $actUrl = "sale_delivery_service_edit.php?lang=" . LANG . "&PARENT_ID=" . $f_PARENT_ID . "&ID=" . $f_ID . "&back_url=" . $backUrl;
        $row =& $lAdmin->AddRow($f_ID, $service, $actUrl, GetMessage("SALE_SALE_EDIT_DESCR"));
        $row->AddField("NAME", '<a href="' . $actUrl . '" class="adm-list-table-icon-link">' . '<span class="adm-list-table-link">' . $f_NAME . '</span>' . '</a>');
예제 #12
0
 protected function getDeliveryCodes()
 {
     $this->deliveryCodes = array();
     $deliveryIterator = Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'CODE')));
     while ($delivery = $deliveryIterator->fetch()) {
         $delivery['CODE'] = (string) $delivery['CODE'];
         if ($delivery['CODE'] == '') {
             continue;
         }
         $this->deliveryCodes[$delivery['CODE']] = $delivery['ID'];
     }
     unset($delivery, $deliveryIterator);
 }
예제 #13
0
 protected static function getEntityItemsFullList($entityType)
 {
     static $result = array();
     if (isset($result[$entityType])) {
         return $result[$entityType];
     }
     $result[$entityType] = array();
     if ($entityType == self::ENTITY_TYPE_DELIVERY) {
         $dbRes = Services\Table::getList(array('filter' => array("ACTIVE" => "Y"), 'select' => array("ID")));
         while ($dsrv = $dbRes->fetch()) {
             $result[$entityType][] = $dsrv["ID"];
         }
     } else {
         $dbRes = PaySystemServiceTable::getList(array('filter' => array("ACTIVE" => "Y"), 'select' => array("ID")));
         while ($ps = $dbRes->fetch()) {
             $result[$entityType][] = $ps["ID"];
         }
     }
     return $result[$entityType];
 }
예제 #14
0
 /**
  * Read some data from database, using cache. Under some info we mean status list, delivery system list and so on.
  * This will be a shared cache between sale.personal.order.list and sale.personal.order.detail, so beware of collisions.
  * @throws Main\SystemException
  * @return void
  */
 protected function obtainDataReferences()
 {
     if ($this->startCache(array('spo-shared'))) {
         try {
             $cachedData = array();
             /////////////////////
             /////////////////////
             // Person type
             $cachedData['PERSON_TYPE'] = array();
             $dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
             while ($arPType = $dbPType->Fetch()) {
                 $cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
             }
             // Save statuses for Filter form
             $cachedData['STATUS'] = array();
             $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID), faslse, false, array('ID', 'NAME', 'DESCRIPTION'));
             while ($arStatus = $dbStatus->Fetch()) {
                 $cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
             }
             $cachedData['PAYSYS'] = array();
             $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
             while ($arPaySystem = $dbPaySystem->Fetch()) {
                 $cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
             }
             $cachedData['DELIVERY'] = array();
             $dbDelivery = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME', 'PARENT_ID')));
             $deliveryService = array();
             while ($delivery = $dbDelivery->fetch()) {
                 $deliveryService[$delivery['ID']] = $delivery;
             }
             foreach ($deliveryService as $delivery) {
                 $cachedData['DELIVERY'][$delivery["ID"]] = array();
                 if ($delivery['PARENT_ID']) {
                     $cachedData['DELIVERY'][$delivery["ID"]]['NAME'] = $deliveryService[$delivery['PARENT_ID']]['NAME'] . ':' . $delivery['NAME'];
                 } else {
                     $cachedData['DELIVERY'][$delivery["ID"]]['NAME'] = $delivery['NAME'];
                 }
             }
             /////////////////////
             /////////////////////
         } catch (Exception $e) {
             $this->abortCache();
             throw $e;
         }
         $this->endCache($cachedData);
     } else {
         $cachedData = $this->getCacheData();
     }
     $this->dbResult = array_merge($this->dbResult, $cachedData);
 }
예제 #15
0
	</tr>
	<tr>
		<td><?php 
echo Loc::getMessage("SALE_F_DELIVERY_SERVICE");
?>
:</td>
		<td>
			<select name="filter_delivery_service[]" multiple size="3">
				<option value=""><?php 
echo GetMessage("SALE_F_ALL");
?>
</option>
				<?php 
$deliveryServiceParentListParent = array();
$deliveryServiceList = array();
$res = Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME', 'PARENT_ID'), 'filter' => array('ACTIVE' => 'Y'), 'order' => array("SORT" => "ASC", "NAME" => "ASC")));
while ($deliveryService = $res->fetch()) {
    if (intval($deliveryService['PARENT_ID']) == 0) {
        $deliveryServiceParentListParent[$deliveryService['ID']] = $deliveryService['NAME'];
    } else {
        $deliveryServiceListAll[$deliveryService['PARENT_ID']][$deliveryService['ID']] = $deliveryService['NAME'];
    }
}
foreach ($deliveryServiceParentListParent as $deliveryServiceParentId => $deliveryServiceParentName) {
    if (!empty($deliveryServiceListAll[$deliveryServiceParentId])) {
        foreach ($deliveryServiceListAll[$deliveryServiceParentId] as $deliveryServiceId => $deliveryServiceName) {
            $deliveryServiceList[$deliveryServiceId] = $deliveryServiceParentName . ":" . $deliveryServiceName;
        }
    } else {
        $deliveryServiceList[$deliveryServiceParentId] = $deliveryServiceParentName;
    }
예제 #16
0
 /**
  * Function returns reference data as shared cache between this component and sale.personal.order.list.
  *
  * @throws Exception
  * @return void
  */
 protected function obtainDataReferences()
 {
     if ($this->startCache(array('spo-shared'))) {
         try {
             $cachedData = array();
             /////////////////////
             /////////////////////
             // Person type
             $dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
             while ($arPType = $dbPType->Fetch()) {
                 $cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
             }
             // Save statuses for Filter form
             $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
             while ($arStatus = $dbStatus->Fetch()) {
                 $cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
             }
             $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
             while ($arPaySystem = $dbPaySystem->Fetch()) {
                 $arPaySystem['NAME'] = htmlspecialcharsbx($arPaySystem['NAME']);
                 $cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
             }
             $cachedData['DELIVERY'] = array();
             $shipmentIds = array();
             foreach ($this->dbResult['SHIPMENT'] as $shipment) {
                 $shipmentIds[] = $shipment['DELIVERY_ID'];
             }
             $dbDelivery = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME', 'PARENT_NAME' => 'PARENT.NAME', 'PARENT_CLASS_NAME' => 'PARENT.CLASS_NAME'), 'filter' => array('ID' => $shipmentIds)));
             $deliveryService = array();
             while ($delivery = $dbDelivery->fetch()) {
                 $deliveryService[$delivery['ID']] = $delivery;
             }
             foreach ($deliveryService as $delivery) {
                 $cachedData['DELIVERY'][$delivery["ID"]] = array();
                 if ($delivery['PARENT_NAME']) {
                     $cachedData['DELIVERY'][$delivery["ID"]]['NAME'] = htmlspecialcharsbx($delivery['PARENT_NAME'] . ':' . $delivery['NAME']);
                 } else {
                     $cachedData['DELIVERY'][$delivery["ID"]]['NAME'] = htmlspecialcharsbx($delivery['NAME']);
                 }
             }
             /////////////////////
             /////////////////////
         } catch (Exception $e) {
             $this->abortCache();
             throw $e;
         }
         $this->endCache($cachedData);
     } else {
         $cachedData = $this->getCacheData();
     }
     $this->dbResult = array_merge($this->dbResult, $this->adaptCachedReferences($cachedData));
 }
예제 #17
0
 public static function init()
 {
     IncludeModuleLangFile(__FILE__);
     if (!self::$fInit) {
         self::$fInit = true;
         self::$siteCookieId = md5('SALE_REPORT_SITE_ID');
         // Initializing list of sites.
         $result = Bitrix\Main\SiteTable::getList(array('select' => array('LID', 'DEF', 'NAME')));
         $i = 0;
         while ($row = $result->fetch()) {
             self::$sitelist[$row['LID']] = $row['NAME'];
             if (++$i === 1) {
                 self::$defaultSiteId = $row['LID'];
             } else {
                 if ($row['DEF'] === 'Y') {
                     self::$defaultSiteId = $row['LID'];
                 }
             }
             self::$weightOptions[$row['LID']] = array('unit' => COption::GetOptionString('sale', 'weight_unit', null, $row['LID']), 'koef' => COption::GetOptionInt('sale', 'weight_koef', null, $row['LID']));
         }
         unset($i, $row, $result);
         // hack, add virtual ID field into StatusLang entity for filtering
         $statusEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\StatusLang');
         if ($statusEntity instanceof \Bitrix\Main\Entity\Base) {
             $statusEntity->addField(array('data_type' => 'string', 'expression' => array('%s', 'STATUS_ID')), 'ID');
         }
         unset($statusEntity);
         // hack, add virtual REPS_ORDER field into Shipment entity for filtering system records
         $shipmentEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\Shipment');
         if ($shipmentEntity instanceof \Bitrix\Main\Entity\Base) {
             $shipmentEntity->addField(array('data_type' => 'Order', 'reference' => array('=ref.ID' => 'this.ORDER_ID', '!=this.SYSTEM' => array('?', 'Y'))), 'REPS_ORDER');
         }
         unset($shipmentEntity);
         // Initializing list of statuses of orders.
         $result = Bitrix\Sale\Internals\StatusLangTable::getList(array('select' => array('STATUS_ID', 'NAME'), 'filter' => array('=LID' => LANGUAGE_ID)));
         while ($row = $result->fetch()) {
             self::$statuslist[$row['STATUS_ID']] = $row['NAME'];
         }
         unset($row, $result);
         self::$genders = array('M' => GetMessage('USER_MALE'), 'F' => GetMessage('USER_FEMALE'));
         // Initializing list of person types.
         $result = Bitrix\Sale\Internals\PersonTypeTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$personTypes[$row['ID']] = array('LID' => $row['LID'], 'NAME' => $row['NAME']);
         }
         unset($row, $result);
         // Initializing list of pay systems of orders.
         $result = Bitrix\Sale\PaySystemTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$paySystemList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => $row['LID']);
         }
         unset($row, $result);
         // Initializing list of services and methods of delivery.
         $result = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$deliveryList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => '');
         }
         unset($row, $result);
         // Obtaining table of correspondences of iblocks to sites.
         $result = Bitrix\Iblock\IblockSiteTable::getList();
         while ($row = $result->fetch()) {
             self::$iblockSite[$row['SITE_ID']][] = $row['IBLOCK_ID'];
         }
         unset($row, $result);
         // Obtaining the list of iblocks which are directories and filling
         // a property $catalogSections with sections of these units.
         $ent = new CCatalog();
         $result = $ent->GetList();
         while ($ibRow = $result->Fetch()) {
             // Obtaining list of sections of the catalog.
             self::$catalogs[] = $ibRow;
             $path = array();
             $curLevel = $prevLevel = 0;
             $sections = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $ibRow['IBLOCK_ID']));
             $row = null;
             while ($row = $sections->GetNext()) {
                 // Formation of an array of identifiers of current and parent sections.
                 $curLevel = $row['DEPTH_LEVEL'];
                 for ($i = 0; $i <= $prevLevel - $curLevel; $i++) {
                     array_pop($path);
                 }
                 array_push($path, $row['ID']);
                 $prevLevel = $curLevel;
                 self::$catalogSections[$row['ID']] = array('name' => ltrim(str_repeat(' . ', $curLevel) . $row['NAME']), 'path' => $path, 'catalog' => array('ID' => $ibRow['ID'], 'NAME' => $ibRow['NAME']));
             }
         }
         unset($ent, $ibRow, $row, $sections, $result);
         // Initialization of the list of warehouses.
         $result = Bitrix\Catalog\StoreTable::getList(array('select' => array('ID', 'TITLE')));
         while ($row = $result->fetch()) {
             self::$productStores[$row['ID']] = $row['TITLE'];
         }
         unset($row, $result);
         // Getting currencies
         $obj = new CCurrency();
         $by = '';
         $order = '';
         $result = $obj->GetList($by, $order, LANGUAGE_ID);
         while ($row = $result->Fetch()) {
             self::$currencies[$row['CURRENCY']] = array('name' => $row['FULL_NAME']);
         }
         unset($row, $result, $obj, $by, $order);
         // Getting types of prices
         $obj = new CCatalogGroup();
         $result = $obj->GetListEx(array('SORT'), array(), false, false, array('ID', 'NAME', 'BASE', 'NAME_LANG'));
         while ($row = $result->Fetch()) {
             self::$priceTypes[$row['ID']] = array('name' => empty($row['NAME_LANG']) ? $row['NAME'] : $row['NAME_LANG'], 'base' => $row['BASE'] === 'Y' ? true : false);
         }
         unset($row, $result, $obj);
         // Getting option, which means, it is necessary to display a fractional quantity of goods of no.
         self::$fDecimalQuant = COption::GetOptionString('sale', 'QUANTITY_FACTORIAL') == 'Y';
         self::initOwners();
     }
 }
예제 #18
0
 private static function getDeliveryServiceInfoById($id)
 {
     $service = null;
     if ($id > 0) {
         $resService = \Bitrix\Sale\Delivery\Services\Table::getList(array('filter' => array('ID' => $id), 'order' => array('SORT' => 'ASC', 'NAME' => 'ASC'), 'select' => array("ID", "NAME", "DESCRIPTION", "LOGOTIP", "CLASS_NAME", "PARENT_ID", "CONFIG")));
         $service = $resService->fetch();
     }
     return $service;
 }
예제 #19
0
 /**
  * @return int
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function getEmptyDeliveryServiceId()
 {
     $res = Table::getList(array('select' => array('ID'), 'filter' => array('=CLASS_NAME' => '\\Bitrix\\Sale\\Delivery\\Services\\EmptyDeliveryService')));
     $data = $res->fetch();
     return $data ? $data['ID'] : 0;
 }
예제 #20
0
?>



		<?php 
if (DoubleVal($arOrder["PRICE_DELIVERY"]) > 0) {
    ?>
			<tr>
				<td bgcolor="#ffffff" style="border: 1pt solid #000000; border-right:none; border-top:none;">
					<?php 
    echo $n;
    ?>
				</td>
				<td bgcolor="#ffffff" style="border: 1pt solid #000000; border-right:none; border-top:none;">
					Доставка <?php 
    $res = \Bitrix\Sale\Delivery\Services\Table::getList(array('filter' => array('=CODE' => $arOrder["DELIVERY_ID"])));
    if ($deliveryService = $res->fetch()) {
        if (strlen($deliveryService["NAME"]) > 0) {
            echo "(" . htmlspecialcharsEx($deliveryService["NAME"]) . ")";
        }
    }
    $basket_tax = CSaleOrderTax::CountTaxes(DoubleVal($arOrder["PRICE_DELIVERY"]), $arTaxList, $arOrder["CURRENCY"]);
    $nds_val = 0;
    $item_price = DoubleVal($arOrder["PRICE_DELIVERY"]);
    for ($i = 0, $max = count($arTaxList); $i < $max; $i++) {
        if ($arTaxList[$i]["IS_IN_PRICE"] == "Y") {
            $item_price -= $arTaxList[$i]["TAX_VAL"];
        }
        $nds_val += $arTaxList[$i]["TAX_VAL"];
        $total_nds += $nds_val;
    }