<?php
namespace Evo\Infrastructure\MappingORM;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiSubresource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Serializer\Filter\GroupFilter;
use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
use App\DTO\ClientBaseExport;
use App\Enum\DocumentStatusEnum;
use App\Enum\DocumentTypeOrganizationEnum;
use App\Enum\LegalRepresentativeQualityTypeEnum;
use App\Enum\OrganizationStatusEnum;
use App\Enum\OrganizationStatusPayedEnum;
use App\Enum\PersonTypeEnum;
use App\Enum\ProductKeyEnum;
use App\Enum\VATRateEnum;
use App\Service\SubscriptionUtils;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ApiResource(
* mercure={"normalization_context"={"groups"="admin_orga_list"}},
* attributes={
* "normalization_context"={"groups"={"read_organization"}, "enable_max_depth"=true},
* "denormalization_context"={"groups"={"write_organization"}}
* },
* collectionOperations={
* "get",
* "post",
* "validation_kyc"={
* "method"="GET",
* "path"="/{status}/validationkyc/document",
* "security"="is_granted('ROLE_ADMIN')"
* },
* "validation_kyc_postal_power"={
* "method"="GET",
* "path"="/validationkyc/postalpower",
* "security"="is_granted('ROLE_ADMIN')"
* },
* "validation_kyc_kbis"={
* "method"="GET",
* "path"="/validationkyc/kbis",
* "security"="is_granted('ROLE_ADMIN')"
* },
* "impaye"={
* "method"="GET",
* "path"="/organizations/impaye",
* "security"="is_granted('ROLE_ADMIN')"
* },
* "impaye_export"={
* "method"="GET",
* "path"="/organizations/impaye/export",
* "formats"={"csv"={"text/csv"}},
* "pagination_enabled"=false,
* "security"="is_granted('ROLE_ADMIN')"
* },
* "global_search"={
* "method"="GET",
* "path"="/organizations/search",
* "normalization_context"={"groups"={"admin_orga_list"}, "enable_max_depth"=true},
* "security"="is_granted('ROLE_ADMIN')"
* },
* "client_base_export"={
* "method"="GET",
* "path"="/clients/export",
* "formats"={"csv"={"text/csv"}},
* "pagination_enabled"=false,
* "output"=ClientBaseExport::class,
* "normalization_context"={"groups"={"client-base-export"}},
* "security"="is_granted('ROLE_SUPER_ADMIN')"
* },
* "ibml_organization_list"={
* "method"="GET",
* "path"="/show/all/organization-ibml",
* "security"="is_granted('ROLE_ADMIN')"
* },
* "comparison_kyc"={
* "method"="GET",
* "path"="/comparisonkyc/{id}",
* "security"="is_granted('ROLE_ADMIN')",
* "paginationEnabled"=false
* }
* },
* itemOperations={
* "get",
* "put",
* }
* )
* @ApiFilter(
* SearchFilter::class,
* properties={
* "id":"exact",
* "users.lastname":"partial",
* "users.firstname":"partial",
* "users.email":"partial",
* "users.phoneNumber":"partial",
* "legalName": "partial",
* "invoiceToken": "exact",
* "SIRET": "start",
* "bal": "exact",
* "status": "exact",
* "store.id": "exact",
* "statusInvoicePayed":"exact",
* "legalRepresentatives.person.familyName": "partial",
* "legalRepresentatives.person.givenName": "partial"
* }
* )
* @ApiFilter(PropertyFilter::class)
* @ApiFilter(OrderFilter::class, arguments={"orderParameterName"="order"})
* @ApiFilter(GroupFilter::class, arguments={"parameterName": "groups", "overrideDefaultGroups": true})
* @ApiFilter(BooleanFilter::class, properties={"isNewImmatriculation"})
* @ApiFilter(DateFilter::class, properties={"createdAt"})
* @ORM\Entity(repositoryClass="App\Repository\OrganizationRepository")
*/
class Organization
{
/**
* @Groups({
* "admin_orga_list",
* "admin:orga:select",
* "read_organization",
* "read_letter_forward",
* "read_search",
* "read_document",
* "admin:doc:list",
* "read_invoice",
* "admin:invoice:read",
* "admin:read:letter",
* "read_quote",
* "admin:quote:read",
* "read_user",
* "write_user",
* "read_credit_note",
* "admin:cn:read",
* "read:activity",
* "admin:user:read",
* "read_potential_case",
* "read_letter",
* "read_comparisonkyc",
* "pappers_activity",
* "pappers_activity_list"
* })
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private ?int $id = null;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization"})
* @ORM\ManyToMany(targetEntity="User", inversedBy="organizations", cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
private ?Collection $users;
/**
* @Groups({"read_organization", "write_organization"})
* @MaxDepth(1)
* @ORM\ManyToMany(targetEntity="Evo\Infrastructure\MappingORM\Associate", inversedBy="organizations", cascade={"persist"})
*/
private ?Collection $associates;
// Ne pas ajouter "read_organization" : problématique de performances
/**
* @Groups({"write_organization", "read_search", "read_export_organization", "admin_orga_list", "pappers_activity"})
* @ORM\ManyToMany(targetEntity="Evo\Infrastructure\MappingORM\LegalRepresentative", inversedBy="organizations", cascade={"persist"})
* @MaxDepth(1)
* @ORM\JoinColumn(nullable=false)
*/
private ?Collection $legalRepresentatives;
/**
* @Groups({"read_organization", "write_organization"})
* @MaxDepth(1)
* @ORM\ManyToMany(targetEntity="Evo\Infrastructure\MappingORM\Auditor", inversedBy="organizations", cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
private ?Collection $auditors;
// Ne pas ajouter "read_organization" : problématique de performances
/**
* @Groups({"write_organization"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Document", mappedBy="organization", cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
private Collection $documents;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @MaxDepth(1)
* @ORM\OneToOne(targetEntity="Evo\Infrastructure\MappingORM\PostalAddress", cascade={"persist"})
*/
private ?PostalAddress $address = null;
/**
* @Groups({
* "admin_orga_list",
* "admin:orga:select",
* "read_organization",
* "write_organization",
* "read_search",
* "read_lead",
* "read_export_organization",
* "read_document",
* "admin:doc:list",
* "admin:read:letter",
* "read_invoice",
* "admin:invoice:read",
* "read_quote",
* "admin:quote:read",
* "read_credit_note",
* "admin:cn:read",
* "admin:user:read",
* "read_potential_case",
* "read_zappier_letter",
* "read_zappier_invoice",
* "read_letter",
* "read_comparisonkyc",
* "read_letter_forward",
* "read:activity",
* "pappers_activity",
* "pappers_activity_list"
* })
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $legalName;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $telephone;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $vatID;
/**
* @Assert\Choice(callback={"App\Enum\LegalStatusTypeEnum", "getChoices"})
* @Groups({"read_organization", "write_organization", "read_search", "read_document", "admin:doc:list", "admin_orga_list", "pappers_activity"})
* @ORM\Column(type="string", length=150, nullable=true)
*/
private ?string $legalStatus = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="text", nullable=true)
*/
private $purpose;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $foundingDate = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $fiscalDate = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $fiscalDateEnd = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $firstFiscalDate = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $firstFiscalDateEnd = null;
/**
* @Groups({"read_organization", "write_organization", "read_search", "admin_orga_list", "read:activity", "pappers_activity"})
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $headQuartersAddressType;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $legalRepresentativeAddressType;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="float", nullable=true)
*/
private ?float $shareCapital = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=150, nullable=true)
*/
private $shareCapitalType;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="float", nullable=true)
*/
private ?float $shareCapitalFixedAmount = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $sharesCount = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $bankChoice = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $registrationSource = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $commercialCourtRegistry = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\Accountant", inversedBy="organizations", cascade={"persist"})
*/
private ?Accountant $accountant = null;
/**
* @Groups({"write_organization"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Letter", mappedBy="organization")
*/
private ?Collection $letters;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\OrganizationSector", inversedBy="organizations")
*/
private ?OrganizationSector $sector = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $sectorOther = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $RCS = null;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization", "read_search", "read_lead", "read_document", "admin:doc:list", "admin:orga:select", "admin:user:read"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $status = null;
/**
* @Groups({"read_organization", "write_organization", "read_search", "read:activity", "pappers_activity", "pappers_activity_list"})
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Email
*/
private ?string $email = null;
/**
* @Groups({"read_organization", "write_organization", "read_search", "admin:orga:select", "admin_orga_list"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\Store", inversedBy="organizations")
*/
private ?Store $store = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", nullable=true)
*/
private ?string $mandatary = null;
/**
* @Groups({
* "admin_orga_list",
* "read_organization",
* "write_organization",
* "read_search",
* "read_export_organization",
* "admin:read:letter"
* })
* @ORM\Column(type="string", nullable=true)
*/
private ?string $bal = null;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @ORM\Column(type="string", nullable=true)
*/
private ?string $forwardingFrequency = null;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @MaxDepth(1)
* @ORM\OneToOne(targetEntity="Evo\Infrastructure\MappingORM\PostalAddress", cascade={"persist"})
*/
private ?PostalAddress $forwardingAddress = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $forwardingAddressName = null;
/**
* @Groups({"read_organization", "write_organization", "read_search", "read_export_organization", "pappers_activity"})
* @ORM\Column(type="string", nullable=true)
*/
private $alternateName;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $domiciliationStartDate = null;
/**
* @Groups({"read_organization", "admin_orga_list", "read_potential_case"})
* @ORM\Column(name="created_at", type="datetime", nullable=true)
*/
private $createdAt;
/**
* @MaxDepth(1)
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\LetterForward", mappedBy="organization", cascade={"persist"})
* @ORM\JoinColumn(nullable=true)
*/
private ?Collection $forwardedLetters;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $terminationDate = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $terminationReason = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $terminationReasonOther = null;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Mandatary", mappedBy="organization", cascade={"persist"})
*/
private ?Collection $mandataries;
/**
* @Groups({"read_organization", "write_organization", "read_potential_case"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\Organization", inversedBy="organizationsPrescribed")
*/
private $prescriber;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Organization", mappedBy="prescriber")
*/
private ?Collection $organizationsPrescribed;
/**
* @Groups({"write_organization"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Invoice", mappedBy="organization")
*/
private ?Collection $invoices;
/**
* @Groups({"write_organization"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Quote", mappedBy="organization")
*/
private ?Collection $quotes;
/**
* @Groups({"read_organization", "write_organization", "admin_orga_list"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $SIRET = null;
/**
* @Groups({
* "read_organization",
* "write_organization",
* "read_search",
* "read_lead",
* "admin_orga_list"
* })
* @ORM\Column(type="boolean")
*/
private $isNewImmatriculation = 0;
/**
* @Groups({"read_organization", "write_organization", "read_lead"})
* @ORM\Column(type="boolean")
*/
private $isNewDomiciliation = 0;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\Order", mappedBy="organization", cascade={"persist"})
*/
private ?Collection $orders;
/**
* @Groups({"read_organization", "write_organization", "admin:invoice:read"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $mandatID = null;
/**
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\DocumentHistory", mappedBy="organization")
*/
private ?Collection $documentHistories;
/**
* @Assert\Choice(callback={"App\Enum\OrganizationConversionReasonEnum", "getChoices"})
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $conversionReason = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean")
*/
private $statusIsForced = 0;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $uniqId = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $iban = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $referenceGocardless = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean")
*/
private $isForwardingActive = 1;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255)
*/
private ?string $VATRate = VATRateEnum::VAT_20;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isImported;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="float")
*/
private $creditNotesAmount = 0;
/**
* @ORM\OneToMany(targetEntity="Evo\Infrastructure\MappingORM\CreditNote", mappedBy="organization")
*/
private ?Collection $creditNotes;
/**
* @ORM\Column(type="float", nullable=true)
*/
private ?float $availableCredits = null;
/**
* @Groups({"read_organization"})
* @ORM\Column(type="string", length=255, nullable=true, unique=true)
*/
private ?string $invoiceToken = null;
/**
* @Groups({"read_organization", "write_organization", "read_notification_preference", "write_notification_preference"})
* @ORM\OneToOne(targetEntity="Evo\Infrastructure\MappingORM\NotificationPreference", inversedBy="organization", cascade={"persist", "remove"})
*/
private ?NotificationPreference $notificationPreference = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $shareCapitalFreePercentage = null;
/**
* @Groups({"read_organization", "write_organization", "admin_orga_list", "read_potential_case"})
* @ORM\Column(type="boolean")
*/
private $isPrescriber = false;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $haveAccountant;
/**
* @Groups({"read_organization", "write_organization", "read_discount", "write_discount"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\DiscountCode", inversedBy="organizations")
*/
private ?DiscountCode $discountCode = null;
/**
* @Groups({"read_organization", "write_organization", "write_lead"})
* @ORM\OneToOne(targetEntity="Evo\Infrastructure\MappingORM\Lead", mappedBy="organization", cascade={"persist", "remove"})
*/
private ?Lead $lead = null;
/**
* @Groups({"read_organization", "write_organization", "read_search", "read_lead"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $statusImmatriculation = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\PrescriberSource", inversedBy="organization")
*/
private ?PrescriberSource $prescriberSource = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isExemptTVA = false;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $projectStage = null;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization"})
* @ORM\Column(type="string")
*/
private ?string $statusInvoicePayed = OrganizationStatusPayedEnum::NO_INVOICES;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $dateMaxUnpaid = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isHaveAuditor = false;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=100, nullable=true)
*/
private ?string $benefitImposition = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $benefitImpositionOption = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $vatTaxeRegim = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $vatTaxeRegimeOption = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $prolongationDateKYC = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\ReasonUnpaid", inversedBy="organizations")
*/
private ?ReasonUnpaid $reasonUnpaid = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity="Evo\Infrastructure\MappingORM\ReasonRIBInactive", inversedBy="organizations")
*/
private ?ReasonRIBInactive $reasonRIBInactive = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $statusTransfert = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isNewTransfert = 0;
/**
* @Groups({"read_organization", "write_organization", "read_search"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $specialRequestBal = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $tracFin;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="text", nullable=true)
*/
private ?string $tracFinNote = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $packImat;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAuthorizePrescriber = 0;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAttachedToPrescriber;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isEmptybal;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true, options={"default" : true})
*/
private $isAuthorizedDebit = true;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $historyNavTunnel = null;
/**
* @ORM\OneToMany(targetEntity=ActivityLog::class, mappedBy="organization")
*/
private ?Collection $activityLogs;
/**
* @ApiSubresource()
* @Groups({"read_organization", "write_organization", "admin_orga_list"})
* @ORM\OneToMany(targetEntity=Subscription::class, mappedBy="organization", cascade={"persist"})
*/
private Collection $subscriptions;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="text", nullable=true)
*/
private ?string $note = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="text", nullable=true)
*/
private ?string $reasonChange = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $previousPack = null;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $zapierHookUrl = [];
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $sigle = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $enseigne = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="text", nullable=true)
*/
private ?string $corporateObject = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $placeKnowDigidom = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $otherPlaceKnownDigidom = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $bankName = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $titulaire = null;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true, options={"default" : false})
*/
private $isInvalidEmail = false;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true, options={"default" : false})
*/
private $isInvalidPhoneNumber = false;
/**
* @Groups({"read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $specialCustomerType = null;
/**
* @ORM\OneToOne(targetEntity=IbmlOrganizationConfiguration::class, mappedBy="organization", cascade={"persist", "remove"})
*/
private ?IbmlOrganizationConfiguration $ibmlOrganizationConfiguration = null;
/**
* @ORM\ManyToMany(targetEntity="Evo\Infrastructure\MappingORM\PotentialCase", mappedBy="organizations")
*/
private ?Collection $potentialCases;
/**
* @ORM\OneToMany(targetEntity=CommercialGesture::class, mappedBy="organization")
*/
private ?Collection $commercialGestures;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity=ProfessionDetail::class, inversedBy="organizations")
*/
private ?ProfessionDetail $activityCategory = null;
/**
* @ORM\ManyToOne(targetEntity=Organization::class, inversedBy="godSons")
*/
private $referralSource;
/**
* @ORM\OneToMany(targetEntity=Organization::class, mappedBy="referralSource")
*/
private ?Collection $godSons;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization"})
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $encryptedParentId = null;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isReferralProcessFinished = true;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization"})
* @ORM\Column(type="boolean", nullable=true)
*/
private $isDigidomAccountant;
/**
* @Groups({"admin_orga_list", "read_organization", "write_organization"})
* @ORM\ManyToOne(targetEntity=ActivityDomain::class, inversedBy="organizations")
*/
private ?ActivityDomain $activityDomain = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private bool $isSurveillance = false;
/**
* @Groups({"read_organization"})
* @ORM\Column(type="json", nullable=true)
*/
private ?array $beneficialOwners = [];
/**
* @ORM\Column(type="string", length=4, nullable=true)
*/
private ?string $accountsSubmissionLastYear = null;
/**
* @ORM\OneToOne(targetEntity=ProcessYousign::class, mappedBy="organization", cascade={"persist"})
*/
private ?ProcessYousign $processYousign = null;
public function __construct()
{
$this->users = new ArrayCollection();
$this->associates = new ArrayCollection();
$this->legalRepresentatives = new ArrayCollection();
$this->auditors = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->letters = new ArrayCollection();
$this->status = OrganizationStatusEnum::NEW;
$this->forwardedLetters = new ArrayCollection();
$this->mandataries = new ArrayCollection();
$this->organizationsPrescribed = new ArrayCollection();
$this->invoices = new ArrayCollection();
$this->quotes = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->documentHistories = new ArrayCollection();
$this->creditNotes = new ArrayCollection();
$this->activityLogs = new ArrayCollection();
$this->subscriptions = new ArrayCollection();
$this->createdAt = new \DateTime();
$this->potentialCases = new ArrayCollection();
$this->commercialGestures = new ArrayCollection();
$this->godSons = new ArrayCollection();
}
public function __toString()
{
return (null !== $this->getLegalName()) ? $this->getLegalName().' '.$this->getLegalStatus() : (string) $this->getID();
}
public function getLegalName(): ?string
{
return $this->legalName;
}
public function setLegalName($legalName): self
{
$this->legalName = $legalName;
return $this;
}
public function getLegalStatus(): ?string
{
return $this->legalStatus;
}
public function setLegalStatus(?string $legalStatus): self
{
$this->legalStatus = $legalStatus;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getUsers(): array
{
$currentUser = array_filter($this->users->getValues(), function (User $user) {
return $user->getEmail() === $this->getEmail();
});
$otherUser = array_filter($this->users->getValues(), function (User $user) {
return $user->getEmail() !== $this->getEmail();
});
return array_merge($currentUser, $otherUser);
}
public function setUsers(?Collection $users): Organization
{
$this->users = $users;
return $this;
}
/**
* @return Organization
*/
public function addUser(User $user)
{
if (!$this->users->contains($user)) {
$this->users->add($user);
}
return $this;
}
/**
* @return Organization
*/
public function removeUser(User $user)
{
$this->users->removeElement($user);
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone($telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getVatID(): ?string
{
return $this->vatID;
}
public function setVatID($vatID): self
{
$this->vatID = $vatID;
return $this;
}
public function getAddress(): ?PostalAddress
{
return $this->address;
}
public function setAddress(PostalAddress $address): self
{
$this->address = $address;
return $this;
}
public function getPurpose(): ?string
{
return $this->purpose;
}
public function setPurpose($purpose): self
{
$this->purpose = $purpose;
return $this;
}
public function getFoundingDate(): ?\DateTimeInterface
{
return $this->foundingDate;
}
public function setFoundingDate(?\DateTimeInterface $foundingDate): self
{
$this->foundingDate = $foundingDate;
return $this;
}
public function getFiscalDate(): ?\DateTimeInterface
{
return $this->fiscalDate;
}
public function setFiscalDate(?\DateTimeInterface $fiscalDate): self
{
$this->fiscalDate = $fiscalDate;
return $this;
}
public function getFiscalDateEnd(): ?\DateTimeInterface
{
return $this->fiscalDateEnd;
}
public function setFiscalDateEnd(?\DateTimeInterface $fiscalDateEnd): self
{
$this->fiscalDateEnd = $fiscalDateEnd;
return $this;
}
public function getFirstFiscalDateEnd(): ?\DateTimeInterface
{
return $this->firstFiscalDateEnd;
}
public function setFirstFiscalDateEnd(?\DateTimeInterface $firstFiscalDateEnd): self
{
$this->firstFiscalDateEnd = $firstFiscalDateEnd;
return $this;
}
public function getHeadQuartersAddressType(): ?string
{
return $this->headQuartersAddressType;
}
public function setHeadQuartersAddressType($headQuartersAddressType): self
{
$this->headQuartersAddressType = $headQuartersAddressType;
return $this;
}
public function getLegalRepresentativeAddressType(): ?string
{
return $this->legalRepresentativeAddressType;
}
public function setLegalRepresentativeAddressType($legalRepresentativeAddressType): self
{
$this->legalRepresentativeAddressType = $legalRepresentativeAddressType;
return $this;
}
public function getShareCapital(): ?float
{
return $this->shareCapital;
}
public function setShareCapital(float $shareCapital): self
{
$this->shareCapital = $shareCapital;
return $this;
}
public function getShareCapitalType(): ?string
{
return $this->shareCapitalType;
}
public function setShareCapitalType($shareCapitalType): self
{
$this->shareCapitalType = $shareCapitalType;
return $this;
}
public function getShareCapitalFixedAmount(): ?float
{
return $this->shareCapitalFixedAmount;
}
public function setShareCapitalFixedAmount(float $shareCapitalFixedAmount): self
{
$this->shareCapitalFixedAmount = $shareCapitalFixedAmount;
return $this;
}
public function getSharesCount(): ?int
{
return $this->sharesCount;
}
public function setSharesCount(int $sharesCount): self
{
$this->sharesCount = $sharesCount;
return $this;
}
/**
* @return Collection|Associate[]
*/
public function getAssociates(): Collection
{
return $this->associates;
}
public function addAssociate(Associate $associate): self
{
if (!$this->associates->contains($associate)) {
$this->associates[] = $associate;
}
return $this;
}
public function removeAssociate(Associate $associate): self
{
if ($this->associates->contains($associate)) {
$this->associates->removeElement($associate);
}
return $this;
}
public function addLegalRepresentative(LegalRepresentative $legalRepresentative): self
{
if (!$this->legalRepresentatives->contains($legalRepresentative)) {
$this->legalRepresentatives[] = $legalRepresentative;
}
return $this;
}
public function removeLegalRepresentative(LegalRepresentative $legalRepresentative): self
{
if ($this->legalRepresentatives->contains($legalRepresentative)) {
$this->legalRepresentatives->removeElement($legalRepresentative);
}
return $this;
}
/**
* @return Collection|Auditor[]
*/
public function getAuditors(): Collection
{
return $this->auditors;
}
public function addAuditor(Auditor $auditor): self
{
if (!$this->auditors->contains($auditor)) {
$this->auditors[] = $auditor;
}
return $this;
}
public function removeAuditor(Auditor $auditor): self
{
if ($this->auditors->contains($auditor)) {
$this->auditors->removeElement($auditor);
}
return $this;
}
/**
* @return Document[]
*/
public function getAllDocuments()
{
$documentsLR = [];
$documentsOrganization = $this->getDocuments();
foreach ($this->getLegalRepresentatives() as $legalRepresentative) {
foreach ($legalRepresentative->getDocuments() as $document) {
$documentsLR[] = $document;
}
}
$arrayCollection = new ArrayCollection(array_merge_recursive($documentsLR, $documentsOrganization));
return $arrayCollection->getValues();
}
public function getDocuments(): array
{
return $this->documents->getValues();
}
public function getDocumentsByType(array $types): array
{
return $this->documents->filter(function (Document $document) use ($types) {
return in_array($document->getType(), $types);
})->getValues();
}
/**
* @return LegalRepresentative[]|Collection
*/
public function getLegalRepresentatives()
{
return $this->legalRepresentatives;
}
/**
* @return Organization
*/
public function addDocument(Document $document)
{
if (!$this->documents->contains($document)) {
$document->setOrganization($this);
$this->documents->add($document);
}
return $this;
}
public function getFirstFiscalDate(): ?\DateTimeInterface
{
return $this->firstFiscalDate;
}
public function setFirstFiscalDate(?\DateTimeInterface $firstFiscalDate): self
{
$this->firstFiscalDate = $firstFiscalDate;
return $this;
}
public function getPresident()
{
foreach ($this->getLegalRepresentatives() as $legalRepresentative) {
if (LegalRepresentativeQualityTypeEnum::CHAIRMAN == $legalRepresentative->getQuality()) {
return $legalRepresentative;
}
}
return null;
}
public function getGeneralManagers()
{
$list = [];
foreach ($this->getLegalRepresentatives() as $legalRepresentative) {
if (LegalRepresentativeQualityTypeEnum::GENERAL_MANAGER == $legalRepresentative->getQuality()) {
$list[] = $legalRepresentative;
}
}
return $list;
}
public function getFirstNameLegalRepresentative(): ?string
{
if (!$this->getLegalRepresentatives()->isEmpty()) {
return $this->getLegalRepresentatives()->first()->getPerson()->getGivenName();
}
return null;
}
public function getLegalRepresentative()
{
foreach ($this->getLegalRepresentatives() as $legalRepresentative) {
if (in_array($legalRepresentative->getQuality(),
[LegalRepresentativeQualityTypeEnum::MANAGER, LegalRepresentativeQualityTypeEnum::CHAIRMAN])) {
$firstname = '-';
$lastname = '-';
if (null !== $legalRepresentative->getPerson()) {
if (PersonTypeEnum::PHYSICAL === $legalRepresentative->getPerson()->getType()) {
$firstname = $legalRepresentative->getPerson()->getGivenName();
$lastname = $legalRepresentative->getPerson()->getFamilyName();
} else {
$firstname = $legalRepresentative->getPerson()->getLegalName();
$lastname = '('.$legalRepresentative->getPerson()->getLegalStatus().')';
}
}
return $firstname.' '.$lastname;
}
}
return null;
}
public function getPhysicalManagers()
{
return array_filter($this->getManagers(), function (LegalRepresentative $legalRepresentative) {
return $legalRepresentative->getPerson()
&& PersonTypeEnum::PHYSICAL == $legalRepresentative->getPerson()->getType();
});
}
public function getManagers()
{
$list = [];
foreach ($this->getLegalRepresentatives() as $legalRepresentative) {
if (in_array($legalRepresentative->getQuality(), [
LegalRepresentativeQualityTypeEnum::MANAGER,
LegalRepresentativeQualityTypeEnum::CO_MANAGER,
], true)) {
$list[] = $legalRepresentative;
}
}
return $list;
}
public function getBankChoice(): ?string
{
return $this->bankChoice;
}
public function setBankChoice(?string $bankChoice): self
{
$this->bankChoice = $bankChoice;
return $this;
}
public function getRegistrationSource(): ?string
{
return $this->registrationSource;
}
public function setRegistrationSource(?string $registrationSource): self
{
$this->registrationSource = $registrationSource;
return $this;
}
public function getCommercialCourtRegistry(): ?string
{
return $this->commercialCourtRegistry;
}
public function setCommercialCourtRegistry(?string $commercialCourtRegistry): self
{
$this->commercialCourtRegistry = $commercialCourtRegistry;
return $this;
}
public function getAccountant(): ?Accountant
{
return $this->accountant;
}
public function setAccountant(?Accountant $accountant): self
{
$this->accountant = $accountant;
return $this;
}
/**
* @return Collection|Letter[]
*/
public function getLetters(): Collection
{
return $this->letters;
}
public function addLetter(Letter $letter): self
{
if (!$this->letters->contains($letter)) {
$this->letters->add($letter);
$letter->setOrganization($this);
}
return $this;
}
public function removeLetter(Letter $letter): self
{
if ($this->letters->contains($letter)) {
$this->letters->removeElement($letter);
// set the owning side to null (unless already changed)
if ($letter->getOrganization() === $this) {
$letter->setOrganization(null);
}
}
return $this;
}
public function getSector(): ?OrganizationSector
{
return $this->sector;
}
public function setSector(?OrganizationSector $sector): self
{
$this->sector = $sector;
return $this;
}
public function getSectorOther(): ?string
{
return $this->sectorOther;
}
public function setSectorOther(?string $sectorOther): self
{
$this->sectorOther = $sectorOther;
return $this;
}
public function getRCS(): ?string
{
return $this->RCS;
}
public function setRCS(?string $RCS): self
{
$this->RCS = $RCS;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
/**
* @Groups({"read_search"})
*/
public function getStatusTranslated(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getStore(): ?Store
{
return $this->store;
}
public function setStore(?Store $store): self
{
$this->store = $store;
return $this;
}
/**
* @return ?string
*/
public function getBal()
{
return $this->bal;
}
/**
* @param string $bal
*
* @return Organization
*/
public function setBal($bal)
{
$this->bal = $bal;
return $this;
}
/**
* @Groups({"read_search", "read_organization"})
*/
public function getPostalPowerAllowed(): bool
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('type', DocumentTypeOrganizationEnum::POSTAL_POWER_OF_ATTORNEY))
->andWhere(Criteria::expr()->eq('status', DocumentStatusEnum::APPROVED));
if ($this->documents instanceof PersistentCollection) {
$matchingDocuments = $this->documents->matching($criteria);
return $matchingDocuments->count() > 0;
}
return false;
}
/**
* @return ?string
*/
public function getForwardingFrequency()
{
return $this->forwardingFrequency;
}
/**
* @param string $forwardingFrequency
*
* @return Organization
*/
public function setForwardingFrequency($forwardingFrequency)
{
$this->forwardingFrequency = $forwardingFrequency;
return $this;
}
public function getForwardingAddress(): ?PostalAddress
{
return $this->forwardingAddress;
}
public function setForwardingAddress(PostalAddress $forwardingAddress): self
{
$this->forwardingAddress = $forwardingAddress;
return $this;
}
public function getAlternateName()
{
return $this->alternateName;
}
/**
* @return Organization
*/
public function setAlternateName($alternateName)
{
$this->alternateName = $alternateName;
return $this;
}
public function getForwardingAddressName(): ?string
{
return $this->forwardingAddressName;
}
public function setForwardingAddressName(?string $forwardingAddressName): self
{
$this->forwardingAddressName = $forwardingAddressName;
return $this;
}
public function getDomiciliationStartDate(): ?\DateTimeInterface
{
return $this->domiciliationStartDate;
}
public function setDomiciliationStartDate(?\DateTimeInterface $domiciliationStartDate): self
{
$this->domiciliationStartDate = $domiciliationStartDate;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection|LetterForward[]
*/
public function getForwardedLetters(): Collection
{
return $this->forwardedLetters;
}
public function addForwardedLetter(LetterForward $forwardedLetter): self
{
if (!$this->forwardedLetters->contains($forwardedLetter)) {
$this->forwardedLetters[] = $forwardedLetter;
$forwardedLetter->setOrganization($this);
}
return $this;
}
public function removeForwardedLetter(LetterForward $forwardedLetter): self
{
if ($this->forwardedLetters->contains($forwardedLetter)) {
$this->forwardedLetters->removeElement($forwardedLetter);
// set the owning side to null (unless already changed)
if ($forwardedLetter->getOrganization() === $this) {
$forwardedLetter->setOrganization(null);
}
}
return $this;
}
public function getTerminationDate(): ?\DateTimeInterface
{
return $this->terminationDate;
}
public function setTerminationDate(?\DateTimeInterface $terminationDate): self
{
$this->terminationDate = $terminationDate;
return $this;
}
public function getTerminationReason(): ?string
{
return $this->terminationReason;
}
public function setTerminationReason(?string $terminationReason): self
{
$this->terminationReason = $terminationReason;
return $this;
}
public function getTerminationReasonOther(): ?string
{
return $this->terminationReasonOther;
}
public function setTerminationReasonOther(?string $terminationReasonOther): self
{
$this->terminationReasonOther = $terminationReasonOther;
return $this;
}
/**
* @return Collection|Mandatary[]
*/
public function getMandataries(): Collection
{
return $this->mandataries;
}
public function addMandatary(Mandatary $mandatary): self
{
if (!$this->mandataries->contains($mandatary)) {
$this->mandataries[] = $mandatary;
$mandatary->setOrganization($this);
}
return $this;
}
public function removeMandatary(Mandatary $mandatary): self
{
if ($this->mandataries->contains($mandatary)) {
$this->mandataries->removeElement($mandatary);
// set the owning side to null (unless already changed)
if ($mandatary->getOrganization() === $this) {
$mandatary->setOrganization(null);
}
}
return $this;
}
/**
* @return string
*/
public function getMandatary()
{
return $this->mandatary;
}
/**
* @param string $mandatary
*
* @return Organization
*/
public function setMandatary($mandatary)
{
$this->mandatary = $mandatary;
return $this;
}
/**
* @return Collection|self[]
*/
public function getOrganizationsPrescribed(): Collection
{
return $this->organizationsPrescribed;
}
public function addOrganizationsPrescribed(self $organizationsPrescribed): self
{
if (!$this->organizationsPrescribed->contains($organizationsPrescribed)) {
$this->organizationsPrescribed[] = $organizationsPrescribed;
$organizationsPrescribed->setPrescriber($this);
}
return $this;
}
public function removeOrganizationsPrescribed(self $organizationsPrescribed): self
{
if ($this->organizationsPrescribed->contains($organizationsPrescribed)) {
$this->organizationsPrescribed->removeElement($organizationsPrescribed);
// set the owning side to null (unless already changed)
if ($organizationsPrescribed->getPrescriber() === $this) {
$organizationsPrescribed->setPrescriber(null);
}
}
return $this;
}
public function getPrescriber(): ?self
{
return $this->prescriber;
}
public function setPrescriber(?self $prescriber): self
{
$this->prescriber = $prescriber;
return $this;
}
/**
* @return Collection|Invoice[]
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setOrganization($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->contains($invoice)) {
$this->invoices->removeElement($invoice);
// set the owning side to null (unless already changed)
if ($invoice->getOrganization() === $this) {
$invoice->setOrganization(null);
}
}
return $this;
}
/**
* @return Collection|Quote[]
*/
public function getQuotes(): Collection
{
return $this->quotes;
}
public function addQuote(Quote $quote): self
{
if (!$this->quotes->contains($quote)) {
$this->quotes[] = $quote;
$quote->setOrganization($this);
}
return $this;
}
public function removeQuote(Quote $quote): self
{
if ($this->quotes->contains($quote)) {
$this->quotes->removeElement($quote);
// set the owning side to null (unless already changed)
if ($quote->getOrganization() === $this) {
$quote->setOrganization(null);
}
}
return $this;
}
public function getSIRET(): ?string
{
return $this->SIRET;
}
public function setSIRET(?string $SIRET): self
{
$this->SIRET = $SIRET;
return $this;
}
public function getIsNewImmatriculation(): ?bool
{
return $this->isNewImmatriculation;
}
public function setIsNewImmatriculation(bool $isNewImmatriculation): self
{
$this->isNewImmatriculation = $isNewImmatriculation;
return $this;
}
/**
* @Groups({"read_search"})
*
* @deprecated don't use this refer to subscriptionUtils
* Is override, don't forget declare the groups in OrganizationNormalizer
*/
public function getPack(): ?string
{
if ($this->getSubscriptions()->toArray()) {
$packs = '';
foreach ($this->getSubscriptions() as $subscription) {
$subscription->getPack() ? $packs .= $subscription->getPack().',' : '';
}
return $packs;
}
return null;
}
public function getIsNewDomiciliation(): ?bool
{
return $this->isNewDomiciliation;
}
public function setIsNewDomiciliation(bool $isNewDomiciliation): self
{
$this->isNewDomiciliation = $isNewDomiciliation;
return $this;
}
/**
* @return Collection|Order[]
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setOrganization($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->contains($order)) {
$this->orders->removeElement($order);
// set the owning side to null (unless already changed)
if ($order->getOrganization() === $this) {
$order->setOrganization(null);
}
}
return $this;
}
public function getMandatID(): ?string
{
return $this->mandatID;
}
public function setMandatID(?string $mandatID): self
{
$this->mandatID = $mandatID;
return $this;
}
/**
* @return Collection|DocumentHistory[]
*/
public function getDocumentHistories(): Collection
{
return $this->documentHistories;
}
public function addDocumentHistory(DocumentHistory $documentHistory): self
{
if (!$this->documentHistories->contains($documentHistory)) {
$this->documentHistories[] = $documentHistory;
$documentHistory->setOrganization($this);
}
return $this;
}
public function removeDocumentHistory(DocumentHistory $documentHistory): self
{
if ($this->documentHistories->contains($documentHistory)) {
$this->documentHistories->removeElement($documentHistory);
// set the owning side to null (unless already changed)
if ($documentHistory->getOrganization() === $this) {
$documentHistory->setOrganization(null);
}
}
return $this;
}
public function getConversionReason(): ?string
{
return $this->conversionReason;
}
public function setConversionReason(?string $conversionReason): self
{
$this->conversionReason = $conversionReason;
return $this;
}
public function getStatusIsForced(): ?bool
{
return $this->statusIsForced;
}
public function setStatusIsForced(bool $statusIsForced): self
{
$this->statusIsForced = $statusIsForced;
return $this;
}
/**
* @return int|string|null
*/
public function getUniqId()
{
if ($this->uniqId) {
return $this->uniqId;
}
return $this->id;
}
public function setUniqId(?string $uniqId): self
{
$this->uniqId = $uniqId;
return $this;
}
public function getIban(): ?string
{
return $this->iban;
}
public function setIban(?string $iban): self
{
$this->iban = $iban;
return $this;
}
public function getReferenceGocardless(): ?string
{
return $this->referenceGocardless;
}
public function setReferenceGocardless(?string $referenceGocardless): self
{
$this->referenceGocardless = $referenceGocardless;
return $this;
}
public function getIsForwardingActive(): ?bool
{
return $this->isForwardingActive;
}
public function setIsForwardingActive(bool $isForwardingActive): self
{
$this->isForwardingActive = $isForwardingActive;
return $this;
}
public function getVATRate(): ?string
{
return $this->VATRate;
}
public function setVATRate(string $VATRate): self
{
$this->VATRate = $VATRate;
return $this;
}
public function getIsImported(): ?bool
{
return $this->isImported;
}
public function setIsImported(?bool $isImported): self
{
$this->isImported = $isImported;
return $this;
}
public function getCreditNotesAmount(): ?float
{
return $this->creditNotesAmount;
}
public function setCreditNotesAmount(float $creditNotesAmount): self
{
$this->creditNotesAmount = $creditNotesAmount;
return $this;
}
/**
* @return Collection|CreditNote[]
*/
public function getCreditNotes(): Collection
{
return $this->creditNotes;
}
public function addCreditNote(CreditNote $creditNote): self
{
if (!$this->creditNotes->contains($creditNote)) {
$this->creditNotes[] = $creditNote;
$creditNote->setOrganization($this);
}
return $this;
}
public function removeCreditNote(CreditNote $creditNote): self
{
if ($this->creditNotes->contains($creditNote)) {
$this->creditNotes->removeElement($creditNote);
// set the owning side to null (unless already changed)
if ($creditNote->getOrganization() === $this) {
$creditNote->setOrganization(null);
}
}
return $this;
}
public function getAvailableCredits(): ?float
{
return $this->availableCredits;
}
public function setAvailableCredits(?float $availableCredits): self
{
$this->availableCredits = $availableCredits;
return $this;
}
public function getInvoiceToken(): ?string
{
return $this->invoiceToken;
}
public function setInvoiceToken(?string $invoiceToken): self
{
$this->invoiceToken = $invoiceToken;
return $this;
}
public function getNotificationPreference(): ?NotificationPreference
{
return $this->notificationPreference;
}
public function setNotificationPreference(?NotificationPreference $notificationPreference): self
{
$this->notificationPreference = $notificationPreference;
return $this;
}
public function getShareCapitalFreePercentage(): ?string
{
return $this->shareCapitalFreePercentage;
}
public function setShareCapitalFreePercentage(?string $shareCapitalFreePercentage): self
{
$this->shareCapitalFreePercentage = $shareCapitalFreePercentage;
return $this;
}
public function getIsPrescriber(): ?bool
{
return $this->isPrescriber;
}
public function setIsPrescriber(bool $isPrescriber): self
{
$this->isPrescriber = $isPrescriber;
return $this;
}
public function getHaveAccountant(): ?bool
{
return $this->haveAccountant;
}
public function setHaveAccountant(?bool $haveAccountant): self
{
$this->haveAccountant = $haveAccountant;
return $this;
}
public function getDiscountCode(): ?DiscountCode
{
return $this->discountCode;
}
public function setDiscountCode(?DiscountCode $discountCode): self
{
$this->discountCode = $discountCode;
return $this;
}
public function getLead(): ?Lead
{
return $this->lead;
}
public function setLead(?Lead $lead): self
{
$this->lead = $lead;
// set (or unset) the owning side of the relation if necessary
$newOrganization = null === $lead ? null : $this;
if (null !== $lead && $lead->getOrganization() !== $newOrganization) {
$lead->setOrganization($newOrganization);
}
return $this;
}
public function getStatusImmatriculation(): ?string
{
return $this->statusImmatriculation;
}
public function setStatusImmatriculation(?string $statusImmatriculation): self
{
$this->statusImmatriculation = $statusImmatriculation;
return $this;
}
public function getPrescriberSource(): ?PrescriberSource
{
return $this->prescriberSource;
}
public function setPrescriberSource(?PrescriberSource $prescriberSource): self
{
$this->prescriberSource = $prescriberSource;
return $this;
}
public function getIsExemptTVA(): ?bool
{
return $this->isExemptTVA;
}
public function setIsExemptTVA(?bool $isExemptTVA): self
{
$this->isExemptTVA = $isExemptTVA;
return $this;
}
public function getProjectStage(): ?string
{
return $this->projectStage;
}
public function setProjectStage(?string $projectStage): self
{
$this->projectStage = $projectStage;
return $this;
}
public function getStatusInvoicePayed(): ?string
{
return $this->statusInvoicePayed;
}
public function setStatusInvoicePayed(string $statusInvoicePayed): self
{
$this->statusInvoicePayed = $statusInvoicePayed;
return $this;
}
public function getDateMaxUnpaid(): ?\DateTimeInterface
{
return $this->dateMaxUnpaid;
}
public function setDateMaxUnpaid(?\DateTimeInterface $dateMaxUnpaid): self
{
$this->dateMaxUnpaid = $dateMaxUnpaid;
return $this;
}
public function getIsHaveAuditor(): ?bool
{
return $this->isHaveAuditor;
}
public function setIsHaveAuditor(?bool $isHaveAuditor): self
{
$this->isHaveAuditor = $isHaveAuditor;
return $this;
}
public function getBenefitImposition(): ?string
{
return $this->benefitImposition;
}
public function setBenefitImposition(?string $benefitImposition): self
{
$this->benefitImposition = $benefitImposition;
return $this;
}
public function getBenefitImpositionOption(): ?string
{
return $this->benefitImpositionOption;
}
public function setBenefitImpositionOption(?string $benefitImpositionOption): self
{
$this->benefitImpositionOption = $benefitImpositionOption;
return $this;
}
public function getVatTaxeRegim(): ?string
{
return $this->vatTaxeRegim;
}
public function setVatTaxeRegim(?string $vatTaxeRegim): self
{
$this->vatTaxeRegim = $vatTaxeRegim;
return $this;
}
public function getVatTaxeRegimeOption(): ?string
{
return $this->vatTaxeRegimeOption;
}
public function setVatTaxeRegimeOption(?string $vatTaxeRegimeOption): self
{
$this->vatTaxeRegimeOption = $vatTaxeRegimeOption;
return $this;
}
public function getProlongationDateKYC(): ?\DateTimeInterface
{
return $this->prolongationDateKYC;
}
public function setProlongationDateKYC(?\DateTimeInterface $prolongationDateKYC): self
{
$this->prolongationDateKYC = $prolongationDateKYC;
return $this;
}
public function getReasonUnpaid(): ?ReasonUnpaid
{
return $this->reasonUnpaid;
}
public function setReasonUnpaid(?ReasonUnpaid $reasonUnpaid): self
{
$this->reasonUnpaid = $reasonUnpaid;
return $this;
}
public function getReasonRIBInactive(): ?ReasonRIBInactive
{
return $this->reasonRIBInactive;
}
public function setReasonRIBInactive(?ReasonRIBInactive $reasonRIBInactive): self
{
$this->reasonRIBInactive = $reasonRIBInactive;
return $this;
}
public function getStatusTransfert(): ?string
{
return $this->statusTransfert;
}
public function setStatusTransfert(?string $statusTransfert): self
{
$this->statusTransfert = $statusTransfert;
return $this;
}
public function getIsNewTransfert(): ?bool
{
return $this->isNewTransfert;
}
public function setIsNewTransfert(?bool $isNewTransfert): self
{
$this->isNewTransfert = $isNewTransfert;
return $this;
}
public function getSpecialRequestBal(): ?string
{
return $this->specialRequestBal;
}
public function setSpecialRequestBal(?string $specialRequestBal): self
{
$this->specialRequestBal = $specialRequestBal;
return $this;
}
public function getPackImat()
{
return $this->packImat;
}
public function setPackImat($packImat): self
{
$this->packImat = $packImat;
return $this;
}
public function getIsAuthorizePrescriber(): ?bool
{
return $this->isAuthorizePrescriber;
}
public function getTracFin(): ?string
{
return $this->tracFin;
}
public function setTracFin(?string $tracFin): self
{
$this->tracFin = $tracFin;
return $this;
}
public function getTracFinNote(): ?string
{
return $this->tracFinNote;
}
public function setTracFinNote(?string $tracFinNote): self
{
$this->tracFinNote = $tracFinNote;
return $this;
}
public function setIsAuthorizePrescriber(?bool $isAuthorizePrescriber): self
{
$this->isAuthorizePrescriber = $isAuthorizePrescriber;
return $this;
}
public function isAttachedToPrescriber(): ?bool
{
return $this->isAttachedToPrescriber;
}
public function setIsAttachedToPrescriber(?bool $isAttachedToPrescriber): self
{
$this->isAttachedToPrescriber = $isAttachedToPrescriber;
return $this;
}
public function getIsEmptybal(): ?bool
{
return $this->isEmptybal;
}
public function setIsEmptybal(?bool $isEmptybal): self
{
$this->isEmptybal = $isEmptybal;
return $this;
}
public function getIsAuthorizedDebit(): ?bool
{
return $this->isAuthorizedDebit;
}
public function setIsAuthorizedDebit(?bool $isAuthorizedDebit): self
{
$this->isAuthorizedDebit = $isAuthorizedDebit;
return $this;
}
public function getHistoryNavTunnel(): ?string
{
return $this->historyNavTunnel;
}
public function setHistoryNavTunnel(?string $historyNavTunnel): self
{
$this->historyNavTunnel = $historyNavTunnel;
return $this;
}
/**
* @return Collection|Subscription[]
*/
public function getSubscriptions(): Collection
{
return $this->subscriptions;
}
public function addSubscription(Subscription $subscription): self
{
if (!$this->subscriptions->contains($subscription)) {
$this->subscriptions->add($subscription);
$subscription->setOrganization($this);
$_SESSION['add_subscription'] = true;
}
return $this;
}
public function removeSubscription(Subscription $subscription): self
{
// set the owning side to null (unless already changed)
if ($this->subscriptions->removeElement($subscription) && $subscription->getOrganization() === $this) {
$subscription->setOrganization(null);
$_SESSION['remove_subscription'] = true;
}
return $this;
}
/**
* @return Collection|ActivityLog[]
*/
public function getActivityLogs(): Collection
{
return $this->activityLogs;
}
public function addActivityLog(ActivityLog $activityLog): self
{
if (!$this->activityLogs->contains($activityLog)) {
$this->activityLogs[] = $activityLog;
$activityLog->setOrganization($this);
}
return $this;
}
public function removeActivityLog(ActivityLog $activityLog): self
{
// set the owning side to null (unless already changed)
if ($this->activityLogs->removeElement($activityLog) && $activityLog->getOrganization() === $this) {
$activityLog->setOrganization(null);
}
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getReasonChange(): ?string
{
return $this->reasonChange;
}
public function setReasonChange(?string $reasonChange): self
{
$this->reasonChange = $reasonChange;
return $this;
}
public function getPreviousPack(): ?string
{
return $this->previousPack;
}
public function setPreviousPack(?string $previousPack): self
{
$this->previousPack = $previousPack;
return $this;
}
public function getZapierHookUrl(): ?array
{
return $this->zapierHookUrl;
}
public function setZapierHookUrl(array $zapierHookUrl): self
{
$this->zapierHookUrl = $zapierHookUrl;
return $this;
}
public function getSigle(): ?string
{
return $this->sigle;
}
public function setSigle(?string $sigle): self
{
$this->sigle = $sigle;
return $this;
}
public function getEnseigne(): ?string
{
return $this->enseigne;
}
public function setEnseigne(?string $enseigne): self
{
$this->enseigne = $enseigne;
return $this;
}
public function getCorporateObject(): ?string
{
return $this->corporateObject;
}
public function setCorporateObject(?string $corporateObject): self
{
$this->corporateObject = $corporateObject;
return $this;
}
public function getPlaceKnowDigidom(): ?string
{
return $this->placeKnowDigidom;
}
public function setPlaceKnowDigidom(?string $placeKnowDigidom): self
{
$this->placeKnowDigidom = $placeKnowDigidom;
return $this;
}
public function getOtherPlaceKnownDigidom(): ?string
{
return $this->otherPlaceKnownDigidom;
}
public function setOtherPlaceKnownDigidom(?string $otherPlaceKnownDigidom): self
{
$this->otherPlaceKnownDigidom = $otherPlaceKnownDigidom;
return $this;
}
public function getBankName(): ?string
{
return $this->bankName;
}
public function setBankName(?string $bankName): self
{
$this->bankName = $bankName;
return $this;
}
public function getTitulaire(): ?string
{
return $this->titulaire;
}
public function setTitulaire(?string $titulaire): self
{
$this->titulaire = $titulaire;
return $this;
}
public function getIsInvalidEmail(): ?bool
{
return $this->isInvalidEmail;
}
public function setIsInvalidEmail(?bool $isInvalidEmail): self
{
$this->isInvalidEmail = $isInvalidEmail;
return $this;
}
public function getIsInvalidPhoneNumber(): ?bool
{
return $this->isInvalidPhoneNumber;
}
public function setIsInvalidPhoneNumber(?bool $isInvalidPhoneNumber): self
{
$this->isInvalidPhoneNumber = $isInvalidPhoneNumber;
return $this;
}
public function getSpecialCustomerType(): ?string
{
return $this->specialCustomerType;
}
public function setSpecialCustomerType(?string $specialCustomerType): self
{
$this->specialCustomerType = $specialCustomerType;
return $this;
}
public function getIbmlOrganizationConfiguration(): ?IbmlOrganizationConfiguration
{
return $this->ibmlOrganizationConfiguration;
}
public function setIbmlOrganizationConfiguration(IbmlOrganizationConfiguration $ibmlOrganizationConfiguration): self
{
// set the owning side of the relation if necessary
if ($ibmlOrganizationConfiguration->getOrganization() !== $this) {
$ibmlOrganizationConfiguration->setOrganization($this);
}
$this->ibmlOrganizationConfiguration = $ibmlOrganizationConfiguration;
return $this;
}
public function getPotentialCases(): Collection
{
return $this->potentialCases;
}
public function addPotentitialCase(PotentialCase $potentialCase): self
{
if (!$this->potentialCases->contains($potentialCase)) {
$this->potentialCases[] = $potentialCase;
$potentialCase->addOrganization($this);
}
return $this;
}
public function removePotentialCase(PotentialCase $potentialCase): self
{
if ($this->potentialCases->removeElement($potentialCase)) {
$potentialCase->removeOrganization($this);
}
return $this;
}
/**
* @return Collection|CommercialGesture[]
*/
public function getCommercialGestures(): Collection
{
return $this->commercialGestures;
}
public function addCommercialGesture(CommercialGesture $commercialGesture): self
{
if (!$this->commercialGestures->contains($commercialGesture)) {
$this->commercialGestures[] = $commercialGesture;
$commercialGesture->setOrganization($this);
}
return $this;
}
public function removeCommercialGesture(CommercialGesture $commercialGesture): self
{
// set the owning side to null (unless already changed)
if ($this->commercialGestures->removeElement($commercialGesture) && $commercialGesture->getOrganization() === $this) {
$commercialGesture->setOrganization(null);
}
return $this;
}
public function getActivityCategory(): ?ProfessionDetail
{
return $this->activityCategory;
}
public function setActivityCategory(?ProfessionDetail $activityCategory): self
{
$this->activityCategory = $activityCategory;
return $this;
}
public function getReferralSource(): ?self
{
return $this->referralSource;
}
public function setReferralSource(?self $referralSource): self
{
$this->referralSource = $referralSource;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getGodSons(): Collection
{
return $this->godSons;
}
public function addGodSon(self $godSon): self
{
if (!$this->godSons->contains($godSon)) {
$this->godSons[] = $godSon;
$godSon->setReferralSource($this);
}
return $this;
}
public function removeGodSon(self $godSon): self
{
// set the owning side to null (unless already changed)
if ($this->godSons->removeElement($godSon) && $godSon->getReferralSource() === $this) {
$godSon->setReferralSource(null);
}
return $this;
}
public function getEncryptedParentId(): ?string
{
return $this->encryptedParentId;
}
public function setEncryptedParentId(?string $encryptedParentId): self
{
$this->encryptedParentId = $encryptedParentId;
return $this;
}
public function getIsReferralProcessFinished(): ?bool
{
return $this->isReferralProcessFinished;
}
public function setIsReferralProcessFinished(?bool $isReferralProcessFinished): self
{
$this->isReferralProcessFinished = $isReferralProcessFinished;
return $this;
}
public function getIsDigidomAccountant(): ?bool
{
return $this->isDigidomAccountant;
}
public function setIsDigidomAccountant(?bool $isDigidomAccountant): self
{
$this->isDigidomAccountant = $isDigidomAccountant;
return $this;
}
public function getActivityDomain(): ?ActivityDomain
{
return $this->activityDomain;
}
public function setActivityDomain(?ActivityDomain $activityDomain): self
{
$this->activityDomain = $activityDomain;
return $this;
}
/**
* @Groups({"read_search_signature"})
*/
public function getNumberOfLetterParcel(): int
{
return 0;
}
public function getIsSurveillance(): bool
{
return $this->isSurveillance;
}
public function setIsSurveillance(bool $isSurveillance): self
{
$this->isSurveillance = $isSurveillance;
return $this;
}
/**
* @Groups({"read_zappier_letter"})
* Virtual property to check if the organization is authorized to use Zappier for letter
* Check if the organization has a subscription DOM with the product type SCAN_ENVELOPPE
* and if the subscription is not blocked
*/
public function isAuthorizedToUseZappierForLetter(): bool
{
$subscription = SubscriptionUtils::getDomSubscription($this);
if (!$subscription) {
return false;
}
return !$subscription->isHasBlockedService() && SubscriptionUtils::hasProductType($subscription, ProductKeyEnum::SCAN_ENVELOPPE);
}
public function getBeneficialOwners(): ?array
{
return $this->beneficialOwners;
}
public function setBeneficialOwners(?array $beneficialOwners): void
{
$this->beneficialOwners = $beneficialOwners;
}
public function getHistory(): array
{
return [];
}
public static function createFixture(array $data): self
{
$self = (new self());
$self->store = $data['store'] ?? null;
$self->legalName = $data['legalName'] ?: null;
$self->status = $data['status'] ?? 'CLIENT OK';
$self->legalStatus = $data['legalStatus'] ?: null;
$self->SIRET = $data['siren'] ?: null;
$self->bal = $data['bal'] ?: null;
$self->domiciliationStartDate = $data['domiciliationStartDate'] ?? null;
$self->headQuartersAddressType = $data['headQuartersAddressType'] ?? null;
$self->VATRate = $data['VATRate'] ?? '20';
$self->isExemptTVA = $data['isExemptTVA'] ?? false;
$self->forwardingFrequency = $data['forwardingFrequency'] ?? 'WEEKLY';
$self->haveAccountant = $data['haveAccountant'] ?? false;
$self->iban = $data['iban'] ?? 'FR7630001007941234567890185';
$self->isNewDomiciliation = $data['isNewDomiciliation'] ?? false;
$self->mandatID = $data['mandatID'] ?? '123456789';
$self->referenceGocardless = $data['referenceGocardless'] ?? '123456789';
return $self;
}
public function getAccountsSubmissionLastYear(): ?string
{
return $this->accountsSubmissionLastYear;
}
public function setAccountsSubmissionLastYear(?string $accountsSubmissionLastYear): self
{
$this->accountsSubmissionLastYear = $accountsSubmissionLastYear;
return $this;
}
public function getProcessYousign(): ?ProcessYousign
{
return $this->processYousign;
}
public function setProcessYousign(?ProcessYousign $processYousign): Organization
{
$this->processYousign = $processYousign;
return $this;
}
}