Initial commit
This commit is contained in:
151
application/Espo/Modules/Crm/Entities/Account.php
Normal file
151
application/Espo/Modules/Crm/Entities/Account.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Address;
|
||||
use Espo\Core\Field\EmailAddressGroup;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Field\PhoneNumberGroup;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
|
||||
class Account extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Account';
|
||||
|
||||
public const TYPE_CUSTOMER = 'Customer';
|
||||
public const TYPE_PARTNER = 'Partner';
|
||||
public const TYPE_RESELLER = 'Reseller';
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
$this->set(Field::NAME, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmailAddress(): ?string
|
||||
{
|
||||
return $this->get('emailAddress');
|
||||
}
|
||||
|
||||
public function getEmailAddressGroup(): EmailAddressGroup
|
||||
{
|
||||
/** @var EmailAddressGroup */
|
||||
return $this->getValueObject('emailAddress');
|
||||
}
|
||||
|
||||
public function getPhoneNumberGroup(): PhoneNumberGroup
|
||||
{
|
||||
/** @var PhoneNumberGroup */
|
||||
return $this->getValueObject('phoneNumber');
|
||||
}
|
||||
|
||||
public function setEmailAddressGroup(EmailAddressGroup $group): self
|
||||
{
|
||||
$this->setValueObject('emailAddress', $group);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPhoneNumberGroup(PhoneNumberGroup $group): self
|
||||
{
|
||||
$this->setValueObject('phoneNumber', $group);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBillingAddress(): Address
|
||||
{
|
||||
/** @var Address */
|
||||
return $this->getValueObject('billingAddress');
|
||||
}
|
||||
|
||||
public function setBillingAddress(Address $address): self
|
||||
{
|
||||
$this->setValueObject('billingAddress', $address);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShippingAddress(): Address
|
||||
{
|
||||
/** @var Address */
|
||||
return $this->getValueObject('shippingAddress');
|
||||
}
|
||||
|
||||
public function setShippingAddress(Address $address): self
|
||||
{
|
||||
$this->setValueObject('shippingAddress', $address);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
}
|
||||
219
application/Espo/Modules/Crm/Entities/Call.php
Normal file
219
application/Espo/Modules/Crm/Entities/Call.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity as OrmEntity;
|
||||
|
||||
class Call extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Call';
|
||||
|
||||
public const STATUS_PLANNED = 'Planned';
|
||||
public const STATUS_HELD = 'Held';
|
||||
public const STATUS_NOT_HELD = 'Not Held';
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
return $this->set(Field::NAME, $name);
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
return $this->set('status', $status);
|
||||
}
|
||||
|
||||
public function getDateStart(): ?DateTime
|
||||
{
|
||||
/** @var ?DateTime */
|
||||
return $this->getValueObject('dateStart');
|
||||
}
|
||||
|
||||
public function setDateStart(?DateTime $dateStart): self
|
||||
{
|
||||
$this->setValueObject('dateStart', $dateStart);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateEnd(): ?DateTime
|
||||
{
|
||||
/** @var ?DateTime */
|
||||
return $this->getValueObject('dateEnd');
|
||||
}
|
||||
|
||||
public function setDateEnd(?DateTime $dateEnd): self
|
||||
{
|
||||
$this->setValueObject('dateEnd', $dateEnd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAssignedUserId(?string $assignedUserId): self
|
||||
{
|
||||
$this->set('assignedUserId', $assignedUserId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::CREATED_BY);
|
||||
}
|
||||
|
||||
public function getModifiedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::MODIFIED_BY);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function getUsers(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Meeting::LINK_USERS);
|
||||
}
|
||||
|
||||
public function getContacts(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Meeting::LINK_CONTACTS);
|
||||
}
|
||||
|
||||
public function getLeads(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Meeting::LINK_LEADS);
|
||||
}
|
||||
|
||||
public function setUsers(LinkMultiple $users): self
|
||||
{
|
||||
return $this->setValueObject(Meeting::LINK_USERS, $users);
|
||||
}
|
||||
|
||||
public function setContacts(LinkMultiple $contacts): self
|
||||
{
|
||||
return $this->setValueObject(Meeting::LINK_CONTACTS, $contacts);
|
||||
}
|
||||
|
||||
public function setLeads(LinkMultiple $leads): self
|
||||
{
|
||||
return $this->setValueObject(Meeting::LINK_LEADS, $leads);
|
||||
}
|
||||
|
||||
public function setParent(Entity|LinkParent|null $parent): self
|
||||
{
|
||||
if ($parent instanceof LinkParent) {
|
||||
$this->setValueObject(Field::PARENT, $parent);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->relations->set(Field::PARENT, $parent);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAccount(Link|Account|null $account): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('account', $account);
|
||||
}
|
||||
|
||||
public function getAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('account');
|
||||
}
|
||||
|
||||
public function getParent(): ?OrmEntity
|
||||
{
|
||||
return $this->relations->getOne(Field::PARENT);
|
||||
}
|
||||
|
||||
public function getUid(): ?string
|
||||
{
|
||||
return $this->get('uid');
|
||||
}
|
||||
|
||||
public function setUid(?string $uid): self
|
||||
{
|
||||
return $this->set('uid', $uid);
|
||||
}
|
||||
}
|
||||
123
application/Espo/Modules/Crm/Entities/Campaign.php
Normal file
123
application/Espo/Modules/Crm/Entities/Campaign.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Date;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
|
||||
class Campaign extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Campaign';
|
||||
|
||||
public const TYPE_EMAIL = 'Email';
|
||||
public const TYPE_NEWSLETTER = 'Newsletter';
|
||||
public const TYPE_INFORMATIONAL_EMAIL = 'Informational Email';
|
||||
public const TYPE_MAIL = 'Mail';
|
||||
|
||||
public const STATUS_ACTIVE = 'Active';
|
||||
public const STATUS_INACTIVE = 'Inactive';
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
$this->set(Field::NAME, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->get('type');
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
return $this->set('status', $status);
|
||||
}
|
||||
|
||||
public function getStartDate(): ?Date
|
||||
{
|
||||
/** @var ?Date */
|
||||
return $this->getValueObject('startDate');
|
||||
}
|
||||
|
||||
public function getEndDate(): ?Date
|
||||
{
|
||||
/** @var ?Date */
|
||||
return $this->getValueObject('endDate');
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
56
application/Espo/Modules/Crm/Entities/CampaignLogRecord.php
Normal file
56
application/Espo/Modules/Crm/Entities/CampaignLogRecord.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
|
||||
class CampaignLogRecord extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'CampaignLogRecord';
|
||||
|
||||
public const ACTION_LEAD_CREATED = 'Lead Created';
|
||||
public const ACTION_SENT = 'Sent';
|
||||
public const ACTION_BOUNCED = 'Bounced';
|
||||
public const ACTION_OPTED_IN = 'Opted In';
|
||||
public const ACTION_OPTED_OUT = 'Opted Out';
|
||||
public const ACTION_OPENED = 'Opened';
|
||||
public const ACTION_CLICKED = 'Clicked';
|
||||
|
||||
public const BOUNCED_TYPE_HARD = 'Hard';
|
||||
public const BOUNCED_TYPE_SOFT = 'Soft';
|
||||
|
||||
public function getParent(): ?LinkParent
|
||||
{
|
||||
/** @var ?LinkParent */
|
||||
return $this->getValueObject(Field::PARENT);
|
||||
}
|
||||
}
|
||||
103
application/Espo/Modules/Crm/Entities/CampaignTrackingUrl.php
Normal file
103
application/Espo/Modules/Crm/Entities/CampaignTrackingUrl.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\ORM\Entity;
|
||||
use LogicException;
|
||||
|
||||
class CampaignTrackingUrl extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'CampaignTrackingUrl';
|
||||
|
||||
public const ACTION_SHOW_MESSAGE = 'Show Message';
|
||||
|
||||
public function get(string $attribute): mixed
|
||||
{
|
||||
if ($attribute === 'urlToUse') {
|
||||
return $this->getUrlToUseInternal();
|
||||
}
|
||||
|
||||
return parent::get($attribute);
|
||||
}
|
||||
|
||||
public function has(string $attribute): bool
|
||||
{
|
||||
if ($attribute === 'urlToUse') {
|
||||
return $this->hasUrlToUseInternal();
|
||||
}
|
||||
|
||||
return parent::has($attribute);
|
||||
}
|
||||
|
||||
public function getCampaignId(): ?string
|
||||
{
|
||||
return $this->get('campaignId');
|
||||
}
|
||||
|
||||
public function getAction(): ?string
|
||||
{
|
||||
return $this->get('action');
|
||||
}
|
||||
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->get('message');
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->get('url');
|
||||
}
|
||||
|
||||
public function getUrlToUse(): string
|
||||
{
|
||||
if (!$this->id) {
|
||||
throw new LogicException();
|
||||
}
|
||||
|
||||
return $this->get('urlToUse');
|
||||
}
|
||||
|
||||
private function getUrlToUseInternal(): string
|
||||
{
|
||||
return "{trackingUrl:$this->id}";
|
||||
}
|
||||
|
||||
private function hasUrlToUseInternal(): bool
|
||||
{
|
||||
return !$this->isNew();
|
||||
}
|
||||
|
||||
public function getCampaign(): ?Campaign
|
||||
{
|
||||
/** @var ?Campaign */
|
||||
return $this->relations->getOne('campaign');
|
||||
}
|
||||
}
|
||||
187
application/Espo/Modules/Crm/Entities/CaseObj.php
Normal file
187
application/Espo/Modules/Crm/Entities/CaseObj.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\EntityCollection;
|
||||
|
||||
class CaseObj extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Case';
|
||||
|
||||
public const STATUS_NEW = 'New';
|
||||
public const STATUS_ASSIGNED = 'Assigned';
|
||||
public const STATUS_CLOSED = 'Closed';
|
||||
public const STATUS_PENDING = 'Pending';
|
||||
public const STATUS_REJECTED = 'Rejected';
|
||||
public const STATUS_DUPLICATE = 'Duplicate';
|
||||
|
||||
protected $entityType = 'Case';
|
||||
|
||||
public function getNumber(): ?int
|
||||
{
|
||||
return $this->get('number');
|
||||
}
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
return $this->set(Field::NAME, $name);
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
return $this->set('status', $status);
|
||||
}
|
||||
|
||||
public function getInboundEmailId(): ?string
|
||||
{
|
||||
return $this->get('inboundEmailId');
|
||||
}
|
||||
|
||||
public function getAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('account');
|
||||
}
|
||||
|
||||
/**
|
||||
* A primary contact.
|
||||
*/
|
||||
public function getContact(): ?Contact
|
||||
{
|
||||
/** @var ?Contact */
|
||||
return $this->relations->getOne('contact');
|
||||
}
|
||||
|
||||
public function getContacts(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject('contacts');
|
||||
}
|
||||
|
||||
public function getLead(): ?Lead
|
||||
{
|
||||
/** @var ?Lead */
|
||||
return $this->relations->getOne('lead');
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAttachmentIdList(): array
|
||||
{
|
||||
/** @var string[] */
|
||||
return $this->getLinkMultipleIdList('attachments');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EntityCollection<Attachment>
|
||||
*/
|
||||
public function getAttachments(): EntityCollection
|
||||
{
|
||||
/** @var EntityCollection<Attachment> */
|
||||
return $this->relations->getMany('attachments');
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAccount(Account|Link|null $account): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('account', $account);
|
||||
}
|
||||
|
||||
public function setContact(Contact|Link|null $contact): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('contact', $contact);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function isInternal(): bool
|
||||
{
|
||||
return (bool) $this->get('isInternal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function setIsInternal(bool $isInternal): self
|
||||
{
|
||||
return $this->set('isInternal', $isInternal);
|
||||
}
|
||||
}
|
||||
118
application/Espo/Modules/Crm/Entities/Contact.php
Normal file
118
application/Espo/Modules/Crm/Entities/Contact.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Entities\Person;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\EntityCollection;
|
||||
|
||||
class Contact extends Person
|
||||
{
|
||||
public const ENTITY_TYPE = 'Contact';
|
||||
|
||||
/**
|
||||
* An assigned user.
|
||||
*/
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
/**
|
||||
* A primary account.
|
||||
*/
|
||||
public function getAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('account');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accounts.
|
||||
*
|
||||
* @return EntityCollection<Account>
|
||||
*/
|
||||
public function getAccounts(): EntityCollection
|
||||
{
|
||||
/** @var EntityCollection<Account> */
|
||||
return $this->relations->getMany('accounts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a primary account.
|
||||
*/
|
||||
public function setAccount(Account|Link|null $account): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('account', $account);
|
||||
}
|
||||
|
||||
/**
|
||||
* Teams.
|
||||
*/
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
/**
|
||||
* A title (for a primary account).
|
||||
*/
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->get('title');
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
}
|
||||
108
application/Espo/Modules/Crm/Entities/Document.php
Normal file
108
application/Espo/Modules/Crm/Entities/Document.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\User;
|
||||
use RuntimeException;
|
||||
|
||||
class Document extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Document';
|
||||
|
||||
public const STATUS_ACTIVE = 'Active';
|
||||
public const STATUS_DRAFT = 'Draft';
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setFile(?Attachment $file): self
|
||||
{
|
||||
$this->relations->set('file', $file);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFileId(): ?string
|
||||
{
|
||||
return $this->get('fileId');
|
||||
}
|
||||
|
||||
public function getFile(): ?Attachment
|
||||
{
|
||||
$file = $this->relations->getOne('file');
|
||||
|
||||
if ($file && !$file instanceof Attachment) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
return $this->set('status', $status);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
36
application/Espo/Modules/Crm/Entities/DocumentFolder.php
Normal file
36
application/Espo/Modules/Crm/Entities/DocumentFolder.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class DocumentFolder extends \Espo\Core\Templates\Entities\CategoryTree
|
||||
{
|
||||
public const ENTITY_TYPE = 'DocumentFolder';
|
||||
}
|
||||
|
||||
128
application/Espo/Modules/Crm/Entities/EmailQueueItem.php
Normal file
128
application/Espo/Modules/Crm/Entities/EmailQueueItem.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Core\Utils\DateTime as DateTimeUtil;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class EmailQueueItem extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'EmailQueueItem';
|
||||
|
||||
public const STATUS_PENDING = 'Pending';
|
||||
public const STATUS_FAILED = 'Failed';
|
||||
public const STATUS_SENT = 'Sent';
|
||||
public const STATUS_SENDING = 'Sending';
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function getAttemptCount(): int
|
||||
{
|
||||
return (int) $this->get('attemptCount');
|
||||
}
|
||||
|
||||
public function isTest(): bool
|
||||
{
|
||||
return (bool) $this->get('isTest');
|
||||
}
|
||||
|
||||
public function getTargetType(): string
|
||||
{
|
||||
$value = $this->get('targetType');
|
||||
|
||||
if (!is_string($value)) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getTargetId(): string
|
||||
{
|
||||
$value = $this->get('targetId');
|
||||
|
||||
if (!is_string($value)) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getMassEmail(): ?MassEmail
|
||||
{
|
||||
/** @var ?MassEmail */
|
||||
return $this->relations->getOne('massEmail');
|
||||
}
|
||||
|
||||
public function getMassEmailId(): ?string
|
||||
{
|
||||
return $this->get('massEmailId');
|
||||
}
|
||||
|
||||
public function getEmailAddress(): ?string
|
||||
{
|
||||
return $this->get('emailAddress');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
$this->set('status', $status);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSentAtNow(): self
|
||||
{
|
||||
$this->set('sentAt', date(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEmailAddress(string $emailAddress): self
|
||||
{
|
||||
$this->set('emailAddress', $emailAddress);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function incrementAttemptCount(): self
|
||||
{
|
||||
$attemptCount = $this->getAttemptCount();
|
||||
$attemptCount++;
|
||||
|
||||
$this->set('attemptCount', $attemptCount);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
130
application/Espo/Modules/Crm/Entities/KnowledgeBaseArticle.php
Normal file
130
application/Espo/Modules/Crm/Entities/KnowledgeBaseArticle.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Collection;
|
||||
|
||||
class KnowledgeBaseArticle extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'KnowledgeBaseArticle';
|
||||
|
||||
public const STATUS_PUBLISHED = 'Published';
|
||||
public const STATUS_ARCHIVED = 'Archived';
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
$this->set(Field::NAME, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getStatus(): string
|
||||
{
|
||||
return (string) $this->get('status');
|
||||
}
|
||||
|
||||
public function getOrder(): ?int
|
||||
{
|
||||
return $this->get('order');
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAttachmentIdList(): array
|
||||
{
|
||||
/** @var string[] */
|
||||
return $this->getLinkMultipleIdList('attachments');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return iterable<Attachment>
|
||||
*/
|
||||
public function getAttachments(): iterable
|
||||
{
|
||||
/** @var Collection<Attachment> */
|
||||
return $this->relations->getMany('attachments');
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBody(): ?string
|
||||
{
|
||||
return $this->get('body');
|
||||
}
|
||||
|
||||
public function setBody(?string $body): self
|
||||
{
|
||||
return $this->set('body', $body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class KnowledgeBaseCategory extends \Espo\Core\Templates\Entities\CategoryTree
|
||||
{
|
||||
public const ENTITY_TYPE = 'KnowledgeBaseCategory';
|
||||
}
|
||||
|
||||
200
application/Espo/Modules/Crm/Entities/Lead.php
Normal file
200
application/Espo/Modules/Crm/Entities/Lead.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Entities\Person;
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Entities\User;
|
||||
|
||||
class Lead extends Person
|
||||
{
|
||||
public const ENTITY_TYPE = 'Lead';
|
||||
|
||||
public const STATUS_NEW = 'New';
|
||||
public const STATUS_ASSIGNED = 'Assigned';
|
||||
public const STATUS_IN_PROCESS = 'In Process';
|
||||
public const STATUS_CONVERTED = 'Converted';
|
||||
public const STATUS_RECYCLED = 'Recycled';
|
||||
public const STATUS_DEAD = 'Dead';
|
||||
|
||||
public function get(string $attribute): mixed
|
||||
{
|
||||
if ($attribute === Field::NAME) {
|
||||
return $this->getNameInternal();
|
||||
}
|
||||
|
||||
return parent::get($attribute);
|
||||
}
|
||||
|
||||
public function has(string $attribute): bool
|
||||
{
|
||||
if ($attribute === Field::NAME) {
|
||||
return $this->hasNameInternal();
|
||||
}
|
||||
|
||||
return parent::has($attribute);
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
private function getNameInternal(): ?string
|
||||
{
|
||||
if (!$this->hasInContainer(Field::NAME) || !$this->getFromContainer(Field::NAME)) {
|
||||
if ($this->get('accountName')) {
|
||||
return $this->get('accountName');
|
||||
}
|
||||
|
||||
if ($this->get('emailAddress')) {
|
||||
return $this->get('emailAddress');
|
||||
}
|
||||
|
||||
if ($this->get('phoneNumber')) {
|
||||
return $this->get('phoneNumber');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getFromContainer(Field::NAME);
|
||||
}
|
||||
|
||||
private function hasNameInternal(): bool
|
||||
{
|
||||
if ($this->hasInContainer(Field::NAME)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->has('accountName')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->has('emailAddress')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->has('phoneNumber')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getCampaign(): ?Campaign
|
||||
{
|
||||
/** @var ?Campaign */
|
||||
return $this->relations->getOne('campaign');
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function getCreatedAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('createdAccount');
|
||||
}
|
||||
|
||||
public function getCreatedContact(): ?Contact
|
||||
{
|
||||
/** @var ?Contact */
|
||||
return $this->relations->getOne('createdContact');
|
||||
}
|
||||
|
||||
public function getCreatedOpportunity(): ?Opportunity
|
||||
{
|
||||
/** @var ?Opportunity */
|
||||
return $this->relations->getOne('createdOpportunity');
|
||||
}
|
||||
|
||||
public function getConvertedAt(): ?DateTime
|
||||
{
|
||||
/** @var ?DateTime */
|
||||
return $this->getValueObject('convertedAt');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
$this->set('status', $status);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCreatedAccount(Account|null $createdAccount): self
|
||||
{
|
||||
$this->relations->set('createdAccount', $createdAccount);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSource(?string $source): self
|
||||
{
|
||||
return $this->set('source', $source);
|
||||
}
|
||||
|
||||
public function setCampaign(Link|Campaign|null $campaign): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('campaign', $campaign);
|
||||
}
|
||||
}
|
||||
132
application/Espo/Modules/Crm/Entities/MassEmail.php
Normal file
132
application/Espo/Modules/Crm/Entities/MassEmail.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\EmailTemplate;
|
||||
use Espo\ORM\EntityCollection;
|
||||
|
||||
class MassEmail extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'MassEmail';
|
||||
|
||||
public const STATUS_COMPLETE = 'Complete';
|
||||
public const STATUS_FAILED = 'Failed';
|
||||
public const STATUS_IN_PROCESS = 'In Process';
|
||||
public const STATUS_PENDING = 'Pending';
|
||||
public const STATUS_DRAFT = 'Draft';
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function getEmailTemplateId(): ?string
|
||||
{
|
||||
return $this->get('emailTemplateId');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EntityCollection<TargetList>
|
||||
*/
|
||||
public function getTargetLists(): EntityCollection
|
||||
{
|
||||
/** @var EntityCollection<TargetList> */
|
||||
return $this->relations->getMany('targetLists');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EntityCollection<TargetList>
|
||||
*/
|
||||
public function getExcludingTargetLists(): EntityCollection
|
||||
{
|
||||
/** @var EntityCollection<TargetList> */
|
||||
return $this->relations->getMany('excludingTargetLists');
|
||||
}
|
||||
|
||||
public function getEmailTemplate(): ?EmailTemplate
|
||||
{
|
||||
/** @var ?EmailTemplate */
|
||||
return $this->relations->getOne('emailTemplate');
|
||||
}
|
||||
|
||||
public function getCampaign(): ?Campaign
|
||||
{
|
||||
/** @var ?Campaign */
|
||||
return $this->relations->getOne('campaign');
|
||||
}
|
||||
|
||||
public function getCampaignId(): ?string
|
||||
{
|
||||
return $this->get('campaignId');
|
||||
}
|
||||
|
||||
public function getInboundEmailId(): ?string
|
||||
{
|
||||
return $this->get('inboundEmailId');
|
||||
}
|
||||
|
||||
public function getFromName(): ?string
|
||||
{
|
||||
return $this->get('fromName');
|
||||
}
|
||||
|
||||
public function getReplyToName(): ?string
|
||||
{
|
||||
return $this->get('replyToName');
|
||||
}
|
||||
|
||||
public function getFromAddress(): ?string
|
||||
{
|
||||
return $this->get('fromAddress');
|
||||
}
|
||||
|
||||
public function getReplyToAddress(): ?string
|
||||
{
|
||||
return $this->get('replyToAddress');
|
||||
}
|
||||
|
||||
public function storeSentEmails(): bool
|
||||
{
|
||||
return (bool) $this->get('storeSentEmails');
|
||||
}
|
||||
|
||||
public function optOutEntirely(): bool
|
||||
{
|
||||
return (bool) $this->get('optOutEntirely');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
$this->set('status', $status);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
250
application/Espo/Modules/Crm/Entities/Meeting.php
Normal file
250
application/Espo/Modules/Crm/Entities/Meeting.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\DateTimeOptional;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity as OrmEntity;
|
||||
|
||||
class Meeting extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Meeting';
|
||||
|
||||
public const ATTENDEE_STATUS_NONE = 'None';
|
||||
public const ATTENDEE_STATUS_ACCEPTED = 'Accepted';
|
||||
public const ATTENDEE_STATUS_TENTATIVE = 'Tentative';
|
||||
public const ATTENDEE_STATUS_DECLINED = 'Declined';
|
||||
|
||||
public const STATUS_PLANNED = 'Planned';
|
||||
public const STATUS_HELD = 'Held';
|
||||
public const STATUS_NOT_HELD = 'Not Held';
|
||||
|
||||
public const LINK_USERS = 'users';
|
||||
public const LINK_CONTACTS = 'contacts';
|
||||
public const LINK_LEADS = 'leads';
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
return $this->set(Field::NAME, $name);
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
return $this->set('status', $status);
|
||||
}
|
||||
|
||||
public function getDateStart(): ?DateTimeOptional
|
||||
{
|
||||
/** @var ?DateTimeOptional */
|
||||
return $this->getValueObject('dateStart');
|
||||
}
|
||||
|
||||
public function setDateStart(?DateTimeOptional $dateStart): self
|
||||
{
|
||||
$this->setValueObject('dateStart', $dateStart);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateEnd(): ?DateTimeOptional
|
||||
{
|
||||
/** @var ?DateTimeOptional */
|
||||
return $this->getValueObject('dateEnd');
|
||||
}
|
||||
|
||||
public function setDateEnd(?DateTimeOptional $dateEnd): self
|
||||
{
|
||||
$this->setValueObject('dateEnd', $dateEnd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAssignedUserId(?string $assignedUserId): self
|
||||
{
|
||||
$this->set('assignedUserId', $assignedUserId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::CREATED_BY);
|
||||
}
|
||||
|
||||
public function getModifiedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::MODIFIED_BY);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function getUsers(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(self::LINK_USERS);
|
||||
}
|
||||
|
||||
public function getContacts(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(self::LINK_CONTACTS);
|
||||
}
|
||||
|
||||
public function getLeads(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(self::LINK_LEADS);
|
||||
}
|
||||
|
||||
public function setUsers(LinkMultiple $users): self
|
||||
{
|
||||
return $this->setValueObject(self::LINK_USERS, $users);
|
||||
}
|
||||
|
||||
public function setContacts(LinkMultiple $contacts): self
|
||||
{
|
||||
return $this->setValueObject(self::LINK_CONTACTS, $contacts);
|
||||
}
|
||||
|
||||
public function setLeads(LinkMultiple $leads): self
|
||||
{
|
||||
return $this->setValueObject(self::LINK_LEADS, $leads);
|
||||
}
|
||||
|
||||
public function setParent(Entity|LinkParent|null $parent): self
|
||||
{
|
||||
if ($parent instanceof LinkParent) {
|
||||
$this->setValueObject(Field::PARENT, $parent);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->relations->set(Field::PARENT, $parent);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAccount(Link|Account|null $account): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('account', $account);
|
||||
}
|
||||
|
||||
public function getAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('account');
|
||||
}
|
||||
|
||||
public function getParent(): ?OrmEntity
|
||||
{
|
||||
return $this->relations->getOne(Field::PARENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function getUid(): ?string
|
||||
{
|
||||
return $this->get('uid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function setUid(?string $uid): self
|
||||
{
|
||||
return $this->set('uid', $uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function setJoinUrl(?string $joinUrl): self
|
||||
{
|
||||
return $this->set('joinUrl', $joinUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function getJoinUrl(): ?string
|
||||
{
|
||||
return $this->get('joinUrl');
|
||||
}
|
||||
}
|
||||
174
application/Espo/Modules/Crm/Entities/Opportunity.php
Normal file
174
application/Espo/Modules/Crm/Entities/Opportunity.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Currency;
|
||||
use Espo\Core\Field\Date;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
|
||||
class Opportunity extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Opportunity';
|
||||
|
||||
public const STAGE_CLOSED_WON = 'Closed Won';
|
||||
public const STAGE_CLOSED_LOST = 'Closed Lost';
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->get(Field::NAME);
|
||||
}
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
$this->set(Field::NAME, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getAmount(): ?Currency
|
||||
{
|
||||
/** @var ?Currency */
|
||||
return $this->getValueObject('amount');
|
||||
}
|
||||
|
||||
public function setAmount(?Currency $amount): self
|
||||
{
|
||||
$this->setValueObject('amount', $amount);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCloseDate(): ?Date
|
||||
{
|
||||
/** @var ?Date */
|
||||
return $this->getValueObject('closeDate');
|
||||
}
|
||||
|
||||
public function setCloseDate(?Date $closeDate): self
|
||||
{
|
||||
$this->setValueObject('closeDate', $closeDate);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStage(): ?string
|
||||
{
|
||||
return $this->get('stage');
|
||||
}
|
||||
|
||||
public function setStage(?string $stage): void
|
||||
{
|
||||
$this->set('stage', $stage);
|
||||
}
|
||||
|
||||
public function getLastStage(): ?string
|
||||
{
|
||||
return $this->get('lastStage');
|
||||
}
|
||||
|
||||
public function setLastStage(?string $lastStage): void
|
||||
{
|
||||
$this->set('lastStage', $lastStage);
|
||||
}
|
||||
|
||||
public function getProbability(): ?int
|
||||
{
|
||||
return $this->get('probability');
|
||||
}
|
||||
|
||||
public function setProbability(?int $probability): void
|
||||
{
|
||||
$this->set('probability', $probability);
|
||||
}
|
||||
|
||||
public function getAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('account');
|
||||
}
|
||||
|
||||
/**
|
||||
* A primary contact.
|
||||
*/
|
||||
public function getContact(): ?Contact
|
||||
{
|
||||
/** @var ?Contact */
|
||||
return $this->relations->getOne('contact');
|
||||
}
|
||||
|
||||
public function getContacts(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject('contacts');
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function setAccount(Account|Link|null $account): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('account', $account);
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
65
application/Espo/Modules/Crm/Entities/Reminder.php
Normal file
65
application/Espo/Modules/Crm/Entities/Reminder.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\ORM\Entity;
|
||||
|
||||
class Reminder extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Reminder';
|
||||
|
||||
public const TYPE_POPUP = 'Popup';
|
||||
public const TYPE_EMAIL = 'Email';
|
||||
|
||||
public function getUserId(): string
|
||||
{
|
||||
return $this->get('userId');
|
||||
}
|
||||
|
||||
public function getTargetEntityId(): string
|
||||
{
|
||||
return $this->get('entityId');
|
||||
}
|
||||
|
||||
public function getTargetEntityType(): string
|
||||
{
|
||||
return $this->get('entityType');
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->get('type');
|
||||
}
|
||||
|
||||
public function getSeconds(): int
|
||||
{
|
||||
return (int) $this->get('seconds');
|
||||
}
|
||||
}
|
||||
36
application/Espo/Modules/Crm/Entities/Target.php
Normal file
36
application/Espo/Modules/Crm/Entities/Target.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
class Target extends \Espo\Core\Entities\Person
|
||||
{
|
||||
public const ENTITY_TYPE = 'Target';
|
||||
}
|
||||
|
||||
65
application/Espo/Modules/Crm/Entities/TargetList.php
Normal file
65
application/Espo/Modules/Crm/Entities/TargetList.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
|
||||
class TargetList extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'TargetList';
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
37
application/Espo/Modules/Crm/Entities/TargetListCategory.php
Normal file
37
application/Espo/Modules/Crm/Entities/TargetListCategory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Templates\Entities\CategoryTree;
|
||||
|
||||
class TargetListCategory extends CategoryTree
|
||||
{
|
||||
public const ENTITY_TYPE = 'TargetListCategory';
|
||||
}
|
||||
162
application/Espo/Modules/Crm/Entities/Task.php
Normal file
162
application/Espo/Modules/Crm/Entities/Task.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Modules\Crm\Entities;
|
||||
|
||||
use Espo\Core\Field\DateTimeOptional;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\Attachment;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity as OrmEntity;
|
||||
use Espo\ORM\EntityCollection;
|
||||
|
||||
class Task extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Task';
|
||||
|
||||
public const STATUS_NOT_STARTED = 'Not Started';
|
||||
public const STATUS_STARTED = 'Started';
|
||||
public const STATUS_COMPLETED = 'Completed';
|
||||
public const STATUS_CANCELED = 'Canceled';
|
||||
public const STATUS_DEFERRED = 'Deferred';
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
return $this->set(Field::NAME, $name);
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
return $this->set('description', $description);
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->get('description');
|
||||
}
|
||||
|
||||
public function getStatus(): ?string
|
||||
{
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
public function setStatus(string $status): self
|
||||
{
|
||||
return $this->set('status', $status);
|
||||
}
|
||||
|
||||
public function getDateStart(): ?DateTimeOptional
|
||||
{
|
||||
/** @var ?DateTimeOptional */
|
||||
return $this->getValueObject('dateStart');
|
||||
}
|
||||
|
||||
public function setDateStart(?DateTimeOptional $dateStart): void
|
||||
{
|
||||
$this->setValueObject('dateStart', $dateStart);
|
||||
}
|
||||
|
||||
public function getDateEnd(): ?DateTimeOptional
|
||||
{
|
||||
/** @var ?DateTimeOptional */
|
||||
return $this->getValueObject('dateEnd');
|
||||
}
|
||||
|
||||
public function setDateEnd(?DateTimeOptional $dateEnd): void
|
||||
{
|
||||
$this->setValueObject('dateEnd', $dateEnd);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAttachmentIdList(): array
|
||||
{
|
||||
/** @var string[] */
|
||||
return $this->getLinkMultipleIdList('attachments');
|
||||
}
|
||||
|
||||
public function setParent(Entity|LinkParent|null $parent): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::PARENT, $parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EntityCollection<Attachment>
|
||||
*/
|
||||
public function getAttachments(): EntityCollection
|
||||
{
|
||||
/** @var EntityCollection<Attachment> */
|
||||
return $this->relations->getMany('attachments');
|
||||
}
|
||||
|
||||
public function setAssignedUser(Link|User|null $assignedUser): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity(Field::ASSIGNED_USER, $assignedUser);
|
||||
}
|
||||
|
||||
public function setTeams(LinkMultiple $teams): self
|
||||
{
|
||||
$this->setValueObject(Field::TEAMS, $teams);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAccount(Link|Account|null $account): self
|
||||
{
|
||||
return $this->setRelatedLinkOrEntity('account', $account);
|
||||
}
|
||||
|
||||
public function getAccount(): ?Account
|
||||
{
|
||||
/** @var ?Account */
|
||||
return $this->relations->getOne('account');
|
||||
}
|
||||
|
||||
public function getParent(): ?OrmEntity
|
||||
{
|
||||
return $this->relations->getOne(Field::PARENT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user