本文整理汇总了PHP中CCrmSecurityHelper::GetCurrentUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmSecurityHelper::GetCurrentUserID方法的具体用法?PHP CCrmSecurityHelper::GetCurrentUserID怎么用?PHP CCrmSecurityHelper::GetCurrentUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmSecurityHelper
的用法示例。
在下文中一共展示了CCrmSecurityHelper::GetCurrentUserID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetUserWorkflowTaskCount
public static function GetUserWorkflowTaskCount($workflowIDs, $userID = 0)
{
if (!is_array($workflowIDs)) {
return 0;
}
if (!(IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc'))) {
return 0;
}
$userID = intval($userID);
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUserID();
}
$filter = array('USER_ID' => $userID);
$workflowQty = count($workflowIDs);
if ($workflowQty > 1) {
//IMPORTANT: will produce SQL error due to CBPTaskService::GetList bug
//$filter['@WORKFLOW_ID'] = $workflowIDs;
$filter['WORKFLOW_ID'] = $workflowIDs[0];
}
/*elseif($workflowQty === 1)
{
$filter['WORKFLOW_ID'] = $workflowIDs[0];
}*/
$result = CBPTaskService::GetList(array(), $filter, array(), false, array());
return is_int($result) ? $result : 0;
}
示例2: __construct
public function __construct(array $settings, $userID = 0, $enablePermissionCheck = true)
{
$this->settings = $settings;
if (!is_int($userID)) {
$userID = (int) $userID;
}
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
}
$this->userID = $userID;
if (!is_bool($enablePermissionCheck)) {
$enablePermissionCheck = (bool) $enablePermissionCheck;
}
$this->enablePermissionCheck = $enablePermissionCheck;
}
示例3: checkCompletePermission
public static function checkCompletePermission($taskID, $userID = 0)
{
if (!is_int($userID)) {
$userID = (int) $userID;
}
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
}
if (!is_int($taskID)) {
$taskID = (int) $taskID;
}
$taskItem = self::getTaskItem($taskID, $userID);
if ($taskItem === null) {
return false;
}
try {
return $taskItem->isActionAllowed(\CTaskItem::ACTION_COMPLETE);
} catch (\TasksException $e) {
return false;
}
}
示例4: __construct
protected function __construct(array $settings, Filter $filter, $userID = 0, $enablePermissionCheck = true)
{
$this->settings = $settings;
$this->filter = $filter;
$this->responsibleIDs = $this->filter->getResponsibleIDs();
if (!is_int($userID)) {
$userID = (int) $userID;
}
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
}
$this->userID = $userID;
if (!is_bool($enablePermissionCheck)) {
$enablePermissionCheck = (bool) $enablePermissionCheck;
}
$this->enablePermissionCheck = $enablePermissionCheck;
//Disable permission check if filter by current user is enabled.
if ($this->enablePermissionCheck && is_array($this->responsibleIDs) && count($this->responsibleIDs) === 1 && (int) $this->responsibleIDs[0] === $this->userID) {
$this->enablePermissionCheck = false;
}
}
示例5: Delete
public function Delete($ID, $arOptions = array())
{
global $DB, $APPLICATION;
$ID = intval($ID);
$iUserId = CCrmSecurityHelper::GetCurrentUserID();
$this->LAST_ERROR = '';
$APPLICATION->ResetException();
if (!is_array($arOptions)) {
$arOptions = array();
}
if (isset($arOptions['CHECK_DEPENDENCIES']) && (bool) $arOptions['CHECK_DEPENDENCIES']) {
$dbRes = self::GetListEx(array(), array('=ID' => $ID), false, false, array('TITLE', 'STATUS_ID', 'COMPANY_ID', 'CONTACT_ID'));
$arFields = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arFields) && isset($arFields['STATUS_ID']) && $arFields['STATUS_ID'] === 'CONVERTED' && (CCrmCompany::Exists(isset($arFields['COMPANY_ID']) ? intval($arFields['COMPANY_ID']) : 0) || CCrmContact::Exists(isset($arFields['CONTACT_ID']) ? intval($arFields['CONTACT_ID']) : 0))) {
$title = isset($arFields['TITLE']) && $arFields['TITLE'] !== '' ? $arFields['TITLE'] : $ID;
$err = GetMessage('CRM_LEAD_DELETION_DEPENDENCIES_FOUND', array('#TITLE#' => $title));
$this->LAST_ERROR = $err;
$APPLICATION->throwException($err);
return false;
}
}
$sWherePerm = '';
if ($this->bCheckPermission) {
$arEntityAttr = $this->cPerms->GetEntityAttr('LEAD', $ID);
$sEntityPerm = $this->cPerms->GetPermType('LEAD', 'DELETE', $arEntityAttr[$ID]);
if ($sEntityPerm == BX_CRM_PERM_NONE) {
return false;
} else {
if ($sEntityPerm == BX_CRM_PERM_SELF) {
$sWherePerm = " AND ASSIGNED_BY_ID = {$iUserId}";
} else {
if ($sEntityPerm == BX_CRM_PERM_OPEN) {
$sWherePerm = " AND (OPENED = 'Y' OR ASSIGNED_BY_ID = {$iUserId})";
}
}
}
}
$events = GetModuleEvents('crm', 'OnBeforeCrmLeadDelete');
while ($arEvent = $events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
$err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
if ($ex = $APPLICATION->GetException()) {
$err .= ': ' . $ex->GetString();
}
$APPLICATION->throwException($err);
$this->LAST_ERROR = $err;
return false;
}
}
//By defaut we need to clean up related bizproc entities
$processBizproc = isset($arOptions['PROCESS_BIZPROC']) ? (bool) $arOptions['PROCESS_BIZPROC'] : true;
if ($processBizproc) {
$bizproc = new CCrmBizProc('LEAD');
$bizproc->ProcessDeletion($ID);
}
$tableName = CCrmLead::TABLE_NAME;
$sSql = "DELETE FROM {$tableName} WHERE ID = {$ID}{$sWherePerm}";
$obRes = $DB->Query($sSql, false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
if (is_object($obRes) && $obRes->AffectedRowsCount() > 0) {
CCrmSearch::DeleteSearch('LEAD', $ID);
$DB->Query("DELETE FROM b_crm_entity_perms WHERE ENTITY='LEAD' AND ENTITY_ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
$GLOBALS['USER_FIELD_MANAGER']->Delete(self::$sUFEntityID, $ID);
$CCrmFieldMulti = new CCrmFieldMulti();
$CCrmFieldMulti->DeleteByElement('LEAD', $ID);
$CCrmEvent = new CCrmEvent();
$CCrmEvent->DeleteByElement('LEAD', $ID);
\Bitrix\Crm\EntityAddress::unregister(CCrmOwnerType::Lead, $ID, \Bitrix\Crm\EntityAddress::Primary);
\Bitrix\Crm\Integrity\DuplicateEntityRanking::unregisterEntityStatistics(CCrmOwnerType::Lead, $ID);
\Bitrix\Crm\Integrity\DuplicatePersonCriterion::unregister(CCrmOwnerType::Lead, $ID);
\Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::unregister(CCrmOwnerType::Lead, $ID);
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::unregister(CCrmOwnerType::Lead, $ID);
\Bitrix\Crm\Integrity\DuplicateIndexMismatch::unregisterEntity(CCrmOwnerType::Lead, $ID);
$enableDupIndexInvalidation = is_array($arOptions) && isset($arOptions['ENABLE_DUP_INDEX_INVALIDATION']) ? (bool) $arOptions['ENABLE_DUP_INDEX_INVALIDATION'] : true;
if ($enableDupIndexInvalidation) {
\Bitrix\Crm\Integrity\DuplicateIndexBuilder::markAsJunk(CCrmOwnerType::Lead, $ID);
}
// Deletion of lead details
CCrmProductRow::DeleteByOwner('L', $ID);
CCrmProductRow::DeleteSettings('L', $ID);
CCrmActivity::DeleteByOwner(CCrmOwnerType::Lead, $ID);
CCrmSonetSubscription::UnRegisterSubscriptionByEntity(CCrmOwnerType::Lead, $ID);
CCrmLiveFeed::DeleteLogEvents(array('ENTITY_TYPE_ID' => CCrmOwnerType::Lead, 'ENTITY_ID' => $ID));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Lead . "_" . $ID);
}
$afterEvents = GetModuleEvents('crm', 'OnAfterCrmLeadDelete');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
}
return true;
}
示例6: saveFile
/**
* @param array $fileData
* @param string $siteID
* @param array $params
* @return int|false
*/
public static function saveFile(array $fileData, $siteID = '', $params = array())
{
if (!(IsModuleInstalled('disk') && Loader::includeModule('disk'))) {
return false;
}
if ($siteID === '') {
$siteID = self::getDefaultSiteID();
}
if (!is_array($params)) {
$params = array();
}
$typeID = isset($params['TYPE_ID']) ? (int) $params['TYPE_ID'] : StorageFileType::Undefined;
if (!StorageFileType::IsDefined($typeID)) {
$typeID = StorageFileType::EmailAttachment;
}
$folder = self::ensureFolderCreated($typeID, $siteID);
if (!$folder) {
return false;
}
$userID = isset($params['USER_ID']) ? (int) $params['USER_ID'] : 0;
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
} else {
if ($userID <= 0) {
$userID = SystemUser::SYSTEM_USER_ID;
}
}
$file = $folder->addFile(array('NAME' => Text::correctFilename($fileData['ORIGINAL_NAME']), 'FILE_ID' => (int) $fileData['ID'], 'SIZE' => (int) $fileData['FILE_SIZE'], 'CREATED_BY' => $userID), array(), true);
return $file ? $file->getId() : false;
}
示例7: define
define('SONET_CRM_LEAD_ENTITY', 'CRMLEAD');
define('SONET_CRM_CONTACT_ENTITY', 'CRMCONTACT');
define('SONET_CRM_COMPANY_ENTITY', 'CRMCOMPANY');
define('SONET_CRM_DEAL_ENTITY', 'CRMDEAL');
define('SONET_CRM_ACTIVITY_ENTITY', 'CRMACTIVITY');
define('SONET_CRM_INVOICE_ENTITY', 'CRMINVOICE');
//<-- Sonet entity types
global $APPLICATION, $DBType, $DB;
IncludeModuleLangFile(__FILE__);
require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/crm/functions.php';
require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/crm/classes/general/crm_usertypecrmstatus.php';
require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/crm/classes/general/crm_usertypecrm.php';
CModule::AddAutoloadClasses('crm', array('CAllCrmLead' => 'classes/general/crm_lead.php', 'CCrmLead' => 'classes/' . $DBType . '/crm_lead.php', 'CCrmLeadWS' => 'classes/general/ws_lead.php', 'CCRMLeadRest' => 'classes/general/rest_lead.php', 'CAllCrmDeal' => 'classes/general/crm_deal.php', 'CCrmDeal' => 'classes/' . $DBType . '/crm_deal.php', 'CAllCrmCompany' => 'classes/general/crm_company.php', 'CCrmCompany' => 'classes/' . $DBType . '/crm_company.php', 'CAllCrmContact' => 'classes/general/crm_contact.php', 'CCrmContact' => 'classes/' . $DBType . '/crm_contact.php', 'CCrmContactWS' => 'classes/general/ws_contact.php', 'CCrmPerms' => 'classes/general/crm_perms.php', 'CCrmRole' => 'classes/general/crm_role.php', 'CCrmFields' => 'classes/general/crm_fields.php', 'CCrmUserType' => 'classes/general/crm_usertype.php', 'CCrmGridOptions' => 'classes/general/crm_grids.php', 'CCrmStatus' => 'classes/general/crm_status.php', 'CCrmFieldMulti' => 'classes/general/crm_field_multi.php', 'CCrmEvent' => 'classes/general/crm_event.php', 'CCrmEMail' => 'classes/general/crm_email.php', 'CCrmVCard' => 'classes/general/crm_vcard.php', 'CCrmActivityTask' => 'classes/general/crm_activity_task.php', 'CCrmActivityCalendar' => 'classes/general/crm_activity_calendar.php', 'CUserTypeCrm' => 'classes/general/crm_usertypecrm.php', 'CUserTypeCrmStatus' => 'classes/general/crm_usertypecrmstatus.php', 'CCrmSearch' => 'classes/general/crm_search.php', 'CCrmBizProc' => 'classes/general/crm_bizproc.php', 'CCrmDocument' => 'classes/general/crm_document.php', 'CCrmDocumentLead' => 'classes/general/crm_document_lead.php', 'CCrmDocumentContact' => 'classes/general/crm_document_contact.php', 'CCrmDocumentCompany' => 'classes/general/crm_document_company.php', 'CCrmDocumentDeal' => 'classes/general/crm_document_deal.php', 'CCrmReportHelper' => 'classes/general/crm_report_helper.php', 'Bitrix\\Crm\\StatusTable' => 'lib/status.php', 'Bitrix\\Crm\\EventTable' => 'lib/event.php', 'Bitrix\\Crm\\EventRelationsTable' => 'lib/event.php', 'Bitrix\\Crm\\DealTable' => 'lib/deal.php', 'Bitrix\\Crm\\LeadTable' => 'lib/lead.php', 'Bitrix\\Crm\\ContactTable' => 'lib/contact.php', 'Bitrix\\Crm\\CompanyTable' => 'lib/company.php', '\\Bitrix\\Crm\\StatusTable' => 'lib/status.php', '\\Bitrix\\Crm\\EventTable' => 'lib/event.php', '\\Bitrix\\Crm\\EventRelationsTable' => 'lib/event.php', '\\Bitrix\\Crm\\DealTable' => 'lib/deal.php', '\\Bitrix\\Crm\\LeadTable' => 'lib/lead.php', '\\Bitrix\\Crm\\ContactTable' => 'lib/contact.php', '\\Bitrix\\Crm\\CompanyTable' => 'lib/company.php', 'CCrmExternalSale' => 'classes/general/crm_external_sale.php', 'CCrmExternalSaleProxy' => 'classes/general/crm_external_sale_proxy.php', 'CCrmExternalSaleImport' => 'classes/general/crm_external_sale_import.php', 'CCrmUtils' => 'classes/general/crm_utils.php', 'CCrmEntityHelper' => 'classes/general/entity_helper.php', 'CAllCrmCatalog' => 'classes/general/crm_catalog.php', 'CCrmCatalog' => 'classes/' . $DBType . '/crm_catalog.php', 'CCrmCurrency' => 'classes/general/crm_currency.php', 'CCrmCurrencyHelper' => 'classes/general/crm_currency_helper.php', 'CCrmProductResult' => 'classes/general/crm_product_result.php', 'CCrmProduct' => 'classes/general/crm_product.php', 'CCrmProductHelper' => 'classes/general/crm_product_helper.php', 'CAllCrmProductRow' => 'classes/general/crm_product_row.php', 'CCrmProductRow' => 'classes/' . $DBType . '/crm_product_row.php', 'CAllCrmInvoice' => 'classes/general/crm_invoice.php', 'CCrmInvoice' => 'classes/' . $DBType . '/crm_invoice.php', 'CAllCrmQuote' => 'classes/general/crm_quote.php', 'CCrmQuote' => 'classes/' . $DBType . '/crm_quote.php', 'CCrmOwnerType' => 'classes/general/crm_owner_type.php', 'CCrmOwnerTypeAbbr' => 'classes/general/crm_owner_type.php', 'Bitrix\\Crm\\ProductTable' => 'lib/product.php', 'Bitrix\\Crm\\ProductRowTable' => 'lib/productrow.php', 'Bitrix\\Crm\\IBlockElementProxyTable' => 'lib/iblockelementproxy.php', 'Bitrix\\Crm\\IBlockElementGrcProxyTable' => 'lib/iblockelementproxy.php', '\\Bitrix\\Crm\\ProductTable' => 'lib/product.php', '\\Bitrix\\Crm\\ProductRowTable' => 'lib/productrow.php', '\\Bitrix\\Crm\\IBlockElementProxyTable' => 'lib/iblockelementproxy.php', '\\Bitrix\\Crm\\IBlockElementGrcProxyTable' => 'lib/iblockelementproxy.php', 'CCrmAccountingHelper' => 'classes/general/crm_accounting_helper.php', 'Bitrix\\Crm\\ExternalSaleTable' => 'lib/externalsale.php', '\\Bitrix\\Crm\\ExternalSaleTable' => 'lib/externalsale.php', 'CCrmExternalSaleHelper' => 'classes/general/crm_external_sale_helper.php', 'CCrmEntityListBuilder' => 'classes/general/crm_entity_list_builder.php', 'CCrmComponentHelper' => 'classes/general/crm_component_helper.php', 'CCrmInstantEditorHelper' => 'classes/general/crm_component_helper.php', 'CAllCrmActivity' => 'classes/general/crm_activity.php', 'CCrmActivity' => 'classes/' . $DBType . '/crm_activity.php', 'CCrmActivityType' => 'classes/general/crm_activity.php', 'CCrmActivityStatus' => 'classes/general/crm_activity.php', 'CCrmActivityPriority' => 'classes/general/crm_activity.php', 'CCrmActivityNotifyType' => 'classes/general/crm_activity.php', 'CCrmActivityStorageType' => 'classes/general/crm_activity.php', 'CCrmContentType' => 'classes/general/crm_activity.php', 'CCrmEnumeration' => 'classes/general/crm_enumeration.php', 'CCrmEntitySelectorHelper' => 'classes/general/crm_entity_selector_helper.php', 'CCrmBizProcHelper' => 'classes/general/crm_bizproc_helper.php', 'CCrmBizProcEventType' => 'classes/general/crm_bizproc_helper.php', 'CCrmUrlUtil' => 'classes/general/crm_url_util.php', 'CCrmAuthorizationHelper' => 'classes/general/crm_authorization_helper.php', 'CCrmWebDavHelper' => 'classes/general/crm_webdav_helper.php', 'CCrmActivityDirection' => 'classes/general/crm_activity.php', 'CCrmViewHelper' => 'classes/general/crm_view_helper.php', 'CCrmSecurityHelper' => 'classes/general/crm_security_helper.php', 'CCrmMailHelper' => 'classes/general/crm_mail_helper.php', 'CCrmNotifier' => 'classes/general/crm_notifier.php', 'CCrmNotifierSchemeType' => 'classes/general/crm_notifier.php', 'CCrmActivityConverter' => 'classes/general/crm_activity_converter.php', 'CCrmDateTimeHelper' => 'classes/general/datetime_helper.php', 'CCrmEMailCodeAllocation' => 'classes/general/crm_email.php', 'CCrmActivityCalendarSettings' => 'classes/general/crm_activity.php', 'CCrmActivityCalendarSettings' => 'classes/general/crm_activity.php', 'CCrmProductReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmReportManager' => 'classes/general/crm_report_helper.php', 'CCrmCallToUrl' => 'classes/general/crm_url_util.php', 'CCrmUrlTemplate' => 'classes/general/crm_url_util.php', 'CCrmFileProxy' => 'classes/general/file_proxy.php', 'CAllCrmMailTemplate' => 'classes/general/mail_template.php', 'CCrmMailTemplate' => 'classes/' . $DBType . '/mail_template.php', 'CCrmMailTemplateScope' => 'classes/general/mail_template.php', 'CCrmTemplateAdapter' => 'classes/general/template_adapter.php', 'CCrmTemplateMapper' => 'classes/general/template_mapper.php', 'CCrmTemplateManager' => 'classes/general/template_manager.php', 'CCrmGridContext' => 'classes/general/crm_grids.php', 'CCrmUserCounter' => 'classes/general/user_counter.php', 'CCrmUserCounterSettings' => 'classes/general/user_counter.php', 'CCrmMobileHelper' => 'classes/general/mobile_helper.php', 'CCrmStatusInvoice' => 'classes/general/crm_status_invoice.php', 'CCrmTax' => 'classes/general/crm_tax.php', 'CCrmVat' => 'classes/general/crm_vat.php', 'CCrmLocations' => 'classes/general/crm_locations.php', 'CCrmPaySystem' => 'classes/general/crm_pay_system.php', 'CCrmRestService' => 'classes/general/restservice.php', 'CCrmFieldInfo' => 'classes/general/field_info.php', 'CCrmFieldInfoAttr' => 'classes/general/field_info.php', 'CCrmActivityEmailSender' => 'classes/general/crm_activity.php', 'CCrmProductSection' => 'classes/general/crm_product_section.php', 'CCrmProductSectionDbResult' => 'classes/general/crm_product_section.php', 'CCrmActivityDbResult' => 'classes/general/crm_activity.php', 'CCrmInvoiceRestService' => 'classes/general/restservice_invoice.php', 'CCrmInvoiceEvent' => 'classes/general/crm_invoice_event.php', 'CCrmInvoiceEventFormat' => 'classes/general/crm_invoice_event.php', 'CCrmLeadReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmInvoiceReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmActivityReportHelper' => 'classes/general/crm_report_helper.php', 'CCrmLiveFeed' => 'classes/general/livefeed.php', 'CCrmLiveFeedMessageRestProxy' => 'classes/general/restservice.php', 'CCrmLiveFeedEntity' => 'classes/general/livefeed.php', 'CCrmLiveFeedEvent' => 'classes/general/livefeed.php', 'CCrmLiveFeedFilter' => 'classes/general/livefeed.php', 'CCrmLiveFeedComponent' => 'classes/general/livefeed.php', 'CAllCrmSonetRelation' => 'classes/general/sonet_relation.php', 'CCrmSonetRelationType' => 'classes/general/sonet_relation.php', 'CCrmSonetRelation' => 'classes/' . $DBType . '/sonet_relation.php', 'CAllCrmSonetSubscription' => 'classes/general/sonet_subscription.php', 'CCrmSonetSubscriptionType' => 'classes/general/sonet_subscription.php', 'CCrmSonetSubscription' => 'classes/' . $DBType . '/sonet_subscription.php', 'CCrmSipHelper' => 'classes/general/sip_helper.php', 'CCrmSaleHelper' => 'classes/general/sale_helper.php', 'CCrmProductFile' => 'classes/general/crm_product_file.php', 'CCrmProductFileControl' => 'classes/general/crm_product_file.php', 'CCrmProductPropsHelper' => 'classes/general/crm_productprops_helper.php', 'CCrmProductSectionHelper' => 'classes/general/crm_product_section_helper.php', '\\Bitrix\\Crm\\Honorific' => 'lib/honorific.php', '\\Bitrix\\Crm\\Conversion\\LeadConverter' => 'lib/conversion/leadconverter.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionConfigItem' => 'lib/conversion/entityconversionconfigitem.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionMapItem' => 'lib/conversion/entityconversionmapitem.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionMap' => 'lib/conversion/entityconversionmap.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionMapper' => 'lib/conversion/leadconversionmapper.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionWizard' => 'lib/conversion/leadconversionwizard.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionPhase' => 'lib/conversion/leadconversionphase.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionConfig' => 'lib/conversion/leadconversionconfig.php', '\\Bitrix\\Crm\\Conversion\\LeadConversionScheme' => 'lib/conversion/leadconversionscheme.php', '\\Bitrix\\Crm\\Conversion\\DealConversionConfig' => 'lib/conversion/dealconversionconfig.php', '\\Bitrix\\Crm\\Conversion\\DealConversionScheme' => 'lib/conversion/dealconversionscheme.php', '\\Bitrix\\Crm\\Conversion\\EntityConversionFileViewer' => 'lib/conversion/entityconversionfileviewer.php', '\\Bitrix\\Crm\\Conversion\\Entity\\EntityConversionMapTable' => 'lib/conversion/entity/entityconversionmap.php', '\\Bitrix\\Crm\\Conversion\\ConversionWizardStep' => 'lib/conversion/conversionwizardstep.php', '\\Bitrix\\Crm\\Conversion\\ConversionWizard' => 'lib/conversion/conversionwizard.php', '\\Bitrix\\Crm\\Synchronization\\UserFieldSynchronizer' => 'lib/synchronization/userfieldsynchronizer.php', '\\Bitrix\\Crm\\Synchronization\\UserFieldSynchronizationException' => 'lib/synchronization/userfieldsynchronizationexception.php', '\\Bitrix\\Crm\\UserField\\UserFieldHistory' => 'lib/userfield/userfieldhistory.php', '\\Bitrix\\Crm\\UserField\\FileViewer' => 'lib/userfield/fileviewer.php', '\\Bitrix\\Crm\\Restriction\\ClientRestriction' => 'lib/restriction/clientrestriction.php', '\\Bitrix\\Crm\\Restriction\\ClientRestrictionManager' => 'lib/restriction/clientrestrictionmanager.php', '\\Bitrix\\Crm\\Restriction\\SelectRestriction' => 'lib/restriction/selectrestriction.php'));
CModule::AddAutoloadClasses('', array('CAdminCalendar' => BX_ROOT . '/modules/main/interface/admin_lib.php'));
//Disable data initialization under agent context
if (CCrmSecurityHelper::GetCurrentUserID() > 0) {
// Convert LEAD & DEAL PRODUCT -->
if (COption::GetOptionString('crm', '~crm_11_0_6_convertion', 'N') !== 'Y') {
$baseCurrencyID = "USD";
$rsLang = CLanguage::GetByID("ru");
if ($arLang = $rsLang->Fetch()) {
$baseCurrencyID = "RUB";
} else {
$rsLang = CLanguage::GetByID("de");
if ($arLang = $rsLang->Fetch()) {
$baseCurrencyID = "EUR";
}
}
$arProducts = CCrmStatus::GetStatusList('PRODUCT', true);
foreach ($arProducts as $prodCode => $prodName) {
CCrmProduct::Add(array('NAME' => $prodName, 'ACTIVE' => 'Y', 'CURRENCY_ID' => $baseCurrencyID, 'PRICE' => 1, 'ORIGIN_ID' => 'CRM_PROD_' . $prodCode, 'ORIGINATOR_ID' => 'CRM_PRODUCT_REFERENCE'));
示例8: CrmCheckPath
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule('crm')) {
return;
}
$currentUserID = CCrmSecurityHelper::GetCurrentUserID();
$CrmPerms = CCrmPerms::GetCurrentUserPermissions();
if ($CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) {
return;
}
$arParams['PATH_TO_DEAL_LIST'] = CrmCheckPath('PATH_TO_DEAL_LIST', $arParams['PATH_TO_DEAL_LIST'], $APPLICATION->GetCurPage());
$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_DEAL_IMPORT'] = CrmCheckPath('PATH_TO_DEAL_IMPORT', $arParams['PATH_TO_DEAL_IMPORT'], $APPLICATION->GetCurPage() . '?import');
$arParams['ELEMENT_ID'] = isset($arParams['ELEMENT_ID']) ? intval($arParams['ELEMENT_ID']) : 0;
if (!isset($arParams['TYPE'])) {
$arParams['TYPE'] = 'list';
}
if (isset($_REQUEST['copy'])) {
$arParams['TYPE'] = 'copy';
}
$toolbarID = 'toolbar_deal_' . $arParams['TYPE'];
if ($arParams['ELEMENT_ID'] > 0) {
$toolbarID .= '_' . $arParams['ELEMENT_ID'];
}
$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
示例9: Delete
public function Delete($ID, $arEntityAttr)
{
if (!CModule::IncludeModule('bizproc')) {
return true;
}
$userID = CCrmSecurityHelper::GetCurrentUserID();
$bDeleteError = !CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $userID, array('crm', $this->sDocument, $this->sEntityType . '_' . $ID), array('UserGroups' => $this->arCurrentUserGroups, 'UserIsAdmin' => CCrmPerms::IsAdmin($userID), 'CRMEntityAttr' => $arEntityAttr));
if (!$bDeleteError) {
return $this->ProcessDeletion($ID);
}
return true;
}
示例10: CBXSanitizer
//<-- PRODUCT_ROWS
// COMMENTS & USER_DESCRIPTION -->
$sanitizer = new CBXSanitizer();
$sanitizer->SetLevel(CBXSanitizer::SECURE_LEVEL_HIGH);
$comments = isset($data['COMMENTS']) ? trim($data['COMMENTS']) : '';
if ($comments !== '') {
$comments = $sanitizer->SanitizeHtml($comments);
}
$userDescription = isset($data['USER_DESCRIPTION']) ? trim($data['USER_DESCRIPTION']) : '';
if ($userDescription !== '') {
$userDescription = $sanitizer->SanitizeHtml($userDescription);
}
//<-- COMMENTS & USER_DESCRIPTION
$responsibleID = max(isset($data['RESPONSIBLE_ID']) ? intval($data['RESPONSIBLE_ID']) : 0, 0);
if ($responsibleID == 0) {
$responsibleID = CCrmSecurityHelper::GetCurrentUserID();
}
$arFields = array('ID' => $ID, 'ORDER_TOPIC' => $topic, 'STATUS_ID' => $statusID, 'CURRENCY' => $currencyID, 'PAY_SYSTEM_ID' => $resolvedPaySystemID, 'PERSON_TYPE_ID' => $resolvedPersonTypeID, 'RESPONSIBLE_ID' => $responsibleID, 'UF_DEAL_ID' => $dealID, 'UF_COMPANY_ID' => $companyID, 'UF_CONTACT_ID' => $contactID, 'COMMENTS' => $comments, 'USER_DESCRIPTION' => $userDescription, 'PRODUCT_ROWS' => $productRows);
// DATE_INSERT & DATE_BILL & DATE_PAY_BEFORE -->
$arFields['DATE_INSERT'] = ConvertTimeStamp($now, 'SHORT', SITE_ID);
$ts = isset($data['DATE_BILL']) ? intval($data['DATE_BILL']) : 0;
$arFields['DATE_BILL'] = ConvertTimeStamp($ts > 0 ? $ts : $now, 'SHORT', SITE_ID);
$ts = isset($data['DATE_PAY_BEFORE']) ? intval($data['DATE_PAY_BEFORE']) : 0;
if ($ts > 0) {
$arFields['DATE_PAY_BEFORE'] = ConvertTimeStamp($ts, 'SHORT', SITE_ID);
}
//<-- DATE_INSERT & DATE_BILL & DATE_PAY_BEFORE
$taxMode = CCrmTax::isVatMode() ? 'VAT' : (CCrmTax::isTaxMode() ? 'EXT' : '');
if ($taxMode === 'EXT') {
$arFields['PR_LOCATION'] = isset($data['LOCATION_ID']) ? intval($data['LOCATION_ID']) : 0;
}
示例11: LocalRedirect
}
if (!isset($_GET['AJAX_CALL'])) {
LocalRedirect($arParams['PATH_TO_MAIL_TEMPLATE_LIST']);
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['conv'])) {
if (CCrmPerms::IsAdmin()) {
$conv = strtoupper($_GET['conv']);
if ($conv === 'EXEC') {
$mailFrom = COption::GetOptionString('crm', 'email_from');
$mailTemplate = COption::GetOptionString('crm', 'email_template');
$mailTemplate = CAllCrmMailTemplate::ConvertHtmlToBbCode($mailTemplate);
if ($mailFrom !== '' || $mailTemplate !== '') {
$element = array();
$element['TITLE'] = GetMessage('CRM_MAIL_TEMPLATE_COMMON_TEMPLATE_NAME');
$element['IS_ACTIVE'] = 'Y';
$element['OWNER_ID'] = CCrmSecurityHelper::GetCurrentUserID();
$element['SORT'] = 100;
$element['EMAIL_FROM'] = $mailFrom;
$element['SCOPE'] = CCrmMailTemplateScope::Common;
$element['SUBJECT'] = '';
$element['BODY'] = $mailTemplate;
$entityTypes = array(CCrmOwnerType::Lead, CCrmOwnerType::Deal, CCrmOwnerType::Contact, CCrmOwnerType::Company);
foreach ($entityTypes as $entityTypeID) {
$element['ENTITY_TYPE_ID'] = $entityTypeID;
CCrmMailTemplate::Add($element);
}
}
COption::SetOptionString('crm', '~CRM_MAIL_TEMPLATE_LIST_CONVERTING', 'Y');
} elseif ($conv === 'SKIP') {
COption::SetOptionString('crm', '~CRM_MAIL_TEMPLATE_LIST_CONVERTING', 'Y');
} elseif ($conv === 'RESET') {
示例12: isset
$arParams['REQUISITE_EDIT_URL_TEMPLATE'] = isset($arParams['REQUISITE_EDIT_URL_TEMPLATE']) ? $arParams['REQUISITE_EDIT_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_SELECTOR_URL_TEMPLATE'] = isset($arParams['DEAL_SELECTOR_URL_TEMPLATE']) ? $arParams['DEAL_SELECTOR_URL_TEMPLATE'] : '';
$arParams['INVOICE_STATUS_SELECTOR_URL_TEMPLATE'] = isset($arParams['INVOICE_STATUS_SELECTOR_URL_TEMPLATE']) ? $arParams['INVOICE_STATUS_SELECTOR_URL_TEMPLATE'] : '';
$arParams['PAY_SYSTEM_SELECTOR_URL_TEMPLATE'] = isset($arParams['PAY_SYSTEM_SELECTOR_URL_TEMPLATE']) ? $arParams['PAY_SYSTEM_SELECTOR_URL_TEMPLATE'] : '';
$arParams['LOCATION_SELECTOR_URL_TEMPLATE'] = isset($arParams['LOCATION_SELECTOR_URL_TEMPLATE']) ? $arParams['LOCATION_SELECTOR_URL_TEMPLATE'] : '';
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_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'] : '';
if ($uid === '') {
$uid = 'mobile_crm_invoice_edit';
}
$arResult['UID'] = $arParams['UID'] = $uid;
$userID = $arResult['USER_ID'] = CCrmSecurityHelper::GetCurrentUserID();
// CONTEXT_ID -->
$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
$arResult['STATUS_LIST'] = CCrmStatus::GetStatus('INVOICE_STATUS');
$personTypes = $arResult['PERSON_TYPES'] = CCrmPaySystem::getPersonTypeIDs();
// '' - NO TAXES
// 'VAT' - VAT ONLY
// 'EXT' - EXTENDED MODE WITH CUSTOM TAXES
示例13: RegisterExportEvent
public static function RegisterExportEvent($entityTypeID, $entityID, $userID = 0)
{
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUserID();
if ($userID <= 0) {
return false;
}
}
$eventType = CCrmEvent::TYPE_EXPORT;
$timestamp = time() + CTimeZone::GetOffset();
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
$entity = new CCrmEvent();
$entity->Add(array('USER_ID' => $userID, 'ENTITY_ID' => $entityID, 'ENTITY_TYPE' => $entityTypeName, 'EVENT_TYPE' => $eventType, 'EVENT_NAME' => CCrmEvent::GetEventTypeName($eventType), 'DATE_CREATE' => ConvertTimeStamp($timestamp, 'FULL', SITE_ID)), false);
return true;
}
示例14: SynchronizeLiveFeedEvent
private static function SynchronizeLiveFeedEvent($invoiceID, $params)
{
$invoiceID = intval($invoiceID);
if ($invoiceID <= 0) {
return;
}
if (!is_array($params)) {
$params = array();
}
$processParents = isset($params['PROCESS_PARENTS']) ? (bool) $params['PROCESS_PARENTS'] : false;
$parents = isset($params['PARENTS']) && is_array($params['PARENTS']) ? $params['PARENTS'] : array();
$hasParents = !empty($parents);
if ($processParents) {
CCrmSonetRelation::UnRegisterRelationsByEntity(CCrmOwnerType::Invoice, $invoiceID, array('QUICK' => $hasParents));
}
$userID = CCrmSecurityHelper::GetCurrentUserID();
$startResponsibleID = isset($params['START_RESPONSIBLE_ID']) ? intval($params['START_RESPONSIBLE_ID']) : 0;
$finalResponsibleID = isset($params['FINAL_RESPONSIBLE_ID']) ? intval($params['FINAL_RESPONSIBLE_ID']) : 0;
$enableMessages = ($startResponsibleID > 0 || $finalResponsibleID > 0) && IsModuleInstalled('im') && CModule::IncludeModule('im');
$topic = isset($params['TOPIC']) ? $params['TOPIC'] : $invoiceID;
$slEntities = CCrmLiveFeed::GetLogEvents(array(), array('ENTITY_TYPE_ID' => CCrmOwnerType::Invoice, 'ENTITY_ID' => $invoiceID), array('ID', 'EVENT_ID'));
foreach ($slEntities as &$slEntity) {
$slID = intval($slEntity['ID']);
$slEventType = $slEntity['EVENT_ID'];
if (isset($params['REFRESH_DATE']) ? (bool) $params['REFRESH_DATE'] : false) {
//Update LOG_UPDATE for force event to rise in global feed
//Update LOG_DATE for force event to rise in entity feed
global $DB;
CCrmLiveFeed::UpdateLogEvent($slID, array('=LOG_UPDATE' => $DB->CurrentTimeFunction(), '=LOG_DATE' => $DB->CurrentTimeFunction()));
} else {
//HACK: FAKE UPDATE FOR INVALIDATE CACHE
CCrmLiveFeed::UpdateLogEvent($slID, array('ENTITY_TYPE_ID' => CCrmOwnerType::Invoice, 'ENTITY_ID' => $invoiceID));
}
if ($processParents && $hasParents) {
CCrmSonetRelation::RegisterRelationBundle($slID, $slEventType, CCrmOwnerType::Invoice, $invoiceID, $parents, array('TYPE_ID' => CCrmSonetRelationType::Ownership));
}
if ($enableMessages) {
$messageFields = array('MESSAGE_TYPE' => IM_MESSAGE_SYSTEM, 'FROM_USER_ID' => $userID, 'NOTIFY_TYPE' => IM_NOTIFY_FROM, 'NOTIFY_MODULE' => 'crm', 'LOG_ID' => $slID, 'NOTIFY_EVENT' => 'invoice_responsible_changed', 'NOTIFY_TAG' => "CRM|INVOICE|{$invoiceID}");
$eventUrl = CCrmLiveFeed::GetShowUrl($slID);
if ($startResponsibleID > 0 && $startResponsibleID !== $userID) {
$messageFields['TO_USER_ID'] = $startResponsibleID;
$messageFields['NOTIFY_MESSAGE'] = GetMessage('CRM_INVOICE_NOT_RESPONSIBLE_IM_NOTIFY', array('#title#' => '<a href="' . htmlspecialcharsbx($eventUrl) . '">' . htmlspecialcharsbx($topic) . '</a>'));
$messageFields['NOTIFY_MESSAGE_OUT'] = GetMessage('CRM_INVOICE_NOT_RESPONSIBLE_IM_NOTIFY', array('#title#' => htmlspecialcharsbx($topic))) . " (" . CCrmUrlUtil::ToAbsoluteUrl($eventUrl) . ")";
CIMNotify::Add($messageFields);
}
if ($finalResponsibleID > 0 && $finalResponsibleID !== $userID) {
$messageFields['TO_USER_ID'] = $finalResponsibleID;
$messageFields['NOTIFY_MESSAGE'] = GetMessage('CRM_INVOICE_RESPONSIBLE_IM_NOTIFY', array('#title#' => '<a href="' . htmlspecialcharsbx($eventUrl) . '">' . htmlspecialcharsbx($topic) . '</a>'));
$messageFields['NOTIFY_MESSAGE_OUT'] = GetMessage('CRM_INVOICE_RESPONSIBLE_IM_NOTIFY', array('#title#' => htmlspecialcharsbx($topic))) . " (" . CCrmUrlUtil::ToAbsoluteUrl($eventUrl) . ")";
CIMNotify::Add($messageFields);
}
}
}
unset($slEntity);
}
示例15: GetRecentlyUsedLocations
public static function GetRecentlyUsedLocations($userID = 0)
{
$userID = intval($userID);
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUserID();
}
$s = CUserOptions::GetOption('m_crm_invoice', 'locations', '', $userID);
$ary = $s !== '' ? explode(',', $s) : array();
$qty = count($ary);
for ($i = 0; $i < $qty; $i++) {
$ary[$i] = intval($ary[$i]);
}
return $ary;
}