• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/helpers/admin/blocks/orderadditional.php
  • Класс: BitrixSaleHelpersAdminBlocksOrderAdditional
  • Вызов: OrderAdditional::getEdit
static function getEdit($collection, $formName, $formPrefix, array $post = array())
{
	global $APPLICATION, $USER;

	$saleModulePermissions = $APPLICATION->GetGroupRight("sale");

	$userCompanyId = null;

	if($saleModulePermissions == "P")
	{
		$userCompanyList = Manager::getUserCompanyList($USER->GetID());
		if (!empty($userCompanyList) && is_array($userCompanyList) && count($userCompanyList) == 1)
		{
			$userCompanyId = reset($userCompanyList);
		}
		if ($collection->getId() == 0)
		{
			if (intval($userCompanyId) > 0)
			{
				$collection->setField('COMPANY_ID', $userCompanyId);
			}

			$collection->setField('RESPONSIBLE_ID', $USER->GetID());
		}
	}

	$data = self::prepareData($collection);

	$lang = Application::getInstance()->getContext()->getLanguage();

	if(get_class($collection) == 'BitrixSaleOrder')
		$orderLocked = BitrixSaleOrder::isLocked($collection->getId());
	else
		$orderLocked = false;

	$blockEmpResponsible = '';
	if (isset($data['EMP_RESPONSIBLE']) && !empty($data['EMP_RESPONSIBLE']))
	{
		$blockEmpResponsible = '
			
				
				
					
'.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_CHANGE_BY').': '.$data['DATE_RESPONSIBLE'].' '.htmlspecialcharsbx($data['EMP_RESPONSIBLE']).'
'; } $additionalInfo = ''; if (isset($data['ADDITIONAL_INFO']) && !empty($data['ADDITIONAL_INFO'])) { $additionalInfo = '
'.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_ADDITIONAL_INFO').': '.$data['ADDITIONAL_INFO'].'
'; } $data['COMPANIES'] = Manager::getListWithRestrictions($collection, BitrixSaleServicesCompanyRestrictionsManager::MODE_MANAGER); if (!empty($data['COMPANIES'])) { $companies = null; if ($saleModulePermissions == "P") { //&& !empty($data['COMPANIES'][$userCompanyId]) if (count($userCompanyList) == 1) { $companyName = $data['COMPANIES'][$userCompanyId]["NAME"]." [".$data['COMPANIES'][$userCompanyId]["ID"]."]"; $companies = htmlspecialcharsbx($companyName); } else { foreach ($data['COMPANIES'] as $companyId => $companyData) { $foundCompany = false; foreach ($userCompanyList as $userCompanyId) { if ($userCompanyId == $companyId) { $foundCompany = true; break; } } if (!$foundCompany) { unset($data['COMPANIES'][$companyId]); } } if (count($data['COMPANIES']) == 1) { $company = reset($data['COMPANIES']);// [$userCompanyId]["NAME"]." [".$data['COMPANIES'][$userCompanyId]["ID"]."]"; $companies = htmlspecialcharsbx($company["NAME"]." [".$company["ID"]."]"); } } } if (empty($companies) && $formPrefix === 'ORDER') { $companies = OrderEdit::makeSelectHtmlWithRestricted( $formPrefix.'[COMPANY_ID]', $data['COMPANIES'], isset($post["COMPANY_ID"]) ? $post["COMPANY_ID"] : $data["COMPANY_ID"], true, array( "class" => "adm-bus-select", "id" => $formPrefix."_COMPANY_ID" ) ); } } else { if ($saleModulePermissions >= "W") { $companies = str_replace("#URL#", "/bitrix/admin/sale_company_edit.php?lang=".$lang, Loc::getMessage('SALE_ORDER_SHIPMENT_ADD_COMPANY')); } } if (!empty($companies)) { $additionalInfo .= '
'.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_COMPANY').': '.$companies.'
'; } return '
'.$blockEmpResponsible.'
'.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_RESPONSIBLE').':
'.static::renderResponsibleLink($data).'   '.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_CHANGE').'
'.$additionalInfo.'
'.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_COMMENT').'
'.Loc::getMessage('SALE_ORDER_ADDITIONAL_INFO_MANAGER_COMMENT').':
'; }