src/AtechNet/CoreBundle/Entity/Customer.php line 656

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Criteria;
  5. use Doctrine\ORM\Mapping\Column;
  6. use Doctrine\ORM\Mapping\Entity;
  7. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  8. use Doctrine\ORM\Mapping\JoinColumn;
  9. use Doctrine\ORM\Mapping\ManyToOne;
  10. use Doctrine\ORM\Mapping\OneToMany;
  11. use Doctrine\ORM\Mapping\OrderBy;
  12. use Doctrine\ORM\Mapping\Table as Table;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity as UniqueEntity;
  14. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  15. use Symfony\Component\Security\Core\User\UserInterface;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. /**
  18.  * @Table(name="customers")
  19.  * @Entity(repositoryClass="App\AtechNet\CoreBundle\Repository\CustomerRepository")
  20.  * @UniqueEntity(
  21.  *     fields={"domain","email"},
  22.  *     errorPath="email",
  23.  *     message="This e-mail is already in use."
  24.  * )
  25.  * @HasLifecycleCallbacks
  26.  */
  27. class Customer extends AbstractSignedEntity implements UserInterface, PasswordAuthenticatedUserInterface
  28. {
  29.     public const string Gender_Women = 'Women';
  30.     public const string Gender_Men = 'Men';
  31.     public const int SOURCE_SIGN_UP = 0;
  32.     public const int SOURCE_NEWSLETTER = 1;
  33.     public const int SOURCE_USER = 2;
  34.     public const int SOURCE_IMPORT = 3;
  35.     public const int SOURCE_NEWSLETTER_EBOOK = 4;
  36.     public const int SOURCE_NEWSLETTER_GIFT = 5;
  37.     public const int SOURCE_UNAS_EXPANSION = 6;
  38.     public const int BAZOS_ID1 = 18822;
  39.     public const int BAZOS_ID2 = 22122;
  40.     public const int BAZOS_ID3 = 43793;
  41.     public const int ATECHCOMP_INTERNAL_ID = 20982;
  42.     public const int AMAZON_COMMISSION_ID = 33977;
  43.     public const int FURBIFY_PC_SHOP_ID = 6370;
  44.     public const int AMAZON_ID = 33978;
  45.     public const int AMAZON_GB_ID = 108995;
  46.     public const BASE_ID = null;
  47.     public const int EMAG_ID = 38585;
  48.     public const int ANDREASHOP_ID = 22579;
  49.     public const int BACKMARKET_ID = 37165;
  50.     public const int BACKMARKET_UK_ID = 106755;
  51.     public const int REFURBED_ID = 37898;
  52.     public const int REFURBED_CH_ID = 106011;
  53.     public const int REFURBED_GB_ID = 106012;
  54.     public const int EBAY_ID = 57361;
  55.     public const int KAUFLAND_ID = 55727;
  56.     public const int VATERA_ID = 92012;
  57.     public const int UNAS_ID = 108137;
  58.     public const int MEDIAMARKT_ID = 108045;
  59.     public const int PC_COMPONENTES_ID = 108748;
  60.     public const int MAXMEDIA_KFT_ID = 17785;
  61.     public const int TYPE_NORMAL = 0;
  62.     public const int TYPE_BUSINESS = 1;
  63.     public const int TYPE_SCHOOL = 2;
  64.     public const int TYPE_HOSPITAL = 3;
  65.     public const int TYPE_INSTITUTION = 4;
  66.     public const int SALES_MANAGER_WS_SK1_ID = 224;
  67.     public const int SALES_MANAGER_NIKI_ID = 231;
  68.     public const int SALES_MANAGER_DENISA_ID = 222;
  69.     public const int TEST_CUSTOMER_RT_HU = 94189;
  70.     public const int TEST_CUSTOMER_RT_SK = 94187;
  71.     public const int TEST_CUSTOMER_RT_CZ = 94190;
  72.     public static function getBazosIDs(): array
  73.     {
  74.         return [
  75.             self::BAZOS_ID1,
  76.             self::BAZOS_ID2,
  77.             self::BAZOS_ID3,
  78.         ];
  79.     }
  80.     public static function genderChoices(): array
  81.     {
  82.         return [
  83.             1 => self::Gender_Women,
  84.             2 => self::Gender_Men,
  85.         ];
  86.     }
  87.     public static function sourceChoices(): array
  88.     {
  89.         return [
  90.             self::SOURCE_SIGN_UP => 'Sign up',
  91.             self::SOURCE_NEWSLETTER => 'Newsletter',
  92.             self::SOURCE_USER => 'User',
  93.             self::SOURCE_IMPORT => 'Import',
  94.             self::SOURCE_NEWSLETTER_EBOOK => 'Newsletter ebook',
  95.             self::SOURCE_NEWSLETTER_GIFT => 'Newsletter gift',
  96.             self::SOURCE_UNAS_EXPANSION => 'Unas expansion',
  97.         ];
  98.     }
  99.     /**
  100.      * @return array<int, string>
  101.      */
  102.     public static function getTypeChoices(): array
  103.     {
  104.         return [
  105.             self::TYPE_NORMAL => 'Normal',
  106.             self::TYPE_BUSINESS => 'Business',
  107.             self::TYPE_SCHOOL => 'School',
  108.             self::TYPE_HOSPITAL => 'Hospital',
  109.             self::TYPE_INSTITUTION => 'Institution',
  110.         ];
  111.     }
  112.     public static function getMarketplaceList(): array
  113.     {
  114.         return [
  115.             self::BACKMARKET_ID => 'Back Market',
  116.             self::REFURBED_ID => 'Refurbed',
  117.             self::EBAY_ID => 'Ebay',
  118.             self::AMAZON_ID => 'Amazon',
  119.             User::USER_ID_UNAS => 'Unas',
  120.         ];
  121.     }
  122.     /**
  123.      * @var Domain
  124.      *
  125.      * @ManyToOne(targetEntity="Domain", inversedBy="customers")
  126.      * @JoinColumn(name="domain_id", referencedColumnName="id")
  127.      */
  128.     private $domain;
  129.     /**
  130.      * @var \DateTIme
  131.      *
  132.      * @Column(name="verified", type="datetime", nullable=true)
  133.      */
  134.     private $verified = null;
  135.     /**
  136.      * @var int
  137.      *
  138.      * @Column(name="old_user_id", type="integer", nullable=true)
  139.      */
  140.     private $oldUserId;
  141.     /**
  142.      * @var bool
  143.      *
  144.      * @Column(name="active", type="boolean", nullable=false)
  145.      */
  146.     private $active = false;
  147.     /**
  148.      * @var bool
  149.      *
  150.      * @Column(name="guest", type="boolean", nullable=false)
  151.      */
  152.     private $guest = false;
  153.     /**
  154.      * @var string
  155.      *
  156.      * @Column(name="username", type="string", nullable=true)
  157.      */
  158.     private $userName;
  159.     /**
  160.      * @var string
  161.      *
  162.      * @Column(name="degree", type="string", nullable=true)
  163.      */
  164.     private $degree;
  165.     /**
  166.      * @var string
  167.      *
  168.      * @Assert\NotNull
  169.      *
  170.      * @Column(name="first_name", type="string")
  171.      */
  172.     private $firstName;
  173.     /**
  174.      * @var string
  175.      *
  176.      * @Assert\NotNull
  177.      *
  178.      * @Column(name="last_name", type="string")
  179.      */
  180.     private $lastName;
  181.     /**
  182.      * @var string
  183.      *
  184.      * @Column(name="business_name", type="string", nullable=true)
  185.      */
  186.     private $businessName;
  187.     /**
  188.      * @var string
  189.      *
  190.      * @Assert\NotNull
  191.      *
  192.      * @Column(name="email", type="string")
  193.      */
  194.     private $email;
  195.     /**
  196.      * @var string
  197.      *
  198.      * @Column(name="phone_number", type="string", nullable=true)
  199.      */
  200.     private $phone;
  201.     /**
  202.      * @var string
  203.      *
  204.      * @Column(name="business_id", type="string", nullable=true)
  205.      */
  206.     private $businessId;
  207.     /**
  208.      * @var string
  209.      *
  210.      * @Column(name="tax_id", type="string", nullable=true)
  211.      */
  212.     private $taxId;
  213.     /**
  214.      * @var string
  215.      *
  216.      * @Column(name="vat_id", type="string", nullable=true)
  217.      */
  218.     private $vatId;
  219.     /**
  220.      * @var \DateTime
  221.      *
  222.      * @Column(name="since", type="datetime", nullable=true)
  223.      */
  224.     private $since;
  225.     /**
  226.      * @var string
  227.      *
  228.      * @Column(name="gender", type="string", nullable=true)
  229.      */
  230.     private $gender;
  231.     /**
  232.      * @var User
  233.      *
  234.      * @ManyToOne(targetEntity="User")
  235.      * @JoinColumn(name="sales_manager_id", referencedColumnName="id")
  236.      */
  237.     private $salesManager;
  238.     /**
  239.      * @var bool
  240.      *
  241.      * @Column(name="wants_newsletter", type="boolean", nullable=false)
  242.      */
  243.     private $wantsNewsletter;
  244.     /**
  245.      * @var string
  246.      *
  247.      * @Column(name="logo", type="string", nullable=true)
  248.      */
  249.     private $logo;
  250.     /**
  251.      * @var string
  252.      *
  253.      * @Column(name="iban", type="string", length=64, nullable=true)
  254.      */
  255.     private $iban;
  256.     /**
  257.      * @var string
  258.      *
  259.      * @Column(name="swift", type="string", length=12, nullable=true)
  260.      */
  261.     private $swift;
  262.     /**
  263.      * @var string
  264.      *
  265.      * @Column(name="password", type="string", nullable=true)
  266.      */
  267.     private $password;
  268.     /**
  269.      * @var string
  270.      *
  271.      * @Column(name="salt", type="text")
  272.      */
  273.     private $salt;
  274.     /**
  275.      * @var \DateTime
  276.      *
  277.      * @Column(name="last_reset", type="datetime", nullable=true)
  278.      */
  279.     private $lastReset;
  280.     /**
  281.      * @var \DateTime
  282.      *
  283.      * @Column(name="last_login", type="datetime", nullable=true)
  284.      */
  285.     private $lastLogin;
  286.     /**
  287.      * @var string
  288.      *
  289.      * @Column(name="last_login_ip", type="text", nullable=true)
  290.      */
  291.     private $lastLoginIp;
  292.     /**
  293.      * @var string
  294.      *
  295.      * @Column(name="remember_key", type="text", nullable=true)
  296.      */
  297.     private $rememberKey;
  298.     /**
  299.      * @var int
  300.      *
  301.      * @Column(name="source", type="integer")
  302.      */
  303.     private $source = 0;
  304.     /**
  305.      * @var bool
  306.      *
  307.      * @Column(name="admin_login", type="boolean")
  308.      */
  309.     private $adminLogin = false;
  310.     /**
  311.      * @var int
  312.      *
  313.      * @Column(name="all_orders_quantity", type="integer")
  314.      */
  315.     private $allOrdersQuantity = 0;
  316.     /**
  317.      * @var float
  318.      *
  319.      * @Column(name="all_orders_full_price", type="decimal", precision=12, scale=2)
  320.      */
  321.     private $allOrdersFullPrice = 0;
  322.     /**
  323.      * @var \DateTime|null
  324.      *
  325.      * @Column(name="last_order_date", type="datetime", nullable=true)
  326.      */
  327.     private $lastOrderDate = null;
  328.     /**
  329.      * @var \DateTime|null
  330.      *
  331.      * @Column(name="second_last_order_date", type="datetime", nullable=true)
  332.      */
  333.     private $secondLastOrderDate = null;
  334.     /**
  335.      * @var \DateTime|null
  336.      *
  337.      * @Column(name="first_order_date", type="datetime", nullable=true)
  338.      */
  339.     private $firstOrderDate = null;
  340.     /**
  341.      * @var int
  342.      *
  343.      * @Column(name="billingo_id", type="bigint", nullable=true)
  344.      */
  345.     private $billingoId;
  346.     /**
  347.      * @var int
  348.      *
  349.      * @Column(name="billingo_v3_id", type="bigint", nullable=true)
  350.      */
  351.     private $billingoV3Id;
  352.     /**
  353.      * @var string
  354.      *
  355.      * @Column(name="billingo_invoices", type="text", nullable=true)
  356.      */
  357.     private $billingoInvoices;
  358.     /**
  359.      * @var int
  360.      *
  361.      * @Column(name="type", type="integer")
  362.      */
  363.     private $type = self::TYPE_NORMAL;
  364.     /**
  365.      * @var int
  366.      *
  367.      * @Column(name="default_due_days", type="integer")
  368.      */
  369.     private $defaultDueDays = 0;
  370.     /**
  371.      * @var string
  372.      *
  373.      * @Column(name="finance_email", type="string", nullable=true)
  374.      */
  375.     private $financeEmail;
  376.     /**
  377.      * @var string
  378.      *
  379.      * @Column(name="rolling_order_message", type="text", nullable=true)
  380.      */
  381.     private $rollingOrderMessage;
  382.     /**
  383.      * @var User
  384.      *
  385.      * @ManyToOne(targetEntity="User")
  386.      * @JoinColumn(name="rolling_order_message_updated_by", referencedColumnName="id", nullable=true)
  387.      */
  388.     private $rollingOrderMessageUpdatedBy;
  389.     /**
  390.      * @var ?\DateTime
  391.      *
  392.      * @Column(name="rolling_order_message_updated_at", type="datetime", nullable=true)
  393.      */
  394.     private $rollingOrderMessageUpdatedAt;
  395.     /**
  396.      * @var ArrayCollection
  397.      *
  398.      * @Assert\Valid
  399.      *
  400.      * @OneToMany(targetEntity="Basket", mappedBy="customer", orphanRemoval=true)
  401.      * @OrderBy({"created" = "DESC"})
  402.      **/
  403.     private $baskets;
  404.     /**
  405.      * @var ArrayCollection
  406.      *
  407.      * @Assert\Valid
  408.      *
  409.      * @OneToMany(targetEntity="Order", mappedBy="customer", orphanRemoval=true, fetch="EXTRA_LAZY")
  410.      **/
  411.     private $orders;
  412.     /**
  413.      * @var ArrayCollection
  414.      *
  415.      * @OneToMany(targetEntity="CustomerAddress", mappedBy="customer", orphanRemoval=true)
  416.      **/
  417.     private $addresses;
  418.     /**
  419.      * @var ArrayCollection
  420.      *
  421.      * @OneToMany(targetEntity="CustomerLink", mappedBy="customer", orphanRemoval=true)
  422.      **/
  423.     private $links;
  424.     /**
  425.      * @var ArrayCollection
  426.      *
  427.      * @OneToMany(targetEntity="CustomerContactPerson", mappedBy="customer", orphanRemoval=true)
  428.      **/
  429.     private $contactPersons;
  430.     /**
  431.      * @var ArrayCollection
  432.      *
  433.      * @OneToMany(targetEntity="CustomerEmail", mappedBy="customer", orphanRemoval=true)
  434.      **/
  435.     private $emails;
  436.     /**
  437.      * @var ArrayCollection
  438.      *
  439.      * @OneToMany(targetEntity="CustomerSentEmail", mappedBy="customer", orphanRemoval=true)
  440.      **/
  441.     private $sentEmails;
  442.     private $allEmails = [];
  443.     private $allPhones = [];
  444.     /**
  445.      * @var ArrayCollection
  446.      *
  447.      * @OneToMany(targetEntity="CustomerNotification", mappedBy="customer", orphanRemoval=true)
  448.      */
  449.     private $notifications;
  450.     /**
  451.      * @var ArrayCollection
  452.      *
  453.      * @OneToMany(targetEntity="CustomerData", mappedBy="customer", orphanRemoval=true)
  454.      **/
  455.     private $datas;
  456.     /**
  457.      * @var ArrayCollection
  458.      *
  459.      * @OneToMany(targetEntity="CustomerNote", mappedBy="customer", orphanRemoval=true)
  460.      **/
  461.     private $notes;
  462.     /**
  463.      * @var ArrayCollection
  464.      *
  465.      * @OneToMany(targetEntity="CustomerViewLog", mappedBy="customer", orphanRemoval=true)
  466.      **/
  467.     private $viewLogs;
  468.     /**
  469.      * @var ArrayCollection
  470.      *
  471.      * @OneToMany(targetEntity="ProductCommission", mappedBy="customer", orphanRemoval=true)
  472.      **/
  473.     private $commissions;
  474.     /**
  475.      * @var bool
  476.      *
  477.      * @Column(name="was_unregistered", type="boolean", nullable=true)
  478.      */
  479.     private $wasUnregistered;
  480.     /**
  481.      * @var ArrayCollection
  482.      *
  483.      * @OneToMany(targetEntity="StockMovement", mappedBy="merchant", orphanRemoval=true)
  484.      * @OrderBy({"created" = "DESC"})
  485.      **/
  486.     private $movements;
  487.     /**
  488.      * @var ArrayCollection
  489.      *
  490.      * @OneToMany(targetEntity="Document", mappedBy="customer", orphanRemoval=true, fetch="EXTRA_LAZY")
  491.      * @OrderBy({"created" = "DESC"})
  492.      **/
  493.     private $documents;
  494.     /**
  495.      * @var ArrayCollection
  496.      * @OneToMany(targetEntity="Claim", mappedBy="customer", orphanRemoval=true)
  497.      * @OrderBy({"created" = "DESC"})
  498.      **/
  499.     private $claims;
  500.     /**
  501.      * @OneToMany(targetEntity="CustomerBillingoData", mappedBy="customer", orphanRemoval=true)
  502.      * @OrderBy({"created" = "DESC"})
  503.      **/
  504.     private $billingoDocuments;
  505.     /**
  506.      * @var bool
  507.      *
  508.      * @Column(name="billing_address_modifiable", type="boolean")
  509.      */
  510.     private $billingAddressModifiable = false;
  511.     /**
  512.      * @var ArrayCollection
  513.      *
  514.      * @OneToMany(targetEntity="Review", mappedBy="customer", orphanRemoval=true)
  515.      * @OrderBy({"created" = "DESC"})
  516.      **/
  517.     private $reviews;
  518.     /**
  519.      * @var string
  520.      *
  521.      * @Column(name="country", type="string", length=32, nullable=true)
  522.      */
  523.     private $country;
  524.     /**
  525.      * @var User|null
  526.      *
  527.      * @ManyToOne(targetEntity="User")
  528.      * @JoinColumn(name="payment_approver_id", referencedColumnName="id", nullable=true)
  529.      */
  530.     private $paymentApprover = null;
  531.     /**
  532.      * @var \DateTime|null
  533.      *
  534.      * @Column(name="commission_confirmation_mail_sent_date", type="datetime", nullable=true)
  535.      */
  536.     private $commissionConfirmationMailSentDate = null;
  537.     /**
  538.      * @var User|null
  539.      *
  540.      * @ManyToOne(targetEntity="User")
  541.      * @JoinColumn(name="commission_confirmation_mail_sent_by", referencedColumnName="id", nullable=true)
  542.      */
  543.     private $commissionConfirmationMailSentBy = null;
  544.     /**
  545.      * @var ArrayCollection
  546.      *
  547.      * @OneToMany(targetEntity="CustomerSalesManagerChangelog", mappedBy="customer", orphanRemoval=true)
  548.      * @OrderBy({"created" = "DESC"})
  549.      */
  550.     private $salesManagerChangelog;
  551.     /**
  552.      * @var ArrayCollection
  553.      *
  554.      * @OneToMany(targetEntity="CustomerPaymentType", mappedBy="customer", orphanRemoval=true)
  555.      */
  556.     private $paymentTypes;
  557.     /**
  558.      * @var ArrayCollection
  559.      *
  560.      * @OneToMany(targetEntity="CustomerClaimProduct", mappedBy="customer")
  561.      */
  562.     private $customerClaimProducts;
  563.     /**
  564.      * @var string
  565.      *
  566.      * @Column(name="daktela_id", type="string", length=30, nullable=true)
  567.      */
  568.     private ?string $daktelaId = null;
  569.     public function __construct()
  570.     {
  571.         parent::__construct();
  572.         $this->customerClaimProducts = new ArrayCollection();
  573.         $this->salt = md5(uniqid(null, true));
  574.         $this->orders = new ArrayCollection();
  575.         $this->movements = new ArrayCollection();
  576.         $this->reviews = new ArrayCollection();
  577.         $this->salesManagerChangelog = new ArrayCollection();
  578.     }
  579.     /**
  580.      * @return ArrayCollection
  581.      */
  582.     public function getCustomerClaimProducts(): ArrayCollection
  583.     {
  584.         return $this->customerClaimProducts;
  585.     }
  586.     public function addCustomerClaimProduct(CustomerClaimProduct $customerClaimProduct): self
  587.     {
  588.         if (!$this->customerClaimProducts->contains($customerClaimProduct)) {
  589.             $this->customerClaimProducts[] = $customerClaimProduct;
  590.             $customerClaimProduct->setCustomer($this);
  591.         }
  592.         return $this;
  593.     }
  594.     public function removeCustomerClaimProduct(CustomerClaimProduct $customerClaimProduct): self
  595.     {
  596.         if ($this->customerClaimProducts->removeElement($customerClaimProduct)) {
  597.             if ($customerClaimProduct->getCustomer() === $this) {
  598.                 $customerClaimProduct->setCustomer(null);
  599.             }
  600.         }
  601.         return $this;
  602.     }
  603.     /**
  604.      * @return string
  605.      */
  606.     public function getUserIdentifier()
  607.     {
  608.         return $this->email;
  609.     }
  610.     /**
  611.      * @return Domain
  612.      */
  613.     public function getDomain()
  614.     {
  615.         return $this->domain;
  616.     }
  617.     /**
  618.      * @param Domain $domain
  619.      */
  620.     public function setDomain($domain)
  621.     {
  622.         $this->domain = $domain;
  623.     }
  624.     /**
  625.      * @return int
  626.      */
  627.     public function getOldUserId()
  628.     {
  629.         return $this->oldUserId;
  630.     }
  631.     /**
  632.      * @param int $oldUserId
  633.      */
  634.     public function setOldUserId($oldUserId)
  635.     {
  636.         $this->oldUserId = $oldUserId;
  637.     }
  638.     /**
  639.      * @return boolean
  640.      */
  641.     public function isActive()
  642.     {
  643.         return $this->active;
  644.     }
  645.     /**
  646.      * @param boolean $active
  647.      */
  648.     public function setActive($active)
  649.     {
  650.         $this->active = $active;
  651.     }
  652.     /**
  653.      * @return boolean
  654.      */
  655.     public function isGuest()
  656.     {
  657.         return $this->guest;
  658.     }
  659.     /**
  660.      * @param boolean $guest
  661.      */
  662.     public function setGuest(bool $guest)
  663.     {
  664.         $this->guest = $guest;
  665.     }
  666.     /**
  667.      * @return string
  668.      */
  669.     public function getUserName()
  670.     {
  671.         return $this->userName;
  672.     }
  673.     /**
  674.      * @param string $userName
  675.      */
  676.     public function setUserName($userName)
  677.     {
  678.         $this->userName = $userName;
  679.     }
  680.     /**
  681.      * @return string
  682.      */
  683.     public function getDegree()
  684.     {
  685.         return $this->degree;
  686.     }
  687.     /**
  688.      * @param string $degree
  689.      */
  690.     public function setDegree($degree)
  691.     {
  692.         $this->degree = $degree;
  693.     }
  694.     /**
  695.      * @return string
  696.      */
  697.     public function getFirstName()
  698.     {
  699.         return $this->firstName;
  700.     }
  701.     /**
  702.      * @param string $firstName
  703.      */
  704.     public function setFirstName($firstName)
  705.     {
  706.         $this->firstName = ucfirst($firstName);
  707.     }
  708.     /**
  709.      * @return string
  710.      */
  711.     public function getLastName()
  712.     {
  713.         return $this->lastName;
  714.     }
  715.     /**
  716.      * @param string $lastName
  717.      */
  718.     public function setLastName($lastName)
  719.     {
  720.         $this->lastName = ucfirst($lastName);
  721.     }
  722.     /**
  723.      * @param bool $inverted
  724.      * @return string
  725.      */
  726.     public function getFullName($inverted = false)
  727.     {
  728.         if ($inverted) {
  729.             return $this->getLastName() . ' ' . $this->getFirstName();
  730.         }
  731.         return $this->getFirstName() . ' ' . $this->getLastName();
  732.     }
  733.     /**
  734.      * @return string
  735.      */
  736.     public function getBusinessName()
  737.     {
  738.         return $this->businessName;
  739.     }
  740.     /**
  741.      * @param string $businessName
  742.      */
  743.     public function setBusinessName($businessName)
  744.     {
  745.         $this->businessName = $businessName;
  746.     }
  747.     /**
  748.      * @return string
  749.      */
  750.     public function getEmail()
  751.     {
  752.         return $this->email;
  753.     }
  754.     /**
  755.      * @param string $email
  756.      */
  757.     public function setEmail($email)
  758.     {
  759.         $this->email = $email;
  760.     }
  761.     public function getAllEmails()
  762.     {
  763.         if ($this->getEmail() != '') {
  764.             $this->allEmails[] = $this->getEmail();
  765.         }
  766.         foreach ($this->emails as $email) {
  767.             if (!in_array($email->getEmail(), $this->allEmails)) {
  768.                 $this->allEmails[] = $email->getEmail();
  769.             }
  770.         }
  771.         foreach ($this->addresses as $address) {
  772.             if (!in_array($address->getEmail(), $this->allEmails)) {
  773.                 $this->allEmails[] = $address->getEmail();
  774.             }
  775.         }
  776.         foreach ($this->contactPersons as $contactPerson) {
  777.             if (!in_array($contactPerson->getEmail(), $this->allEmails)) {
  778.                 $this->allEmails[] = $contactPerson->getEmail();
  779.             }
  780.         }
  781.         return $this->allEmails;
  782.     }
  783.     /**
  784.      * @return string
  785.      */
  786.     public function getPhone()
  787.     {
  788.         return $this->phone;
  789.     }
  790.     /**
  791.      * @param string $phone
  792.      */
  793.     public function setPhone($phone)
  794.     {
  795.         $this->phone = $phone;
  796.     }
  797.     public function getAllPhoneNumbers()
  798.     {
  799.         if ($this->getPhone() != '') {
  800.             $this->allPhones[] = $this->getPhone();
  801.         }
  802.         foreach ($this->addresses as $address) {
  803.             if (!in_array($address->getPhone(), $this->allPhones)) {
  804.                 $this->allPhones[] = $address->getPhone();
  805.             }
  806.         }
  807.         foreach ($this->contactPersons as $contactPerson) {
  808.             if (!in_array($contactPerson->getPhone(), $this->allPhones)) {
  809.                 $this->allPhones[] = $contactPerson->getPhone();
  810.             }
  811.         }
  812.         return $this->allPhones;
  813.     }
  814.     /**
  815.      * @return string
  816.      */
  817.     public function getBusinessId()
  818.     {
  819.         return $this->businessId;
  820.     }
  821.     /**
  822.      * @param string $businessId
  823.      */
  824.     public function setBusinessId($businessId)
  825.     {
  826.         $this->businessId = $businessId;
  827.     }
  828.     /**
  829.      * @return string
  830.      */
  831.     public function getTaxId()
  832.     {
  833.         return $this->taxId;
  834.     }
  835.     /**
  836.      * @param string $taxId
  837.      */
  838.     public function setTaxId($taxId)
  839.     {
  840.         $this->taxId = $taxId;
  841.     }
  842.     /**
  843.      * @return string
  844.      */
  845.     public function getVatId()
  846.     {
  847.         return $this->vatId;
  848.     }
  849.     /**
  850.      * @param string $vatId
  851.      */
  852.     public function setVatId($vatId)
  853.     {
  854.         $this->vatId = $vatId;
  855.     }
  856.     /**
  857.      * @return \DateTime
  858.      */
  859.     public function getSince()
  860.     {
  861.         return $this->since;
  862.     }
  863.     /**
  864.      * @param \DateTime $since
  865.      */
  866.     public function setSince($since)
  867.     {
  868.         $this->since = $since;
  869.     }
  870.     /**
  871.      * @return string
  872.      */
  873.     public function getGender()
  874.     {
  875.         return $this->gender;
  876.     }
  877.     /**
  878.      * @param string $gender
  879.      */
  880.     public function setGender($gender)
  881.     {
  882.         $this->gender = $gender;
  883.     }
  884.     /**
  885.      * @return ?User
  886.      */
  887.     public function getSalesManager()
  888.     {
  889.         return $this->salesManager;
  890.     }
  891.     /**
  892.      * @param User $salesManager
  893.      */
  894.     public function setSalesManager($salesManager)
  895.     {
  896.         $this->salesManager = $salesManager;
  897.     }
  898.     /**
  899.      * @return boolean
  900.      */
  901.     public function isWantsNewsletter()
  902.     {
  903.         return $this->wantsNewsletter;
  904.     }
  905.     /**
  906.      * @param boolean $wantsNewsletter
  907.      */
  908.     public function setWantsNewsletter($wantsNewsletter)
  909.     {
  910.         $this->wantsNewsletter = $wantsNewsletter;
  911.     }
  912.     /**
  913.      * @return string
  914.      */
  915.     public function getLogo()
  916.     {
  917.         return $this->logo;
  918.     }
  919.     /**
  920.      * @param string $logo
  921.      */
  922.     public function setLogo($logo)
  923.     {
  924.         $this->logo = $logo;
  925.     }
  926.     /**
  927.      * @return string|null
  928.      */
  929.     public function getPassword(): ?string
  930.     {
  931.         return $this->password;
  932.     }
  933.     /**
  934.      * @param string $password
  935.      */
  936.     public function setPassword($password)
  937.     {
  938.         $this->password = $password;
  939.     }
  940.     /**
  941.      * @return string
  942.      */
  943.     public function getSalt()
  944.     {
  945.         return $this->salt;
  946.     }
  947.     /**
  948.      * @return \DateTime
  949.      */
  950.     public function getLastReset()
  951.     {
  952.         return $this->lastReset;
  953.     }
  954.     /**
  955.      * @param \DateTime $lastReset
  956.      */
  957.     public function setLastReset($lastReset)
  958.     {
  959.         $this->lastReset = $lastReset;
  960.     }
  961.     /**
  962.      * @return \DateTime
  963.      */
  964.     public function getLastLogin()
  965.     {
  966.         return $this->lastLogin;
  967.     }
  968.     /**
  969.      * @param \DateTime $lastLogin
  970.      */
  971.     public function setLastLogin($lastLogin)
  972.     {
  973.         $this->lastLogin = $lastLogin;
  974.     }
  975.     /**
  976.      * @return string
  977.      */
  978.     public function getLastLoginIp()
  979.     {
  980.         return $this->lastLoginIp;
  981.     }
  982.     /**
  983.      * @param string $lastLoginIp
  984.      */
  985.     public function setLastLoginIp($lastLoginIp)
  986.     {
  987.         $this->lastLoginIp = $lastLoginIp;
  988.     }
  989.     /**
  990.      * @return ArrayCollection
  991.      */
  992.     public function getOrders()
  993.     {
  994.         return $this->orders;
  995.     }
  996.     public function getOrdersByCriteria(int $firstResult, int $maxResult)
  997.     {
  998.         $criteria = Criteria::create()
  999.             ->setFirstResult($firstResult)
  1000.             ->setMaxResults($maxResult)
  1001.             ->andWhere(Criteria::expr()->notIn('status', [Order::STATUS_FINISHED]));
  1002.         return $this->orders->matching($criteria);
  1003.     }
  1004.     /**
  1005.      * @return ArrayCollection
  1006.      */
  1007.     public function getAddresses()
  1008.     {
  1009.         return $this->addresses;
  1010.     }
  1011.     /**
  1012.      * @param ArrayCollection $addresses
  1013.      */
  1014.     public function setAddresses($addresses)
  1015.     {
  1016.         $this->addresses = $addresses;
  1017.     }
  1018.     /**
  1019.      * @return ArrayCollection
  1020.      */
  1021.     public function getLinks()
  1022.     {
  1023.         return $this->links;
  1024.     }
  1025.     /**
  1026.      * @param ArrayCollection $links
  1027.      */
  1028.     public function setLinks($links)
  1029.     {
  1030.         $this->links = $links;
  1031.     }
  1032.     /**
  1033.      * @return ArrayCollection
  1034.      */
  1035.     public function getContactPersons()
  1036.     {
  1037.         return $this->contactPersons;
  1038.     }
  1039.     /**
  1040.      * @param ArrayCollection $contactPersons
  1041.      */
  1042.     public function setContactPersons($contactPersons)
  1043.     {
  1044.         $this->contactPersons = $contactPersons;
  1045.     }
  1046.     /**
  1047.      * @return ArrayCollection
  1048.      */
  1049.     public function getEmails()
  1050.     {
  1051.         return $this->emails;
  1052.     }
  1053.     /**
  1054.      * @param ArrayCollection $emails
  1055.      */
  1056.     public function setEmails($emails)
  1057.     {
  1058.         $this->emails = $emails;
  1059.     }
  1060.     /**
  1061.      * @return CustomerData
  1062.      */
  1063.     public function getData()
  1064.     {
  1065.         if (!is_null($this->datas) && $this->datas->count() > 0) {
  1066.             return $this->datas->first();
  1067.         }
  1068.         return null;
  1069.     }
  1070.     /**
  1071.      * @return ArrayCollection
  1072.      */
  1073.     public function getNotes()
  1074.     {
  1075.         return $this->notes;
  1076.     }
  1077.     /**
  1078.      * @param ArrayCollection $notes
  1079.      */
  1080.     public function setNotes($notes)
  1081.     {
  1082.         $this->notes = $notes;
  1083.     }
  1084.     /**
  1085.      * @return ArrayCollection
  1086.      */
  1087.     public function getDatas()
  1088.     {
  1089.         return $this->datas;
  1090.     }
  1091.     /**
  1092.      * @param ArrayCollection $datas
  1093.      */
  1094.     public function setDatas($datas)
  1095.     {
  1096.         $this->datas = $datas;
  1097.     }
  1098.     /**
  1099.      * @return ArrayCollection
  1100.      */
  1101.     public function getViewLogs()
  1102.     {
  1103.         return $this->viewLogs;
  1104.     }
  1105.     /**
  1106.      * @param ArrayCollection $viewLogs
  1107.      */
  1108.     public function setViewLogs($viewLogs)
  1109.     {
  1110.         $this->viewLogs = $viewLogs;
  1111.     }
  1112.     /**
  1113.      * @return string
  1114.      */
  1115.     public function getRememberKey()
  1116.     {
  1117.         return $this->rememberKey;
  1118.     }
  1119.     /**
  1120.      * @param string $rememberKey
  1121.      */
  1122.     public function setRememberKey($rememberKey)
  1123.     {
  1124.         $this->rememberKey = $rememberKey;
  1125.     }
  1126.     /**
  1127.      * @return int
  1128.      */
  1129.     public function getSource()
  1130.     {
  1131.         return $this->source;
  1132.     }
  1133.     /**
  1134.      * @param int $source
  1135.      */
  1136.     public function setSource($source)
  1137.     {
  1138.         $this->source = $source;
  1139.     }
  1140.     /**
  1141.      * @return boolean
  1142.      */
  1143.     public function isAdminLogin()
  1144.     {
  1145.         return $this->adminLogin;
  1146.     }
  1147.     /**
  1148.      * @param boolean $adminLogin
  1149.      */
  1150.     public function setAdminLogin($adminLogin)
  1151.     {
  1152.         $this->adminLogin = $adminLogin;
  1153.     }
  1154.     /**
  1155.      * @return ArrayCollection
  1156.      */
  1157.     public function getBaskets()
  1158.     {
  1159.         return $this->baskets;
  1160.     }
  1161.     /**
  1162.      * @return ArrayCollection
  1163.      */
  1164.     public function getSentEmails()
  1165.     {
  1166.         return $this->sentEmails;
  1167.     }
  1168.     /**
  1169.      * @return ArrayCollection
  1170.      */
  1171.     public function getNotifications()
  1172.     {
  1173.         return $this->notifications;
  1174.     }
  1175.     /**
  1176.      * @return boolean
  1177.      */
  1178.     public function isWasUnregistered()
  1179.     {
  1180.         return $this->wasUnregistered;
  1181.     }
  1182.     /**
  1183.      * @return ArrayCollection
  1184.      */
  1185.     public function getCommissions()
  1186.     {
  1187.         return $this->commissions;
  1188.     }
  1189.     /**
  1190.      * @return int
  1191.      */
  1192.     public function getAllOrdersQuantity()
  1193.     {
  1194.         return $this->allOrdersQuantity;
  1195.     }
  1196.     /**
  1197.      * @internal param int $allOrdersQuantity
  1198.      */
  1199.     public function setAllOrdersQuantity()
  1200.     {
  1201.         $quantity = 0;
  1202.         foreach ($this->orders as $order) {
  1203.             if ($order->getStatus() != Order::STATUS_CANCELED) {
  1204.                 $quantity++;
  1205.             }
  1206.         }
  1207.         $this->allOrdersQuantity = $quantity;
  1208.     }
  1209.     /**
  1210.      * @return float
  1211.      */
  1212.     public function getAllOrdersFullPrice()
  1213.     {
  1214.         return $this->allOrdersFullPrice;
  1215.     }
  1216.     /**
  1217.      * @internal param float $allOrdersFullPrice
  1218.      */
  1219.     public function setAllOrdersFullPrice()
  1220.     {
  1221.         $ordersValue = 0;
  1222.         foreach ($this->orders as $order) {
  1223.             if ($order->getStatus() != Order::STATUS_CANCELED) {
  1224.                 $ordersValue += $order->getFullPrice();
  1225.             }
  1226.         }
  1227.         $this->allOrdersFullPrice = $ordersValue;
  1228.     }
  1229.     /**
  1230.      * Returns the the value of orders by this customer
  1231.      */
  1232.     public function getOrdersValue()
  1233.     {
  1234.         $ordersValue = 0;
  1235.         foreach ($this->orders as $order) {
  1236.             $ordersValue += $order->getFullPrice();
  1237.         }
  1238.         return $ordersValue;
  1239.     }
  1240.     /**
  1241.      * Returns the the quantity of orders by this customer
  1242.      */
  1243.     public function getOrdersQuantity()
  1244.     {
  1245.         return $this->orders->count();
  1246.     }
  1247.     /**
  1248.      * Update the quantity and full price for current customer
  1249.      */
  1250.     public function updateAllOrderPriceAndQuantity()
  1251.     {
  1252.         $this->setAllOrdersQuantity();
  1253.         $this->setAllOrdersFullPrice();
  1254.         $this->updateOrderDates();
  1255.     }
  1256.     public function getLastOrderDate(): ?\DateTime
  1257.     {
  1258.         return $this->lastOrderDate;
  1259.     }
  1260.     public function getSecondLastOrderDate(): ?\DateTime
  1261.     {
  1262.         return $this->secondLastOrderDate;
  1263.     }
  1264.     public function getFirstOrderDate(): ?\DateTime
  1265.     {
  1266.         return $this->firstOrderDate;
  1267.     }
  1268.     public function updateOrderDates(): void
  1269.     {
  1270.         $dates = [];
  1271.         foreach ($this->orders as $order) {
  1272.             $dates[] = $order->getCreated();
  1273.         }
  1274.         usort($dates, fn (\DateTime $a, \DateTime $b) => $a <=> $b);
  1275.         $count = count($dates);
  1276.         $this->firstOrderDate = $count >= 1 ? $dates[0] : null;
  1277.         $this->lastOrderDate = $count >= 1 ? $dates[$count - 1] : null;
  1278.         $this->secondLastOrderDate = $count >= 2 ? $dates[$count - 2] : null;
  1279.     }
  1280.     /**
  1281.      * @return ArrayCollection
  1282.      */
  1283.     public function getMovements()
  1284.     {
  1285.         return $this->movements;
  1286.     }
  1287.     /**
  1288.      * @param ArrayCollection $movements
  1289.      */
  1290.     public function setMovements($movements)
  1291.     {
  1292.         $this->movements = $movements;
  1293.     }
  1294.     /**
  1295.      * @return ArrayCollection
  1296.      */
  1297.     public function getSalesManagerChangeLogs()
  1298.     {
  1299.         return $this->salesManagerChangelog;
  1300.     }
  1301.     /**
  1302.      * @return ArrayCollection
  1303.      */
  1304.     public function getDocuments()
  1305.     {
  1306.         return $this->documents;
  1307.     }
  1308.     public function getCurrency(): ?string
  1309.     {
  1310.         return $this->getDomain()?->getCurrency();
  1311.     }
  1312.     /**
  1313.      * @param string $vatId
  1314.      * @param null|int $date
  1315.      * @return bool
  1316.      *
  1317.      * $date Date format: 'YmdHi'
  1318.      */
  1319.     public function useZeroVat($vatId = 'not set', $date = null)
  1320.     {
  1321.         if (in_array($vatId, ['HU27955422', 'HU14120204'])) {
  1322.             return true;
  1323.         } elseif ($vatId == 'HU11511810') {
  1324.             return false;
  1325.         }
  1326.         if (!is_null($date) && ($date < Domain::HU_VAT_CHANGE_DATE || $date > Domain::HU_VAT_CHANGE_BACK_DATE)) {
  1327.             if ((is_null($this->getDomain()->getLanguage()) || $this->getDomain()->getLanguage()->getCode() == 'sk') && !in_array($this->getDomain()->getId(), [Domain::DOMAIN_ID_WS_EU, Domain::DOMAIN_ID_OTHER])) {
  1328.                 return false;
  1329.             } else {
  1330.                 return $this->hasProperVatId($vatId);
  1331.             }
  1332.         } else {
  1333.             if (date('YmdHi') < Domain::HU_VAT_CHANGE_BACK_DATE) {
  1334.                 if (in_array($this->domain->getLanguage()->getCode(), ['sk', 'hu']) && !in_array($this->getDomain()->getId(), [Domain::DOMAIN_ID_WS_EU,Domain::DOMAIN_ID_OTHER])) {
  1335.                     return !is_null($this->getId()) && in_array($this->getId(), self::getBazosIDs());
  1336.                 } else {
  1337.                     return $this->hasProperVatId($vatId);
  1338.                 }
  1339.             } else {
  1340.                 if ($this->domain->getLanguage()->getCode() == 'sk' && $this->domain->getId() != Domain::DOMAIN_ID_WS_EU) {
  1341.                     return !is_null($this->getId()) && in_array($this->getId(), self::getBazosIDs());
  1342.                 } else {
  1343.                     return $this->hasProperVatId($vatId);
  1344.                 }
  1345.             }
  1346.         }
  1347.     }
  1348.     /**
  1349.      * @param string $vatId
  1350.      * @return bool
  1351.      */
  1352.     public function hasProperVatId($vatId = 'not set')
  1353.     {
  1354.         $vatIdToCheck = $vatId == 'not set' ? $this->vatId : $vatId;
  1355.         return !is_null($vatIdToCheck) && strlen($vatIdToCheck) > 3;
  1356.     }
  1357.     /**
  1358.      * @return string
  1359.      */
  1360.     public function getIban()
  1361.     {
  1362.         return $this->iban;
  1363.     }
  1364.     /**
  1365.      * @param string $iban
  1366.      */
  1367.     public function setIban($iban)
  1368.     {
  1369.         $this->iban = $iban;
  1370.     }
  1371.     /**
  1372.      * @return string
  1373.      */
  1374.     public function getSwift()
  1375.     {
  1376.         return $this->swift;
  1377.     }
  1378.     /**
  1379.      * @param string $swift
  1380.      */
  1381.     public function setSwift($swift)
  1382.     {
  1383.         $this->swift = $swift;
  1384.     }
  1385.     /**
  1386.      * @return int
  1387.      */
  1388.     public function getBillingoId()
  1389.     {
  1390.         return $this->billingoId;
  1391.     }
  1392.     /**
  1393.      * @param int $billingoId
  1394.      */
  1395.     public function setBillingoId($billingoId)
  1396.     {
  1397.         $this->billingoId = $billingoId;
  1398.     }
  1399.     /**
  1400.      * @return int|null
  1401.      */
  1402.     public function getBillingoV3Id(): ?int
  1403.     {
  1404.         return $this->billingoV3Id;
  1405.     }
  1406.     /**
  1407.      * @param int|null $billingoV3Id
  1408.      */
  1409.     public function setBillingoV3Id(?int $billingoV3Id): void
  1410.     {
  1411.         $this->billingoV3Id = $billingoV3Id;
  1412.     }
  1413.     /**
  1414.      * @return string
  1415.      */
  1416.     public function getBillingoInvoices()
  1417.     {
  1418.         return $this->billingoInvoices;
  1419.     }
  1420.     /**
  1421.      * @param string $billingoInvoices
  1422.      */
  1423.     public function setBillingoInvoices($billingoInvoices)
  1424.     {
  1425.         $this->billingoInvoices = $billingoInvoices;
  1426.     }
  1427.     /**
  1428.      * @return mixed|string
  1429.      */
  1430.     public function getBillingoInvoicesUnserialized()
  1431.     {
  1432.         return !is_null($this->billingoInvoices) && count(unserialize($this->billingoInvoices)) > 0 ? unserialize($this->billingoInvoices) : null;
  1433.     }
  1434.     /**
  1435.      * @param int $orderId
  1436.      * @return mixed|string
  1437.      */
  1438.     public function getBillingoInvoicesUnserializedByOrder($orderId)
  1439.     {
  1440.         $billingInvoices = $this->getBillingoInvoicesUnserialized();
  1441.         return !is_null($billingInvoices) && isset($billingInvoices[$orderId]) ? $billingInvoices[$orderId] : null;
  1442.     }
  1443.     /**
  1444.      * @return ArrayCollection
  1445.      */
  1446.     public function getClaims()
  1447.     {
  1448.         return $this->claims;
  1449.     }
  1450.     /**
  1451.      * @return ArrayCollection
  1452.      */
  1453.     public function getBillingoDocuments()
  1454.     {
  1455.         return $this->billingoDocuments;
  1456.     }
  1457.     /**
  1458.      * @return int
  1459.      */
  1460.     public function getType()
  1461.     {
  1462.         return $this->type;
  1463.     }
  1464.     /**
  1465.      * @param int $type
  1466.      */
  1467.     public function setType($type)
  1468.     {
  1469.         $this->type = $type;
  1470.     }
  1471.     /**
  1472.      * @return int
  1473.      */
  1474.     public function getDefaultDueDays()
  1475.     {
  1476.         return $this->defaultDueDays;
  1477.     }
  1478.     /**
  1479.      * @param int $defaultDueDays
  1480.      */
  1481.     public function setDefaultDueDays($defaultDueDays)
  1482.     {
  1483.         $this->defaultDueDays = $defaultDueDays;
  1484.     }
  1485.     /**
  1486.      * @return string
  1487.      */
  1488.     public function getFinanceEmail()
  1489.     {
  1490.         return $this->financeEmail;
  1491.     }
  1492.     /**
  1493.      * @param string $financeEmail
  1494.      */
  1495.     public function setFinanceEmail($financeEmail)
  1496.     {
  1497.         $this->financeEmail = $financeEmail;
  1498.     }
  1499.     /**
  1500.      * @return bool
  1501.      */
  1502.     public function isBillingAddressModifiable()
  1503.     {
  1504.         return $this->billingAddressModifiable;
  1505.     }
  1506.     /**
  1507.      * @param bool $billingAddressModifiable
  1508.      */
  1509.     public function setBillingAddressModifiable($billingAddressModifiable)
  1510.     {
  1511.         $this->billingAddressModifiable = $billingAddressModifiable;
  1512.     }
  1513.     public function isBusiness(): bool
  1514.     {
  1515.         return !is_null($this->getBusinessName()) && trim($this->getBusinessName()) != '';
  1516.     }
  1517.     /**
  1518.      * @return ArrayCollection
  1519.      */
  1520.     public function getReviews()
  1521.     {
  1522.         return $this->reviews;
  1523.     }
  1524.     /**
  1525.      * @param string $country
  1526.      * @return Customer
  1527.      */
  1528.     public function setCountry($country): Customer
  1529.     {
  1530.         $this->country = $country;
  1531.         return $this;
  1532.     }
  1533.     /**
  1534.      * @return string
  1535.      */
  1536.     public function getCountry(): ?string
  1537.     {
  1538.         return $this->country;
  1539.     }
  1540.     /**
  1541.      * @return User|null
  1542.      */
  1543.     public function getPaymentApprover(): ?User
  1544.     {
  1545.         return $this->paymentApprover;
  1546.     }
  1547.     /**
  1548.      * @param User|null $paymentApprover
  1549.      */
  1550.     public function setPaymentApprover(?User $paymentApprover): void
  1551.     {
  1552.         $this->paymentApprover = $paymentApprover;
  1553.     }
  1554.     /**
  1555.      * @return \DateTime|null
  1556.      */
  1557.     public function getCommissionConfirmationMailSentDate(): ?\DateTime
  1558.     {
  1559.         return $this->commissionConfirmationMailSentDate;
  1560.     }
  1561.     /**
  1562.      * @param \DateTime|null $commissionConfirmationMailSentDate
  1563.      */
  1564.     public function setCommissionConfirmationMailSentDate(?\DateTime $commissionConfirmationMailSentDate): void
  1565.     {
  1566.         $this->commissionConfirmationMailSentDate = $commissionConfirmationMailSentDate;
  1567.     }
  1568.     /**
  1569.      * @return User|null
  1570.      */
  1571.     public function getCommissionConfirmationMailSentBy(): ?User
  1572.     {
  1573.         return $this->commissionConfirmationMailSentBy;
  1574.     }
  1575.     /**
  1576.      * @param User|null $commissionConfirmationMailSentBy
  1577.      */
  1578.     public function setCommissionConfirmationMailSentBy(?User $commissionConfirmationMailSentBy): void
  1579.     {
  1580.         $this->commissionConfirmationMailSentBy = $commissionConfirmationMailSentBy;
  1581.     }
  1582.     /**
  1583.      * @return ArrayCollection
  1584.      */
  1585.     public function getPaymentTypes()
  1586.     {
  1587.         return $this->paymentTypes;
  1588.     }
  1589.     /**
  1590.      * @param int $domainId
  1591.      * @return string|null
  1592.      */
  1593.     public static function getCountryCodeByDomainId(int $domainId): ?string
  1594.     {
  1595.         switch ($domainId) {
  1596.             case Domain::DOMAIN_ID_RT_SK:
  1597.             case Domain::DOMAIN_ID_WS_SK:
  1598.                 return 'SK';
  1599.             case Domain::DOMAIN_ID_RT_HU:
  1600.             case Domain::DOMAIN_ID_WS_HU:
  1601.                 return 'HU';
  1602.             case Domain::DOMAIN_ID_RT_CZ:
  1603.             case Domain::DOMAIN_ID_WS_CZ:
  1604.                 return 'CZ';
  1605.         }
  1606.         return null;
  1607.     }
  1608.     /**
  1609.      * @return bool
  1610.      */
  1611.     public function isB2B(): bool
  1612.     {
  1613.         return $this->domain->getType() == 'retail'
  1614.             && !is_null($this->getSalesManager())
  1615.             && in_array($this->getSalesManager()->getId(), [
  1616.                 User::USER_ID_MARTIN_RIECICIAR,
  1617.                 User::USER_ID_BEATA_SEDLAROVA,
  1618.                 User::USER_ID_B2B_SK,
  1619.                 User::USER_ID_B2B_CZ,
  1620.                 User::USER_ID_B2B_HU,
  1621.                 User::USER_ID_GERHARD_SZABO,
  1622.             ]);
  1623.     }
  1624.     public function getRoles()
  1625.     {
  1626.         return ['ROLE_USER'];
  1627.     }
  1628.     public function eraseCredentials()
  1629.     {
  1630.     }
  1631.     public function __call($name, $arguments)
  1632.     {
  1633.     }
  1634.     /**
  1635.      * @return string|null
  1636.      */
  1637.     public function getRollingOrderMessage(): ?string
  1638.     {
  1639.         return $this->rollingOrderMessage;
  1640.     }
  1641.     /**
  1642.      * @param string|null $rollingOrderMessage
  1643.      * @return void
  1644.      */
  1645.     public function setRollingOrderMessage(?string $rollingOrderMessage): void
  1646.     {
  1647.         $this->rollingOrderMessage = $rollingOrderMessage;
  1648.     }
  1649.     /**
  1650.      * @param User|null $user
  1651.      * @return void
  1652.      */
  1653.     public function setRollingOrderMessageUpdatedBy(?User $user): void
  1654.     {
  1655.         $this->rollingOrderMessageUpdatedBy = $user;
  1656.     }
  1657.     /**
  1658.      * @return ?User
  1659.      */
  1660.     public function getRollingOrderMessageUpdatedBy(): ?User
  1661.     {
  1662.         return $this->rollingOrderMessageUpdatedBy;
  1663.     }
  1664.     /**
  1665.      * @return ?\DateTime
  1666.      */
  1667.     public function getRollingOrderMessageUpdatedAt(): ?\DateTime
  1668.     {
  1669.         return $this->rollingOrderMessageUpdatedAt;
  1670.     }
  1671.     /**
  1672.      * @param \DateTime|null $rollingOrderMessage
  1673.      * @return void
  1674.      */
  1675.     public function setRollingOrderMessageUpdatedAt(?\DateTime $dateTime): void
  1676.     {
  1677.         $this->rollingOrderMessageUpdatedAt = $dateTime;
  1678.     }
  1679.     /**
  1680.      * @return bool
  1681.      */
  1682.     public function isCompany(): bool
  1683.     {
  1684.         if ($this->taxId || $this->vatId || $this->businessId || $this->businessName) {
  1685.             return true;
  1686.         } else {
  1687.             return false;
  1688.         }
  1689.     }
  1690.     /**
  1691.      * @return string|null
  1692.      */
  1693.     public function getDaktelaId(): ?string
  1694.     {
  1695.         return $this->daktelaId;
  1696.     }
  1697.     /**
  1698.      * @param string|null $daktelaId
  1699.      *
  1700.      * @return void
  1701.      */
  1702.     public function setDaktelaId(?string $daktelaId): void
  1703.     {
  1704.         $this->daktelaId = $daktelaId;
  1705.     }
  1706. }