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