Example #1
0
 public function executeComponent()
 {
     if (!Loader::includeModule('sale')) {
         return false;
     }
     DiscountCouponsManager::init();
     parent::setFramemode(false);
     $this->weightKoef = $this->arParams["WEIGHT_KOEF"];
     $this->weightUnit = $this->arParams["WEIGHT_UNIT"];
     $this->columns = $this->arParams["COLUMNS_LIST"];
     $this->offersProps = $this->arParams["OFFERS_PROPS"];
     $this->quantityFloat = $this->arParams["QUANTITY_FLOAT"];
     $this->countDiscount4AllQuantity = $this->arParams["COUNT_DISCOUNT_4_ALL_QUANTITY"];
     $this->priceVatShowValue = $this->arParams["PRICE_VAT_SHOW_VALUE"];
     $this->hideCoupon = $this->arParams["HIDE_COUPON"];
     $this->usePrepayment = $this->arParams["USE_PREPAYMENT"];
     $this->pathToOrder = $this->arParams["PATH_TO_ORDER"];
     return parent::executeComponent();
 }
Example #2
0
$arParams["WEIGHT_KOEF"] = htmlspecialcharsbx(Option::get('sale', 'weight_koef', 1, SITE_ID));
if (empty($arParams["TEMPLATE_LOCATION"])) {
    $arParams["TEMPLATE_LOCATION"] = ".default";
}
$errorMessage = "";
$arResultProps = array();
$PERSON_TYPE = isset($_POST["PERSON_TYPE"]) ? (int) $_POST["PERSON_TYPE"] : 0;
$PROFILE_ID = isset($_POST["PROFILE_ID"]) ? (int) $_POST["PROFILE_ID"] : '';
$PROFILE_ID_OLD = isset($_POST["PROFILE_ID_OLD"]) ? (int) $_POST["PROFILE_ID_OLD"] : '';
$PAYSYSTEM_ID = isset($_POST["PAYSYSTEM_ID"]) ? htmlspecialcharsbx($_POST["PAYSYSTEM_ID"]) : '';
$DELIVERY_ID = isset($_POST["DELIVERY_ID"]) ? htmlspecialcharsbx($_POST["DELIVERY_ID"]) : '';
$ORDER_DESCRIPTION = htmlspecialcharsbx(trim($_POST["ORDER_DESCRIPTION"]));
$ORDER_ID = isset($_REQUEST["ORDER_ID"]) ? (int) $_REQUEST["ORDER_ID"] : '';
$currentUserId = (int) $USER->GetID();
if ((int) $ORDER_ID <= 0) {
    DiscountCouponsManager::init();
    /*
     * person type
     */
    $arPersonTypeList = array();
    $dbPersonType = CSalePersonType::GetList(array("ID" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y", 'LID' => SITE_ID));
    while ($arPersonType = $dbPersonType->GetNext()) {
        $arPersonType["CHECKED"] = 'N';
        if ($PERSON_TYPE <= 0) {
            $PERSON_TYPE = $arPersonType["ID"];
            $arPersonType["CHECKED"] = "Y";
        } else {
            if (isset($_POST["PERSON_TYPE"]) && $_POST["PERSON_TYPE"] == $arPersonType["ID"]) {
                $arPersonType["CHECKED"] = "Y";
            }
        }
Example #3
0
if ($boolLocked)
{
	CAdminMessage::ShowMessage(array(
		'MESSAGE' => $strLockUserInfoExt,
		'TYPE' => 'ERROR',
		'HTML' => true
	));
}

if ($ID > 0)
{
	DiscountCouponsManager::init(DiscountCouponsManager::MODE_ORDER, array('orderId' => $ID, 'userId' => $str_USER_ID));
}
else
{
	DiscountCouponsManager::init(DiscountCouponsManager::MODE_MANAGER, array('userId' => 0));
}

CAdminMessage::ShowMessage($errorMessage);

//double function from sale.ajax.location/process.js
?><script type="text/javascript">
function getLocation(country_id, region_id, city_id, arParams, site_id, admin_section)
{
	BX.showWait();

	property_id = arParams.CITY_INPUT_NAME;

	function getLocationResult(res)
	{
		BX.closeWait();
Example #4
0
 public function processRequest($reqObject, $method, $postData)
 {
     $this->log(self::LOG_LEVEL_DEBUG, "YMARKET_INCOMING_REQUEST", $reqObject . ":" . $method, print_r($postData, true));
     $arResult = array();
     if (!$this->isActive()) {
         $arResult = $this->processError(self::ERROR_STATUS_503, GetMessage("SALE_YMH_ERROR_OFF"));
     } elseif (!$this->checkAuth()) {
         $arResult = $this->processError(self::ERROR_STATUS_403, GetMessage("SALE_YMH_ERROR_FORBIDDEN"));
     } else {
         self::$isYandexRequest = true;
         $arPostData = $this->extractPostData($postData);
         DiscountCouponsManager::init(DiscountCouponsManager::MODE_EXTERNAL);
         switch ($reqObject) {
             case 'cart':
                 $arResult = $this->processCartRequest($arPostData);
                 break;
             case 'order':
                 if ($method == "accept") {
                     $arResult = $this->processOrderAcceptRequest($arPostData);
                 } elseif ($method == "status") {
                     $arResult = $this->processOrderStatusRequest($arPostData);
                 }
                 break;
             default:
                 $arResult = $this->processError(self::ERROR_STATUS_400, GetMessage("SALE_YMH_ERROR_UNKNOWN_REQ_OBJ"));
                 break;
         }
     }
     $this->log(self::LOG_LEVEL_DEBUG, "YMARKET_INCOMING_REQUEST_RESULT", $reqObject . ":" . $method, print_r($arResult, true));
     $arPreparedResult = $this->prepareResult($arResult);
     return $arPreparedResult;
 }
Example #5
0
$needFieldsRestore = $_SERVER["REQUEST_METHOD"] == "POST" && !$isSavingOperation;
$isCopyingOrderOperation = $ID > 0;
$createWithProducts = isset($_GET["USER_ID"]) && isset($_GET["SITE_ID"]) && isset($_GET["product"]);
$arUserGroups = $USER->GetUserGroupArray();
$saleModulePermissions = $APPLICATION->GetGroupRight("sale");
if ($saleModulePermissions == "D" || $isSavingOperation && $saleModulePermissions < "U") {
    $APPLICATION->AuthForm(Loc::getMessage("SALE_OK_ACCESS_DENIED"));
}
$moduleId = "sale";
Bitrix\Main\Loader::includeModule('sale');
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/lib/helpers/admin/orderedit.php";
$siteId = isset($_REQUEST["SITE_ID"]) ? htmlspecialcharsbx($_REQUEST["SITE_ID"]) : "";
$siteName = OrderEdit::getSiteName($siteId);
$order = null;
$result = new \Bitrix\Sale\Result();
DiscountCouponsManager::init(DiscountCouponsManager::MODE_MANAGER, array('userId' => isset($_POST["USER_ID"]) ? $_POST["USER_ID"] : 0));
// try to create order from form data & save it
if ($isSavingOperation || $needFieldsRestore) {
    $order = OrderEdit::createOrderFromForm($_POST, $USER->GetID(), true, $_FILES, $result);
    if ($order) {
        if (isset($_POST["SHIPMENT"]) && $_POST["SHIPMENT"]) {
            $dlvRes = Blocks\OrderShipment::updateData($order, $_POST['SHIPMENT']);
            if (!$dlvRes->isSuccess()) {
                $result->addErrors($dlvRes->getErrors());
            }
        }
        if (isset($_POST["PAYMENT"]) && $_POST["PAYMENT"]) {
            $payRes = Blocks\OrderPayment::updateData($order, $_POST['PAYMENT'], !$result->isSuccess());
            if (!$payRes->isSuccess()) {
                $result->addErrors($payRes->getErrors());
            }
Example #6
0
 /**
  * @param $newUserId
  * @param int $orderId
  * @param int|null $oldUserId
  */
 public static function initCouponsData($newUserId, $orderId = 0, $oldUserId = 0)
 {
     $newUserId = (int) $newUserId;
     $orderId = (int) $orderId;
     $params = array('userId' => $newUserId);
     if ($oldUserId !== null) {
         $oldUserId = (int) $oldUserId;
         if ($oldUserId != $newUserId) {
             $params["oldUserId"] = $oldUserId;
         }
     }
     if ($orderId > 0) {
         $params['orderId'] = $orderId;
         DiscountCouponsManager::init(DiscountCouponsManager::MODE_ORDER, $params);
     } else {
         DiscountCouponsManager::init(DiscountCouponsManager::MODE_MANAGER, $params);
     }
 }
Example #7
0
 /**
  * @param $newUserId
  * @param int $orderId
  * @param int $oldUserId
  */
 public static function initCouponsData($newUserId, $orderId = 0, $oldUserId = 0)
 {
     $params = array('userId' => intval($newUserId));
     if (intval($oldUserId) != intval($newUserId)) {
         $params["oldUserId"] = intval($oldUserId);
     }
     if (intval($orderId) > 0) {
         $params['orderId'] = intval($orderId);
         DiscountCouponsManager::init(DiscountCouponsManager::MODE_ORDER, $params);
     } else {
         DiscountCouponsManager::init(DiscountCouponsManager::MODE_MANAGER, $params);
     }
 }