public static function getShipmentStatusList() { static $shipmentStatuses = array(); if (empty($shipmentStatuses)) { $context = Application::getInstance()->getContext(); $lang = $context->getLanguage(); $params = array('select' => array('ID', 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME'), 'filter' => array('=Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.LID' => $lang, '=TYPE' => 'D')); $dbRes = StatusTable::getList($params); while ($shipmentStatus = $dbRes->fetch()) { $shipmentStatuses[$shipmentStatus["ID"]] = $shipmentStatus["SALE_INTERNALS_STATUS_SALE_INTERNALS_STATUS_LANG_STATUS_NAME"] . " [" . $shipmentStatus["ID"] . "]"; } } return $shipmentStatuses; }
/** * <p>Метод возвращает параметры статуса с кодом ID, включая языкозависимые параметры для языка strLang. Метод динамичный.</p> * * * @param string $ID Код статуса заказа. </htm * * @param string $strLang = LANGUAGE_ID Язык, для которого возвращаются языкозависимые параметры. По * умолчанию используется текущий язык. * * @return array <p>Возвращается ассоциативный массив параметров статуса с * ключами:</p> <table class="tnormal" width="100%"> <tr> <th width="15%">Ключ</th> <th>Описание</th> * </tr> <tr> <td>ID</td> <td>Код статуса заказа.</td> </tr> <tr> <td>SORT</td> <td>Индекс * сортировки.</td> </tr> <tr> <td>LID</td> <td>Язык.</td> </tr> <tr> <td>NAME</td> <td>Название * статуса.</td> </tr> <tr> <td>DESCRIPTION</td> <td>Описание статуса.</td> </tr> </table> <p> * </p<a name="examples"></a> * * <h4>Example</h4> * <pre> * <? * if ($arStatus = CSaleStatus::GetByID($STATUS_ID)) * { * echo "<pre>"; * print_r($arStatus); * echo "</pre>"; * } * ?> * </pre> * * * @static * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalestatus/csalestatus__getbyid.bfbe15e3.php * @author Bitrix */ public static function GetByID($statusId, $languageId = LANGUAGE_ID) { return StatusTable::getList(array('select' => array('ID', 'SORT', 'LID' => 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.LID', 'NAME' => 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME', 'DESCRIPTION' => 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.DESCRIPTION'), 'filter' => array('=ID' => $statusId, '=Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.LID' => $languageId, '=TYPE' => 'O'), 'limit' => 1))->fetch(); }
echo !empty($currentSettings["tracking_check_period"]) && intval($currentSettings["tracking_check_period"]) > 0 ? intval($currentSettings["tracking_check_period"]) : '0'; ?> "></td> </tr> <tr class="heading"> <td colspan="2"><?php echo GetMessage("SALE_TRACKING_MAP"); ?> </td> </tr> <?php $shipmentStatuses = array(); $context = Main\Application::getInstance()->getContext(); $dbRes = Sale\Internals\StatusTable::getList(array('select' => array('ID', 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME'), 'filter' => array('=Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.LID' => $context->getLanguage(), '=TYPE' => 'D'), 'order' => array('SORT' => 'ASC'))); while ($shipmentStatus = $dbRes->fetch()) { $shipmentStatuses[$shipmentStatus["ID"]] = $shipmentStatus["SALE_INTERNALS_STATUS_SALE_INTERNALS_STATUS_LANG_STATUS_NAME"] . " [" . $shipmentStatus["ID"] . "]"; } $trackingStatuses = \Bitrix\Sale\Delivery\Tracking\Manager::getStatusesList(); ?> <tr><td><b><?php echo GetMessage("SALE_TRACKING_TSTATUSES"); ?> </b></td><td><b><?php echo GetMessage("SALE_TRACKING_SSTATUSES"); ?> </b></td></tr><?php foreach ($trackingStatuses as $tStatusId => $tStatusName) { ?> <tr>
StatusGroupTaskTable::add($data); } if ($result->isSuccess()) { if ($isNew) { CSaleStatus::CreateMailTemplate($statusId); } } if ($_POST['save']) { LocalRedirect('sale_status.php?lang=' . LANGUAGE_ID . GetFilterParams('filter_', false)); } else { LocalRedirect("sale_status_edit.php?ID=" . $statusId . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_", false)); } } } else { if ($statusId) { if ($row = StatusTable::getList(array('select' => array('*'), 'filter' => array('=ID' => $statusId), 'limit' => 1))->fetch()) { $status = $row; $result = StatusLangTable::getList(array('select' => array('*'), 'filter' => array('=STATUS_ID' => $statusId))); while ($row = $result->fetch()) { $translations[$row['LID']] = $row; } $result = StatusGroupTaskTable::getList(array('select' => array('*'), 'filter' => array('=STATUS_ID' => $statusId))); while ($row = $result->fetch()) { $groupTasks[$row['GROUP_ID']] = $row; } } else { $status['ID'] = $statusId; $statusId = null; } } }
"; } if(par.length > 0) { window.open("sale_order_export.php?EXPORT_FORMAT="+val+"&"+par, "vvvvv"); } } </script> <?php $lAdmin->EndEpilogContent(); $arGroupActionsTmp = array("delete" => Loc::getMessage("MAIN_ADMIN_LIST_DELETE"), "cancel" => Loc::getMessage("SOAN_LIST_CANCEL"), "cancel_n" => Loc::getMessage("SOAN_LIST_CANCEL_N")); $allowedStatusesFrom = \Bitrix\Sale\OrderStatus::getStatusesUserCanDoOperations($intUserID, array('from')); foreach ($allowedStatusesFrom as $status) { if (!isset($LOCAL_STATUS_CACHE[$status]) || empty($LOCAL_STATUS_CACHE[$status])) { $arStatus = StatusTable::getList(array('select' => array('NAME' => 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME'), 'filter' => array('=ID' => $status, '=Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.LID' => LANGUAGE_ID, '=TYPE' => 'O'), 'limit' => 1))->fetch(); if ($arStatus) { $LOCAL_STATUS_CACHE[$status] = htmlspecialcharsEx($arStatus["NAME"]); } } $arGroupActionsTmp["status_" . $status] = Loc::getMessage("SOAN_LIST_STATUS_CHANGE") . ' "' . $LOCAL_STATUS_CACHE[$status] . '"'; } $arGroupActionsTmp["export_csv"] = array("action" => "exportData('csv')", "value" => "export_csv", "name" => str_replace("#EXP#", "CSV", Loc::getMessage("SOAN_EXPORT_2"))); $arGroupActionsTmp["export_commerceml"] = array("action" => "exportData('commerceml')", "value" => "export_commerceml", "name" => str_replace("#EXP#", "CommerceML", Loc::getMessage("SOAN_EXPORT_2"))); $arGroupActionsTmp["export_commerceml2"] = array("action" => "exportData('commerceml2')", "value" => "export_commerceml2", "name" => str_replace("#EXP#", "CommerceML 2.0", Loc::getMessage("SOAN_EXPORT_2"))); $strPath2Export = BX_PERSONAL_ROOT . "/php_interface/include/sale_export/"; if (file_exists($_SERVER["DOCUMENT_ROOT"] . $strPath2Export)) { if ($handle = opendir($_SERVER["DOCUMENT_ROOT"] . $strPath2Export)) { while (($file = readdir($handle)) !== false) { if ($file == "." || $file == "..") { continue;
$orderLink = "<a href=\"sale_order_view.php?ID=" . $arOrder["ID"] . "&lang=" . LANG . "\">" . $arOrder["ID"] . "</a>"; $row->AddField("ID", $orderLink); $status_id = "<a title=\"" . GetMessage('BUYERS_ORDER_DETAIL_PAGE') . "\" href=\"/bitrix/admin/sale_order_view.php?ID=" . $arOrder["ID"] . "&lang=" . LANG . "\">" . GetMessage('BUYERS_PREF') . $arOrder["ID"] . "</a>"; $status_id .= "<input type=\"hidden\" name=\"table_id\" value=\"" . $sTableID_tab3 . "\">"; $row->AddField("STATUS_ID", $status_id); $payed = ""; $res = \Bitrix\Sale\Internals\PaymentTable::getList(array('order' => array('ID' => 'ASC'), 'filter' => array('ORDER_ID' => $arOrder['ID']))); while ($payment = $res->fetch()) { if (strval($payed) != "") { $payed .= "<hr>"; } $payed .= "[<a href='/bitrix/admin/sale_order_payment_edit.php?order_id=" . $arOrder['ID'] . "&payment_id=" . $payment["ID"] . "&lang=" . LANGUAGE_ID . "'>" . $payment["ID"] . "</a>], " . htmlspecialcharsbx($payment["PAY_SYSTEM_NAME"]) . ", " . ($payment["PAID"] == "Y" ? \Bitrix\Main\Localization\Loc::getMessage("SOB_PAYMENTS_PAID") : \Bitrix\Main\Localization\Loc::getMessage("SOB_PAYMENTS_UNPAID")) . ", " . (strlen($payment["PS_STATUS"]) > 0 ? \Bitrix\Main\Localization\Loc::getMessage("SOB_PAYMENTS_STATUS") . ": " . htmlspecialcharsbx($payment["PS_STATUS"]) . ", " : "") . '<span style="white-space:nowrap;">' . htmlspecialcharsex(SaleFormatCurrency($payment["SUM"], $payment["CURRENCY"])) . '<span>'; } $row->AddField("PAYED", $payed); $shipmentStatuses = array(); $dbRes = \Bitrix\Sale\Internals\StatusTable::getList(array('select' => array('ID', 'NAME' => 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME'), 'filter' => array('=Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.LID' => LANGUAGE_ID, '=TYPE' => 'D'))); while ($shipmentStatus = $dbRes->fetch()) { $shipmentStatuses[$shipmentStatus["ID"]] = $shipmentStatus["NAME"] . " [" . $shipmentStatus["ID"] . "]"; } $allowDelivery = ""; $res = \Bitrix\Sale\Internals\ShipmentTable::getList(array('order' => array('ID' => 'ASC'), 'filter' => array('ORDER_ID' => $arOrder['ID'], '!=SYSTEM' => 'Y'))); while ($shipment = $res->fetch()) { $shipment["ID_LINKED"] = '[<a href="/bitrix/admin/sale_order_shipment_edit.php?order_id=' . $arOrder['ID'] . '&shipment_id=' . $shipment["ID"] . '&lang=' . LANGUAGE_ID . '">' . $shipment["ID"] . '</a>]'; if (strval($allowDelivery) != "") { $allowDelivery .= "<hr>"; } $allowDelivery .= "[<a href='/bitrix/admin/sale_order_shipment_edit.php?order_id=" . $arOrder['ID'] . "&shipment_id=" . $shipment["ID"] . "&lang=" . LANGUAGE_ID . "'>" . $shipment["ID"] . "</a>], " . htmlspecialcharsbx($shipment["DELIVERY_NAME"]) . ", " . '<span>' . htmlspecialcharsEx(SaleFormatCurrency($shipment["PRICE_DELIVERY"], $shipment["CURRENCY"])) . "</span>, " . ($shipment["ALLOW_DELIVERY"] == "Y" ? \Bitrix\Main\Localization\Loc::getMessage("SOB_SHIPMENTS_ALLOW_DELIVERY") : \Bitrix\Main\Localization\Loc::getMessage("SOB_SHIPMENTS_NOT_ALLOW_DELIVERY")) . ", " . ($shipment["CANCELED"] == "Y" ? \Bitrix\Main\Localization\Loc::getMessage("SOB_SHIPMENTS_CANCELED") . ", " : "") . ($shipment["DEDUCTED"] == "Y" ? \Bitrix\Main\Localization\Loc::getMessage("SOB_SHIPMENTS_DEDUCTED") . ", " : "") . ($shipment["MARKED"] == "Y" ? \Bitrix\Main\Localization\Loc::getMessage("SOB_SHIPMENTS_MARKED") . ", " : "") . (strlen($shipment["TRACKING_NUMBER"]) > 0 ? htmlspecialcharsbx($shipment["TRACKING_NUMBER"]) . ", " : ""); if (strlen($shipment["STATUS_ID"]) > 0) { $allowDelivery .= $shipmentStatuses[$shipment["STATUS_ID"]] ? htmlspecialcharsbx($shipmentStatuses[$shipment["STATUS_ID"]]) : \Bitrix\Main\Localization\Loc::getMessage("SOB_SHIPMENTS_STATUS") . ": " . $shipment["STATUS_ID"]; } }
static function getStatusesGroupCanDoOperations($groupId, array $operations) { $statuses = array(); if (!is_array($groupId)) { $groupId = array($groupId); } if (in_array('1', $groupId, true) || \CMain::GetUserRight('sale', $groupId) >= 'W') { $statuses = self::getAllStatuses(); } else { $operations = self::convertNamesToOperations($operations); $result = StatusTable::getList(array('select' => array('ID', 'OPERATION' => 'Bitrix\\Sale\\Internals\\StatusGroupTaskTable:STATUS.TASK.Bitrix\\Main\\TaskOperation:TASK.OPERATION.NAME'), 'filter' => array('=TYPE' => static::TYPE, '=Bitrix\\Sale\\Internals\\StatusGroupTaskTable:STATUS.GROUP_ID' => $groupId, '=Bitrix\\Sale\\Internals\\StatusGroupTaskTable:STATUS.TASK.Bitrix\\Main\\TaskOperation:TASK.OPERATION.NAME' => $operations), 'order' => array('SORT'))); while ($row = $result->fetch()) { if ($status =& $statuses[$row['ID']]) { $status[] = $row['OPERATION']; } else { $status = array($row['OPERATION']); } } unset($status); foreach ($statuses as $id => $ops) { if (array_diff($operations, $ops)) { unset($statuses[$id]); } } $statuses = array_keys($statuses); } return $statuses; }
<select name="filter_company_id"> <option value="NOT_REF">(<?php echo GetMessage("SALE_ORDER_ALL"); ?> )</option> <?php foreach ($companies as $company) { echo '<option value="' . $company['ID'] . '">' . htmlspecialcharsbx($company['NAME']) . '</option>'; } ?> </select> </td> </tr> <?php $params = array("select" => array('ID', 'STATUS_NAME' => 'Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME'), "filter" => array('=Bitrix\\Sale\\Internals\\StatusLangTable:STATUS.NAME' => $lang, 'TYPE' => 'O')); $result = \Bitrix\Sale\Internals\StatusTable::getList($params); ?> <tr> <td valign="top"><?php echo GetMessage("SALE_ORDER_SHIPMENT_STATUS"); ?> :<br /><img src="/bitrix/images/sale/mouse.gif" width="44" height="21" border="0" alt=""></td> <td valign="top"> <select name="filter_status[]" multiple size="3"> <?php while ($statusList = $result->fetch()) { ?> <option value="<?php echo $statusList["ID"]; ?> "<?php