本文整理汇总了PHP中CSaleOrder::CanUserCancelOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrder::CanUserCancelOrder方法的具体用法?PHP CSaleOrder::CanUserCancelOrder怎么用?PHP CSaleOrder::CanUserCancelOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrder
的用法示例。
在下文中一共展示了CSaleOrder::CanUserCancelOrder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEdit
public static function getEdit(Order $order, \CUser $user, $showCancel, $showSaveButton)
{
$data = self::prepareData($order);
if ($showCancel) {
$bUserCanCancelOrder = \CSaleOrder::CanUserCancelOrder($order->getId(), $user->GetUserGroupArray(), $user->GetID());
} else {
$bUserCanCancelOrder = false;
}
$result = '
<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_STATUS_CREATED") . ':</td>
<td class="adm-detail-content-cell-r">
<div>' . $data["DATE_INSERT"] . ' <a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $data["CREATOR_USER_ID"] . '">' . htmlspecialcharsbx($data["CREATOR_USER_NAME"]) . '</a>
</div>
</td>
</tr>
<tr>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS_LAST_MODIF") . ':</td>
<td class="adm-detail-content-cell-r"><div>' . $data["DATE_UPDATE"] . '</div></td>
</tr>
<tr>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS_SITE") . ':</td>
<td class="adm-detail-content-cell-r"><div>' . htmlspecialcharsbx(\Bitrix\Sale\Helpers\Admin\OrderEdit::getSiteName($order->getSiteId())) . '</div></td>
</tr>';
if (strlen($data['SOURCE_NAME']) > 0) {
$result .= '<tr>' . '<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS_SOURCE") . ':</td>' . '<td class="adm-detail-content-cell-r">' . $data['SOURCE_NAME'] . '</td>' . '</tr>';
}
$result .= '<tr>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS") . ':</td>
<td class="adm-detail-content-cell-r">' . \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml("STATUS_ID", self::getStatusesList($user->GetID(), $data["STATUS_ID"]), $data["STATUS_ID"], false, array("class" => "adm-bus-select", "id" => "STATUS_ID"));
if ($showSaveButton) {
$result .= '
<span id="save_status_button" class="adm-btn" onclick="BX.Sale.Admin.OrderEditPage.onSaveStatusButton(\'' . $order->getId() . '\',\'STATUS_ID\');">
' . Loc::getMessage("SALE_ORDER_STATUS_SAVE") . '
</span>';
}
$result .= '</td>
</tr>';
if ($showCancel && $bUserCanCancelOrder) {
$result .= self::getCancelBlockHtml($order, $data);
}
$result .= '</tbody>
</table>
';
return $result;
}
示例2: array
if ($boolLocked && $saleModulePermissions >= 'W')
{
$aMenu[] = array(
"TEXT" => GetMessage("SOE_TO_UNLOCK"),
"LINK" => "/bitrix/admin/sale_order_new.php?ID=".$ID."&unlock=Y&lang=".LANGUAGE_ID.GetFilterParams("filter_"),
);
}
$link = urlencode(DeleteParam(array("mode")));
$link = urlencode($APPLICATION->GetCurPage())."?mode=settings".($link <> "" ? "&".$link: "");
$bUserCanViewOrder = CSaleOrder::CanUserViewOrder($ID, $arUserGroups, $intUserID);
$bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($ID, $arUserGroups, $LID);
$bUserCanDeleteOrder = CSaleOrder::CanUserDeleteOrder($ID, $arUserGroups, $intUserID);
$bUserCanCancelOrder = CSaleOrder::CanUserCancelOrder($ID, $arUserGroups, $intUserID);
$bUserCanDeductOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "PERM_DEDUCTION", $arUserGroups);
$bUserCanMarkOrder = CSaleOrder::CanUserMarkOrder($ID, $arUserGroups, $intUserID);
$bUserCanPayOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "P", $arUserGroups);
$bUserCanDeliverOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "D", $arUserGroups);
if ($bUserCanViewOrder && $ID > 0)
{
$aMenu[] = array(
"TEXT" => GetMessage("NEWO_DETAIL"),
"TITLE"=>GetMessage("NEWO_DETAIL_TITLE"),
"LINK" => "/bitrix/admin/sale_order_detail.php?ID=".$ID."&lang=".LANGUAGE_ID.GetFilterParams("filter_")
);
}
if ($ID > 0)
示例3: fillOrderFromRequest
/**
* Filling the order data from request
*
* @internal
*
* @param Sale\Order $order Entity order.
* @param array $fields An array of request data.
*
* @return Sale\Result
*/
public static function fillOrderFromRequest(Sale\Order $order, array $fields)
{
global $USER;
$result = new Sale\Result();
if (isset($fields['CANCELED'])) {
if ($order->getId() > 0 && $order->getField('CANCELED') != $fields['CANCELED']) {
if (!\CSaleOrder::CanUserCancelOrder($order->getId(), $USER->GetUserGroupArray(), $USER->GetID())) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'), 'SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'));
return $result;
}
/** @var Sale\Result $r */
$r = $order->setField('CANCELED', $fields['CANCELED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
if (isset($fields['MARKED'])) {
if ($order->getId() > 0 && $order->getField('MARKED') != $fields['MARKED']) {
/** @var Sale\Result $r */
$r = $order->setField('MARKED', $fields['MARKED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
if ($order->getId() > 0 && !empty($fields['ACCOUNT_NUMBER']) && !empty($fields['SITE_ID'])) {
$filter = array('filter' => array('ACCOUNT_NUMBER' => $fields['ACCOUNT_NUMBER'], '!ID' => $order->getId()), 'select' => array('ID'));
if (($res = OrderTable::getList($filter)) && $res->fetch()) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_ACCOUNT_NUMBER_ALREADY_EXISTS'), 'SALE_COMPATIBLE_ORDER_ACCOUNT_NUMBER_ALREADY_EXISTS'));
}
}
return $result;
}
示例4: array
$bVarsFromForm = false;
$PARTIAL_SUBMIT = $PARTIAL_SUBMIT == "Y" ? "Y" : "N";
if ($PARTIAL_SUBMIT == "Y") {
$bVarsFromForm = true;
$arInd = array();
$ids = array();
$allIDs = array();
$arIDs = explode(",", trim($_POST["BASKET_IDS"]));
foreach ($arIDs as $v) {
$ids[] = $v;
$allIDs[] = $v;
}
}
$bUserCanViewOrder = CSaleOrder::CanUserViewOrder($ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID());
$bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($ID, $GLOBALS["USER"]->GetUserGroupArray());
$bUserCanCancelOrder = CSaleOrder::CanUserCancelOrder($ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID());
$bUserCanPayOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "P", $GLOBALS["USER"]->GetUserGroupArray());
$bUserCanDeliverOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "D", $GLOBALS["USER"]->GetUserGroupArray());
$bUserCanDeleteOrder = CSaleOrder::CanUserDeleteOrder($ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID());
$simpleForm = COption::GetOptionString("sale", "lock_catalog", "Y");
$bSimpleForm = $simpleForm == "Y" ? True : False;
if ($action == "update" && $saleModulePermissions >= "U" && $_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && $bUserCanEditOrder && $PARTIAL_SUBMIT != "Y" && empty($dontsave)) {
// *****************************************************************
// ***** Preparing ***********************************************
// *****************************************************************
$bTrabsactionStarted = False;
// Order params
$currentDate = Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG)));
$dbOrderTmp = CSaleOrder::GetList(array(), array("ID" => $ID));
//GetByID($ID);
$arOrder = $dbOrderTmp->Fetch();
示例5: GetMessage
preventHide: true,
min_width: 250,
hint: '".CUtil::JSEscape($fieldValueTmp)."'
});
";
}
}
}
$row->AddField("PAYED", $fieldValue);
$row->AddField("PAY_VOUCHER_NUM", $f_PAY_VOUCHER_NUM);
$row->AddField("PAY_VOUCHER_DATE", $f_PAY_VOUCHER_DATE);
$row->AddField("DELIVERY_DOC_NUM", $f_DELIVERY_DOC_NUM);
$row->AddField("DELIVERY_DOC_DATE", $f_DELIVERY_DOC_DATE);
if ($row->bEditMode != true
|| $row->bEditMode == true && !CSaleOrder::CanUserCancelOrder($f_ID, $arUserGroups, $intUserID))
{
$fieldValue = "";
if (in_array("CANCELED", $arVisibleColumns))
{
$fieldValue .= "<span id=\"cancel_".$arOrder["ID"]."\">".(($arOrder["CANCELED"] == "Y") ? GetMessage("SO_YES") : GetMessage("SO_NO"))."</span>";
$fieldValueTmp = $arOrder["DATE_CANCELED"];
if (IntVal($arOrder["DATE_CANCELED"]) > 0)
{
if (IntVal($arOrder["EMP_CANCELED_ID"]) > 0)
{
if (!isset($LOCAL_PAYED_USER_CACHE[$arOrder["EMP_CANCELED_ID"]])
|| empty($LOCAL_PAYED_USER_CACHE[$arOrder["EMP_CANCELED_ID"]]))
{
$dbUser = CUser::GetByID($arOrder["EMP_CANCELED_ID"]);
if ($arUser = $dbUser->Fetch())
示例6: cancelOrderAction
protected function cancelOrderAction()
{
global $USER;
$orderId = isset($this->request['orderId']) ? intval($this->request['orderId']) : 0;
$canceled = isset($this->request['canceled']) ? $this->request['canceled'] : "N";
$comment = isset($this->request['comment']) ? trim($this->request['comment']) : "";
$errors = array();
if (!\CSaleOrder::CanUserCancelOrder($orderId, $USER->GetUserGroupArray(), $this->userId)) {
throw new UserMessageException("Insufficient rights to cancel order");
}
/** @var \Bitrix\Sale\Order $saleOrder*/
if (!($saleOrder = \Bitrix\Sale\Order::load($orderId))) {
throw new UserMessageException("Can't load order with id: " . $orderId);
}
$state = $saleOrder->getField("CANCELED");
if ($state != $canceled) {
throw new UserMessageException($state == "Y" ? "Order already canceled." : "Order not canceled yet.");
}
/** @var \Bitrix\Sale\Result $res */
$res = $saleOrder->setField("CANCELED", $canceled == "Y" ? "N" : "Y");
if (!$res->isSuccess()) {
$errors = array_merge($errors, $res->getErrorMessages());
}
$saleOrder->setField("REASON_CANCELED", $canceled == "N" ? $comment : "");
if (!($res = $saleOrder->save())) {
$errors = array_merge($errors, $res->getErrorMessages());
}
$canceled = $saleOrder->getField("CANCELED");
$this->addResultData("CANCELED", $canceled);
if ($canceled == "Y") {
$userInfo = Admin\Blocks\OrderStatus::getUserInfo($saleOrder->getField("EMP_CANCELED_ID"));
$this->addResultData("DATE_CANCELED", $saleOrder->getField("DATE_CANCELED")->toString());
$this->addResultData("EMP_CANCELED_ID", $saleOrder->getField("EMP_CANCELED_ID"));
$this->addResultData("EMP_CANCELED_NAME", $userInfo["NAME"] . " (" . $userInfo["LOGIN"] . ")");
}
if (!empty($errors)) {
throw new UserMessageException(implode("<br>\n", $errors));
}
}
示例7: cancel
/**
* Cancel order
*
* @param int $orderId Order ID.
* @param string $value The cancel key(Y/N).
* @return Sale\Result
* @throws \Bitrix\Main\ArgumentNullException
*/
public static function cancel($orderId, $value)
{
global $USER;
$result = new Sale\Result();
if (intval($orderId) <= 0) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'), 'SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'));
return $result;
}
if (!\CSaleOrder::CanUserCancelOrder($orderId, $USER->GetUserGroupArray(), $USER->GetID())) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'), 'SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'));
return $result;
}
/** @var Sale\Order $order */
if (!($order = Sale\Order::load($orderId))) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_NOT_FOUND'), 'SALE_COMPATIBLE_ORDER_NOT_FOUND'));
return $result;
}
/** @var Sale\Result $r */
$r = $order->setField('CANCELED', $value);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
$r = $order->save();
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
return $result;
}
示例8: GetMessage
}
}
$fieldValueTmp .= "<br />[<a href=\"/bitrix/admin/user_edit.php?ID=" . $arOrder["EMP_PAYED_ID"] . "&lang=" . LANG . "\">" . $arOrder["EMP_PAYED_ID"] . "</a>] ";
$fieldValueTmp .= $LOCAL_PAYED_USER_CACHE[$arOrder["EMP_PAYED_ID"]];
}
if (!$bExport) {
$fieldValue .= "<script type=\"text/javascript\">\n\t\t\t\t\t\tnew top.BX.CHint({\n\t\t\t\t\t\t\tparent: top.BX('payed_" . $arOrder["ID"] . "'),\n\t\t\t\t\t\t\tshow_timeout: 10,\n\t\t\t\t\t\t\thide_timeout: 100,\n\t\t\t\t\t\t\tdx: 2,\n\t\t\t\t\t\t\tpreventHide: true,\n\t\t\t\t\t\t\tmin_width: 250,\n\t\t\t\t\t\t\thint: '" . CUtil::JSEscape($fieldValueTmp) . "'\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>";
}
}
}
$row->AddField("PAYED", $fieldValue);
$row->AddField("PAY_VOUCHER_NUM", $f_PAY_VOUCHER_NUM);
$row->AddField("PAY_VOUCHER_DATE", $f_PAY_VOUCHER_DATE);
$row->AddField("DELIVERY_DOC_NUM", $f_DELIVERY_DOC_NUM);
$row->AddField("DELIVERY_DOC_DATE", $f_DELIVERY_DOC_DATE);
if ($row->bEditMode != true || $row->bEditMode == true && !CSaleOrder::CanUserCancelOrder($f_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID())) {
$fieldValue = "";
if (in_array("CANCELED", $arVisibleColumns)) {
$fieldValue .= "<span id=\"cancel_" . $arOrder["ID"] . "\">" . ($arOrder["CANCELED"] == "Y" ? GetMessage("SO_YES") : GetMessage("SO_NO")) . "</span>";
$fieldValueTmp = $arOrder["DATE_CANCELED"];
if (IntVal($arOrder["DATE_CANCELED"]) > 0) {
if (IntVal($arOrder["EMP_CANCELED_ID"]) > 0) {
if (!isset($LOCAL_PAYED_USER_CACHE[$arOrder["EMP_CANCELED_ID"]]) || empty($LOCAL_PAYED_USER_CACHE[$arOrder["EMP_CANCELED_ID"]])) {
$dbUser = CUser::GetByID($arOrder["EMP_CANCELED_ID"]);
if ($arUser = $dbUser->Fetch()) {
$LOCAL_PAYED_USER_CACHE[$arOrder["EMP_CANCELED_ID"]] = htmlspecialcharsEx($arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"] . " (" . $arUser["LOGIN"] . ")");
}
}
$fieldValueTmp .= "<br />[<a href=\"/bitrix/admin/user_edit.php?ID=" . $arOrder["EMP_CANCELED_ID"] . "&lang=" . LANG . "\">" . $arOrder["EMP_CANCELED_ID"] . "</a>] ";
$fieldValueTmp .= $LOCAL_PAYED_USER_CACHE[$arOrder["EMP_CANCELED_ID"]];
}
示例9:
$fieldValue = "";
if (in_array("PAYED", $arVisibleColumns)) {
$fieldValue .= '<span id="payed_' . $arOrder['ID'] . '">' . ($arOrder["PAYED"] == "Y" ? Loc::getMessage("SO_YES") : Loc::getMessage("SO_NO")) . "</span>";
$fieldValueTmp = $arOrder["DATE_PAYED"];
if (strlen($arOrder["DATE_PAYED"]) > 0) {
if (IntVal($arOrder["EMP_PAYED_ID"]) > 0) {
$fieldValueTmp .= '<br />' . $formattedUserNames[$arOrder["EMP_PAYED_ID"]];
}
if (!$bExport) {
$sScript .= "\n\t\t\t\t\t\t\tnew top.BX.CHint({\n\t\t\t\t\t\t\t\tparent: top.BX('payed_" . $arOrder["ID"] . "'),\n\t\t\t\t\t\t\t\tshow_timeout: 10,\n\t\t\t\t\t\t\t\thide_timeout: 100,\n\t\t\t\t\t\t\t\tdx: 2,\n\t\t\t\t\t\t\t\tpreventHide: true,\n\t\t\t\t\t\t\t\tmin_width: 250,\n\t\t\t\t\t\t\t\thint: '" . CUtil::JSEscape($fieldValueTmp) . "'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t";
}
}
}
$row->AddField("PAYED", $fieldValue);
//CANCELED
if ($row->bEditMode != true || $row->bEditMode == true && !CSaleOrder::CanUserCancelOrder($orderId, $arUserGroups, $intUserID)) {
$fieldValue = "";
if (in_array("CANCELED", $arVisibleColumns)) {
$fieldValue .= '<span id="cancel_' . $arOrder['ID'] . '">' . ($arOrder["CANCELED"] == "Y" ? Loc::getMessage("SO_YES") : Loc::getMessage("SO_NO")) . "</span>";
$fieldValueTmp = $arOrder["DATE_CANCELED"];
if (IntVal($arOrder["DATE_CANCELED"]) > 0) {
if (IntVal($arOrder["EMP_CANCELED_ID"]) > 0) {
$fieldValueTmp .= '<br />' . $formattedUserNames[$arOrder["EMP_CANCELED_ID"]];
}
if (!$bExport) {
$sScript .= "\n\t\t\t\t\t\t\tnew top.BX.CHint({\n\t\t\t\t\t\t\t\tparent: top.BX('cancel_" . $arOrder["ID"] . "'),\n\t\t\t\t\t\t\t\tshow_timeout: 10,\n\t\t\t\t\t\t\t\thide_timeout: 100,\n\t\t\t\t\t\t\t\tdx: 2,\n\t\t\t\t\t\t\t\tpreventHide: true,\n\t\t\t\t\t\t\t\tmin_width: 250,\n\t\t\t\t\t\t\t\thint: '" . CUtil::JSEscape($fieldValueTmp) . "'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t";
}
}
}
$row->AddField("CANCELED", $fieldValue, true);
} else {
示例10: fillOrderFromRequest
/**
* Filling the order data from request
*
* @internal
*
* @param Sale\Order $order Entity order.
* @param array $fields An array of request data.
*
* @return Sale\Result
*/
public static function fillOrderFromRequest(Sale\Order $order, array $fields)
{
global $USER;
$result = new Sale\Result();
if (isset($fields['CANCELED'])) {
if ($order->getId() > 0 && $order->getField('CANCELED') != $fields['CANCELED']) {
if (!\CSaleOrder::CanUserCancelOrder($order->getId(), $USER->GetUserGroupArray(), $USER->GetID())) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'), 'SALE_COMPATIBLE_ORDER_CANCEL_NO_PERMISSION'));
return $result;
}
/** @var Sale\Result $r */
$r = $order->setField('CANCELED', $fields['CANCELED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
if (isset($fields['MARKED'])) {
if ($order->getId() > 0 && $order->getField('MARKED') != $fields['MARKED']) {
/** @var Sale\Result $r */
$r = $order->setField('MARKED', $fields['MARKED']);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
}
}
return $result;
}