public static function GetLangByID($statusId, $languageId = LANGUAGE_ID) { return StatusLangTable::getList(array('select' => array('*'), 'filter' => array('=STATUS_ID' => $statusId, '=LID' => $languageId), 'limit' => 1))->fetch(); }
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; } } } // V I E W ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if ($statusId) {
/** * @return array Order's statuses & flags. */ public static function getBitrixStatuses($siteId) { $result = array("CANCELED" => Loc::getMessage("SALE_EBAY_HLP_FLAG_CANCELED"), "ALLOW_DELIVERY" => Loc::getMessage("SALE_EBAY_HLP_FLAG_DELIVERY"), "PAYED" => Loc::getMessage("SALE_EBAY_HLP_FLAG_PAYED"), "DEDUCTED" => Loc::getMessage("SALE_EBAY_HLP_FLAG_DEDUCTED")); if (strlen($siteId) <= 0) { throw new ArgumentNullException("siteId"); } $dbRes = SiteTable::getList(array('filter' => array('LID' => $siteId), 'select' => array("LANGUAGE_ID"))); if ($site = $dbRes->fetch()) { $langId = $site["LANGUAGE_ID"]; } else { throw new SystemException("Site with id: \"" . $siteId . "\" not found!"); } $dbRes = StatusLangTable::getList(array('filter' => array('LID' => $langId, 'STATUS.TYPE' => 'O'), 'order' => array("STATUS.SORT" => "ASC", "NAME" => "ASC"), 'select' => array("ID" => "STATUS.ID", "NAME"))); while ($row = $dbRes->fetch()) { $result[$row['ID']] = Loc::getMessage("SALE_EBAY_HLP_STATUS") . " " . $row['NAME'] . ' [' . $row['ID'] . ']'; } return $result; }
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); } } } }