示例#1
0
    __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))));
    }
    $data = isset($_REQUEST['ENTITY_DATA']) && is_array($_REQUEST['ENTITY_DATA']) ? $_REQUEST['ENTITY_DATA'] : array();
    if (count($data) == 0) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_DATA_NOT_FOUND')));
    }
    $ID = isset($data['ID']) ? intval($data['ID']) : 0;
    if ($ID <= 0) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_ID_NOT_FOUND')));
    }
    if (!CCrmDeal::CheckUpdatePermission($ID, $curUserPrems)) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
    }
    $stageID = isset($data['STAGE_ID']) ? $data['STAGE_ID'] : '';
    if ($stageID === '') {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_DEAL_STAGE_NOT_FOUND')));
    }
    //$DB->StartTransaction();
    $fields = array('STAGE_ID' => $stageID);
    $entity = new CCrmDeal(false);
    $successed = $entity->Update($ID, $fields, true, true, array());
    if ($successed) {
        //$DB->Commit();
        $errors = array();
        CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Deal, $ID, CCrmBizProcEventType::Edit, $errors);
        $dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
示例#2
0
// page count
$arResult['PAGER_PARAM'] = "PAGEN_{$arResult['PAGE_NAVNUM']}";
$arResult['PAGE_NEXT_NUMBER'] = $arResult['PAGE_NUMBER'] + 1;
while ($item = $dbRes->Fetch()) {
    $itemID = intval($item['ID']);
    $ownerID = intval($item['OWNER_ID']);
    $ownerTypeID = intval($item['OWNER_TYPE_ID']);
    CCrmMobileHelper::PrepareActivityItem($item, $arParams, array('ENABLE_COMMUNICATIONS' => false));
    $arResult['ITEMS'][] =& $item;
    unset($item);
}
if ($arResult['PAGE_NEXT_NUMBER'] > $arResult['PAGE_NAVCOUNT']) {
    $arResult['NEXT_PAGE_URL'] = '';
} else {
    $arResult['NEXT_PAGE_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&PAGING=Y&FORMAT=json&' . $arResult['PAGER_PARAM'] . '=' . $arResult['PAGE_NEXT_NUMBER'], array('AJAX_CALL', 'PAGING', 'FORMAT', 'SEARCH', $arResult['PAGER_PARAM']));
}
$arResult['SEARCH_PAGE_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&SEARCH=Y&FORMAT=json&apply_filter=Y&save=Y', array('AJAX_CALL', 'SEARCH', 'FORMAT', 'save', 'apply_filter', 'clear_filter'));
$arResult['SERVICE_URL'] = SITE_DIR . 'bitrix/components/bitrix/mobile.crm.activity.list/ajax.php?siteID=' . SITE_ID . '&' . bitrix_sessid_get();
$arResult['IS_FILTERED'] = !empty($filter);
$arResult['CREATE_CALL_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Call)) : '';
$arResult['CREATE_MEETING_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Meeting)) : '';
$arResult['CREATE_EMAIL_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Email)) : '';
$arResult['RELOAD_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&FORMAT=json', array('AJAX_CALL', 'SEARCH', 'FORMAT', 'save', 'apply_filter', 'clear_filter'));
//Require any update permission
$arResult['PERMISSIONS'] = array('CREATE' => CCrmLead::CheckUpdatePermission(0, $userPerms) || CCrmCompany::CheckUpdatePermission(0, $userPerms) || CCrmContact::CheckUpdatePermission(0, $userPerms) || CCrmDeal::CheckUpdatePermission(0, $userPerms));
$format = isset($_REQUEST['FORMAT']) ? strtolower($_REQUEST['FORMAT']) : '';
// Only JSON format is supported
if ($format !== '' && $format !== 'json') {
    $format = '';
}
$this->IncludeComponentTemplate($format);
示例#3
0
}
$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) {
        $arResult['BUTTONS'][] = array('TITLE' => GetMessage('DEAL_EXPORT_CSV_TITLE'), 'TEXT' => GetMessage('DEAL_EXPORT_CSV'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'csv', 'ncc' => '1')), 'ICON' => 'btn-export');
        $arResult['BUTTONS'][] = array('TITLE' => GetMessage('DEAL_EXPORT_EXCEL_TITLE'), 'TEXT' => GetMessage('DEAL_EXPORT_EXCEL'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'excel', 'ncc' => '1')), 'ICON' => 'btn-export');
