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. Если в базе есть заказы, находящиеся в этом статусе, то этот статус удалить нельзя. Метод динамичный.</p> * * * @param string $ID Код статуса заказа. </htm * * @return bool <p>Возвращается <i>true</i> в случае успешного удаления и <i>false</i> - в * противном случае.</p> <br><br> * * @static * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalestatus/csalestatus__delete.11104aab.php * @author Bitrix */ public static function Delete($statusId) { if (!$statusId) { return false; } global $DB, $APPLICATION; $statusId = $DB->ForSql($statusId, 2); if (OrderTable::getList(array('filter' => array('=STATUS_ID' => $statusId), 'limit' => 1))->fetch()) { $APPLICATION->ThrowException(Loc::getMessage("SKGS_ERROR_DELETE"), "ERROR_DELETE_STATUS_TO_ORDER"); return false; } foreach (GetModuleEvents("sale", "OnBeforeStatusDelete", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($statusId)) === false) { return false; } } foreach (GetModuleEvents("sale", "OnStatusDelete", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($statusId)); } StatusLangTable::deleteByStatus($statusId); StatusGroupTaskTable::deleteByStatus($statusId); return StatusTable::delete($statusId)->isSuccess(); }
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 install(array $data) { if (!($statusId = $data['ID']) || !is_string($statusId)) { throw new SystemException('invalid status ID', 0, __FILE__, __LINE__); } if ($languages = $data['LANG']) { unset($data['LANG']); if (!is_array($languages)) { throw new SystemException('invalid status LANG', 0, __FILE__, __LINE__); } } $data['TYPE'] = static::TYPE; // install status if it is not installed if (!StatusTable::getById($statusId)->fetch()) { StatusTable::add($data); } // install status languages if they are not installed if ($languages) { $installedLanguages = array(); $result = StatusLangTable::getList(array('select' => array('LID'), 'filter' => array('=STATUS_ID' => $statusId))); while ($row = $result->fetch()) { $installedLanguages[$row['LID']] = true; } foreach ($languages as $language) { if (!is_array($language)) { throw new SystemException('invalid status language', 0, __FILE__, __LINE__); } if (!$installedLanguages[$language['LID']]) { $language['STATUS_ID'] = $statusId; StatusLangTable::add($language); } } } }
<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