Exemplo n.º 1
0
 /**
  * @param array $restriction
  * @param array $filter
  * @return bool
  * @throws \Bitrix\Main\ArgumentNullException
  */
 protected static function checkRestrictionFilter(array $restriction, array $filter)
 {
     $result = true;
     switch ($restriction["CLASS_NAME"]) {
         case '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite':
             $fieldInFilter = self::isFieldInFilter2("LID", $filter);
             $value = self::getFilterValue("LID", $filter);
             if (!$fieldInFilter) {
                 break;
             }
             if (is_array($restriction["PARAMS"]["SITE_ID"])) {
                 $result = in_array($value, $restriction["PARAMS"]["SITE_ID"]);
             } else {
                 $result = $value == $restriction["PARAMS"]["SITE_ID"];
             }
             break;
         case '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByWeight':
             $result = !(self::isFieldInFilter2("WEIGHT_FROM", $filter) && floatval(self::getFilterValue("WEIGHT_FROM", $filter)) < floatval($restriction["PARAMS"]["MIN_WEIGHT"]));
             $result = $result && !(self::isFieldInFilter2("WEIGHT_TO", $filter) && floatval(self::getFilterValue("WEIGHT_TO", $filter)) > floatval($restriction["PARAMS"]["MAX_WEIGHT"]));
             break;
         case '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPrice':
             $fieldInFilter = self::isFieldInFilter2("ORDER_PRICE_FROM", $filter);
             $value = self::getFilterValue("ORDER_PRICE_FROM", $filter);
             $value = floatval($value);
             if ($fieldInFilter && $value > 0 && floatval($restriction["PARAMS"]["MIN_PRICE"]) > 0) {
                 $result = floatval($value) > floatval($restriction["PARAMS"]["MIN_PRICE"]);
                 if (!$result) {
                     break;
                 }
             }
             $fieldInFilter = self::isFieldInFilter2("ORDER_PRICE_TO", $filter);
             $value = self::getFilterValue("ORDER_PRICE_TO", $filter);
             $value = floatval($value);
             if ($fieldInFilter && $value > 0 && floatval($restriction["PARAMS"]["MAX_PRICE"]) > 0) {
                 $result = floatval($value) < floatval($restriction["PARAMS"]["MAX_PRICE"]);
                 if (!$result) {
                     break;
                 }
             }
             $fieldInFilter = self::isFieldInFilter2("ORDER_CURRENCY", $filter);
             $value = self::getFilterValue("ORDER_CURRENCY", $filter);
             if ($fieldInFilter && strlen($value) > 0 && strlen($restriction["PARAMS"]["CURRENCY"]) > 0) {
                 $result = $value == $restriction["PARAMS"]["CURRENCY"];
                 if (!$result) {
                     break;
                 }
             }
             break;
         case '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByLocation':
             $fieldInFilter = self::isFieldInFilter2("LOCATION", $filter);
             $value = self::getFilterValue("LOCATION", $filter);
             if ($fieldInFilter && strlen($value) > 0) {
                 $result = \Bitrix\Sale\Delivery\Services\Manager::checkServiceRestriction($restriction['DELIVERY_ID'], $value, '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByLocation');
             }
             break;
         default:
             break;
     }
     return $result;
 }
