static function getMap(): array
{
Container::getInstance()->getLocalization()->loadMessages();
$fieldRepository = ServiceLocator::getInstance()->get('crm.model.fieldRepository');
return [
$fieldRepository->getId(),
$fieldRepository->getCreatedTime('DATE_CREATE'),
$fieldRepository->getShortDate(
'DATE_CREATE_SHORT',
['DATE_CREATE'],
),
$fieldRepository->getUpdatedTime('DATE_MODIFY'),
$fieldRepository->getShortDate(
'DATE_MODIFY_SHORT',
['DATE_MODIFY'],
),
$fieldRepository->getCreatedBy('CREATED_BY_ID'),
(new Reference('CREATED_BY', UserTable::class, Join::on('this.CREATED_BY_ID', 'ref.ID'))),
$fieldRepository->getUpdatedBy('MODIFY_BY_ID'),
(new Reference('MODIFY_BY', UserTable::class, Join::on('this.MODIFY_BY_ID', 'ref.ID'))),
$fieldRepository->getAssigned(),
(new Reference('ASSIGNED_BY', UserTable::class, Join::on('this.ASSIGNED_BY_ID', 'ref.ID'))),
$fieldRepository->getOpened()
->configureDefaultValue(static function() {
return QuoteSettings::getCurrent()->getOpenedFlag();
})
,
$fieldRepository->getLeadId(),
(new Reference('LEAD_BY', LeadTable::class, Join::on('this.LEAD_ID', 'ref.ID'))),
(new IntegerField('DEAL_ID'))
->configureTitle(\CCrmOwnerType::GetAllDescriptions()[\CCrmOwnerType::Deal]),
(new Reference('DEAL', DealTable::class, Join::on('this.DEAL_ID', 'ref.ID')))
->configureTitle(\CCrmOwnerType::GetAllDescriptions()[\CCrmOwnerType::Deal]),
$fieldRepository->getCompanyId(),
(new Reference('COMPANY_BY', CompanyTable::class, Join::on('this.COMPANY_ID', 'ref.ID'))),
$fieldRepository->getContactId(),
(new Reference('CONTACT_BY', ContactTable::class, Join::on('this.CONTACT_ID', 'ref.ID'))),
(new OneToMany('CONTACT_BINDINGS', QuoteContactTable::class, 'QUOTE'))
->configureCascadeDeletePolicy(CascadePolicy::FOLLOW),
(new EnumField('PERSON_TYPE_ID'))
->configureRequired()
->configureValues(static::getPersonTypeValues())
->configureDefaultValue([static::class, 'getDefaultPersonType']),
$fieldRepository->getMyCompanyId(),
(new Reference('MYCOMPANY', CompanyTable::class, Join::on('this.MYCOMPANY_ID', 'ref.ID'))),
$fieldRepository->getTitle()
->configureTitle(Loc::getMessage('CRM_QUOTE_TITLE_TITLE'))
,
$fieldRepository->getStageId('STATUS_ID', \CCrmOwnerType::Quote),
$fieldRepository->getClosed()
->configureTitle(Loc::getMessage('CRM_QUOTE_CLOSED_TITLE_MSGVER_1'))
,
$fieldRepository->getOpportunity(),
$fieldRepository->getIsManualOpportunity(),
$fieldRepository->getTaxValue(),
$fieldRepository->getCurrencyId(),
$fieldRepository->getOpportunityAccount(),
$fieldRepository->getTaxValueAccount(),
$fieldRepository->getAccountCurrencyId(),
$fieldRepository->getComments(),
(new IntegerField('COMMENTS_TYPE'))
->configureNullable()
->configureDefaultValue(static::DEFAULT_TEXT_TYPE)
,
$fieldRepository->getBeginDate(),
$fieldRepository->getShortDate(
'BEGINDATE_SHORT',
['BEGINDATE'],
),
$fieldRepository->getCloseDate(),
$fieldRepository->getShortDate(
'CLOSEDATE_SHORT',
['CLOSEDATE']
),
$fieldRepository->getExchRate(),
(new StringField('QUOTE_NUMBER'))
->configureSize(100)
->configureUnique()
->configureTitle(Loc::getMessage('CRM_QUOTE_QUOTE_NUMBER_TITLE_MSGVER_1'))
,
(new TextField('CONTENT'))
->configureTitle(Loc::getMessage('CRM_TYPE_ITEM_FIELD_CONTENT'))
->addSaveDataModifier($fieldRepository->getHtmlNormalizer())
,
(new IntegerField('CONTENT_TYPE'))
->configureDefaultValue(static::DEFAULT_TEXT_TYPE)
,
(new TextField('TERMS'))
->configureTitle(Loc::getMessage('CRM_TYPE_ITEM_FIELD_TERMS'))
->addSaveDataModifier($fieldRepository->getHtmlNormalizer())
,
(new IntegerField('TERMS_TYPE'))
->configureDefaultValue(static::DEFAULT_TEXT_TYPE)
,
(new EnumField('STORAGE_TYPE_ID'))
->configureValues(static::getStorageTypeIdValues())
->configureDefaultValue([static::class, 'getDefaultStorageTypeId'])
,
(new ArrayField('STORAGE_ELEMENT_IDS'))
// For compatibility reasons
->configureSerializationPhp()
->addSaveDataModifier([static::class, 'normalizeStorageElementIds'])
,
$fieldRepository->getLocationId(),
$fieldRepository->getWebformId(),
(new StringField('CLIENT_TITLE'))
->configureSize(255)
,
(new StringField('CLIENT_ADDR'))
->configureSize(255)
,
(new StringField('CLIENT_CONTACT'))
->configureSize(255)
,
(new StringField('CLIENT_EMAIL'))
->configureSize(255)
,
(new StringField('CLIENT_PHONE'))
->configureSize(255)
,
(new StringField('CLIENT_TP_ID'))
->configureSize(255)
,
(new StringField('CLIENT_TPA_ID'))
->configureSize(255)
,
$fieldRepository->getSearchContent(),
$fieldRepository->getLastActivityBy(),
$fieldRepository->getLastActivityTime(),
$fieldRepository->getHasProducts(
\CCrmOwnerType::Quote,
),
$fieldRepository->getProductRows(
'QUOTE_OWNER',
),
(new OneToMany('ELEMENTS', QuoteElementTable::class, 'QUOTE'))
->configureJoinType(Join::TYPE_INNER)
,
(new DateField(Item\Quote::FIELD_NAME_ACTUAL_DATE))
->configureDefaultValue(static function(): Date {
return (new Date())->add('7D');
})
->configureTitle(Loc::getMessage('CRM_TYPE_ITEM_FIELD_ACTUAL_DATE'))
,
];
}