Exemplo n.º 1
0
if (isset($arResult['ELEMENT']['CURRENCY_ID']) && $arResult['ELEMENT']['CURRENCY_ID'] !== '') {
    $currencyID = $arResult['ELEMENT']['CURRENCY_ID'];
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CURRENCY_ID'), 'type' => 'list', 'params' => array('sale_order_marker' => 'Y'), 'items' => $arResult['CURRENCY_LIST'], 'value' => $currencyID);
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_QUOTE_FIELD_OPPORTUNITY'), 'params' => array('size' => 21, 'sale_order_marker' => 'Y'), 'value' => isset($arResult['ELEMENT']['OPPORTUNITY']) ? $arResult['ELEMENT']['OPPORTUNITY'] : '', 'type' => 'text');
$arResult['RESPONSIBLE_SELECTOR_PARAMS'] = array('NAME' => 'crm_quote_edit_resonsible', 'INPUT_NAME' => 'ASSIGNED_BY_ID', 'SEARCH_INPUT_NAME' => 'ASSIGNED_BY_NAME', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE']);
$arResult['FIELDS']['tab_1'][] = array('id' => 'ASSIGNED_BY_ID', 'componentParams' => $arResult['RESPONSIBLE_SELECTOR_PARAMS'], 'name' => GetMessage('CRM_QUOTE_FIELD_ASSIGNED_BY_ID'), 'type' => 'intranet_user_search', 'value' => isset($arResult['ELEMENT']['ASSIGNED_BY_ID']) ? $arResult['ELEMENT']['ASSIGNED_BY_ID'] : $USER->GetID());
//Fix for issue #36848
$beginDate = isset($arResult['ELEMENT']['BEGINDATE']) ? $arResult['ELEMENT']['BEGINDATE'] : '';
$closeDate = isset($arResult['ELEMENT']['CLOSEDATE']) ? $arResult['ELEMENT']['CLOSEDATE'] : '';
$arResult['FIELDS']['tab_1'][] = array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_BEGINDATE'), 'params' => array('sale_order_marker' => 'Y'), 'type' => 'date_link', 'value' => $beginDate !== '' ? ConvertTimeStamp(MakeTimeStamp($beginDate), 'SHORT', SITE_ID) : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_CLOSEDATE'), 'type' => 'date_short', 'value' => $closeDate !== '' ? ConvertTimeStamp(MakeTimeStamp($closeDate), 'SHORT', SITE_ID) : '', 'params' => array('class' => 'bx-crm-dialog-input bx-crm-dialog-input-date'));
if (CCrmLead::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'LEAD_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LEAD_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'LEAD', 'INPUT_NAME' => 'LEAD_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['LEAD_ID']) ? $arResult['ELEMENT']['LEAD_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmDeal::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'DEAL_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_DEAL_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'DEAL', 'INPUT_NAME' => 'DEAL_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['DEAL_ID']) ? $arResult['ELEMENT']['DEAL_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_QUOTE_FIELD_OPENED'), 'type' => 'vertical_checkbox', 'params' => array(), 'value' => isset($arResult['ELEMENT']['OPENED']) ? $arResult['ELEMENT']['OPENED'] : true, 'title' => GetMessage('CRM_QUOTE_FIELD_OPENED_TITLE'));
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CLIENT_INFO'), 'type' => 'section');
if (CCrmContact::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CONTACT_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'NEW_INPUT_NAME' => CCrmContact::CheckCreatePermission() ? 'NEW_CONTACT_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['CONTACT_ID']) ? $arResult['ELEMENT']['CONTACT_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmCompany::CheckReadPermission()) {
    $arResult['FIELDS']['tab_1'][] = array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_COMPANY_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'COMPANY', 'INPUT_NAME' => 'COMPANY_ID', 'NEW_INPUT_NAME' => CCrmCompany::CheckCreatePermission() ? 'NEW_COMPANY_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['COMPANY_ID']) ? $arResult['ELEMENT']['COMPANY_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if ($bTaxMode) {
    // CLIENT LOCATION
    $sLocationHtml = '';
    $locValue = isset($arResult['ELEMENT']['LOCATION_ID']) ? $arResult['ELEMENT']['LOCATION_ID'] : '';
    ob_start();
Exemplo n.º 2
0
        __CrmMobileDealEditEndResonse(array('DELETED_ENTITY_ID' => $ID));
    } else {
        //$DB->Rollback();
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_DEAL_COULD_NOT_DELETE')));
    }
} elseif ($action === 'GET_ENTITY') {
    __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
    $typeName = isset($_REQUEST['ENTITY_TYPE_NAME']) ? $_REQUEST['ENTITY_TYPE_NAME'] : '';
    if ($typeName !== CCrmOwnerType::DealName) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_TYPE_NOT_SUPPORTED', array('#ENTITY_TYPE#' => $typeName))));
    }
    $ID = isset($_REQUEST['ENTITY_ID']) ? intval($_REQUEST['ENTITY_ID']) : 0;
    if ($ID <= 0) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_ID_NOT_FOUND')));
    }
    if (!CCrmDeal::CheckReadPermission($ID)) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
    }
    $dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
    $item = $dbRes ? $dbRes->GetNext() : null;
    if (!is_array($item)) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_DEAL_NOT_FOUND', array('#ID#' => $ID))));
    }
    $formatParams = isset($_REQUEST['FORMAT_PARAMS']) ? $_REQUEST['FORMAT_PARAMS'] : array();
    CCrmMobileHelper::PrepareDealItem($item, $formatParams);
    __CrmMobileDealEditEndResonse(array('ENTITY' => CCrmMobileHelper::PrepareDealData($item)));
} elseif ($action === 'SET_STAGE') {
    __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
    $typeName = isset($_REQUEST['ENTITY_TYPE_NAME']) ? $_REQUEST['ENTITY_TYPE_NAME'] : '';
    if ($typeName !== CCrmOwnerType::DealName) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_TYPE_NOT_SUPPORTED', array('#ENTITY_TYPE#' => $typeName))));
Exemplo n.º 3
0
 public static function GetShowUrl($typeID, $ID, $bCheckPermissions = false)
 {
     $typeID = intval($typeID);
     $ID = intval($ID);
     if ($ID <= 0) {
         return '';
     }
     switch ($typeID) {
         case self::Lead:
             if ($bCheckPermissions && !CCrmLead::CheckReadPermission($ID)) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $ID));
         case self::Contact:
             if ($bCheckPermissions && !CCrmContact::CheckReadPermission($ID)) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $ID));
         case self::Company:
             if ($bCheckPermissions && !CCrmCompany::CheckReadPermission($ID)) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $ID));
         case self::Deal:
             if ($bCheckPermissions && !CCrmDeal::CheckReadPermission($ID)) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $ID));
         case self::Activity:
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_activity_show'), array('activity_id' => $ID));
         case self::Invoice:
             if ($bCheckPermissions && !CCrmInvoice::CheckReadPermission($ID)) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_invoice_show'), array('invoice_id' => $ID));
         case self::Quote:
             if ($bCheckPermissions && !CCrmQuote::CheckReadPermission($ID)) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_show'), array('quote_id' => $ID));
         default:
             return '';
     }
 }
