function fChangeOrderStatus($ID, $STATUS_ID) { global $APPLICATION; global $crmMode; $errorMessageTmp = ""; $STATUS_ID = trim($STATUS_ID); if (strlen($STATUS_ID) <= 0) $errorMessageTmp .= GetMessage("ERROR_NO_STATUS").". "; if ('' == $errorMessageTmp) { if (!CSaleOrder::CanUserChangeOrderStatus($ID, $STATUS_ID, $GLOBALS["USER"]->GetUserGroupArray())) $errorMessageTmp .= GetMessage("SOD_NO_PERMS2STATUS").". "; } if ('' == $errorMessageTmp) { if (!CSaleOrder::StatusOrder($ID, $STATUS_ID)) { if ($ex = $APPLICATION->GetException()) { if ($ex->GetID() != "ALREADY_FLAG") $errorMessageTmp .= $ex->GetString(); } else $errorMessageTmp .= GetMessage("ERROR_CHANGE_STATUS").". "; } } $arResult = array( 'STATUS_ERR' => false, 'STATUS_ERR_MESS' => '', ); $dbOrder = CSaleOrder::GetList( array("ID" => "DESC"), array("ID" => $ID), false, false, array("DATE_STATUS", "EMP_STATUS_ID", "STATUS_ID") ); if ($arOrder = $dbOrder->Fetch()) { $arResult["DATE_STATUS"] = $arOrder["DATE_STATUS"]; if (!$crmMode && IntVal($arOrder["EMP_STATUS_ID"]) > 0) $arResult["EMP_STATUS_ID"] = GetFormatedUserName($arOrder["EMP_STATUS_ID"], false); $arResult["STATUS_ID"] = $arOrder["STATUS_ID"]; } if ('' != $errorMessageTmp) { $arResult['STATUS_ERR'] = true; $arResult['STATUS_ERR_MESS'] = $errorMessageTmp; } return $arResult; }
<td class="adm-list-table-cell"><div class="adm-list-table-cell-inner"><?echo GetMessage("SOD_TRANS_DESCR")?></div></td> <td class="adm-list-table-cell"><div class="adm-list-table-cell-inner"><?echo GetMessage("SOD_TRANS_COMMENT")?></div></td> </tr> <? $bNoTransact = True; while ($arTransact = $dbTransact->Fetch()) { $bNoTransact = False; ?> <tr class="adm-list-table-row"> <td class="adm-list-table-cell"><?php echo $arTransact["TRANSACT_DATE"]; ?> </td> <td class="adm-list-table-cell"> <?echo GetFormatedUserName($arTransact["USER_ID"]);?> </td> <td class="adm-list-table-cell"> <? echo (($arTransact["DEBIT"] == "Y") ? "+" : "-"); echo SaleFormatCurrency($arTransact["AMOUNT"], $arTransact["CURRENCY"]); ?> </td> <td class="adm-list-table-cell"> <? if (array_key_exists($arTransact["DESCRIPTION"], $arTransactTypes)) echo htmlspecialcharsEx($arTransactTypes[$arTransact["DESCRIPTION"]]); else echo htmlspecialcharsEx($arTransact["DESCRIPTION"]); ?> </td>
} if (in_array("GROUPS_ID", $arVisibleColumns)) { $strUserGroup = ''; $arUserGroups = CUser::GetUserGroup($arBuyers["USER_ID"]); foreach ($arUsersGroups as $arGroup) { if (in_array($arGroup["ID"], $arUserGroups)) { $strUserGroup .= htmlspecialcharsbx($arGroup["NAME"]) . "<br>"; } } $row->AddField("GROUPS_ID", $strUserGroup); } if (in_array("LID", $arVisibleColumns)) { $row->AddField("LID", $arSites[$arBuyers["LID"]]["NAME"]); } /*BUYER*/ $fieldBuyer = GetFormatedUserName($arBuyers["USER_ID"], false); $row->AddField("BUYER", $fieldBuyer); $arActions = array(); $arActions[] = array("ICON" => "view", "TEXT" => GetMessage("BUYER_SUB_ACTION_PROFILE"), "ACTION" => $lAdmin->ActionRedirect("sale_buyers_profile.php?USER_ID=" . $arBuyers["USER_ID"] . "&lang=" . LANGUAGE_ID), "DEFAULT" => true); foreach ($arSitesShop as $val) { $arActions[] = array("ICON" => "view", "TEXT" => GetMessage("BUYER_SUB_ACTION_ORDER") . " [" . $val["ID"] . "]", "ACTION" => $lAdmin->ActionRedirect("sale_order_new.php?user_id=" . $arBuyers["USER_ID"] . "&LID=" . $val["ID"] . "&lang=" . LANGUAGE_ID)); } $row->AddActions($arActions); } $arFooterArray = array(array("title" => GetMessage('MAIN_ADMIN_LIST_SELECTED'), "value" => $dbUsersList->SelectedRowsCount())); $lAdmin->AddFooter($arFooterArray); $aContext = array(); $lAdmin->AddAdminContextMenu($aContext); $lAdmin->CheckListMode(); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/prolog.php"; require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
} $row->AddField("MARKED", $fieldValue); $fieldValue = ""; if (in_array("REASON_MARKED", $arVisibleColumns)) { $fieldValue = "<span id=\"REASON_MARKED_".$arOrder["ID"]."\" style=\"".(($arOrder["MARKED"] == "Y") ? "color: #ff2400;" : "")."\" >".(($arOrder["MARKED"] == "Y") ? $arOrder["REASON_MARKED"] : "")."</span>"; } $row->AddField("REASON_MARKED", $fieldValue); $row->AddField("PRICE", htmlspecialcharsex(SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"]))); $row->AddField("SUM_PAID", htmlspecialcharsex(SaleFormatCurrency($arOrder["SUM_PAID"], $arOrder["CURRENCY"]))); $fieldValue = ""; if (in_array("USER", $arVisibleColumns)) $fieldValue = GetFormatedUserName($arOrder["USER_ID"], true); $row->AddField("USER", $fieldValue); $fieldValue = ""; if (in_array("PAY_SYSTEM", $arVisibleColumns)) { if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0) { if (!isset($LOCAL_PAY_SYSTEM_CACHE[$arOrder["PAY_SYSTEM_ID"]]) || empty($LOCAL_PAY_SYSTEM_CACHE[$arOrder["PAY_SYSTEM_ID"]])) { if ($arPaySys = CSalePaySystem::GetByID($arOrder["PAY_SYSTEM_ID"])) $LOCAL_PAY_SYSTEM_CACHE[$arOrder["PAY_SYSTEM_ID"]] = htmlspecialcharsEx($arPaySys["NAME"]); } $fieldValue .= "[";
$dbRes->InitFromArray($arHistoryData); $dbRecords = new CAdminResult($dbRes, $sTableHistory); $dbRecords->NavStart(); $lAdminHistory->NavText($dbRecords->GetNavPrint(Loc::getMessage('SOD_HIST_LIST'))); $histdHeader = array(array("id" => "DATE_CREATE", "content" => Loc::getMessage("SOD_HIST_H_DATE"), "sort" => "DATE_CREATE", "default" => true), array("id" => "USER_ID", "content" => Loc::getMessage("SOD_HIST_H_USER"), "sort" => "USER_ID", "default" => true), array("id" => "TYPE", "content" => Loc::getMessage("SOD_HIST_TYPE"), "sort" => "TYPE", "default" => true), array("id" => "DATA", "content" => Loc::getMessage("SOD_HIST_DATA"), "sort" => "", "default" => true)); if (!isset($entity)) { $histdHeader[] = array("id" => "ENTITY_ID", "content" => Loc::getMessage("SOD_HIST_ENTITY_ID"), "sort" => "", "default" => true); } $lAdminHistory->AddHeaders($histdHeader); $arOperations = array(); while ($arChangeRecord = $dbRecords->Fetch()) { $entityName = ''; $row =& $lAdminHistory->AddRow($arChangeRecord["ID"], $arChangeRecord, '', ''); $stmp = MakeTimeStamp($arChangeRecord["DATE_CREATE"], "DD.MM.YYYY HH:MI:SS"); $row->AddField("DATE_CREATE", date("d.m.Y H:i", $stmp)); $row->AddField("USER_ID", GetFormatedUserName($arChangeRecord["USER_ID"], false)); $arRecord = CSaleOrderChange::GetRecordDescription($arChangeRecord["TYPE"], $arChangeRecord["DATA"]); $row->AddField("TYPE", $arRecord["NAME"]); $row->AddField("DATA", htmlspecialcharsbx($arRecord["INFO"])); if (!isset($entity)) { if ($arChangeRecord["ENTITY"] == 'SHIPMENT') { $shipment = $shipmentCollection->getItemById($arChangeRecord["ENTITY_ID"]); if ($shipment) { $entityName = $shipment->getField('DELIVERY_NAME'); } } else { if ($arChangeRecord["ENTITY"] == 'PAYMENT') { $payment = $paymentCollection->getItemById($arChangeRecord["ENTITY_ID"]); if ($payment) { $entityName = $payment->getField('PAY_SYSTEM_NAME'); }
if (!$bExport) { $sScript .= "\n\t\t\t\t\t\tnew top.BX.CHint({\n\t\t\t\t\t\t\tparent: top.BX('MARKED_" . $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"; } } } $row->AddField("MARKED", $fieldValue); $fieldValue = ""; if (in_array("REASON_MARKED", $arVisibleColumns)) { $fieldValue = '<span id="REASON_MARKED_' . $arOrder["ID"] . '" style="' . ($arOrder["MARKED"] == "Y" ? "color: #ff2400;" : "") . '" >' . ($arOrder["MARKED"] == "Y" ? htmlspecialcharsbx($arOrder["REASON_MARKED"]) : "") . "</span>"; } $row->AddField("REASON_MARKED", $fieldValue); $row->AddField("PRICE", '<span style="white-space:nowrap;">' . htmlspecialcharsex(SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"])) . '</span>'); $row->AddField("SUM_PAID", '<span style="white-space:nowrap;">' . htmlspecialcharsex(SaleFormatCurrency($arOrder["SUM_PAID"], $arOrder["CURRENCY"])) . '</span>'); $fieldValue = ""; if (in_array("USER", $arVisibleColumns)) { $fieldValue = GetFormatedUserName($arOrder["USER_ID"], false, false); } $row->AddField("USER", $fieldValue); $paySystemsFields = array("PAY_SYSTEM_ID", "PAY_SYSTEM", "PAYMENTS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "PS_STATUS", "PS_SUM"); $shipmentFields = array_intersect($arVisibleColumns, $paySystemsFields); if (!empty($shipmentFields)) { $payments = array(); /** @var \Bitrix\Main\DB\Result $res */ $res = \Bitrix\Sale\Internals\PaymentTable::getList(array('order' => array('ID' => 'ASC'), 'filter' => array('ORDER_ID' => $arOrder['ID']))); while ($payment = $res->fetch()) { $payment["ID_LINKED"] = '[<a href="/bitrix/admin/sale_order_payment_edit.php?order_id=' . $arOrder['ID'] . '&payment_id=' . $payment["ID"] . '&lang=' . LANGUAGE_ID . '">' . $payment["ID"] . '</a>]'; $payments[] = $payment; } unset($payment, $res); //PAYMENTS $fieldValue = "";