} 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_") ); }
$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(); if (!$arOrder) { $errorMessage .= GetMessage("SOE_NO_ORDER") . ". "; }
"ICON" => "unlock", "TEXT" => GetMessage("IBEL_A_UNLOCK"), "TITLE" => GetMessage("IBLOCK_UNLOCK_ALT"), "ACTION" => $lAdmin->ActionDoGroup($arOrder["ID"], "unlock", '') ); $arActions[] = array("SEPARATOR" => true); } $arActions[] = array("ICON"=>"view", "TEXT"=>GetMessage("SALE_DETAIL_DESCR"), "ACTION"=>$lAdmin->ActionRedirect("sale_order_detail.php?ID=".$f_ID."&lang=".LANGUAGE_ID.GetFilterParams("filter_")), "DEFAULT"=>true); $arActions[] = array("ICON"=>"print", "TEXT"=>GetMessage("SALE_PRINT_DESCR"), "ACTION"=>$lAdmin->ActionRedirect("sale_order_print.php?ID=".$f_ID."&lang=".LANGUAGE_ID.GetFilterParams("filter_"))); if ($arOrder['LOCK_STATUS'] != "red") { if (CSaleOrder::CanUserUpdateOrder($f_ID, $arUserGroups)) $arActions[] = array("ICON"=>"edit", "TEXT"=>GetMessage("SALE_OEDIT_DESCR"), "ACTION"=>$lAdmin->ActionRedirect("sale_order_new.php?ID=".$f_ID."&lang=".LANGUAGE_ID.GetFilterParams("filter_"))); if ($saleModulePermissions == "W" || $f_PAYED != "Y" && CSaleOrder::CanUserDeleteOrder($f_ID, $arUserGroups, $intUserID)) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON"=>"delete", "TEXT"=>GetMessage("SALE_DELETE_DESCR"), "ACTION"=>"if(confirm('".GetMessage('SALE_CONFIRM_DEL_MESSAGE')."')) ".$lAdmin->ActionDoGroup($f_ID, "delete")); } } $row->AddActions($arActions); } $arFooterArray = array( array( "title" => GetMessage('SOAN_FILTERED1').":", "value" => $dbOrderList->SelectedRowsCount() ), );
$row->AddViewField('BASKET_DISCOUNT_COUPON', ' '); $row->AddViewField('BASKET_DISCOUNT_NAME', ' '); $row->AddViewField("SOURCE_NAME", '<span style="white-space:nowrap;">' . htmlspecialcharsbx($arOrder["SOURCE_NAME"]) . '</span>'); $arActions = array(); if ($arOrder['LOCK_STATUS'] == "red" && $saleModulePermissions >= "W" || $arOrder['LOCK_STATUS'] == "yellow") { $arActions[] = array("ICON" => "unlock", "TEXT" => Loc::getMessage("IBEL_A_UNLOCK"), "TITLE" => Loc::getMessage("IBLOCK_UNLOCK_ALT"), "ACTION" => $lAdmin->ActionDoGroup($arOrder["ID"], "unlock", '')); $arActions[] = array("SEPARATOR" => true); } $arActions[] = array("ICON" => "view", "TEXT" => Loc::getMessage("SALE_DETAIL_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_view.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_")), "DEFAULT" => true); $arActions[] = array("ICON" => "copy", "TEXT" => Loc::getMessage("SOA_ORDER_COPY"), "ACTION" => $lAdmin->ActionRedirect("sale_order_create.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . "&" . 'SITE_ID=' . $f_LID . '&' . bitrix_sessid_get() . GetFilterParams("filter_"))); $arActions[] = array("ICON" => "print", "TEXT" => Loc::getMessage("SALE_PRINT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_print.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"))); if ($arOrder['LOCK_STATUS'] != "red") { if (CSaleOrder::CanUserUpdateOrder($f_ID, $arUserGroups)) { $arActions[] = array("ICON" => "edit", "TEXT" => Loc::getMessage("SALE_OEDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_edit.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"))); } if ($saleModulePermissions == "W" || $f_PAYED != "Y" && CSaleOrder::CanUserDeleteOrder($f_ID, $arUserGroups, $intUserID)) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => Loc::getMessage("SALE_DELETE_DESCR"), "ACTION" => "if(confirm('" . Loc::getMessage('SALE_CONFIRM_DEL_MESSAGE') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete")); } } $row->AddActions($arActions); } if (!empty($rowsList)) { if (in_array('BASKET_DISCOUNT_NAME', $arVisibleColumns)) { $discountList = array(); $discountsIterator = Sale\Internals\OrderRulesTable::getList(array('select' => array('ORDER_ID', 'DISCOUNT_NAME' => 'ORDER_DISCOUNT.NAME', 'DISCOUNT_ID' => 'ORDER_DISCOUNT.ID'), 'filter' => array('@ORDER_ID' => array_keys($rowsList)), 'order' => array('ORDER_ID' => 'ASC', 'ID' => 'ASC'))); while ($discount = $discountsIterator->fetch()) { $discount['ORDER_ID'] = (int) $discount['ORDER_ID']; $discount['DISCOUNT_ID'] = (int) $discount['DISCOUNT_ID']; $discount['DISCOUNT_NAME'] = (string) $discount['DISCOUNT_NAME']; if (!isset($discountList[$discount['ORDER_ID']])) {
} foreach ($arOrderPropsCode as $key => $value) { $row->AddField("PROP_" . $key, ""); } } $arActions = array(); if ($arOrder['LOCK_STATUS'] == "red" && $saleModulePermissions >= "W" || $arOrder['LOCK_STATUS'] == "yellow") { $arActions[] = array("ICON" => "unlock", "TEXT" => GetMessage("IBEL_A_UNLOCK"), "TITLE" => GetMessage("IBLOCK_UNLOCK_ALT"), "ACTION" => $lAdmin->ActionDoGroup($arOrder["ID"], "unlock", '')); $arActions[] = array("SEPARATOR" => true); } $arActions[] = array("ICON" => "view", "TEXT" => GetMessage("SALE_DETAIL_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_detail.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_")), "DEFAULT" => true); $arActions[] = array("ICON" => "print", "TEXT" => GetMessage("SALE_PRINT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_print.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"))); if (CSaleOrder::CanUserUpdateOrder($f_ID, $GLOBALS["USER"]->GetUserGroupArray())) { $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("SALE_OEDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_new.php?ID=" . $f_ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"))); } if ($saleModulePermissions == "W" || $f_PAYED != "Y" && CSaleOrder::CanUserDeleteOrder($f_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID())) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("SALE_DELETE_DESCR"), "ACTION" => "if(confirm('" . GetMessage('SALE_CONFIRM_DEL_MESSAGE') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete")); } $row->AddActions($arActions); } $arFooterArray = array(array("title" => GetMessage('SOAN_FILTERED1') . ":", "value" => $dbOrderList->SelectedRowsCount())); if ($saleModulePermissions == "W") { $dbOrderList = CSaleOrder::GetList(array("CURRENCY" => "ASC"), $arFilterTmp, array("CURRENCY", "SUM" => "PRICE"), false, array("CURRENCY", "SUM" => "PRICE")); while ($arOrderList = $dbOrderList->Fetch()) { $arFooterArray[] = array("title" => GetMessage("SOAN_ITOG") . " " . $arOrderList["CURRENCY"] . ":", "value" => htmlspecialcharsex(SaleFormatCurrency($arOrderList["PRICE"], $arOrderList["CURRENCY"]))); } } elseif ($saleModulePermissions < "W" && COption::GetOptionString("sale", "show_order_sum", "N") == "Y") { $arOrdersSum = array(); $dbOrderList = CSaleOrder::GetList(array($by => $order), $arFilterTmp, $arGroupByTmp, false, $arSelectFields); while ($arOrder = $dbOrderList->Fetch()) {
$row->AddViewField('BASKET_DISCOUNT_COUPON', ' '); $row->AddViewField('BASKET_DISCOUNT_NAME', ' '); $row->AddViewField("SOURCE_NAME", '<span style="white-space:nowrap;">' . htmlspecialcharsbx($arOrder["SOURCE_NAME"]) . '</span>'); $arActions = array(); if ($arOrder['LOCK_STATUS'] == "red" && $saleModulePermissions >= "W" || $arOrder['LOCK_STATUS'] == "yellow") { $arActions[] = array("ICON" => "unlock", "TEXT" => Loc::getMessage("IBEL_A_UNLOCK"), "TITLE" => Loc::getMessage("IBLOCK_UNLOCK_ALT"), "ACTION" => $lAdmin->ActionDoGroup($arOrder["ID"], "unlock", '')); $arActions[] = array("SEPARATOR" => true); } $arActions[] = array("ICON" => "view", "TEXT" => Loc::getMessage("SALE_DETAIL_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_view.php?ID=" . $orderId . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_")), "DEFAULT" => true); $arActions[] = array("ICON" => "copy", "TEXT" => Loc::getMessage("SOA_ORDER_COPY"), "ACTION" => $lAdmin->ActionRedirect("sale_order_create.php?ID=" . $orderId . "&lang=" . LANGUAGE_ID . "&" . 'SITE_ID=' . $arOrder['LID'] . '&' . bitrix_sessid_get() . GetFilterParams("filter_"))); $arActions[] = array("ICON" => "print", "TEXT" => Loc::getMessage("SALE_PRINT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_print.php?ID=" . $orderId . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"))); if ($arOrder['LOCK_STATUS'] != "red") { if (CSaleOrder::CanUserUpdateOrder($orderId, $arUserGroups)) { $arActions[] = array("ICON" => "edit", "TEXT" => Loc::getMessage("SALE_OEDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_order_edit.php?ID=" . $orderId . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"))); } if ($saleModulePermissions == "W" || $arOrder["PAYED"] != "Y" && CSaleOrder::CanUserDeleteOrder($orderId, $arUserGroups, $intUserID)) { $arActions[] = array("SEPARATOR" => true); $arActions[] = array("ICON" => "delete", "TEXT" => Loc::getMessage("SALE_DELETE_DESCR"), "ACTION" => "if(confirm('" . Loc::getMessage('SALE_CONFIRM_DEL_MESSAGE') . "')) " . $lAdmin->ActionDoGroup($orderId, "delete", GetFilterParams("filter_", false))); } } $row->AddActions($arActions); } } if (!empty($rowsList)) { if (in_array('BASKET_DISCOUNT_NAME', $arVisibleColumns)) { $discountList = array(); $discountsIterator = Sale\Internals\OrderRulesTable::getList(array('select' => array('ORDER_ID', 'DISCOUNT_NAME' => 'ORDER_DISCOUNT.NAME', 'DISCOUNT_ID' => 'ORDER_DISCOUNT.ID'), 'filter' => array('@ORDER_ID' => array_keys($rowsList)), 'order' => array('ORDER_ID' => 'ASC', 'ID' => 'ASC'))); while ($discount = $discountsIterator->fetch()) { $discount['ORDER_ID'] = (int) $discount['ORDER_ID']; $discount['DISCOUNT_ID'] = (int) $discount['DISCOUNT_ID']; $discount['DISCOUNT_NAME'] = (string) $discount['DISCOUNT_NAME'];