Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/sale/lib/helpers/ |
Upload File : |
<?php namespace Bitrix\Sale\Helpers; use Bitrix\Main\Config\Option, Bitrix\Sale, Bitrix\Main\Application, Bitrix\Main\SiteTable; class Order { /** * Check ability to view order is not an authorized user * * @param Sale\Order $order * * @return bool * @throws \Bitrix\Main\ArgumentNullException */ public static function isAllowGuestView(Sale\Order $order) { $guestStatuses = Option::get("sale", "allow_guest_order_view_status", ""); $guestStatuses = ($guestStatuses <> '') ? unserialize($guestStatuses, ['allowed_classes' => false]) : array(); return (is_array($guestStatuses) && in_array($order->getField('STATUS_ID'), $guestStatuses) && Option::get("sale", "allow_guest_order_view") === 'Y'); } /** * Return link to order for an unauthorized users. * * @param Sale\Order $order * * @return string * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ArgumentNullException */ public static function getPublicLink(Sale\Order $order) { $context = Application::getInstance()->getContext(); $scheme = $context->getRequest()->isHttps() ? 'https' : 'http'; $siteData = SiteTable::getList(array( 'filter' => array('LID' => $order->getSiteId()), )); $site = $siteData->fetch(); $paths = unserialize(Option::get("sale", "allow_guest_order_view_paths"), ['allowed_classes' => false]); $path = htmlspecialcharsbx($paths[$site['LID']]); if (isset($path) && mb_strpos($path, '#order_id#')) { $accountNumber = urlencode(urlencode($order->getField('ACCOUNT_NUMBER'))); $path = str_replace('#order_id#', $accountNumber,$path); if (mb_strpos($path, '/') !== 0) { $path = '/'.$path; } $path .= (mb_strpos($path, '?')) ? '&' : "?"; $path .= "access=".$order->getHash(); } else { return ""; } return $scheme.'://'.$site['SERVER_NAME'].$path; } }