示例#4
0
     }
     if ($itemQty > 0) {
         CCrmContact::RebuildEntityAccessAttrs($itemIDs);
         $progressData['TOTAL_ITEMS'] = $totalItemQty;
         $processedItemQty += $itemQty;
         $progressData['PROCESSED_ITEMS'] = $processedItemQty;
         $progressData['LAST_ITEM_ID'] = $itemIDs[$itemQty - 1];
         COption::SetOptionString('crm', '~CRM_REBUILD_CONTACT_ATTR_PROGRESS', serialize($progressData));
         __CrmConfigPermsEndResonse(array('STATUS' => 'PROGRESS', 'PROCESSED_ITEMS' => $processedItemQty, 'TOTAL_ITEMS' => $totalItemQty, 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_PROGRESS_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty, '#TOTAL_ITEMS#' => $totalItemQty))));
     } else {
         COption::RemoveOption('crm', '~CRM_REBUILD_CONTACT_ATTR');
         COption::RemoveOption('crm', '~CRM_REBUILD_CONTACT_ATTR_PROGRESS');
         __CrmConfigPermsEndResonse(array('STATUS' => 'COMPLETED', 'PROCESSED_ITEMS' => $processedItemQty, 'TOTAL_ITEMS' => $totalItemQty, 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_COMPLETED_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty))));
     }
 } elseif ($entityTypeID === CCrmOwnerType::Deal) {
     if (!CCrmDeal::CheckUpdatePermission(0)) {
         __CrmConfigPermsEndResonse(array('ERROR' => 'Access denied.'));
     }
     if (COption::GetOptionString('crm', '~CRM_REBUILD_DEAL_ATTR', 'N') !== 'Y') {
         __CrmConfigPermsEndResonse(array('STATUS' => 'NOT_REQUIRED', 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_NOT_REQUIRED_SUMMARY')));
     }
     $progressData = COption::GetOptionString('crm', '~CRM_REBUILD_DEAL_ATTR_PROGRESS', '');
     $progressData = $progressData !== '' ? unserialize($progressData) : array();
     $lastItemID = isset($progressData['LAST_ITEM_ID']) ? intval($progressData['LAST_ITEM_ID']) : 0;
     $processedItemQty = isset($progressData['PROCESSED_ITEMS']) ? intval($progressData['PROCESSED_ITEMS']) : 0;
     $totalItemQty = isset($progressData['TOTAL_ITEMS']) ? intval($progressData['TOTAL_ITEMS']) : 0;
     if ($totalItemQty <= 0) {
         $totalItemQty = CCrmDeal::GetListEx(array(), array('CHECK_PERMISSIONS' => 'N'), array(), false);
     }
     $filter = array('CHECK_PERMISSIONS' => 'N');
     if ($lastItemID > 0) {
示例#5
0
 public static function GetEditUrl($typeID, $ID, $bCheckPermissions = false)
 {
     $typeID = intval($typeID);
     $ID = intval($ID);
     if ($ID <= 0) {
         $ID = 0;
     }
     switch ($typeID) {
         case self::Lead:
             if ($bCheckPermissions && !($ID > 0 ? CCrmLead::CheckUpdatePermission($ID) : CCrmLead::CheckCreatePermission())) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_edit'), array('lead_id' => $ID));
         case self::Contact:
             if ($bCheckPermissions && !($ID > 0 ? CCrmContact::CheckUpdatePermission($ID) : CCrmContact::CheckCreatePermission())) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_edit'), array('contact_id' => $ID));
         case self::Company:
             if ($bCheckPermissions && !($ID > 0 ? CCrmCompany::CheckUpdatePermission($ID) : CCrmCompany::CheckCreatePermission())) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_edit'), array('company_id' => $ID));
         case self::Deal:
             if ($bCheckPermissions && !($ID > 0 ? CCrmDeal::CheckUpdatePermission($ID) : CCrmDeal::CheckCreatePermission())) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_edit'), array('deal_id' => $ID));
         case self::Invoice:
             if ($bCheckPermissions && !($ID > 0 ? CCrmInvoice::CheckUpdatePermission($ID) : CCrmInvoice::CheckCreatePermission())) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_invoice_edit'), array('invoice_id' => $ID));
         case self::Quote:
             if ($bCheckPermissions && !($ID > 0 ? CCrmQuote::CheckUpdatePermission($ID) : CCrmQuote::CheckCreatePermission())) {
                 return '';
             }
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_edit'), array('quote_id' => $ID));
         case self::Activity:
             return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_activity_edit'), array('activity_id' => $ID));
         default:
             return '';
     }
 }
示例#6
0
         }
         if (empty($arResult['ERROR_MESSAGE'])) {
             if (!$CCrmBizProc->StartWorkflow($arResult['ELEMENT']['ID'], $arBizProcParametersValues)) {
                 $arResult['ERROR_MESSAGE'] = $CCrmBizProc->LAST_ERROR;
             }
         }
         $ID = isset($arResult['ELEMENT']['ID']) ? $arResult['ELEMENT']['ID'] : 0;
         if (!empty($arResult['ERROR_MESSAGE'])) {
             ShowError($arResult['ERROR_MESSAGE']);
             $arResult['ELEMENT'] = CCrmComponentHelper::PrepareEntityFields(array_merge(array('ID' => $ID), $arFields), CCrmDeal::GetFields());
         } else {
             if (intval($_POST['SYNC_ORDER_ID']) > 0) {
                 LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $ID)));
             }
             if (isset($_POST['apply'])) {
                 if (CCrmDeal::CheckUpdatePermission($ID)) {
                     LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => $ID)));
                 }
             } elseif (isset($_POST['saveAndAdd'])) {
                 LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0)));
             } elseif (isset($_POST['saveAndView'])) {
                 if (CCrmDeal::CheckReadPermission($ID)) {
                     LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $ID)));
                 }
             }
             // save
             LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_LIST'], array()));
         }
     }
 } elseif (isset($_GET['delete']) && check_bitrix_sessid()) {
     if ($bEdit) {
示例#7
0
$contextID = isset($arParams['CONTEXT_ID']) ? $arParams['CONTEXT_ID'] : '';
if ($contextID === '' && isset($_REQUEST['context_id'])) {
    $contextID = $_REQUEST['context_id'];
}
if ($contextID === '') {
    $contextID = "{$uid}_{$entityID}";
}
$arResult['CONTEXT_ID'] = $arParams['CONTEXT_ID'] = $contextID;
//<-- CONTEXT_ID
$dbFields = CCrmDeal::GetListEx(array(), array('ID' => $entityID));
$arFields = $dbFields->GetNext();
if (!$arFields) {
    ShowError(GetMessage('CRM_DEAL_VIEW_NOT_FOUND', array('#ID#' => $arParams['ENTITY_ID'])));
    return;
}
$arResult['PERMISSIONS'] = array('EDIT' => CCrmDeal::CheckUpdatePermission($entityID, $userPerms), 'DELETE' => CCrmDeal::CheckDeletePermission($entityID, $userPerms));
$arFields['~CONTACT_ID'] = isset($arFields['~CONTACT_ID']) ? intval($arFields['~CONTACT_ID']) : 0;
$arFields['~CONTACT_NAME'] = isset($arFields['~CONTACT_NAME']) ? $arFields['~CONTACT_NAME'] : '';
$arFields['~CONTACT_LAST_NAME'] = isset($arFields['~CONTACT_LAST_NAME']) ? $arFields['~CONTACT_LAST_NAME'] : '';
$arFields['~CONTACT_SECOND_NAME'] = isset($arFields['~CONTACT_SECOND_NAME']) ? $arFields['~CONTACT_SECOND_NAME'] : '';
$arFields['~CONTACT_POST'] = isset($arFields['~CONTACT_POST']) ? $arFields['~CONTACT_POST'] : '';
$arFields['~CONTACT_PHOTO'] = isset($arFields['~CONTACT_PHOTO']) ? intval($arFields['~CONTACT_PHOTO']) : 0;
$arFields['~COMPANY_ID'] = isset($arFields['~COMPANY_ID']) ? intval($arFields['~COMPANY_ID']) : 0;
$arFields['~COMPANY_TITLE'] = isset($arFields['~COMPANY_TITLE']) ? $arFields['~COMPANY_TITLE'] : '';
$arFields['~COMPANY_LOGO'] = isset($arFields['~COMPANY_LOGO']) ? intval($arFields['~COMPANY_LOGO']) : 0;
$arFields['~ASSIGNED_BY_ID'] = isset($arFields['~ASSIGNED_BY_ID']) ? intval($arFields['~ASSIGNED_BY_ID']) : 0;
$arFields['~ASSIGNED_BY_LOGIN'] = isset($arFields['~ASSIGNED_BY_LOGIN']) ? $arFields['~ASSIGNED_BY_LOGIN'] : '';
$arFields['~ASSIGNED_BY_NAME'] = isset($arFields['~ASSIGNED_BY_NAME']) ? $arFields['~ASSIGNED_BY_NAME'] : '';
$arFields['~ASSIGNED_BY_LAST_NAME'] = isset($arFields['~ASSIGNED_BY_LAST_NAME']) ? $arFields['~ASSIGNED_BY_LAST_NAME'] : '';
$arFields['~ASSIGNED_BY_SECOND_NAME'] = isset($arFields['~ASSIGNED_BY_SECOND_NAME']) ? $arFields['~ASSIGNED_BY_SECOND_NAME'] : '';
$arFields['~COMMENTS'] = isset($arFields['~COMMENTS']) ? $arFields['~COMMENTS'] : '';
示例#8
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule('crm')) {
    ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
    return;
}
$entityID = $arParams['ENTITY_ID'] = isset($arParams['ENTITY_ID']) ? intval($arParams['ENTITY_ID']) : 0;
if ($entityID <= 0 && isset($_REQUEST['deal_id'])) {
    $entityID = $arParams['ENTITY_ID'] = intval($_REQUEST['deal_id']);
}
$arResult['ENTITY_ID'] = $entityID;
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!($entityID > 0 ? CCrmDeal::CheckUpdatePermission($entityID, $userPerms) : CCrmDeal::CheckCreatePermission($userPerms))) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
global $APPLICATION;
$arParams['DEAL_SHOW_URL_TEMPLATE'] = isset($arParams['DEAL_SHOW_URL_TEMPLATE']) ? $arParams['DEAL_SHOW_URL_TEMPLATE'] : '';
$arParams['DEAL_EDIT_URL_TEMPLATE'] = isset($arParams['DEAL_EDIT_URL_TEMPLATE']) ? $arParams['DEAL_EDIT_URL_TEMPLATE'] : '';
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$arParams['STATUS_SELECTOR_URL_TEMPLATE'] = isset($arParams['STATUS_SELECTOR_URL_TEMPLATE']) ? $arParams['STATUS_SELECTOR_URL_TEMPLATE'] : '';
$arParams['CURRENCY_SELECTOR_URL_TEMPLATE'] = isset($arParams['CURRENCY_SELECTOR_URL_TEMPLATE']) ? $arParams['CURRENCY_SELECTOR_URL_TEMPLATE'] : '';
$arParams['PRODUCT_ROW_EDIT_URL_TEMPLATE'] = isset($arParams['PRODUCT_ROW_EDIT_URL_TEMPLATE']) ? $arParams['PRODUCT_ROW_EDIT_URL_TEMPLATE'] : '';
$arParams['PRODUCT_SELECTOR_URL_TEMPLATE'] = isset($arParams['PRODUCT_SELECTOR_URL_TEMPLATE']) ? $arParams['PRODUCT_SELECTOR_URL_TEMPLATE'] : '';
$arParams['CLIENT_SELECTOR_URL_TEMPLATE'] = isset($arParams['CLIENT_SELECTOR_URL_TEMPLATE']) ? $arParams['CLIENT_SELECTOR_URL_TEMPLATE'] : '';
$arParams['DEAL_STAGE_SELECTOR_URL_TEMPLATE'] = isset($arParams['DEAL_STAGE_SELECTOR_URL_TEMPLATE']) ? $arParams['DEAL_STAGE_SELECTOR_URL_TEMPLATE'] : '';
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']);
$uid = isset($arParams['UID']) ? $arParams['UID'] : '';
示例#9
0
    $name = isset($_POST['NAME']) ? $_POST['NAME'] : '';
    $GLOBALS['APPLICATION']->RestartBuffer();
    Header('Content-Type: text/html; charset=' . LANG_CHARSET);
    $APPLICATION->IncludeComponent('bitrix:intranet.user.selector.new', '.default', array('MULTIPLE' => 'N', 'NAME' => $name, 'POPUP' => 'Y', 'SITE_ID' => SITE_ID), null, array('HIDE_ICONS' => 'Y'));
    __CrmDealShowEndHtmlResonse();
}
if ($mode === 'GET_FORMATTED_SUM') {
    $sum = isset($_POST['SUM']) ? $_POST['SUM'] : 0.0;
    $currencyID = isset($_POST['CURRENCY_ID']) ? $_POST['CURRENCY_ID'] : '';
    if ($currencyID === '') {
        $currencyID = CCrmCurrency::GetBaseCurrencyID();
    }
    __CrmDealShowEndJsonResonse(array('FORMATTED_SUM' => CCrmCurrency::MoneyToString($sum, $currencyID, '#'), 'FORMATTED_SUM_WITH_CURRENCY' => CCrmCurrency::MoneyToString($sum, $currencyID, '')));
}
if ($mode === 'GET_VISUAL_EDITOR') {
    if (!CCrmDeal::CheckUpdatePermission(0, $currentUserPermissions)) {
        __CrmDealShowEndHtmlResonse();
    }
    $lheEditorID = isset($_POST['EDITOR_ID']) ? $_POST['EDITOR_ID'] : '';
    $lheEditorName = isset($_POST['EDITOR_NAME']) ? $_POST['EDITOR_NAME'] : '';
    CModule::IncludeModule('fileman');
    $GLOBALS['APPLICATION']->RestartBuffer();
    Header('Content-Type: text/html; charset=' . LANG_CHARSET);
    $emailEditor = new CLightHTMLEditor();
    $emailEditor->Show(array('id' => $lheEditorID, 'height' => '250', 'BBCode' => false, 'bUseFileDialogs' => false, 'bFloatingToolbar' => false, 'bArisingToolbar' => false, 'bResizable' => false, 'autoResizeOffset' => 20, 'jsObjName' => $lheEditorName, 'bInitByJS' => false, 'bSaveOnBlur' => false, 'toolbarConfig' => array('Bold', 'Italic', 'Underline', 'Strike', 'BackColor', 'ForeColor', 'CreateLink', 'DeleteLink', 'InsertOrderedList', 'InsertUnorderedList', 'Outdent', 'Indent')));
    __CrmDealShowEndHtmlResonse();
}
$type = isset($_POST['OWNER_TYPE']) ? strtoupper($_POST['OWNER_TYPE']) : '';
if ($type !== 'D') {
    __CrmDealShowEndJsonResonse(array('ERROR' => 'OWNER_TYPE IS NOT SUPPORTED!'));
}
示例#10
0
}
if (!CModule::IncludeModule('crm')) {
    ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
    return;
}
// 'Fileman' module always installed
CModule::IncludeModule('fileman');
$CCrmDeal = new CCrmDeal();
if ($CCrmDeal->cPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ')) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
CUtil::InitJSCore(array('ajax', 'tooltip'));
$arResult['EDITABLE_FIELDS'] = array();
$arResult['ELEMENT_ID'] = $arParams['ELEMENT_ID'] = isset($arParams['ELEMENT_ID']) ? intval($arParams['ELEMENT_ID']) : 0;
$arResult['CAN_EDIT'] = CCrmDeal::CheckUpdatePermission($arResult['ELEMENT_ID'], $CCrmDeal->cPerms);
$arParams['PATH_TO_DEAL_LIST'] = CrmCheckPath('PATH_TO_DEAL_LIST', $arParams['PATH_TO_DEAL_LIST'], $APPLICATION->GetCurPage());
$arResult['PATH_TO_DEAL_SHOW'] = $arParams['PATH_TO_DEAL_SHOW'] = CrmCheckPath('PATH_TO_DEAL_SHOW', $arParams['PATH_TO_DEAL_SHOW'], $APPLICATION->GetCurPage() . '?deal_id=#deal_id#&show');
$arParams['PATH_TO_DEAL_EDIT'] = CrmCheckPath('PATH_TO_DEAL_EDIT', $arParams['PATH_TO_DEAL_EDIT'], $APPLICATION->GetCurPage() . '?deal_id=#deal_id#&edit');
$arParams['PATH_TO_CONTACT_SHOW'] = CrmCheckPath('PATH_TO_CONTACT_SHOW', $arParams['PATH_TO_CONTACT_SHOW'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&show');
$arParams['PATH_TO_CONTACT_EDIT'] = CrmCheckPath('PATH_TO_CONTACT_EDIT', $arParams['PATH_TO_CONTACT_EDIT'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&edit');
$arParams['PATH_TO_COMPANY_SHOW'] = CrmCheckPath('PATH_TO_COMPANY_SHOW', $arParams['PATH_TO_COMPANY_SHOW'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&show');
$arParams['PATH_TO_COMPANY_EDIT'] = CrmCheckPath('PATH_TO_COMPANY_EDIT', $arParams['PATH_TO_COMPANY_EDIT'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&edit');
$arParams['PATH_TO_LEAD_SHOW'] = CrmCheckPath('PATH_TO_LEAD_SHOW', $arParams['PATH_TO_LEAD_SHOW'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&show');
$arParams['PATH_TO_LEAD_EDIT'] = CrmCheckPath('PATH_TO_LEAD_EDIT', $arParams['PATH_TO_LEAD_EDIT'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&edit');
$arParams['PATH_TO_LEAD_CONVERT'] = CrmCheckPath('PATH_TO_LEAD_CONVERT', $arParams['PATH_TO_LEAD_CONVERT'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&convert');
$arParams['PATH_TO_USER_PROFILE'] = CrmCheckPath('PATH_TO_USER_PROFILE', $arParams['PATH_TO_USER_PROFILE'], '/company/personal/user/#user_id#/');
$arParams['PATH_TO_PRODUCT_EDIT'] = CrmCheckPath('PATH_TO_PRODUCT_EDIT', $arParams['PATH_TO_PRODUCT_EDIT'], $APPLICATION->GetCurPage() . '?product_id=#product_id#&edit');
$arParams['PATH_TO_PRODUCT_SHOW'] = CrmCheckPath('PATH_TO_PRODUCT_SHOW', $arParams['PATH_TO_PRODUCT_SHOW'], $APPLICATION->GetCurPage() . '?product_id=#product_id#&show');
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
global $USER_FIELD_MANAGER;
示例#11
0
 public function setProductRows($ID, $rows)
 {
     $ID = intval($ID);
     if ($ID <= 0) {
         throw new RestException('The parameter id is invalid or not defined.');
     }
     if (!is_array($rows)) {
         throw new RestException('The parameter rows must be array.');
     }
     if (!CCrmDeal::CheckUpdatePermission($ID)) {
         throw new RestException('Access denied.');
     }
     if (!CCrmDeal::Exists($ID)) {
         throw new RestException('Not found.');
     }
     $proxy = new CCrmProductRowRestProxy();
     $actualRows = array();
     $qty = count($rows);
     for ($i = 0; $i < $qty; $i++) {
         $row = $rows[$i];
         if (!is_array($row)) {
             continue;
         }
         $proxy->prepareForSave($row);
         if (isset($row['OWNER_TYPE'])) {
             unset($row['OWNER_TYPE']);
         }
         if (isset($row['OWNER_ID'])) {
             unset($row['OWNER_ID']);
         }
         $actualRows[] = $row;
     }
     return CCrmDeal::SaveProductRows($ID, $actualRows, true, true, true);
 }
示例#12
0
文件: index.php 项目: pitnan/u136056
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
global $APPLICATION;
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/stream/index.php");
$APPLICATION->SetTitle(GetMessage("CRM_TITLE"));
$APPLICATION->SetPageProperty("BodyClass", " page-one-column");
if (CModule::IncludeModule("crm") && CCrmPerms::IsAccessEnabled()) {
    $currentUserPerms = CCrmPerms::GetCurrentUserPermissions();
    $canEdit = CCrmLead::CheckUpdatePermission(0, $currentUserPerms) || CCrmContact::CheckUpdatePermission(0, $currentUserPerms) || CCrmCompany::CheckUpdatePermission(0, $currentUserPerms) || CCrmDeal::CheckUpdatePermission(0, $currentUserPerms);
    $APPLICATION->IncludeComponent("bitrix:crm.control_panel", "", array("ID" => "STREAM", "ACTIVE_ITEM_ID" => "STREAM", "PATH_TO_COMPANY_LIST" => "/crm/company/", "PATH_TO_COMPANY_EDIT" => "/crm/company/edit/#company_id#/", "PATH_TO_CONTACT_LIST" => "/crm/contact/", "PATH_TO_CONTACT_EDIT" => "/crm/contact/edit/#contact_id#/", "PATH_TO_DEAL_LIST" => "/crm/deal/", "PATH_TO_DEAL_EDIT" => "/crm/deal/edit/#deal_id#/", "PATH_TO_QUOTE_LIST" => "/crm/quote/", "PATH_TO_QUOTE_EDIT" => "/crm/quote/edit/#quote_id#/", "PATH_TO_INVOICE_LIST" => "/crm/invoice/", "PATH_TO_INVOICE_EDIT" => "/crm/invoice/edit/#invoice_id#/", "PATH_TO_LEAD_LIST" => "/crm/lead/", "PATH_TO_LEAD_EDIT" => "/crm/lead/edit/#lead_id#/", "PATH_TO_REPORT_LIST" => "/crm/reports/report/", "PATH_TO_DEAL_FUNNEL" => "/crm/reports/", "PATH_TO_EVENT_LIST" => "/crm/events/", "PATH_TO_PRODUCT_LIST" => "/crm/product/", "PATH_TO_SETTINGS" => "/crm/configs/", "PATH_TO_SEARCH_PAGE" => "/search/index.php?where=crm"));
    // --> IMPORT RESPONSIBILITY SUBSCRIPTIONS
    $currentUserID = CCrmSecurityHelper::GetCurrentUserID();
    if ($currentUserID > 0) {
        CCrmSonetSubscription::EnsureAllResponsibilityImported($currentUserID);
    }
    // <-- IMPORT RESPONSIBILITY SUBSCRIPTIONS
    $APPLICATION->IncludeComponent("bitrix:crm.entity.livefeed", "", array("DATE_TIME_FORMAT" => "d.m.Y H:i:s", "CAN_EDIT" => $canEdit, "FORM_ID" => "", "PATH_TO_USER_PROFILE" => "/company/personal/user/#user_id#/", "PATH_TO_GROUP" => "/workgroups/group/#group_id#/", "PATH_TO_CONPANY_DEPARTMENT" => "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"), null, array("HIDE_ICONS" => "Y"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";