Exemplo n.º 2
0
 protected function changeDeliveryServiceAction()
 {
     $result = array();
     $profiles = array();
     $index = $this->request['index'];
     $formData = isset($this->request["formData"]) ? $this->request["formData"] : array();
     $formData['ID'] = $formData['order_id'];
     $deliveryId = intval($formData['SHIPMENT'][$index]['DELIVERY_ID']);
     if ($deliveryId <= 0) {
         return;
     }
     $order = $this->getOrder($formData);
     /** @var  \Bitrix\Sale\Delivery\Services\Base $service */
     $service = Sale\Delivery\Services\Manager::getService($deliveryId);
     if ($service->canHasProfiles()) {
         $profiles = Admin\Blocks\OrderShipment::getDeliveryServiceProfiles($deliveryId);
         if (!isset($formData['SHIPMENT'][$index]['PROFILE'])) {
             reset($profiles);
             $initProfile = current($profiles);
             $formData['SHIPMENT'][$index]['PROFILE'] = $initProfile['ID'];
             $this->request["formData"]['SHIPMENT'][$index]['PROFILE'] = $initProfile['ID'];
         }
     }
     $res = Admin\Blocks\OrderShipment::updateData($order, $formData['SHIPMENT']);
     $data = $res->getData();
     $shipment = array_shift($data['SHIPMENT']);
     if ($service->canHasProfiles()) {
         $profiles = Admin\Blocks\OrderShipment::checkProfilesRestriction($profiles, $shipment);
         $result["PROFILES"] = Admin\Blocks\OrderShipment::getProfileEditControl($profiles, $index, $shipment->getDeliveryId());
         foreach ($profiles as $profile) {
             if ($formData['SHIPMENT'][$index]['PROFILE'] == $profile['ID'] && !$profile['RESTRICTED']) {
                 $result['DELIVERY_ERROR'] = Loc::getMessage('SALE_OA_ERROR_DELIVERY_SERVICE');
                 break;
             }
         }
     }
     $deliveryService = Admin\Blocks\OrderShipment::getDeliveryServiceList($shipment);
     foreach ($deliveryService as $i => $dlService) {
         if ($dlService['ID'] <= 0) {
             continue;
         }
         if (!Sale\Delivery\Services\Manager::checkServiceRestriction($dlService['ID'], $shipment, '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite')) {
             unset($deliveryService[$i]);
         }
     }
     $deliveryServiceTree = Admin\Blocks\OrderShipment::makeDeliveryServiceTree($deliveryService);
     $result['DELIVERY_SERVICE_LIST'] = Admin\Blocks\OrderShipment::getTemplate($deliveryServiceTree);
     foreach ($deliveryService as $delivery) {
         if ($deliveryId == $delivery['ID'] && $delivery['RESTRICTED']) {
             $result['DELIVERY_ERROR'] = Loc::getMessage('SALE_OA_ERROR_DELIVERY_SERVICE');
             break;
         }
     }
     $storeMap = Admin\Blocks\OrderShipment::getMap($shipment->getDeliveryId(), $index);
     if ($storeMap) {
         $result['MAP'] = $storeMap;
     }
     $extraServiceManager = new \Bitrix\Sale\Delivery\ExtraServices\Manager($deliveryId);
     $extraServiceManager->setOperationCurrency($order->getCurrency());
     $deliveryExtraService = $shipment->getExtraServices();
     if ($deliveryExtraService) {
         $extraServiceManager->setValues($deliveryExtraService);
     }
     $extraService = $extraServiceManager->getItems();
     if ($extraService) {
         $result["EXTRA_SERVICES"] = Admin\Blocks\OrderShipment::getExtraServiceEditControl($extraService, $index);
     }
     $deliveryPrice = Admin\Blocks\OrderShipment::getDeliveryPrice($shipment);
     if ($shipment->getField('CUSTOM_PRICE_DELIVERY') == 'Y') {
         $result["CUSTOM_PRICE"] = $deliveryPrice;
     } else {
         $this->request['formData']['SHIPMENT'][$index]['PRICE_DELIVERY'] = $deliveryPrice;
     }
     $this->addResultData("SHIPMENT_DATA", $result);
     $this->formDataChanged = true;
 }