Exemplo n.º 4
0
if ($arParams['ELEMENT_ID'] > 0) {
    $toolbarID .= '_' . $arParams['ELEMENT_ID'];
}
$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
    $bRead = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ');
    $bExport = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'EXPORT');
    $bImport = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'IMPORT');
    $bAdd = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'ADD');
    $bWrite = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'WRITE');
    $bDelete = false;
} else {
    $bExport = false;
    $bImport = false;
    $bRead = CCrmDeal::CheckReadPermission($arParams['ELEMENT_ID'], $CrmPerms);
    $bAdd = CCrmDeal::CheckCreatePermission($CrmPerms);
    $bWrite = CCrmDeal::CheckUpdatePermission($arParams['ELEMENT_ID'], $CrmPerms);
    $bDelete = CCrmDeal::CheckDeletePermission($arParams['ELEMENT_ID'], $CrmPerms);
}
if (!$bRead && !$bAdd && !$bWrite) {
    return false;
}
if ($arParams['TYPE'] === 'list') {
    if ($bAdd) {
        $arResult['BUTTONS'][] = array('TEXT' => GetMessage('DEAL_ADD'), 'TITLE' => GetMessage('DEAL_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0)), 'HIGHLIGHT' => true);
    }
    if ($bImport) {
        $arResult['BUTTONS'][] = array('TEXT' => GetMessage('DEAL_IMPORT'), 'TITLE' => GetMessage('DEAL_IMPORT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_IMPORT'], array()), 'ICON' => 'btn-import');
    }
    if ($bExport) {
Exemplo n.º 5
0
$componentData = isset($_REQUEST['PARAMS']) && is_array($_REQUEST['PARAMS']) ? $_REQUEST['PARAMS'] : array();
$componentParams = isset($componentData['params']) && is_array($componentData['params']) ? $componentData['params'] : array();
//Security check
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
$filter = isset($componentParams['INTERNAL_FILTER']) && is_array($componentParams['INTERNAL_FILTER']) ? $componentParams['INTERNAL_FILTER'] : array();
$contactID = isset($filter['UF_CONTACT_ID']) ? $filter['UF_CONTACT_ID'] : 0;
$companyID = isset($filter['UF_COMPANY_ID']) ? $filter['UF_COMPANY_ID'] : 0;
$dealID = isset($filter['UF_DEAL_ID']) ? $filter['UF_DEAL_ID'] : 0;
$quoteID = isset($filter['UF_QUOTE_ID']) ? $filter['UF_QUOTE_ID'] : 0;
$isPermitted = false;
if ($contactID > 0) {
    $isPermitted = CCrmContact::CheckReadPermission($contactID, $userPermissions);
} elseif ($companyID > 0) {
    $isPermitted = CCrmCompany::CheckReadPermission($companyID, $userPermissions);
} elseif ($dealID > 0) {
    $isPermitted = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
} elseif ($quoteID > 0) {
    $isPermitted = CCrmQuote::CheckReadPermission($quoteID, $userPermissions);
}
if (!$isPermitted) {
    die;
}
//For custom reload with params
$ajaxLoaderParams = array('url' => '', 'method' => 'POST', 'dataType' => 'ajax', 'data' => array('PARAMS' => $componentData));
global $APPLICATION;
Header('Content-Type: text/html; charset=' . LANG_CHARSET);
$APPLICATION->ShowAjaxHead();
//Force AJAX mode
$componentParams['AJAX_MODE'] = 'Y';
$componentParams['AJAX_OPTION_JUMP'] = 'N';
$componentParams['AJAX_OPTION_HISTORY'] = 'N';
Exemplo n.º 6
0
 public function getProductRows($ID)
 {
     $ID = intval($ID);
     if ($ID <= 0) {
         throw new RestException('The parameter id is invalid or not defined.');
     }
     if (!CCrmDeal::CheckReadPermission($ID)) {
         throw new RestException('Access denied.');
     }
     return CCrmDeal::LoadProductRows($ID);
 }
Exemplo n.º 7
0
 * 'ENABLE_SONET_SUBSCRIPTION'
 */
global $DB, $APPLICATION;
if (!CCrmSecurityHelper::IsAuthorized() || !check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] != 'POST') {
    return;
}
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
CUtil::JSPostUnescape();
$APPLICATION->RestartBuffer();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
$action = isset($_POST['ACTION']) ? $_POST['ACTION'] : '';
if (strlen($action) == 0) {
    echo CUtil::PhpToJSObject(array('ERROR' => 'INVALID DATA!'));
    die;
}
if ($action === 'ENABLE_SONET_SUBSCRIPTION') {
    $userID = CCrmSecurityHelper::GetCurrentUserID();
    $entityTypeName = isset($_POST['ENTITY_TYPE']) ? strtoupper($_POST['ENTITY_TYPE']) : '';
    $entityID = isset($_POST['ENTITY_ID']) ? intval($_POST['ENTITY_ID']) : 0;
    if ($userID > 0 && $entityTypeName === CCrmOwnerType::DealName && $entityID > 0 && CCrmDeal::CheckReadPermission($entityID)) {
        $isEnabled = CCrmSonetSubscription::IsRelationRegistered(CCrmOwnerType::Deal, $entityID, CCrmSonetSubscriptionType::Observation, $userID);
        $enable = isset($_POST['ENABLE']) && strtoupper($_POST['ENABLE']) === 'Y';
        if ($isEnabled !== $enable) {
            if ($enable) {
                CCrmSonetSubscription::RegisterSubscription(CCrmOwnerType::Deal, $entityID, CCrmSonetSubscriptionType::Observation, $userID);
            } else {
                CCrmSonetSubscription::UnRegisterSubscription(CCrmOwnerType::Deal, $entityID, CCrmSonetSubscriptionType::Observation, $userID);
            }
        }
    }
}
Exemplo n.º 8
0
$arResult['FIELDS'] = array();
$readOnlyMode = !$enableInstantEdit || $isExternal;
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_invoice_info', 'name' => GetMessage('CRM_SECTION_INVOICE_INFO'), 'type' => 'section', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'ACCOUNT_NUMBER', 'name' => GetMessage('CRM_FIELD_ACCOUNT_NUMBER'), 'params' => array('size' => 100), 'value' => isset($arResult['ELEMENT']['ACCOUNT_NUMBER']) ? $arResult['ELEMENT']['ACCOUNT_NUMBER'] : '', 'type' => 'label', 'required' => true, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'ORDER_TOPIC', 'name' => GetMessage('CRM_FIELD_ORDER_TOPIC'), 'params' => array('size' => 255), 'value' => isset($arResult['ELEMENT']['ORDER_TOPIC']) ? $arResult['ELEMENT']['ORDER_TOPIC'] : '', 'type' => 'label', 'required' => true, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'STATUS_ID', 'name' => GetMessage('CRM_FIELD_STATUS_ID'), 'type' => 'label', 'value' => $arResult['ELEMENT']['STATUS_TEXT'], 'required' => true, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'PAY_VOUCHER_DATE', 'name' => GetMessage('CRM_FIELD_PAY_VOUCHER_DATE'), 'type' => 'label', 'value' => !empty($arResult['ELEMENT']['PAY_VOUCHER_DATE']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($arResult['ELEMENT']['PAY_VOUCHER_DATE']), 'SHORT', SITE_ID)) : '', 'visible' => $bStatusSuccess, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'PAY_VOUCHER_NUM', 'name' => GetMessage('CRM_FIELD_PAY_VOUCHER_NUM'), 'type' => 'label', 'value' => isset($arResult['ELEMENT']['PAY_VOUCHER_NUM']) ? $arResult['ELEMENT']['PAY_VOUCHER_NUM'] : '', 'visible' => $bStatusSuccess, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'REASON_MARKED_SUCCESS', 'name' => GetMessage('CRM_FIELD_REASON_MARKED_SUCCESS'), 'value' => isset($arResult['ELEMENT']['REASON_MARKED_SUCCESS']) ? $arResult['ELEMENT']['REASON_MARKED_SUCCESS'] : '', 'type' => 'label', 'visible' => $bStatusSuccess, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'DATE_MARKED', 'name' => GetMessage('CRM_FIELD_DATE_MARKED'), 'type' => 'label', 'value' => !empty($arResult['ELEMENT']['DATE_MARKED']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($arResult['ELEMENT']['DATE_MARKED']), 'SHORT', SITE_ID)) : '', 'visible' => $bStatusFailed, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'REASON_MARKED', 'name' => GetMessage('CRM_FIELD_REASON_MARKED'), 'value' => isset($arResult['ELEMENT']['REASON_MARKED']) ? $arResult['ELEMENT']['REASON_MARKED'] : '', 'type' => 'label', 'visible' => $bStatusFailed, 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'DATE_BILL', 'name' => GetMessage('CRM_FIELD_DATE_BILL'), 'type' => 'label', 'value' => !empty($arResult['ELEMENT']['DATE_BILL']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($arResult['ELEMENT']['DATE_BILL']), 'SHORT', SITE_ID)) : '', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'DATE_PAY_BEFORE', 'name' => GetMessage('CRM_FIELD_DATE_PAY_BEFORE'), 'type' => 'label', 'value' => !empty($arResult['ELEMENT']['DATE_PAY_BEFORE']) ? CCrmComponentHelper::TrimDateTimeString(ConvertTimeStamp(MakeTimeStamp($arResult['ELEMENT']['DATE_PAY_BEFORE']), 'SHORT', SITE_ID)) : '', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'RESPONSIBLE_ID', 'name' => GetMessage('CRM_FIELD_RESPONSIBLE_ID'), 'type' => 'custom', 'value' => isset($arResult['ELEMENT']['RESPONSIBLE_ID']) ? CCrmViewHelper::PrepareFormResponsible($arResult['ELEMENT']['RESPONSIBLE_ID'], $arParams['NAME_TEMPLATE'], $arParams['PATH_TO_USER_PROFILE']) : '', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_FIELD_CURRENCY_ID'), 'params' => array('size' => 50), 'type' => 'label', 'value' => htmlspecialcharsbx(isset($arResult['CURRENCY_LIST'][$currencyID]) ? $arResult['CURRENCY_LIST'][$currencyID] : $currencyID), 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'UF_DEAL_ID', 'name' => GetMessage('CRM_FIELD_UF_DEAL_ID'), 'value' => isset($arResult['ELEMENT']['UF_DEAL_TITLE']) ? !CCrmDeal::CheckReadPermission($dealID) ? htmlspecialcharsbx($arResult['ELEMENT']['UF_DEAL_TITLE']) : '<a href="' . $arResult['PATH_TO_DEAL_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_D_' . $dealID . '">' . htmlspecialcharsbx($arResult['ELEMENT']['UF_DEAL_TITLE']) . '</a>' . '<script type="text/javascript">BX.tooltip("DEAL_' . $dealID . '", "balloon_' . $arResult['GRID_ID'] . '_D_' . $dealID . '", "/bitrix/components/bitrix/crm.deal.show/card.ajax.php", "crm_balloon_deal", true);</script>' : GetMessage('CRM_INVOICE_DEAL_NOT_ASSIGNED'), 'type' => 'custom', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'UF_QUOTE_ID', 'name' => GetMessage('CRM_FIELD_UF_QUOTE_ID'), 'value' => isset($arResult['ELEMENT']['UF_QUOTE_TITLE']) ? !CCrmQuote::CheckReadPermission($quoteID) ? htmlspecialcharsbx($arResult['ELEMENT']['UF_QUOTE_TITLE']) : '<a href="' . $arResult['PATH_TO_QUOTE_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_Q_' . $quoteID . '">' . htmlspecialcharsbx($arResult['ELEMENT']['UF_QUOTE_TITLE']) . '</a>' . '<script type="text/javascript">BX.tooltip("QUOTE_' . $quoteID . '", "balloon_' . $arResult['GRID_ID'] . '_Q_' . $quoteID . '", "/bitrix/components/bitrix/crm.quote.show/card.ajax.php", "crm_balloon_quote", true);</script>' : GetMessage('CRM_INVOICE_QUOTE_NOT_ASSIGNED'), 'type' => 'custom', 'isTactile' => true);
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_invoice_payer', 'name' => GetMessage('CRM_SECTION_INVOICE_PAYER'), 'type' => 'section', 'isTactile' => true);
$clientField = array('id' => 'CLIENT_ID', 'name' => GetMessage('CRM_FIELD_CLIENT_ID'), 'value' => '', 'type' => 'custom', 'isTactile' => true);
$contactHtml = '';
if ($contactID > 0) {
    $formattedName = isset($arResult['ELEMENT']['UF_CONTACT_FORMATTED_NAME']) ? htmlspecialcharsbx($arResult['ELEMENT']['UF_CONTACT_FORMATTED_NAME']) : '';
    $contactHtml = $formattedName !== '' ? !CCrmContact::CheckReadPermission($contactID) ? $formattedName : '<a href="' . $arResult['PATH_TO_CONTACT_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_C_' . $contactID . '">' . $formattedName . '</a>' . '<script type="text/javascript">BX.tooltip("CONTACT_' . $contactID . '", "balloon_' . $arResult['GRID_ID'] . '_C_' . $contactID . '", "' . SITE_DIR . 'bitrix/components/bitrix/crm.contact.show/card.ajax.php", "crm_balloon_contact", true);</script>' : '';
}
if ($companyID > 0) {
    $title = isset($arResult['ELEMENT']['UF_COMPANY_TITLE']) ? htmlspecialcharsbx($arResult['ELEMENT']['UF_COMPANY_TITLE']) : '';
    $clientField['value'] = $title !== '' ? !CCrmCompany::CheckReadPermission($companyID) ? $title : '<a href="' . $arResult['PATH_TO_COMPANY_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_CO_' . $companyID . '">' . $title . '</a>' . '<script type="text/javascript">BX.tooltip("COMPANY_' . $companyID . '", "balloon_' . $arResult['GRID_ID'] . '_CO_' . $companyID . '", "' . SITE_DIR . 'bitrix/components/bitrix/crm.company.show/card.ajax.php", "crm_balloon_company", true);</script>' : GetMessage('CRM_INVOICE_CLIENT_NOT_ASSIGNED');
} elseif ($contactID > 0) {
    $clientField['value'] = $contactHtml !== '' ? $contactHtml : GetMessage('CRM_INVOICE_CLIENT_NOT_ASSIGNED');
}
$arResult['FIELDS']['tab_1'][] =& $clientField;
Exemplo n.º 9
0
 if ($topic === '') {
     __CrmMobileInvoiceEditEndResonse(array('ERROR' => GetMessage('CRM_INVOICE_TOPIC_IS_NOT_ASSIGNED')));
 }
 $companyID = max(isset($data['COMPANY_ID']) ? intval($data['COMPANY_ID']) : 0, 0);
 if ($companyID > 0 && !CCrmCompany::CheckReadPermission($companyID, $curUserPrems)) {
     $companyID = 0;
 }
 $contactID = max(isset($data['CONTACT_ID']) ? intval($data['CONTACT_ID']) : 0, 0);
 if ($contactID > 0 && !CCrmContact::CheckReadPermission($contactID, $curUserPrems)) {
     $contactID = 0;
 }
 if ($companyID === 0 && $contactID === 0) {
     __CrmMobileInvoiceEditEndResonse(array('ERROR' => GetMessage('CRM_INVOICE_CLIENT_IS_NOT_ASSIGNED')));
 }
 $dealID = max(isset($data['DEAL_ID']) ? intval($data['DEAL_ID']) : 0, 0);
 if ($dealID > 0 && !CCrmDeal::CheckReadPermission($dealID, $curUserPrems)) {
     $dealID = 0;
 }
 $personTypeID = isset($data['PERSON_TYPE_ID']) ? intval($data['PERSON_TYPE_ID']) : 0;
 $resolvedPersonTypeID = $companyID > 0 || $contactID > 0 ? CCrmInvoice::ResolvePersonTypeID($companyID, $contactID) : 0;
 $paySystemID = isset($data['PAY_SYSTEM_ID']) ? intval($data['PAY_SYSTEM_ID']) : 0;
 $paySystems = CCrmPaySystem::GetPaySystemsListItems($resolvedPersonTypeID);
 $resolvedPaySystemID = 0;
 if ($personTypeID === $resolvedPersonTypeID && $paySystemID > 0 && array_key_exists($paySystemID, $paySystems)) {
     // Pay system does not changed
     $resolvedPaySystemID = $paySystemID;
 } elseif (!empty($paySystems)) {
     // Take first pay system
     $resolvedPaySystemID = array_shift(array_keys($paySystems));
 }
 // CURRENCY_ID -->