18 public static function getEdit(
Sale\
Order $order, $showProfiles =
false, $profileId = 0)
23 <div class="adm-bus-table-container">
24 <table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table">
26 <tr'.(intval($data[
"USER_ID"]) > 0 ?
' style="display: none"':
'' ).
' id="sale-order-buyer-find-button-wrap">
27 <td class="adm-detail-content-cell-l fwb" width="40%">
30 <td class="adm-detail-content-cell-r">
31 <input type="button" name="FIND_BUYER" value="'.
Loc::getMessage(
"SALE_ORDER_BUYER_FIND").
'" onclick="BX.Sale.Admin.OrderBuyer.showChooseBuyerWindow(\''.LANGUAGE_ID.
'\')
"><br>
32 <i>'.Loc::getMessage("SALE_ORDER_BUYER_START_TO_CREATE
").':</i>
35 <tr'.(intval($data["USER_ID
"]) <= 0 ? ' style="display: none
"': '' ).' id="sale-order-buyer-name-wrap
">
36 <td class="adm-detail-content-cell-l
" width="40%
">'.Loc::getMessage("SALE_ORDER_BUYER
").':</td>
37 <td class="adm-detail-content-cell-r
">
38 <div class="adm-s-order-person-choose
">'.static::renderBuyerLink($data, ['id="BUYER_USER_NAME
"']).'
40 <a class="adm-s-bus-morelinkqhsw
" onclick="BX.Sale.Admin.OrderBuyer.showChooseBuyerWindow(\
''.LANGUAGE_ID.
'\')
" href="javascript:void(0);
">
41 '.Loc::getMessage("SALE_ORDER_BUYER_CHANGE
").'
43 <a class="adm-s-bus-morelinkqhsw
" onclick="BX.Sale.Admin.OrderBuyer.clearBuyer();
" href="javascript:void(0);
">
44 '.Loc::getMessage("SALE_ORDER_BUYER_CLEAR
").'
46 <input type="hidden
" name="USER_ID
" id="USER_ID
" value="'.intval($data["USER_ID"]).'" onchange="BX.Sale.Admin.OrderBuyer.onBuyerIdChange(
this);
">
51 <td class="adm-detail-content-cell-l fwb
">'.Loc::getMessage("SALE_ORDER_BUYER_PAYER_TYPE
").':</td>
52 <td class="adm-detail-content-cell-r
">'.
53 \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml(
55 self::getBuyerTypesList($order->getSiteId()),
56 isset($data["PERSON_TYPE_ID
"]) ? $data["PERSON_TYPE_ID
"] : "",
59 "class" => "adm-bus-select
",
60 "id" => "PERSON_TYPE_ID
",
61 "onchange
" => "BX.Sale.Admin.OrderBuyer.onBuyerTypeChange(this.value);
"
66 <tr id="sale-order-buyer-profiles-list-row
"'.($showProfiles ? '' : ' style="display:none;
"').'>
67 <td class="adm-detail-content-cell-l
">'.Loc::getMessage("SALE_ORDER_BUYER_CHOOSE_PROFILE
").':</td>
68 <td class="adm-detail-content-cell-r
"><div id="BUYER_PROFILE_ID_CONTAINER
">';
71 $result .= \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml(
73 self::getBuyerProfilesList($data["USER_ID
"], $data["PERSON_TYPE_ID
"]),
77 "class" => "adm-bus-select
",
78 "id" => "BUYER_PROFILE_ID
",
79 "onchange
" => "BX.Sale.Admin.OrderBuyer.onBuyerProfileChange();
"
84 $result .= '</div></td>
89 '<div id="order_properties_container
"></div>'.
90 '<div>'.self::getOrderPropertiesByJS($order).'</div>'.
91 '<div class="adm-bus-table-container caption border sale-order-props-group
">'.
92 '<div class="adm-bus-table-caption-title
">'.Loc::getMessage("SALE_ORDER_BUYER_COMMENT
").'</div>
93 <table border="0
" cellspacing="0
" cellpadding="0
" width="100%
" class="adm-detail-content-table edit-table
">
96 <td class="adm-detail-content-cell-l
" width="40%
">'.Loc::getMessage("SALE_ORDER_BUYER_ORDERCOMMENT
").':</td>
97 <td class="adm-detail-content-cell-r
">
98 <textarea style="width:400px;min-height:100px;
" name="USER_DESCRIPTION
" id="USER_DESCRIPTION
">'.
99 htmlspecialcharsbx($data["USER_DESCRIPTION
"]).
120 public static function getView(Sale\Order $order)
122 $data = self::prepareData($order);
123 $buyersList = self::getBuyerTypesList($order->getSiteId());
126 <div class="adm-bus-table-container
">
127 <table border="0
" cellspacing="0
" cellpadding="0
" width="100%
" class="adm-detail-content-table edit-table
">
130 <td class="adm-detail-content-cell-l
" width="40%
">'.Loc::getMessage("SALE_ORDER_BUYER
").':</td>
131 <td class="adm-detail-content-cell-r
">
132 <div>'.static::renderBuyerLink($data).'</div>
136 <td class="adm-detail-content-cell-l
">'.Loc::getMessage("SALE_ORDER_BUYER_PAYER_TYPE
").':</td>
137 <td class="adm-detail-content-cell-r
">'.htmlspecialcharsbx($buyersList[$data["PERSON_TYPE_ID
"]]).
143 self::getOrderPropertiesHtml($order, true).
144 '<div class="adm-bus-table-container caption border sale-order-props-group
">'.
145 '<div class="adm-bus-table-caption-title
">'.Loc::getMessage("SALE_ORDER_BUYER_COMMENT
").'</div>
146 <table border="0
" cellspacing="0
" cellpadding="0
" width="100%
" class="adm-detail-content-table edit-table
">
149 <td class="adm-detail-content-cell-l
" width="40%
">'.Loc::getMessage("SALE_ORDER_BUYER_ORDERCOMMENT
").':</td>
150 <td class="adm-detail-content-cell-r
"><p id="sale-adm-user-description-view
" style="color:gray; max-width:800px; overflow:
auto;
">'.($data["USER_DESCRIPTION
"] <> '' ? nl2br(htmlspecialcharsbx($data["USER_DESCRIPTION
"])) : Loc::getMessage("SALE_ORDER_BUYER_NO
")).'</p></td>
346 protected static function getProfileValuesFromUser($userId, $personTypeId)
348 if(intval($personTypeId) <= 0)
349 throw new ArgumentNullException('userId');
351 if(intval($personTypeId) <= 0)
352 throw new ArgumentNullException('personTypeId');
354 $uRes = UserTable::getById($userId);
356 if(!$user= $uRes->fetch())
361 $pRes = OrderPropsTable::getList(array(
363 'PERSON_TYPE_ID' => $personTypeId,
369 while($prop = $pRes->fetch())
371 if($prop['DEFAULT_VALUE'] <> '')
373 $result[$prop['ID']] = $prop['DEFAULT_VALUE'];
376 elseif($prop['IS_EMAIL'] == 'Y' && !empty($user['EMAIL']))
378 $result[$prop['ID']] = $user['EMAIL'];
380 elseif($prop['IS_PAYER'] == 'Y')
384 if(!empty($user['LAST_NAME']))
385 $name .= $user['LAST_NAME'];
387 if(!empty($user['NAME']))
388 $name .= $user['NAME'];
390 if(!empty($user['SECOND_NAME']))
391 $name .= $user['SECOND_NAME'];
394 $result[$prop['ID']] = $name;
396 elseif($prop['IS_PHONE'] == 'Y' && !empty($user['PERSONAL_MOBILE']))
398 $result[$prop['ID']] = $user['PERSONAL_MOBILE'];
400 elseif($prop['IS_ADDRESS'] == 'Y')
404 if(!empty($user['PERSONAL_STREET']))
405 $address .= $user['PERSONAL_STREET'];
407 if(!empty($user['PERSONAL_CITY']))
408 $address .= $user['PERSONAL_CITY'];
410 if(!empty($user['PERSONAL_STATE']))
411 $address .= $user['PERSONAL_STATE'];
413 if(!empty($user['PERSONAL_ZIP']))
414 $address .= $user['PERSONAL_ZIP'];
416 if(!empty($user['PERSONAL_COUNTRY']))
417 $address .= $user['PERSONAL_COUNTRY'];
419 $result[$prop['ID']] = $address;