Exemplo n.º 3
0
    public static function getEditTemplate($data, $index, $formType, $post)
    {
        $index++;
        static $items = null;
        if (is_null($items)) {
            $items = self::getDeliveryServiceList();
        }
        foreach ($items as $i => $dlService) {
            if ($dlService['ID'] <= 0) {
                continue;
            }
            if (!Services\Manager::checkServiceRestriction($dlService['ID'], self::$shipment, '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite')) {
                unset($items[$i]);
            }
        }
        if (!isset($items[$data['DELIVERY_ID']])) {
            $delivery = self::getDeliveryServiceInfoById($data['DELIVERY_ID']);
            if ($delivery) {
                $items[$delivery['ID']] = $delivery;
            }
        }
        static $deliveries = null;
        if (is_null($deliveries)) {
            $deliveries = self::makeDeliveryServiceTree($items);
        }
        $deliveryId = 0;
        $profileId = 0;
        if (isset($post['DELIVERY_ID'])) {
            if (isset($post['PROFILE'])) {
                $data['DELIVERY_ID'] = $post['PROFILE'];
            } else {
                $data['DELIVERY_ID'] = $post['DELIVERY_ID'];
            }
        }
        if ($data['DELIVERY_ID']) {
            $deliveryId = $data['DELIVERY_ID'];
            $service = Services\Manager::getService($deliveryId);
            if ($service && $service->getParentService()) {
                $profileId = $deliveryId;
                $deliveryId = $service->getParentService()->getId();
            }
        }
        if (isset($post['ALLOW_DELIVERY'])) {
            $data['ALLOW_DELIVERY'] = $post['ALLOW_DELIVERY'];
        }
        if ($data['ALLOW_DELIVERY'] == 'Y') {
            $allowDelivery = '<span id="BUTTON_ALLOW_DELIVERY_' . $index . '">' . Loc::getMessage('SALE_ORDER_SHIPMENT_ALLOW_DELIVERY_YES') . '</span>';
        } else {
            $allowDelivery = '<span id="BUTTON_ALLOW_DELIVERY_' . $index . '" class="notdelivery">' . Loc::getMessage('SALE_ORDER_SHIPMENT_ALLOW_DELIVERY_NO') . '</span>';
        }
        $allowDelivery = '<span>' . $allowDelivery . '<span class="triangle"> &#9662;</span></span>';
        if (isset($post['DEDUCTED'])) {
            $data['DEDUCTED'] = $post['DEDUCTED'];
        }
        if ($data['DEDUCTED'] == 'Y') {
            $deducted = '<span id="BUTTON_DEDUCTED_' . $index . '">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DEDUCTED_YES') . '</span>';
        } else {
            $deducted = '<span id="BUTTON_DEDUCTED_' . $index . '" class="notdeducted">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DEDUCTED_NO') . '</span>';
        }
        $deducted = '<span>' . $deducted . '<span class="triangle"> &#9662;</span></span>';
        $lang = Main\Application::getInstance()->getContext()->getLanguage();
        $map = '';
        $extraServiceHTML = '';
        $extraServiceManager = new \Bitrix\Sale\Delivery\ExtraServices\Manager($data['DELIVERY_ID']);
        $extraServiceManager->setOperationCurrency($data['CURRENCY']);
        if (isset($post['EXTRA_SERVICES'])) {
            $data['EXTRA_SERVICES'] = $post['EXTRA_SERVICES'];
        }
        if (isset($post['EXTRA_SERVICES'])) {
            $data['DELIVERY_STORE_ID'] = $post['DELIVERY_STORE_ID'];
        }
        if ($data['EXTRA_SERVICES']) {
            $extraServiceManager->setValues($data['EXTRA_SERVICES']);
        }
        $extraService = $extraServiceManager->getItems();
        if ($extraService) {
            $extraServiceHTML = self::getExtraServiceEditControl($extraService, $index);
        }
        if ($data['DELIVERY_ID'] > 0) {
            $map = self::getMap($data['DELIVERY_ID'], $index, $data['DELIVERY_STORE_ID']);
        }
        $title = $data['ID'] > 0 ? Loc::getMessage('SALE_ORDER_SHIPMENT_BLOCK_EDIT_SHIPMENT_TITLE') . $data['ID'] : Loc::getMessage('SALE_ORDER_SHIPMENT_BLOCK_NEW_SHIPMENT_TITLE') . $index;
        $curFormat = \CCurrencyLang::getCurrencyFormat($data['CURRENCY']);
        $currencyLang = trim(str_replace("#", '', $curFormat["FORMAT_STRING"]));
        $customPriceDelivery = isset($post['CUSTOM_PRICE_DELIVERY']) ? $post['CUSTOM_PRICE_DELIVERY'] : $data['CUSTOM_PRICE_DELIVERY'];
        $basePriceDelivery = round(isset($post['BASE_PRICE_DELIVERY']) ? $post['BASE_PRICE_DELIVERY'] : $data['BASE_PRICE_DELIVERY'], 2);
        $priceDelivery = round(isset($post['PRICE_DELIVERY']) ? $post['PRICE_DELIVERY'] : $data['PRICE_DELIVERY'], 2);
        $blockProfiles = '';
        if ($profileId > 0) {
            $profiles = self::getDeliveryServiceProfiles($deliveryId);
            $profiles = self::checkProfilesRestriction($profiles, self::$shipment);
            $profilesTemplate = self::getProfileEditControl($profiles, $index, $profileId);
            $blockProfiles = '
				<tr id="BLOCK_PROFILES_' . $index . '">
					<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_SERVICE_PROFILE') . ':</td>
					<td class="adm-detail-content-cell-r" id="PROFILE_SELECT_' . $index . '">' . $profilesTemplate . '</td>
				</tr>';
        }
        $id = isset($post['ID']) ? $post['SHIPMENT_ID'] : $data['ID'];
        $companyList = OrderEdit::getCompanyList();
        if (!empty($companyList)) {
            $companies = \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml('SHIPMENT[' . $index . '][COMPANY_ID]', $companyList, isset($post["COMPANY_ID"]) ? $post["COMPANY_ID"] : $data["COMPANY_ID"], true, array("class" => "adm-bus-select", "id" => "OFFICE_SHIPMENT" . $index));
        } else {
            $companies = str_replace("#URL#", "/bitrix/admin/sale_company_edit.php?lang=" . $lang, Loc::getMessage('SALE_ORDER_SHIPMENT_ADD_COMPANY'));
        }
        if (isset($items[$data['DELIVERY_ID']]['LOGOTIP']['MAIN'])) {
            $logo = $items[$data['DELIVERY_ID']]['LOGOTIP']['MAIN'];
        } else {
            $logo = '/bitrix/images/sale/logo-default-d.gif';
        }
        $result = '
		<div class="adm-bus-pay" id="shipment_container_' . $index . '">
			<input type="hidden" name="SHIPMENT[' . $index . '][SHIPMENT_ID]" id="SHIPMENT_ID_' . $index . '" value="' . $id . '">
			<input type="hidden" name="SHIPMENT[' . $index . '][CUSTOM_PRICE_DELIVERY]" id="CUSTOM_PRICE_DELIVERY_' . $index . '" value="' . $customPriceDelivery . '">
			<input type="hidden" name="SHIPMENT[' . $index . '][CUSTOM_PRICE]" id="CUSTOM_PRICE_' . $index . '" value="' . (isset($post['CUSTOM_PRICE']) ? $post['CUSTOM_PRICE'] : $data['CUSTOM_PRICE']) . '">
			<input type="hidden" name="SHIPMENT[' . $index . '][DEDUCTED]" id="STATUS_DEDUCTED_' . $index . '" value="' . ($data['DEDUCTED'] == "" ? "N" : $data['DEDUCTED']) . '">
			<input type="hidden" name="SHIPMENT[' . $index . '][ALLOW_DELIVERY]" id="STATUS_ALLOW_DELIVERY_' . $index . '" value="' . ($data['ALLOW_DELIVERY'] == "" ? "N" : $data['ALLOW_DELIVERY']) . '">
			<div class="adm-bus-component-content-container">
				<div class="adm-bus-pay-section">
					<div class="adm-bus-pay-section-title-container">
						<div class="adm-bus-pay-section-title">' . $title . '</div>
					</div>
					<div class="adm-bus-pay-section-content">
						<div class="adm-bus-pay-section-sidebar">
							<div style="background: url(\'' . $logo . '\')" id="delivery_service_logo_' . $index . '" class="adm-shipment-block-logo"></div>
							<div id="section_map_' . $index . '">' . $map . '</div>
						</div>
						<div class="adm-bus-pay-section-right">
							<div class="adm-bus-table-container caption border">
								<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_SHIPMENT_BLOCK_SERVICE') . '</div>
								<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
									<tbody>
										<tr id="BLOCK_DELIVERY_SERVICE_' . $index . '">
											<td class="adm-detail-content-cell-l fwb" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_SERVICE') . ':</td>
											<td class="adm-detail-content-cell-r">
												' . self::getDeliverySelectHtml($deliveries, $deliveryId, $index) . '
											</td>
										</tr>
										' . $blockProfiles . '
									</tbody>
								</table>
							</div>
							<div class="adm-bus-table-container caption border">
								<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_BLOCK_PRICE') . '</div>
								<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
									<tbody>
										<tr>
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_SUM_PRICE') . ':</td>
											<td class="adm-detail-content-cell-r tal"><input type="text" class="adm-bus-input-price" name="SHIPMENT[' . $index . '][BASE_PRICE_DELIVERY]" id="BASE_PRICE_DELIVERY_' . $index . '" value="' . $basePriceDelivery . '"> ' . $currencyLang . '<br></td>
										</tr>
										<tr id="sale-order-shipment-discounts-row-' . $index . '" style="display: none;">
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DISCOUNT') . ':</td>
											<td class="adm-detail-content-cell-r tal" id="sale-order-shipment-discounts-container-' . $index . '"></td>
										</tr>
										<tr style="display: none;">
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_SUM_DISCOUNT_PRICE') . ':</td>
											<td class="adm-detail-content-cell-r tal"><span id="PRICE_DELIVERY_' . $index . '">' . $priceDelivery . '</span> ' . $currencyLang . '</td>
										</tr>
									</tbody>
								</table>
							</div>
							<div class="adm-bus-table-container caption border">
								<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_SHIPMENT_BLOCK_SHIPMENT') . '</div>
								<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
									<tbody>
										<tr>
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_OFFICE') . ':</td>
											<td class="adm-detail-content-cell-r">' . $companies . '</td>
										</tr>
									</tbody>
								</table>
							</div>
							<div class="adm-bus-table-container caption border">
								<div class="adm-bus-moreInfo_part1">
									<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_SHIPMENT_BLOCK_STATUS') . '</div>
									<table class="adm-detail-content-table edit-table" border="0" width="100%" cellpadding="0" cellspacing="0">
										<tbody>
											<tr>
												<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_ALLOW_DELIVERY') . ':</td>
												<td class="adm-detail-content-cell-r delivery-status">' . $allowDelivery . '</td>
											</tr>
											' . (!empty($data['EMP_ALLOW_DELIVERY_ID']) ? '
											<tr>
												<td class="adm-detail-content-cell-l vat" width="40%"></td>
												<td class="adm-detail-content-cell-r">
													<div>' . Loc::getMessage('SALE_ORDER_SHIPMENT_MODIFY_BY') . ': <span style="color: #66878F" id="order_additional_info_date_responsible">' . htmlspecialcharsbx($data['DATE_ALLOW_DELIVERY']) . '</span>  <a href="/bitrix/admin/user_edit.php?lang=' . $lang . '&ID=' . $data['EMP_ALLOW_DELIVERY_ID'] . '" id="order_additional_info_emp_responsible">' . htmlspecialcharsbx($data['EMP_ALLOW_DELIVERY_ID_LAST_NAME']) . ' ' . htmlspecialcharsbx($data['EMP_ALLOW_DELIVERY_ID_NAME']) . '</a></div>
												</td>
											</tr>
											' : '') . '
											<tr>
												<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DEDUCTED') . ':</td>
												<td class="adm-detail-content-cell-r deducted-status">' . $deducted . '</td>
											</tr>
											' . (!empty($data['EMP_DEDUCTED_ID']) ? '
											<tr>
												<td class="adm-detail-content-cell-l fwb vat" width="40%"></td>
												<td class="adm-detail-content-cell-r">
													<div>' . Loc::getMessage('SALE_ORDER_SHIPMENT_MODIFY_BY') . ': <span style="color: #66878F" id="order_additional_info_date_responsible">' . htmlspecialcharsbx($data['DATE_DEDUCTED']) . '</span>  <a href="/bitrix/admin/user_edit.php?lang=' . $lang . '&ID=' . $data['EMP_DEDUCTED_ID'] . '" id="order_additional_info_emp_responsible">' . htmlspecialcharsbx($data['EMP_DEDUCTED_ID_LAST_NAME']) . ' ' . htmlspecialcharsbx($data['EMP_DEDUCTED_ID_NAME']) . '</a></div>
												</td>
											</tr>
											' : '') . '
										</tbody>
									</table>
								</div>
							</div>
							<div class="adm-bus-table-container caption border">
								<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_SHIPMENT_BLOCK_DELIVERY_INFO') . '</div>
								<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
									<tbody>
										<tr>
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_TRACKING_NUMBER') . ':</td>
											<td class="adm-detail-content-cell-r tal"><input type="text" class="adm-bus-input" name="SHIPMENT[' . $index . '][TRACKING_NUMBER]" value="' . htmlspecialcharsbx(isset($post['TRACKING_NUMBER']) ? $post['TRACKING_NUMBER'] : $data['TRACKING_NUMBER']) . '"><br></td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_DOC_NUM') . ':</td>
											<td class="adm-detail-content-cell-r tal"><input type="text" class="adm-bus-input" name="SHIPMENT[' . $index . '][DELIVERY_DOC_NUM]" value="' . htmlspecialcharsbx(isset($post['DELIVERY_DOC_NUM']) ? $post['DELIVERY_DOC_NUM'] : $data['DELIVERY_DOC_NUM']) . '"><br></td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_DOC_DATE') . ':</td>
											<td class="adm-detail-content-cell-r tal">
												<div class="adm-input-wrap adm-calendar-second" style="display: inline-block;">
													<input type="text" class="adm-input adm-calendar-to" id="DELIVERY_DOC_DATE" name="SHIPMENT[' . $index . '][DELIVERY_DOC_DATE]" size="15" value="' . htmlspecialcharsbx(isset($post['DELIVERY_DOC_DATE']) ? $post['DELIVERY_DOC_DATE'] : $data['DELIVERY_DOC_DATE']) . '">
													<span class="adm-calendar-icon" title="' . Loc::getMessage('SALE_ORDER_SHIPMENT_DELIVERY_CHOOSE_DATE') . '" onclick="BX.calendar({node:this, field:\'DELIVERY_DOC_DATE\', form: \'\', bTime: false, bHideTime: false});"></span>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
								<div id="DELIVERY_INFO_' . $index . '">' . $extraServiceHTML . '
								</div>
							</div>
						</div>
						<div class="clb"></div>
					</div>
				</div>
			</div>
		</div>';
        $srcList = self::getImgDeliveryServiceList($items);
        $params = array('index' => $index, 'isAjax' => false, 'src_list' => $srcList, 'active' => true, 'discounts' => $data["DISCOUNTS"], 'discountsMode' => $formType == "edit" ? "view" : "edit", 'templateType' => 'edit');
        $params['base_price_delivery'] = $data['BASE_PRICE_DELIVERY'];
        if ($customPriceDelivery == 'Y') {
            $params['base_price_delivery'] = $data['CUSTOM_PRICE'];
        }
        $result .= self::initJsShipment($params);
        return $result;
    }
