src/Entity/Account.php line 93

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use DH\Auditor\Provider\Doctrine\Auditing\Annotation as Audit;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\Criteria;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use MedBrief\MSR\Controller\Account\Managers;
  11. use MedBrief\MSR\Controller\Account\UserRestrictedAccounts;
  12. use MedBrief\MSR\Entity\MatterRequest\MatterRequestDefaults;
  13. use MedBrief\MSR\Repository\AccountRepository;
  14. use MedBrief\MSR\Service\MatterTypeAwareInterface;
  15. use MedBrief\MSR\Traits\FilterableClassConstantsTrait;
  16. use Symfony\Component\Serializer\Annotation\Groups;
  17. use Symfony\Component\Validator\Constraints as Assert;
  18. /**
  19. * @ApiResource(
  20. * collectionOperations={
  21. * "get"={
  22. * "access_control"="is_granted('CREATE_MATTER_REQUEST')",
  23. * "method"="GET",
  24. * "path"="/accounts",
  25. * "controller"=UserRestrictedAccounts::class,
  26. * "defaults"={"_api_receive"=false},
  27. * "openapi_context"={
  28. * "summary"="Retrieves all Account (Client Area) resources available.",
  29. * "description"="Retrieves all Account (Client Area) resources available. To be used in the 'clientAreaId' field when creating a Matter Request.",
  30. * }
  31. * },
  32. * "client_areas"={
  33. * "access_control"="is_granted('CREATE_MATTER_REQUEST')",
  34. * "method"="GET",
  35. * "path"="/client-areas",
  36. * "controller"=UserRestrictedAccounts::class,
  37. * "defaults"={"_api_receive"=false},
  38. * "normalization_context"={"groups"={"client_area:read"}},
  39. * "openapi_context"={
  40. * "summary"="Retrieves all Account (Client Area) resources available.",
  41. * "description"="Retrieves all Account (Client Area) resources available. See [Client Areas](/docs/api/detail#client-areas)",
  42. * }
  43. * }
  44. * },
  45. * itemOperations={
  46. * "get"={"access_control"="is_granted('READ', object)"},
  47. * "managers_get"={
  48. * "access_control"="is_granted('CREATE_MATTER_REQUEST')",
  49. * "method"="GET",
  50. * "path"="/accounts/{id}/managers",
  51. * "controller"=Managers::class,
  52. * "openapi_context"={
  53. * "summary"="Retrieves all User resources that can be assigned as Matter Manager.",
  54. * "description"="Retrieves a list of User resources specific to the specified Account (Client Area) that can be assigned as a Matter Manager on a Matter Request. To be used in the 'manager' field when creating a Matter Request.",
  55. * "responses"={
  56. * "200"={
  57. * "description"="A collection of User resources",
  58. * "content"={
  59. * "application/ld+json"={
  60. * "schema"={
  61. * "$ref"="#/components/schemas/User.jsonld-user.read"
  62. * }
  63. * },
  64. * "application/json"={
  65. * "schema"={
  66. * "$ref"="#/components/schemas/User-user.read"
  67. * }
  68. * }
  69. * }
  70. * }
  71. * }
  72. * }
  73. * },
  74. * },
  75. * attributes={
  76. * "normalization_context"={"groups"={"account:read"}},
  77. * }
  78. * )
  79. *
  80. * @ORM\Table(name="account")
  81. *
  82. * @ORM\Entity(repositoryClass=AccountRepository::class)
  83. *
  84. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
  85. *
  86. * @Audit\Auditable
  87. *
  88. * @Audit\Security(view={"ROLE_ALLOWED_TO_AUDIT"})
  89. */
  90. class Account implements MatterTypeAwareInterface
  91. {
  92. use FilterableClassConstantsTrait;
  93. public const INVOICE_BILLING_FREQUENCY_MONTHLY = 1;
  94. public const INVOICE_BILLING_FREQUENCY_QUARTERLY = 2;
  95. public const INVOICE_BILLING_FREQUENCY_START_OF_MATTER = 3;
  96. public const INVOICE_TYPE_INDIVIDUAL_MATTER = 1;
  97. public const INVOICE_TYPE_CONSOLIDATED = 2;
  98. // Default role options
  99. public const DEFAULT_ROLE_ADMINISTRATOR = 'ADMINISTRATOR';
  100. public const DEFAULT_ROLE_SUPERADMINISTRATOR = 'SUPERADMINISTRATOR';
  101. public const DEFAULT_ROLE_PROJECTMANAGER = 'PROJECTMANAGER';
  102. public const DEFAULT_ROLE_SORTER = 'SORTER';
  103. // Only has access to the old matter creation form
  104. public const MATTER_CREATION_PROCESS_CLASSIC = 'classic';
  105. public const MATTER_CREATION_PROCESS_CLASSIC__LABEL = 'Classic';
  106. // Only has access to the new matter creation form
  107. public const MATTER_CREATION_PROCESS_STANDARD = 'standard';
  108. public const MATTER_CREATION_PROCESS_STANDARD__LABEL = 'Standard';
  109. // Has access to both the old and new matter creation form
  110. public const MATTER_CREATION_PROCESS_ALL = 'all';
  111. public const MATTER_CREATION_PROCESS_ALL__LABEL = 'Standard & Classic';
  112. // Country of Registration options
  113. public const COUNTRY_OF_REGISTRATION_ENGLAND_AND_WALES = 'england_and_wales';
  114. public const COUNTRY_OF_REGISTRATION_ENGLAND_AND_WALES__LABEL = 'England and Wales';
  115. public const COUNTRY_OF_REGISTRATION_SCOTLAND = 'scotland';
  116. public const COUNTRY_OF_REGISTRATION_SCOTLAND__LABEL = 'Scotland';
  117. public const COUNTRY_OF_REGISTRATION_NORTHERN_IRELAND = 'northern_ireland';
  118. public const COUNTRY_OF_REGISTRATION_NORTHERN_IRELAND__LABEL = 'Northern Ireland';
  119. /**
  120. * @var ContactableAddress
  121. *
  122. * This field is unmapped, and is purely here for the API.
  123. *
  124. * @Groups({"account:read", "matter_request:read"})
  125. */
  126. protected $returnDetailsAddress;
  127. /**
  128. * @var string
  129. *
  130. * @ORM\Column(name="matterCreationProcess", type="string", nullable=true)
  131. */
  132. protected $matterCreationProcess = self::MATTER_CREATION_PROCESS_CLASSIC;
  133. /**
  134. * @var string|null
  135. *
  136. * @ORM\Column(name="custom_index_header", type="text", nullable=true)
  137. */
  138. protected $custom_index_header;
  139. /**
  140. * @var string|null
  141. *
  142. * @ORM\Column(name="standardIndexHeader", type="text", nullable=true)
  143. */
  144. protected $standardIndexHeader;
  145. /**
  146. * Indicates if the MedBrief logo should be hidden from the index produced.
  147. * The scenario for this is where clients sort their own records, or a sorting standard that
  148. * deviates from our standard sorting product.
  149. *
  150. * @var bool
  151. *
  152. * @ORM\Column(type="boolean", options={"default"=false})
  153. */
  154. protected $hideLogoFromIndex = false;
  155. /**
  156. * @Groups({"client_area:read"})
  157. *
  158. * @ORM\Column(name="id", type="bigint", nullable=false)
  159. *
  160. * @ORM\Id
  161. *
  162. * @ORM\GeneratedValue(strategy="IDENTITY")
  163. */
  164. private ?int $id;
  165. /**
  166. * @Groups({"account:read", "matter_request:read", "client_area:read"})
  167. *
  168. * @ORM\Column(name="name", type="string", length=155, nullable=false)
  169. */
  170. private ?string $name;
  171. /**
  172. * @var Collection
  173. *
  174. * @ORM\OneToMany(targetEntity="MedBrief\MSR\Entity\Domain", mappedBy="account", cascade={"all"})
  175. */
  176. private $domains;
  177. /**
  178. * @var array|null
  179. *
  180. * @ORM\Column(name="allowed_license_levels", type="array", nullable=true)
  181. */
  182. private $allowed_license_levels;
  183. /**
  184. * @var string|null
  185. *
  186. * @ORM\Column(name="prefix", type="string", length=25, nullable=true)
  187. */
  188. private $prefix;
  189. /**
  190. * @var string|null
  191. *
  192. * @ORM\Column(name="legal_entity_name", type="text", nullable=true)
  193. */
  194. private $legal_entity_name;
  195. /**
  196. * Sets all service requests for this client not to come up for invoicing.
  197. *
  198. * @var bool
  199. *
  200. * @ORM\Column(name="hide_from_invoicing", type="boolean", options={"default"=false})
  201. */
  202. private $hide_from_invoicing;
  203. /**
  204. * @var string|null
  205. *
  206. * @ORM\Column(name="default_role", type="string", nullable=true)
  207. */
  208. private $default_role;
  209. /**
  210. * Holds the Account's payment terms value (in days) for adjusting
  211. * the due date on invoices automagically.
  212. *
  213. * @var int
  214. *
  215. * @ORM\Column(name="invoice_payment_terms", type="integer", nullable=true)
  216. */
  217. private $invoice_payment_terms;
  218. /**
  219. * @var int|null
  220. *
  221. * @ORM\Column(name="invoice_billing_frequency", type="integer", nullable=true)
  222. */
  223. private $invoice_billing_frequency;
  224. /**
  225. * @var int|null
  226. *
  227. * @ORM\Column(name="invoice_type", type="integer", nullable=true)
  228. */
  229. private $invoice_type;
  230. /**
  231. * The different UserNotifications disabled for this Client
  232. *
  233. * @var array
  234. *
  235. * @ORM\Column(name="disabled_notifications", type="array", nullable=true)
  236. */
  237. private $disabled_notifications = [];
  238. /**
  239. * A default sorting instruction for all the Account's sorting sessions.
  240. * This is visible to the sorter.
  241. *
  242. * @var SortingInstruction
  243. *
  244. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\SortingInstruction", inversedBy="account", cascade={"persist","remove"}, orphanRemoval=true)
  245. *
  246. * @ORM\JoinColumns({
  247. *
  248. * @ORM\JoinColumn(name="defaultSortingInstruction_id", referencedColumnName="id", unique=true)
  249. * })
  250. */
  251. private $defaultSortingInstruction;
  252. /**
  253. * Determines if a draft memo will be exported for the client on Sorting Session completions.
  254. *
  255. * @var bool
  256. *
  257. * @ORM\Column(name="requireMemo", type="boolean", options={"default"=false})
  258. */
  259. private $requireMemo = false;
  260. /**
  261. * Whether to require the user to enter a password on downloading a document or folder
  262. *
  263. * @var bool
  264. *
  265. * @ORM\Column(name="require_password_on_download", type="boolean", options={"default"=false})
  266. */
  267. private $require_password_on_download;
  268. /**
  269. * @var ArrayCollection
  270. *
  271. * @ORM\OneToMany(targetEntity="MedBrief\MSR\Entity\AccountSortingMemoPhrase", mappedBy="account", cascade={"all"})
  272. */
  273. private $accountSortingMemoPhrases;
  274. /**
  275. * @var MatterRequestDefaults
  276. *
  277. * @Groups({"account:read", "matter_request:read"})
  278. *
  279. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\MatterRequest\MatterRequestDefaults", mappedBy="account")
  280. */
  281. private $matterRequestDefaults;
  282. /**
  283. * @var ContactableAddress
  284. *
  285. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\ContactableAddress", cascade={"all"})
  286. *
  287. * @ORM\JoinColumns({
  288. *
  289. * @ORM\JoinColumn(name="billingAddress_id", referencedColumnName="id", unique=true)
  290. * })
  291. */
  292. private $billingAddress;
  293. /**
  294. * @var ContactableAddress
  295. */
  296. private $accountsAddress;
  297. /**
  298. * @var ContactableAddress
  299. *
  300. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\ContactableAddress", cascade={"all"})
  301. *
  302. * @ORM\JoinColumns({
  303. *
  304. * @ORM\JoinColumn(name="physicalAddress_id", referencedColumnName="id", unique=true)
  305. * })
  306. */
  307. private $physicalAddress;
  308. /**
  309. * @var Collection
  310. *
  311. * @ORM\ManyToMany(targetEntity="MedBrief\MSR\Entity\ContactableAddress", inversedBy="accounts", cascade={"persist"})
  312. *
  313. * @ORM\JoinTable(name="account_contactableaddress",
  314. * joinColumns={
  315. *
  316. * @ORM\JoinColumn(name="account_id", referencedColumnName="id", onDelete="CASCADE")
  317. * },
  318. * inverseJoinColumns={
  319. * @ORM\JoinColumn(name="contactableaddress_id", referencedColumnName="id", onDelete="CASCADE")
  320. * }
  321. * )
  322. */
  323. private $offices;
  324. /**
  325. * @var string
  326. *
  327. * @ORM\Column(name="slug", type="string")
  328. *
  329. * @Gedmo\Slug(fields={"name"}, updatable=false, separator="_")
  330. */
  331. private $slug;
  332. /**
  333. * @var \DateTime
  334. *
  335. * @ORM\Column(name="created", type="datetime")
  336. *
  337. * @Gedmo\Timestampable(on="create")
  338. */
  339. private $created;
  340. /**
  341. * @var \DateTime
  342. *
  343. * @ORM\Column(name="updated", type="datetime")
  344. *
  345. * @Gedmo\Timestampable(on="update")
  346. */
  347. private $updated;
  348. /**
  349. * @var Collection
  350. *
  351. * @ORM\OneToMany(targetEntity="MedBrief\MSR\Entity\Project", mappedBy="account", cascade={"all"})
  352. */
  353. private $projects;
  354. /**
  355. * @var Collection
  356. */
  357. private $addresses;
  358. /**
  359. * @var \DateTime
  360. *
  361. * @ORM\Column(name="deletedAt", type="datetime", nullable=true)
  362. */
  363. private $deletedAt;
  364. /**
  365. * @var string
  366. */
  367. private $image;
  368. /**
  369. * @var string
  370. *
  371. * @ORM\Column(name="image_name", type="string", length=255, nullable=true)
  372. */
  373. private $image_name;
  374. /**
  375. * Determines if an account can create/update batch requests and sort sessions.
  376. *
  377. * @var bool
  378. *
  379. * @ORM\Column(name="canCreateBatchAndSort", type="boolean", options={"default"=false})
  380. */
  381. private $canCreateBatchAndSort = false;
  382. /**
  383. * Determines if an account can is able to use match.
  384. *
  385. * @var bool
  386. *
  387. * @ORM\Column(name="matchOptIn", type="boolean", options={"default"=false})
  388. */
  389. private bool $matchOptIn = false;
  390. /**
  391. * Determines the default value of the same field on a Project/Matter, when a new Project is created.
  392. *
  393. * @var bool
  394. *
  395. * @ORM\Column(name="allowExpertViewUnsortedRecords", type="boolean", options={"default"=false})
  396. */
  397. private $allowExpertViewUnsortedRecords = false;
  398. /**
  399. * Determines if the questions presented during the Matter Closure Wizard are optional.
  400. *
  401. * @var bool
  402. *
  403. * @ORM\Column(name="matterClosureQuestionsOptional", type="boolean", options={"default"=false})
  404. */
  405. private $matterClosureQuestionsOptional = false;
  406. /**
  407. * @var bool
  408. *
  409. * @ORM\Column(name="useParentClinicalSectionsOnly", type="boolean")
  410. */
  411. private $useParentClinicalSectionsOnly = false;
  412. /**
  413. * @ORM\ManyToOne(targetEntity=Firm::class, inversedBy="clientAreas")
  414. */
  415. private $firm;
  416. /**
  417. * @Groups({"account:read", "matter_request:read"})
  418. *
  419. * @ORM\Column(name="allowedMatterTypes", type="array", nullable=true)
  420. *
  421. * @Assert\Count(
  422. * min=1,
  423. * minMessage = "Please select an option.",
  424. * groups={"account:read", "matter_request:read"}
  425. * )
  426. */
  427. private array $allowedMatterTypes = [];
  428. /**
  429. * @ORM\OneToMany(targetEntity=LicenceRenewalTerm::class, mappedBy="account", orphanRemoval=true)
  430. *
  431. * @ORM\OrderBy({"effectiveDate" = "ASC"})
  432. *
  433. * When a new period is added, a new related service option for the same period should also be created and mapped.
  434. */
  435. private ?Collection $licenceRenewalTerms;
  436. /**
  437. * Sets whether any client level users, or users invited to the client's
  438. * matters should require 2FA to be enabled.
  439. *
  440. * @ORM\Column(type="boolean", options={"default"=false})
  441. */
  442. private bool $enforceTwoFactorAuth = false;
  443. /**
  444. * If enabled, allows the users that are forced to enabled 2FA via the
  445. * enforceTwoFactorAuth property to skip the requirement for the first
  446. * two (2) logins.
  447. *
  448. * @ORM\Column(type="boolean", options={"default"=false})
  449. */
  450. private bool $allowTwoFactorAuthGracePeriod = false;
  451. /**
  452. * If enabled, the account (client) is not liable for the disclosure fee,
  453. * the Recipient Firm is liable.
  454. *
  455. * @ORM\Column(type="boolean", options={"default"=false})
  456. */
  457. private bool $clientNotLiableForDisclosureFee = false;
  458. /**
  459. * @var string|null
  460. *
  461. * @ORM\Column(name="trading_name", type="text", nullable=true)
  462. *
  463. * @Assert\NotBlank(message="Trading name is required")
  464. */
  465. private $trading_name = null;
  466. /**
  467. * @var string|null
  468. *
  469. * @ORM\Column(name="company_registration_number", type="string", length=255, nullable=true)
  470. *
  471. * @Assert\NotBlank(message="Company registration number is required")
  472. */
  473. private $company_registration_number = null;
  474. /**
  475. * @var string|null
  476. *
  477. * @ORM\Column(name="country_of_registration", type="string", length=255, nullable=true)
  478. *
  479. * @Assert\NotBlank(message="Country of registration is required")
  480. */
  481. private $country_of_registration = null;
  482. /**
  483. * Constructor
  484. */
  485. public function __construct()
  486. {
  487. $this->domains = new ArrayCollection();
  488. $this->allowed_license_levels = [];
  489. $this->hide_from_invoicing = false;
  490. $this->require_password_on_download = false;
  491. $this->accountSortingMemoPhrases = new ArrayCollection();
  492. $this->matterCreationProcess = self::MATTER_CREATION_PROCESS_CLASSIC;
  493. $this->projects = new ArrayCollection();
  494. $this->offices = new ArrayCollection();
  495. $this->licenceRenewalTerms = new ArrayCollection();
  496. }
  497. public function __toString()
  498. {
  499. return $this->getName();
  500. }
  501. /**
  502. * Get id
  503. *
  504. * @return int
  505. */
  506. public function getId()
  507. {
  508. return $this->id;
  509. }
  510. /**
  511. * Set name
  512. *
  513. * @param string $name
  514. *
  515. * @return Account
  516. */
  517. public function setName($name)
  518. {
  519. $this->name = $name;
  520. return $this;
  521. }
  522. /**
  523. * Get name
  524. *
  525. * @return string
  526. */
  527. public function getName()
  528. {
  529. return $this->name;
  530. }
  531. /**
  532. * Add domains
  533. *
  534. * @param Domain $domains
  535. *
  536. * @return Account
  537. */
  538. public function addDomain(Domain $domains)
  539. {
  540. $this->domains[] = $domains;
  541. return $this;
  542. }
  543. /**
  544. * Remove domains
  545. *
  546. * @param Domain $domains
  547. */
  548. public function removeDomain(Domain $domains)
  549. {
  550. $this->domains->removeElement($domains);
  551. }
  552. /**
  553. * Get domains
  554. *
  555. * @return Collection
  556. */
  557. public function getDomains()
  558. {
  559. return $this->domains;
  560. }
  561. /**
  562. * Set slug
  563. *
  564. * @param string $slug
  565. *
  566. * @return Account
  567. */
  568. public function setSlug($slug)
  569. {
  570. $this->slug = $slug;
  571. return $this;
  572. }
  573. /**
  574. * Get slug
  575. *
  576. * @return string
  577. */
  578. public function getSlug()
  579. {
  580. return $this->slug;
  581. }
  582. /**
  583. * Set created
  584. *
  585. * @param \DateTime $created
  586. *
  587. * @return Account
  588. */
  589. public function setCreated($created)
  590. {
  591. $this->created = $created;
  592. return $this;
  593. }
  594. /**
  595. * Get created
  596. *
  597. * @return \DateTime
  598. */
  599. public function getCreated()
  600. {
  601. return $this->created;
  602. }
  603. /**
  604. * Set updated
  605. *
  606. * @param \DateTime $updated
  607. *
  608. * @return Account
  609. */
  610. public function setUpdated($updated)
  611. {
  612. $this->updated = $updated;
  613. return $this;
  614. }
  615. /**
  616. * Get updated
  617. *
  618. * @return \DateTime
  619. */
  620. public function getUpdated()
  621. {
  622. return $this->updated;
  623. }
  624. /**
  625. * Add projects
  626. *
  627. * @param Project $projects
  628. *
  629. * @return Account
  630. */
  631. public function addProject(Project $projects)
  632. {
  633. $this->projects[] = $projects;
  634. return $this;
  635. }
  636. /**
  637. * Remove projects
  638. *
  639. * @param Project $projects
  640. */
  641. public function removeProject(Project $projects)
  642. {
  643. $this->projects->removeElement($projects);
  644. }
  645. /**
  646. * Get projects
  647. *
  648. * @return Collection
  649. */
  650. public function getProjects()
  651. {
  652. return $this->projects;
  653. }
  654. public function getArchivedProjects()
  655. {
  656. $criteria = Criteria::create()
  657. ->where(Criteria::expr()->gt('archive_status', 0))
  658. ->orderBy(['name' => Criteria::ASC])
  659. ;
  660. return $this->getProjects()->matching($criteria);
  661. }
  662. public function getActiveProjects()
  663. {
  664. $criteria = Criteria::create()
  665. ->where(Criteria::expr()->eq('status', Project::STATUS_ACTIVE))
  666. ->orderBy(['name' => Criteria::ASC])
  667. ;
  668. return $this->getProjects()->matching($criteria);
  669. }
  670. public function getInactiveProjects()
  671. {
  672. $criteria = Criteria::create()
  673. ->where(Criteria::expr()->eq('status', Project::STATUS_INACTIVE))
  674. ->orderBy(['name' => Criteria::ASC])
  675. ;
  676. return $this->getProjects()->matching($criteria);
  677. }
  678. /**
  679. * Set invoice_billing_frequency
  680. *
  681. * @param string $invoiceBillingFrequency
  682. *
  683. * @return Account
  684. */
  685. public function setInvoiceBillingFrequency($invoiceBillingFrequency)
  686. {
  687. $this->invoice_billing_frequency = $invoiceBillingFrequency;
  688. return $this;
  689. }
  690. /**
  691. * Get invoice_billing_frequency
  692. *
  693. * @return string
  694. */
  695. public function getInvoiceBillingFrequency()
  696. {
  697. return $this->invoice_billing_frequency;
  698. }
  699. /**
  700. * Set invoice_type
  701. *
  702. * @param string $invoiceType
  703. *
  704. * @return Account
  705. */
  706. public function setInvoiceType($invoiceType)
  707. {
  708. $this->invoice_type = $invoiceType;
  709. return $this;
  710. }
  711. /**
  712. * Get invoice_type
  713. *
  714. * @return string
  715. */
  716. public function getInvoiceType()
  717. {
  718. return $this->invoice_type;
  719. }
  720. /**
  721. * Set billingAddress
  722. *
  723. * @param ContactableAddress $billingAddress
  724. *
  725. * @return Account
  726. */
  727. public function setBillingAddress(?ContactableAddress $billingAddress = null)
  728. {
  729. $this->billingAddress = $billingAddress;
  730. return $this;
  731. }
  732. /**
  733. * Get billingAddress
  734. *
  735. * @return ContactableAddress
  736. */
  737. public function getBillingAddress()
  738. {
  739. return $this->billingAddress;
  740. }
  741. /**
  742. * Set accountsAddress
  743. *
  744. * @param ContactableAddress $accountsAddress
  745. *
  746. * @return Account
  747. */
  748. public function setAccountsAddress(?ContactableAddress $accountsAddress = null)
  749. {
  750. $this->accountsAddress = $accountsAddress;
  751. return $this;
  752. }
  753. /**
  754. * Get accountsAddress
  755. *
  756. * @return ContactableAddress
  757. */
  758. public function getAccountsAddress()
  759. {
  760. return $this->accountsAddress;
  761. }
  762. /**
  763. * Set physicalAddress
  764. *
  765. * @param ContactableAddress $physicalAddress
  766. *
  767. * @return Account
  768. */
  769. public function setPhysicalAddress(?ContactableAddress $physicalAddress = null)
  770. {
  771. $this->physicalAddress = $physicalAddress;
  772. return $this;
  773. }
  774. /**
  775. * Get physicalAddress
  776. *
  777. * @return ContactableAddress
  778. */
  779. public function getPhysicalAddress()
  780. {
  781. return $this->physicalAddress;
  782. }
  783. /**
  784. * Add offices
  785. *
  786. * @param ContactableAddress $offices
  787. *
  788. * @return Account
  789. */
  790. public function addOffice(ContactableAddress $offices)
  791. {
  792. $this->offices[] = $offices;
  793. return $this;
  794. }
  795. /**
  796. * Remove offices
  797. *
  798. * @param ContactableAddress $offices
  799. */
  800. public function removeOffice(ContactableAddress $offices)
  801. {
  802. $this->offices->removeElement($offices);
  803. }
  804. /**
  805. * Get offices
  806. *
  807. * @return Collection
  808. */
  809. public function getOffices()
  810. {
  811. return $this->offices;
  812. }
  813. /**
  814. * Returns an array of permitted values for the invoice billing frequency field and their
  815. * associated labels,
  816. *
  817. * @return array
  818. */
  819. public static function getInvoiceBillingFrequencyOptions()
  820. {
  821. return [
  822. self::INVOICE_BILLING_FREQUENCY_MONTHLY => 'Monthly',
  823. self::INVOICE_BILLING_FREQUENCY_QUARTERLY => 'Quarterly',
  824. self::INVOICE_BILLING_FREQUENCY_START_OF_MATTER => 'At the start of the matter',
  825. ];
  826. }
  827. /**
  828. * Returns a human readable version of the invoice billing frequency
  829. *
  830. * @return string
  831. */
  832. public function getInvoiceBillingFrequencyName()
  833. {
  834. $options = self::getInvoiceBillingFrequencyOptions();
  835. return
  836. $options[$this->getInvoiceBillingFrequency()] ?? $this->getInvoiceBillingFrequency();
  837. }
  838. /**
  839. * Returns an array of permitted values for the invoice billing frequency field and their
  840. * associated labels,
  841. *
  842. * @return array
  843. */
  844. public static function getInvoiceTypeOptions()
  845. {
  846. return [
  847. self::INVOICE_TYPE_CONSOLIDATED => 'Consolidated',
  848. self::INVOICE_TYPE_INDIVIDUAL_MATTER => 'Individual Matter',
  849. ];
  850. }
  851. /**
  852. * Returns a human readable version of the invoice billing frequency
  853. *
  854. * @return string
  855. */
  856. public function getInvoiceTypeName()
  857. {
  858. $options = self::getInvoiceTypeOptions();
  859. return
  860. $options[$this->getInvoiceType()] ?? $this->getInvoiceType();
  861. }
  862. /**
  863. * Set deletedAt
  864. *
  865. * @param \DateTime $deletedAt
  866. *
  867. * @return Account
  868. */
  869. public function setDeletedAt($deletedAt)
  870. {
  871. $this->deletedAt = $deletedAt;
  872. return $this;
  873. }
  874. /**
  875. * Get deletedAt
  876. *
  877. * @return \DateTime
  878. */
  879. public function getDeletedAt()
  880. {
  881. return $this->deletedAt;
  882. }
  883. /**
  884. * Set image
  885. *
  886. * @param string $image
  887. *
  888. * @return Account
  889. */
  890. public function setImage($image)
  891. {
  892. if (null !== $image) {
  893. // It is required that at least one field changes if you are using doctrine
  894. // otherwise the event listeners won't be called and the file is lost
  895. $this->updated = new \DateTimeImmutable();
  896. }
  897. $this->image = $image;
  898. return $this;
  899. }
  900. /**
  901. * Indicates whether or not this user has an image
  902. *
  903. * @return bool
  904. */
  905. public function hasImage()
  906. {
  907. // note that we use the imageName field because the image field will be
  908. // populated with the gaufrette file location immediately on upload
  909. // even if the upload fails. So if you call this function on the user
  910. // before it is peristed it may give you a false positive.
  911. $image = $this->getImageName();
  912. return !empty($image);
  913. }
  914. /**
  915. * Get image
  916. *
  917. * @return string
  918. */
  919. public function getImage()
  920. {
  921. return $this->image;
  922. }
  923. /**
  924. * Set image_name
  925. *
  926. * @param string $imageName
  927. *
  928. * @return Account
  929. */
  930. public function setImageName($imageName)
  931. {
  932. $this->image_name = $imageName;
  933. return $this;
  934. }
  935. /**
  936. * Get image_name
  937. *
  938. * @return string
  939. */
  940. public function getImageName()
  941. {
  942. return $this->image_name;
  943. }
  944. /**
  945. * Set allowedLicenseLevels
  946. *
  947. * @param array $allowedLicenseLevels
  948. *
  949. * @return Account
  950. */
  951. public function setAllowedLicenseLevels($allowedLicenseLevels)
  952. {
  953. $this->allowed_license_levels = $allowedLicenseLevels;
  954. return $this;
  955. }
  956. /**
  957. * Get allowedLicenseLevels
  958. *
  959. * @return array
  960. */
  961. public function getAllowedLicenseLevels()
  962. {
  963. if ($this->allowed_license_levels === null) {
  964. return [];
  965. }
  966. return $this->allowed_license_levels;
  967. }
  968. /**
  969. * Set prefix
  970. *
  971. * @param string $prefix
  972. *
  973. * @return Account
  974. */
  975. public function setPrefix($prefix)
  976. {
  977. $this->prefix = strtoupper($prefix);
  978. return $this;
  979. }
  980. /**
  981. * Get prefix
  982. *
  983. * @return string
  984. */
  985. public function getPrefix()
  986. {
  987. return strtoupper($this->prefix);
  988. }
  989. /**
  990. * Set legalEntityName
  991. *
  992. * @param string $legalEntityName
  993. *
  994. * @return Account
  995. */
  996. public function setLegalEntityName($legalEntityName)
  997. {
  998. $this->legal_entity_name = $legalEntityName;
  999. return $this;
  1000. }
  1001. /**
  1002. * Get legalEntityName
  1003. *
  1004. * @return string
  1005. */
  1006. public function getLegalEntityName()
  1007. {
  1008. return $this->legal_entity_name;
  1009. }
  1010. /**
  1011. * Set defaultRole
  1012. *
  1013. * @param string $defaultRole
  1014. *
  1015. * @return Account
  1016. */
  1017. public function setDefaultRole($defaultRole)
  1018. {
  1019. $this->default_role = $defaultRole;
  1020. return $this;
  1021. }
  1022. /**
  1023. * Get defaultRole
  1024. *
  1025. * @return string
  1026. */
  1027. public function getDefaultRole()
  1028. {
  1029. return $this->default_role;
  1030. }
  1031. /**
  1032. * Get defaultRoleOptions
  1033. *
  1034. * @return array
  1035. */
  1036. public static function getDefaultRoleOptions()
  1037. {
  1038. return [
  1039. self::DEFAULT_ROLE_ADMINISTRATOR => 'Client Administrator',
  1040. self::DEFAULT_ROLE_SUPERADMINISTRATOR => 'Client Super Administrator',
  1041. self::DEFAULT_ROLE_PROJECTMANAGER => 'Client Project Manager',
  1042. self::DEFAULT_ROLE_SORTER => 'Sorter',
  1043. ];
  1044. }
  1045. /**
  1046. * Get DefaultRoleLabel
  1047. *
  1048. * @return string
  1049. */
  1050. public function getDefaultRoleLabel()
  1051. {
  1052. $options = self::getDefaultRoleOptions();
  1053. return $options[$this->getDefaultRole()] ?? '';
  1054. }
  1055. /**
  1056. * Get DefaultRoleLabel
  1057. *
  1058. * @return string
  1059. */
  1060. public function getDefaultRoleAsRole()
  1061. {
  1062. if (!$this->getDefaultRole()) {
  1063. return '';
  1064. }
  1065. return 'ROLE_ACCOUNT_' . $this->getId() . '_' . $this->getDefaultRole();
  1066. }
  1067. /**
  1068. * Set hideFromInvoicing
  1069. *
  1070. * @param bool $hideFromInvoicing
  1071. *
  1072. * @return Account
  1073. */
  1074. public function setHideFromInvoicing($hideFromInvoicing)
  1075. {
  1076. $this->hide_from_invoicing = $hideFromInvoicing;
  1077. return $this;
  1078. }
  1079. /**
  1080. * Get hideFromInvoicing
  1081. *
  1082. * @return bool
  1083. */
  1084. public function getHideFromInvoicing()
  1085. {
  1086. return $this->hide_from_invoicing;
  1087. }
  1088. /**
  1089. * Set invoicePaymentTerms
  1090. *
  1091. * @param int $invoicePaymentTerms
  1092. *
  1093. * @return Account
  1094. */
  1095. public function setInvoicePaymentTerms($invoicePaymentTerms)
  1096. {
  1097. $this->invoice_payment_terms = $invoicePaymentTerms;
  1098. return $this;
  1099. }
  1100. /**
  1101. * Get invoicePaymentTerms
  1102. *
  1103. * @return int
  1104. */
  1105. public function getInvoicePaymentTerms()
  1106. {
  1107. return $this->invoice_payment_terms;
  1108. }
  1109. /**
  1110. * Get the disabled UserNotification types
  1111. *
  1112. * @return array
  1113. */
  1114. public function getDisabledNotifications(): array
  1115. {
  1116. return $this->disabled_notifications ?: [];
  1117. }
  1118. /**
  1119. * @param array $disabled_notifications
  1120. *
  1121. * @return Account
  1122. */
  1123. public function setDisabledNotifications(array $disabled_notifications): Account
  1124. {
  1125. $this->disabled_notifications = $disabled_notifications;
  1126. return $this;
  1127. }
  1128. /**
  1129. * Disable a notification
  1130. *
  1131. * @param $notification_type
  1132. *
  1133. * @return Account
  1134. */
  1135. public function disableNotification($notification_type)
  1136. {
  1137. if (!$this->disabled_notifications) {
  1138. $this->disabled_notifications = [];
  1139. }
  1140. array_push($this->disabled_notifications, $notification_type);
  1141. return $this;
  1142. }
  1143. /**
  1144. * Function to determine if the specific UserNotification is disabled for this Entity
  1145. *
  1146. * @param $notification_type
  1147. *
  1148. * @return bool
  1149. */
  1150. public function isNotificationDisabled($notification_type)
  1151. {
  1152. if (!$this->disabled_notifications) {
  1153. $this->disabled_notifications = [];
  1154. return false;
  1155. }
  1156. return in_array($notification_type, $this->disabled_notifications) ? true : false;
  1157. }
  1158. /**
  1159. * Set defaultSortingInstruction.
  1160. *
  1161. * @param SortingInstruction|null $defaultSortingInstruction
  1162. *
  1163. * @return Account
  1164. */
  1165. public function setDefaultSortingInstruction(?SortingInstruction $defaultSortingInstruction = null)
  1166. {
  1167. $this->defaultSortingInstruction = $defaultSortingInstruction;
  1168. return $this;
  1169. }
  1170. /**
  1171. * Get defaultSortingInstruction.
  1172. *
  1173. * @return SortingInstruction|null
  1174. */
  1175. public function getDefaultSortingInstruction()
  1176. {
  1177. return $this->defaultSortingInstruction;
  1178. }
  1179. /**
  1180. * Set requireMemo.
  1181. *
  1182. * @param bool $requireMemo
  1183. *
  1184. * @return Account
  1185. */
  1186. public function setRequireMemo($requireMemo)
  1187. {
  1188. $this->requireMemo = $requireMemo;
  1189. return $this;
  1190. }
  1191. /**
  1192. * Get requireMemo.
  1193. *
  1194. * @return bool
  1195. */
  1196. public function getRequireMemo()
  1197. {
  1198. return $this->requireMemo;
  1199. }
  1200. /**
  1201. * Set requirePasswordOnDownload.
  1202. *
  1203. * @param bool $requirePasswordOnDownload
  1204. *
  1205. * @return Account
  1206. */
  1207. public function setRequirePasswordOnDownload($requirePasswordOnDownload)
  1208. {
  1209. $this->require_password_on_download = $requirePasswordOnDownload;
  1210. return $this;
  1211. }
  1212. /**
  1213. * Get requirePasswordOnDownload.
  1214. *
  1215. * @return bool
  1216. */
  1217. public function getRequirePasswordOnDownload()
  1218. {
  1219. return $this->require_password_on_download;
  1220. }
  1221. /**
  1222. * Add accountSortingMemoPhrase.
  1223. *
  1224. * @param AccountSortingMemoPhrase $accountSortingMemoPhrase
  1225. *
  1226. * @return Account
  1227. */
  1228. public function addAccountSortingMemoPhrase(AccountSortingMemoPhrase $accountSortingMemoPhrase)
  1229. {
  1230. $this->accountSortingMemoPhrases[] = $accountSortingMemoPhrase;
  1231. return $this;
  1232. }
  1233. /**
  1234. * Remove accountSortingMemoPhrase.
  1235. *
  1236. * @param AccountSortingMemoPhrase $accountSortingMemoPhrase
  1237. *
  1238. * @return bool TRUE if this collection contained the specified element, FALSE otherwise.
  1239. */
  1240. public function removeAccountSortingMemoPhrase(AccountSortingMemoPhrase $accountSortingMemoPhrase)
  1241. {
  1242. return $this->accountSortingMemoPhrases->removeElement($accountSortingMemoPhrase);
  1243. }
  1244. /**
  1245. * Get accountSortingMemoPhrases.
  1246. *
  1247. * @return Collection
  1248. */
  1249. public function getAccountSortingMemoPhrases()
  1250. {
  1251. return $this->accountSortingMemoPhrases;
  1252. }
  1253. /**
  1254. * Set matterRequestDefaults.
  1255. *
  1256. * @param MatterRequestDefaults|null $matterRequestDefaults
  1257. *
  1258. * @return Account
  1259. */
  1260. public function setMatterRequestDefaults(?MatterRequestDefaults $matterRequestDefaults = null)
  1261. {
  1262. $this->matterRequestDefaults = $matterRequestDefaults;
  1263. return $this;
  1264. }
  1265. /**
  1266. * Get matterRequestDefaults.
  1267. *
  1268. * @return MatterRequestDefaults|null
  1269. */
  1270. public function getMatterRequestDefaults()
  1271. {
  1272. return $this->matterRequestDefaults;
  1273. }
  1274. /**
  1275. * Returns the return details address.
  1276. *
  1277. * @return ContactableAddress|null
  1278. */
  1279. public function getReturnDetailsAddress(): ?ContactableAddress
  1280. {
  1281. if ($this->getOffices() && $this->getOffices()->first()) {
  1282. return $this->getOffices()->first();
  1283. }
  1284. return null;
  1285. }
  1286. /**
  1287. * Set matterCreationProcess.
  1288. *
  1289. * @param string|null $matterCreationProcess
  1290. *
  1291. * @return Account
  1292. */
  1293. public function setMatterCreationProcess($matterCreationProcess = null): Account
  1294. {
  1295. $this->matterCreationProcess = $matterCreationProcess;
  1296. return $this;
  1297. }
  1298. /**
  1299. * Set customIndexHeader.
  1300. *
  1301. * @param string|null $customIndexHeader
  1302. *
  1303. * @return Account
  1304. */
  1305. public function setCustomIndexHeader($customIndexHeader = null)
  1306. {
  1307. $this->custom_index_header = $customIndexHeader;
  1308. return $this;
  1309. }
  1310. /**
  1311. * Get customIndexHeader.
  1312. *
  1313. * @return string|null
  1314. */
  1315. public function getCustomIndexHeader()
  1316. {
  1317. return $this->custom_index_header;
  1318. }
  1319. /**
  1320. * Get matterCreationProcess.
  1321. *
  1322. * @return string|null
  1323. */
  1324. public function getMatterCreationProcess(): ?string
  1325. {
  1326. return $this->matterCreationProcess;
  1327. }
  1328. /**
  1329. * Returns true if the client has access to classic matter creation.
  1330. *
  1331. * @return bool
  1332. */
  1333. public function hasAccessToClassicMatterCreation(): bool
  1334. {
  1335. return $this->matterCreationProcess === self::MATTER_CREATION_PROCESS_CLASSIC || $this->matterCreationProcess === self::MATTER_CREATION_PROCESS_ALL || $this->matterCreationProcess === null;
  1336. }
  1337. /**
  1338. * Returns true if the client has access to standard matter creation.
  1339. *
  1340. * @return bool
  1341. */
  1342. public function hasAccessToStandardMatterCreation(): bool
  1343. {
  1344. return $this->matterCreationProcess === self::MATTER_CREATION_PROCESS_STANDARD || $this->matterCreationProcess === self::MATTER_CREATION_PROCESS_ALL;
  1345. }
  1346. /**
  1347. * Returns matter creations options as an array, usable as the choices for a form.
  1348. *
  1349. * @return array
  1350. */
  1351. public static function getMatterCreationProcessOptions(): array
  1352. {
  1353. $matterCreationProcessOptions = self::getConstantsWithLabelsAsChoices('MATTER_CREATION_PROCESS');
  1354. return array_flip($matterCreationProcessOptions);
  1355. }
  1356. /**
  1357. * Returns a human readable version of matterCreationProcess.
  1358. *
  1359. * @return string
  1360. */
  1361. public function getMatterCreationProcessName()
  1362. {
  1363. $options = self::getMatterCreationProcessOptions();
  1364. return $options[$this->getMatterCreationProcess()] ?? $this->getMatterCreationProcess();
  1365. }
  1366. /**
  1367. * Get the value of standardIndexHeader
  1368. *
  1369. * @return string|null
  1370. */
  1371. public function getStandardIndexHeader()
  1372. {
  1373. return $this->standardIndexHeader;
  1374. }
  1375. /**
  1376. * Set the value of standardIndexHeader
  1377. *
  1378. * @param string|null $standardIndexHeader
  1379. *
  1380. * @return self
  1381. */
  1382. public function setStandardIndexHeader($standardIndexHeader)
  1383. {
  1384. $this->standardIndexHeader = $standardIndexHeader;
  1385. return $this;
  1386. }
  1387. /**
  1388. * Set canCreateBatchAndSort.
  1389. *
  1390. * @param bool $canCreateBatchAndSort
  1391. *
  1392. * @return Account
  1393. */
  1394. public function setCanCreateBatchAndSort($canCreateBatchAndSort)
  1395. {
  1396. $this->canCreateBatchAndSort = $canCreateBatchAndSort;
  1397. return $this;
  1398. }
  1399. /**
  1400. * Get canCreateBatchAndSort.
  1401. *
  1402. * @return bool
  1403. */
  1404. public function getCanCreateBatchAndSort()
  1405. {
  1406. return $this->canCreateBatchAndSort;
  1407. }
  1408. /**
  1409. * Set matchOptIn.
  1410. *
  1411. * @param bool $matchOptIn
  1412. *
  1413. * @return Account
  1414. */
  1415. public function setMatchOptIn(bool $matchOptIn): self
  1416. {
  1417. $this->matchOptIn = $matchOptIn;
  1418. return $this;
  1419. }
  1420. /**
  1421. * Get matchOptIn.
  1422. *
  1423. * @return bool
  1424. */
  1425. public function getMatchOptIn(): bool
  1426. {
  1427. return $this->matchOptIn;
  1428. }
  1429. /**
  1430. * getAllowExpertViewUnsortedRecords
  1431. *
  1432. * @return bool
  1433. */
  1434. public function getAllowExpertViewUnsortedRecords(): bool
  1435. {
  1436. return $this->allowExpertViewUnsortedRecords;
  1437. }
  1438. /**
  1439. * @param bool $allowExpertViewUnsortedRecords
  1440. *
  1441. * @return self
  1442. */
  1443. public function setAllowExpertViewUnsortedRecords(bool $allowExpertViewUnsortedRecords): self
  1444. {
  1445. $this->allowExpertViewUnsortedRecords = $allowExpertViewUnsortedRecords;
  1446. return $this;
  1447. }
  1448. /**
  1449. * @return bool
  1450. */
  1451. public function getMatterClosureQuestionsOptional(): bool
  1452. {
  1453. return $this->matterClosureQuestionsOptional;
  1454. }
  1455. /**
  1456. * @param bool $matterClosureQuestionsOptional
  1457. *
  1458. * @return Account
  1459. */
  1460. public function setMatterClosureQuestionsOptional(bool $matterClosureQuestionsOptional): self
  1461. {
  1462. $this->matterClosureQuestionsOptional = $matterClosureQuestionsOptional;
  1463. return $this;
  1464. }
  1465. /**
  1466. * @return bool|null
  1467. *
  1468. */
  1469. public function getUseParentClinicalSectionsOnly(): ?bool
  1470. {
  1471. return $this->useParentClinicalSectionsOnly;
  1472. }
  1473. /**
  1474. * @param bool $useParentClinicalSectionsOnly
  1475. *
  1476. * @return self
  1477. *
  1478. */
  1479. public function setUseParentClinicalSectionsOnly(bool $useParentClinicalSectionsOnly): self
  1480. {
  1481. $this->useParentClinicalSectionsOnly = $useParentClinicalSectionsOnly;
  1482. return $this;
  1483. }
  1484. public function getFirm(): ?Firm
  1485. {
  1486. return $this->firm;
  1487. }
  1488. public function setFirm(?Firm $firm): self
  1489. {
  1490. $this->firm = $firm;
  1491. return $this;
  1492. }
  1493. /**
  1494. * @return bool
  1495. */
  1496. public function getHideLogoFromIndex(): bool
  1497. {
  1498. return $this->hideLogoFromIndex;
  1499. }
  1500. /**
  1501. * @param bool $hideLogoFromIndex
  1502. *
  1503. * @return self
  1504. */
  1505. public function setHideLogoFromIndex(bool $hideLogoFromIndex): self
  1506. {
  1507. $this->hideLogoFromIndex = $hideLogoFromIndex;
  1508. return $this;
  1509. }
  1510. /**
  1511. * @return array|null
  1512. *
  1513. */
  1514. public function getAllowedMatterTypes(): ?array
  1515. {
  1516. return $this->allowedMatterTypes;
  1517. }
  1518. /**
  1519. * @param array|null $allowedMatterTypes
  1520. *
  1521. * @return self
  1522. *
  1523. */
  1524. public function setAllowedMatterTypes(?array $allowedMatterTypes): self
  1525. {
  1526. $this->allowedMatterTypes = $allowedMatterTypes;
  1527. return $this;
  1528. }
  1529. /**
  1530. * @return array
  1531. */
  1532. public static function getAllowedMatterTypeOptions(): array
  1533. {
  1534. return self::getConstantsWithLabelsAsChoices('MATTER_TYPE');
  1535. }
  1536. /**
  1537. * @return Collection<int, LicenceRenewalTerm>
  1538. */
  1539. public function getLicenceRenewalTerms(): Collection
  1540. {
  1541. return $this->licenceRenewalTerms;
  1542. }
  1543. /**
  1544. * @return Collection<int, LicenceRenewalTerm>
  1545. */
  1546. public function getZeroPeriodLicenceRenewalTerms(): Collection
  1547. {
  1548. return $this->licenceRenewalTerms->filter(function ($term) {
  1549. return $term->getPeriod() === 0;
  1550. });
  1551. }
  1552. /**
  1553. * @param LicenceRenewalTerm $licenceRenewalTerm
  1554. *
  1555. * @return self
  1556. */
  1557. public function addLicenceRenewalTerm(LicenceRenewalTerm $licenceRenewalTerm): self
  1558. {
  1559. if (!$this->licenceRenewalTerms->contains($licenceRenewalTerm)) {
  1560. $this->licenceRenewalTerms[] = $licenceRenewalTerm;
  1561. $licenceRenewalTerm->setAccount($this);
  1562. }
  1563. return $this;
  1564. }
  1565. /**
  1566. * @param LicenceRenewalTerm $licenceRenewalTerm
  1567. *
  1568. * @return self
  1569. */
  1570. public function removeLicenceRenewalTerm(LicenceRenewalTerm $licenceRenewalTerm): self
  1571. {
  1572. if ($this->licenceRenewalTerms->removeElement($licenceRenewalTerm)) {
  1573. // set the owning side to null (unless already changed)
  1574. if ($licenceRenewalTerm->getAccount() === $this) {
  1575. $licenceRenewalTerm->setAccount(null);
  1576. }
  1577. }
  1578. return $this;
  1579. }
  1580. /**
  1581. * @return bool|null
  1582. */
  1583. public function isEnforceTwoFactorAuth(): ?bool
  1584. {
  1585. return $this->enforceTwoFactorAuth;
  1586. }
  1587. /**
  1588. * @param bool $enforceTwoFactorAuth
  1589. *
  1590. * @return self
  1591. */
  1592. public function setEnforceTwoFactorAuth(bool $enforceTwoFactorAuth): self
  1593. {
  1594. $this->enforceTwoFactorAuth = $enforceTwoFactorAuth;
  1595. return $this;
  1596. }
  1597. /**
  1598. * @return bool|null
  1599. */
  1600. public function isAllowTwoFactorAuthGracePeriod(): ?bool
  1601. {
  1602. return $this->allowTwoFactorAuthGracePeriod;
  1603. }
  1604. /**
  1605. * @param bool $allowTwoFactorAuthGracePeriod
  1606. *
  1607. * @return self
  1608. */
  1609. public function setAllowTwoFactorAuthGracePeriod(bool $allowTwoFactorAuthGracePeriod): self
  1610. {
  1611. $this->allowTwoFactorAuthGracePeriod = $allowTwoFactorAuthGracePeriod;
  1612. return $this;
  1613. }
  1614. /**
  1615. * Checks if the client is not liable for the disclosure fee.
  1616. *
  1617. * @return bool True if the client is not liable, false otherwise.
  1618. */
  1619. public function isClientNotLiableForDisclosureFee(): bool
  1620. {
  1621. return $this->clientNotLiableForDisclosureFee;
  1622. }
  1623. /**
  1624. * Sets whether the client is not liable for the disclosure fee.
  1625. *
  1626. * @param bool $clientNotLiableForDisclosureFee True if the client is not liable, false otherwise.
  1627. *
  1628. * @return self
  1629. */
  1630. public function setClientNotLiableForDisclosureFee(bool $clientNotLiableForDisclosureFee): self
  1631. {
  1632. $this->clientNotLiableForDisclosureFee = $clientNotLiableForDisclosureFee;
  1633. return $this;
  1634. }
  1635. /**
  1636. * Returns an array of permitted values for the country of registration field and their
  1637. * associated labels.
  1638. *
  1639. * @return array
  1640. */
  1641. public static function getCountryOfRegistrationOptions()
  1642. {
  1643. return [
  1644. self::COUNTRY_OF_REGISTRATION_ENGLAND_AND_WALES => self::COUNTRY_OF_REGISTRATION_ENGLAND_AND_WALES__LABEL,
  1645. self::COUNTRY_OF_REGISTRATION_SCOTLAND => self::COUNTRY_OF_REGISTRATION_SCOTLAND__LABEL,
  1646. self::COUNTRY_OF_REGISTRATION_NORTHERN_IRELAND => self::COUNTRY_OF_REGISTRATION_NORTHERN_IRELAND__LABEL,
  1647. ];
  1648. }
  1649. /**
  1650. * Get trading_name.
  1651. *
  1652. * @return string|null
  1653. */
  1654. public function getTradingName(): ?string
  1655. {
  1656. return $this->trading_name;
  1657. }
  1658. /**
  1659. * Set trading_name.
  1660. *
  1661. * @param string|null $trading_name
  1662. *
  1663. * @return self
  1664. */
  1665. public function setTradingName(?string $trading_name): self
  1666. {
  1667. $this->trading_name = $trading_name;
  1668. return $this;
  1669. }
  1670. /**
  1671. * Get company_registration_number.
  1672. *
  1673. * @return string|null
  1674. */
  1675. public function getCompanyRegistrationNumber(): ?string
  1676. {
  1677. return $this->company_registration_number;
  1678. }
  1679. /**
  1680. * Set company_registration_number.
  1681. *
  1682. * @param string|null $company_registration_number
  1683. *
  1684. * @return self
  1685. */
  1686. public function setCompanyRegistrationNumber(?string $company_registration_number): self
  1687. {
  1688. $this->company_registration_number = $company_registration_number;
  1689. return $this;
  1690. }
  1691. /**
  1692. * Get country_of_registration.
  1693. *
  1694. * @return string|null
  1695. */
  1696. public function getCountryOfRegistration(): ?string
  1697. {
  1698. return $this->country_of_registration;
  1699. }
  1700. /**
  1701. * Set country_of_registration.
  1702. *
  1703. * @param string|null $country_of_registration
  1704. *
  1705. * @return self
  1706. */
  1707. public function setCountryOfRegistration(?string $country_of_registration): self
  1708. {
  1709. $this->country_of_registration = $country_of_registration;
  1710. return $this;
  1711. }
  1712. /**
  1713. * Returns a human-readable version of the country of registration
  1714. *
  1715. * @return string
  1716. */
  1717. public function getCountryOfRegistrationName()
  1718. {
  1719. $options = self::getCountryOfRegistrationOptions();
  1720. return $options[$this->getCountryOfRegistration()] ?? $this->getCountryOfRegistration();
  1721. }
  1722. }