Example #1
0
echo bitrix_sessid_post();
?>
	<div style="position: relative; vertical-align: top">
		<?php 
$tabControl->DraggableBlocksStart();
?>
		<?php 
foreach ($blocksOrder as $blockCode) {
    echo '<a id="' . $blockCode . '"></a>';
    $tabControl->DraggableBlockBegin(Loc::getMessage("SALE_OVIEW_BLOCK_TITLE_" . toUpper($blockCode)), $blockCode);
    switch ($blockCode) {
        case "statusorder":
            echo Admin\Blocks\OrderStatus::getEdit($saleOrder, $USER, true, true);
            break;
        case "buyer":
            echo Admin\Blocks\OrderBuyer::getView($saleOrder);
            break;
        case "delivery":
            $shipments = $saleOrder->getShipmentCollection();
            $index = 0;
            /** @var \Bitrix\Sale\Shipment  $shipment*/
            foreach ($shipments as $shipment) {
                if (!$shipment->isSystem()) {
                    echo Admin\Blocks\OrderShipment::getView($shipment, $index++);
                }
            }
            echo Admin\Blocks\OrderShipment::createNewShipmentButton();
            break;
        case "financeinfo":
            echo Admin\Blocks\OrderFinanceInfo::getView($saleOrder, false);
            break;
Example #2
0
			<?php 
foreach ($blocksOrder as $blockCode) {
    $tabControl->DraggableBlockBegin(GetMessage("SALE_BLOCK_TITLE_" . toUpper($blockCode)), $blockCode);
    switch ($blockCode) {
        case "goodsList":
            echo $shipmentOrderBasket->getEdit();
            echo '<div style="display: none;">' . $shipmentOrderBasket->settingsDialog->getHtml() . '</div>';
            break;
        case "shipmentStatus":
            echo \Bitrix\Sale\Helpers\Admin\Blocks\OrderShipmentStatus::getEdit($shipment);
            break;
        case "shipment":
            echo \Bitrix\Sale\Helpers\Admin\Blocks\OrderShipment::getEdit($shipment, 0, 'edit', $dataForRecovery[1]);
            break;
        case "buyer":
            echo \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getView($saleOrder);
            break;
        case "additional":
            echo \Bitrix\Sale\Helpers\Admin\Blocks\OrderAdditional::getEdit($shipment, $formId . '_form', 'SHIPMENT[1]');
            break;
    }
    $tabControl->DraggableBlockEnd();
}
?>
		</div>
	</td>
</tr>

<?php 
//--TAB order
$tabControl->EndTab();
Example #3
0
 protected function getDemandedFields(array $demandedFields, array $incomingFields, \Bitrix\Sale\Order $order = null)
 {
     $result = array();
     $userId = isset($incomingFields["USER_ID"]) && intval($incomingFields["USER_ID"]) > 0 ? intval($incomingFields["USER_ID"]) : 0;
     $currency = isset($incomingFields["CURRENCY"]) ? trim($incomingFields["CURRENCY"]) : "";
     $personTypeId = isset($incomingFields['PERSON_TYPE_ID']) ? intval($incomingFields['PERSON_TYPE_ID']) : 0;
     $orderId = isset($incomingFields["ID"]) ? intval($incomingFields["ID"]) : 0;
     if ($order === null && intval($orderId) > 0) {
         $order = \Bitrix\Sale\Order::load($orderId);
     }
     foreach ($demandedFields as $demandedField) {
         switch ($demandedField) {
             case "BUYER_USER_NAME":
                 $result["BUYER_USER_NAME"] = intval($userId) > 0 ? \Bitrix\Sale\Helpers\Admin\OrderEdit::getUserName(intval($userId)) : "";
                 break;
             case "PROPERTIES":
                 $profileId = isset($incomingFields["BUYER_PROFILE_ID"]) ? intval($incomingFields["BUYER_PROFILE_ID"]) : 0;
                 $result["PROPERTIES"] = \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getProfileParams($userId, $profileId);
                 break;
             case "BUYER_PROFILES_LIST":
                 if (intval($personTypeId) <= 0) {
                     throw new \Bitrix\Main\ArgumentNullException("personTypeId");
                 }
                 $result["BUYER_PROFILES_LIST"] = \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getBuyerProfilesList($userId, $personTypeId);
                 break;
             case "BUYER_PROFILES_DATA":
                 $result["BUYER_PROFILES_DATA"] = \Bitrix\Sale\Helpers\Admin\Blocks\OrderBuyer::getUserProfiles($userId);
                 break;
             case "BUYER_BUDGET":
                 $res = \CSaleUserAccount::getList(array(), array('USER_ID' => $userId, 'CURRENCY' => $currency, 'LOCKED' => 'N'), false, false, array('CURRENT_BUDGET'));
                 if ($userAccount = $res->Fetch()) {
                     $result["BUYER_BUDGET"] = $userAccount['CURRENT_BUDGET'];
                 } else {
                     $result["BUYER_BUDGET"] = 0;
                 }
                 break;
             case "PROPERTIES_ARRAY":
                 if (!$order) {
                     throw new \Bitrix\Main\SystemException("Can't init order");
                 }
                 if (intval($personTypeId) <= 0) {
                     throw new \Bitrix\Main\ArgumentNullException("personTypeId");
                 }
                 $order->setPersonTypeId($personTypeId);
                 $result["PROPERTIES_ARRAY"] = $order->getPropertyCollection()->getArray();
                 break;
             case "PRODUCT":
                 $result["PRODUCT"] = array();
                 break;
             case "COUPONS":
                 if (!$userId) {
                     throw new \Bitrix\Main\ArgumentNullException("userId");
                 }
                 $result["COUPONS"] = Admin\OrderEdit::getCouponsData();
                 break;
             case "COUPONS_LIST":
                 $result["COUPONS_LIST"] = Admin\OrderEdit::getCouponList($order);
                 break;
             default:
                 throw new \Bitrix\Main\SystemException("Field: \"" . $demandedField . "\" is unknown!");
         }
     }
     return $result;
 }
Example #4
0
echo bitrix_sessid_post();
?>
	<div style="position: relative; vertical-align: top">
		<?php 
$tabControl->DraggableBlocksStart();
?>
		<?php 
foreach ($blocksOrder as $blockCode) {
    echo '<a id="' . $blockCode . '"></a>';
    $tabControl->DraggableBlockBegin(Loc::getMessage("SALE_BLOCK_TITLE_" . toUpper($blockCode)), $blockCode);
    switch ($blockCode) {
        case "statusorder":
            echo Blocks\OrderStatus::getEdit($order, $USER, false, false);
            break;
        case "buyer":
            echo Blocks\OrderBuyer::getEdit($order);
            break;
        case "delivery":
            $shipments = $order->getShipmentCollection();
            $index = 0;
            /** @var \Bitrix\Sale\Shipment  $shipment*/
            foreach ($shipments as $shipment) {
                if (!$shipment->isSystem()) {
                    echo Blocks\OrderShipment::getView($shipment, ++$index, 'edit');
                }
            }
            break;
        case "payment":
            $payments = $order->getPaymentCollection();
            $index = 0;
            foreach ($payments as $payment) {
Example #5
0
                }
            }
            break;
        case "payment":
            $payments = $order->getPaymentCollection();
            if (count($payments) == 0) {
                $order->getPaymentCollection()->createItem();
            }
            $index = 0;
            foreach ($payments as $payment) {
                echo Blocks\OrderPayment::getEdit($payment, ++$index, $_POST['PAYMENT'][$index]);
            }
            echo Blocks\OrderPayment::createButtonAddPayment('edit');
            break;
        case 'relprops':
            echo Blocks\OrderBuyer::getPropsEdit($order);
            break;
        case "financeinfo":
            echo Blocks\OrderFinanceInfo::getView($order);
            break;
        case "additional":
            echo Blocks\OrderAdditional::getEdit($order, $formId . "_form", 'ORDER');
            break;
        case "statusorder":
            echo Blocks\OrderStatus::getEditSimple($USER->GetID(), 'STATUS_ID', \Bitrix\Sale\OrderStatus::getInitialStatus());
            break;
    }
    $tabControl->DraggableBlockEnd();
}
?>
	</div>
Example #6
0
 /**
  * @param Order $order
  * @param array $formData
  * @param int $userId
  *
  * @return \Bitrix\Sale\Result
  */
 protected static function fillSimpleFields(Order $order, array $formData, $userId = 0)
 {
     $result = new \Bitrix\Sale\Result();
     if (isset($formData["ORDER"]["RESPONSIBLE_ID"])) {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->setField("RESPONSIBLE_ID", $formData["ORDER"]["RESPONSIBLE_ID"]);
         if (!$r->isSuccess()) {
             $result->addErrors($r->getErrors());
         }
     }
     if (isset($formData["PERSON_TYPE_ID"]) && intval($formData["PERSON_TYPE_ID"]) > 0) {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->setPersonTypeId(intval($formData['PERSON_TYPE_ID']));
     } else {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->setPersonTypeId(Blocks\OrderBuyer::getDefaultPersonType($order->getSiteId()));
     }
     if (!$r->isSuccess()) {
         $result->addErrors($r->getErrors());
     }
     if (isset($formData["ORDER"]["COMMENTS"])) {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->setField("COMMENTS", $formData["ORDER"]["COMMENTS"]);
         if (!$r->isSuccess()) {
             $result->addErrors($r->getErrors());
         }
     }
     if (isset($formData["USER_DESCRIPTION"])) {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->setField("USER_DESCRIPTION", $formData["USER_DESCRIPTION"]);
         if (!$r->isSuccess()) {
             $result->addErrors($r->getErrors());
         }
     }
     if (isset($formData["RESPONSIBLE_ID"])) {
         /** @var \Bitrix\Sale\Result $r */
         $r = $order->setField("RESPONSIBLE_ID", $formData["RESPONSIBLE_ID"]);
         if (!$r->isSuccess()) {
             $result->addErrors($r->getErrors());
         }
     }
     if (isset($formData["STATUS_ID"]) && strlen($formData["STATUS_ID"]) > 0) {
         $statusesList = \Bitrix\Sale\OrderStatus::getAllowedUserStatuses($userId, \Bitrix\Sale\OrderStatus::getInitialStatus());
         if (array_key_exists($formData["STATUS_ID"], $statusesList)) {
             /** @var \Bitrix\Sale\Result $r */
             $r = $order->setField("STATUS_ID", $formData["STATUS_ID"]);
             if (!$r->isSuccess()) {
                 $result->addErrors($r->getErrors());
             }
         }
     }
     return $result;
 }