Exemplo n.º 4
0
     if (strlen($arUserResult["DELIVERY_ID"]) <= 0 || $arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d" || $checkByDelivery) {
         if (!CSalePaySystemsHelper::checkPSCompability($arPaySystem["PSA_ACTION_FILE"], $arOrder, $arResult["ORDER_PRICE"], $arResult["DELIVERY_PRICE"], $arUserResult["DELIVERY_LOCATION"])) {
             continue;
         }
         if ($arPaySystem["PSA_LOGOTIP"] > 0) {
             $arPaySystem["PSA_LOGOTIP"] = CFile::GetFileArray($arPaySystem["PSA_LOGOTIP"]);
         }
         $arPaySystem["PSA_NAME"] = htmlspecialcharsEx($arPaySystem["PSA_NAME"]);
         $arResult["PAY_SYSTEM"][$arPaySystem["ID"]] = $arPaySystem;
         $arResult["PAY_SYSTEM"][$arPaySystem["ID"]]["PRICE"] = CSalePaySystemsHelper::getPSPrice($arPaySystem, $arResult["ORDER_PRICE"], $arResult["DELIVERY_PRICE"], $arUserResult["DELIVERY_LOCATION"]);
         if (IntVal($arUserResult["PAY_SYSTEM_ID"]) == IntVal($arPaySystem["ID"]) || IntVal($arUserResult["PAY_SYSTEM_ID"]) <= 0 && $bFirst) {
             //$arPaySystem["CHECKED"] = "Y";
             $arResult["PAY_SYSTEM"][$arPaySystem["ID"]]["CHECKED"] = "Y";
             $arUserResult["PAY_SYSTEM_ID"] = $arPaySystem["ID"];
             foreach ($arResult["DELIVERY"] as $deliveryId => $deliveryParams) {
                 if (!\Bitrix\Sale\Delivery\Services\Manager::checkServiceRestriction($deliveryId, $arPaySystem["ID"], '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPaySystem')) {
                     unset($arResult["DELIVERY"][$deliveryId]);
                 }
             }
         }
         $bFirst = false;
     }
 }
 if (IntVal($arUserResult["PAY_SYSTEM_ID"]) > 0 && empty($arResult["PAY_SYSTEM"][$arUserResult["PAY_SYSTEM_ID"]])) {
     $bF = true;
     foreach ($arResult["PAY_SYSTEM"] as $k => $v) {
         if ($bF) {
             $arResult["PAY_SYSTEM"][$k]["CHECKED"] = "Y";
             $arUserResult["PAY_SYSTEM_ID"] = $arResult["PAY_SYSTEM"][$k]["ID"];
             $bF = false;
         }