src/Entity/Gos/Orders.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\AdditionalAccess\AdditionalAccessBeneficiary;
  4. use App\Entity\Gos\AdditionalAccess\UserAdditionalAccessOffer;
  5. use App\Entity\Gos\VirtualCurrency\VirtualCurrencyTransaction;
  6. use App\Entity\OrdersInterface;
  7. use App\Enum\DocumentDistributionChannels;
  8. use App\Model\TaxStatement;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. /**
  13.  * Orders
  14.  *
  15.  * @ORM\Table()
  16.  * @ORM\Entity(repositoryClass="App\Repository\OrdersRepository")
  17.  * @ORM\HasLifecycleCallbacks
  18.  */
  19. class Orders implements OrdersInterface
  20. {
  21.     /**
  22.      * @var int
  23.      *
  24.      * @ORM\Column(name="id", type="integer")
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="AUTO")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @ORM\Column(type="string", length=150, unique=true, nullable=true)
  31.      */
  32.     private $ordTran;
  33.     /**
  34.      * @ORM\Column(type="text", length=1000, nullable=true)
  35.      */
  36.     private $comment;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private $couponCode;
  43.     /**
  44.      * @var float
  45.      *
  46.      * @ORM\Column(type="float", precision=18, scale=2, nullable=true)
  47.      */
  48.     private $totalPriceGross;
  49.     /**
  50.      * @var float
  51.      *
  52.      * @ORM\Column(type="float", precision=18, scale=2, nullable=true)
  53.      */
  54.     private $totalPriceNet;
  55.     /**
  56.      * @var float
  57.      *
  58.      * @ORM\Column(type="float", precision=18, scale=2, nullable=true)
  59.      */
  60.     private $totalPriceBeforeCouponGross;
  61.     /**
  62.      * @var float
  63.      *
  64.      * @ORM\Column(type="float", precision=18, scale=2, nullable=true)
  65.      */
  66.     private $totalPriceBeforeCouponNet;
  67.     /**
  68.      * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  69.      */
  70.     private $receiveAdvertising;
  71.     /**
  72.      * @ORM\Column(type="string", length=128, nullable=true)
  73.      */
  74.     private $actionNumber;
  75.     /**
  76.      * @ORM\Column(type="string", length=100, nullable=true)
  77.      */
  78.     private $fromSource;
  79.     /**
  80.      * @ORM\Column(type="string", length=100, nullable=true)
  81.      */
  82.     private $campaign;
  83.     /**
  84.      * @ORM\Column(type="string", length=100, nullable=true)
  85.      */
  86.     private $campaignChannel;
  87.     /**
  88.      * @ORM\Column(type="string", length=255, nullable=true)
  89.      */
  90.     private $buttonParameters;
  91.     /**
  92.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderPart", mappedBy="orders", cascade={"persist"})
  93.      */
  94.     private $orderPart;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Participants", mappedBy="orders", cascade={"persist"})
  97.      */
  98.     private $participants;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\Address", inversedBy="orders")
  101.      * @ORM\JoinColumn()
  102.      */
  103.     private $address;
  104.     /**
  105.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\User", inversedBy="orders")
  106.      * @ORM\JoinColumn()
  107.      */
  108.     private $user;
  109.     /**
  110.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="orders")
  111.      * @ORM\JoinColumn()
  112.      */
  113.     private $portalSettings;
  114.     /**
  115.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\OrderType", inversedBy="orders")
  116.      * @ORM\JoinColumn()
  117.      */
  118.     private $orderType;
  119.     /**
  120.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\OrderTerm", mappedBy="orders")
  121.      */
  122.     private $orderTerms;
  123.     /**
  124.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\SalesManagoEvent", mappedBy="orders")
  125.      */
  126.     private $salesManagoEvent;
  127.     /**
  128.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\UserTerms", mappedBy="orders")
  129.      */
  130.     private $userTerms;
  131.     /**
  132.      * @ORM\Column(type="string", length=15, nullable=true)
  133.      */
  134.     private $client_ipv4;
  135.     /**
  136.      * @ORM\Column(type="string", length=255, nullable=true)
  137.      */
  138.     private $client_host;
  139.     /**
  140.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\NoTaxType", inversedBy="orders")
  141.      */
  142.     private $noTaxType;
  143.     /**
  144.      * @ORM\Column(type="string", length=255, nullable=true)
  145.      */
  146.     private $noTaxPublicSectorUnit;
  147.     /**
  148.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\TouchPoint", mappedBy="order")
  149.      */
  150.     private $touchPoint;
  151.     /**
  152.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\TouchPointAll", mappedBy="order")
  153.      */
  154.     private $touchPointAll;
  155.     /**
  156.      * @ORM\OneToMany(targetEntity="Gift", mappedBy="buyerOrder", cascade={"persist"})
  157.      */
  158.     private $buyerGift;
  159.     /**
  160.      * @ORM\OneToOne(targetEntity="Gift", mappedBy="recipientOrder")
  161.      */
  162.     private $recipientGift;
  163.     /**
  164.      * @ORM\ManyToOne(targetEntity="Country", inversedBy="orders")
  165.      * @ORM\JoinColumn()
  166.      */
  167.     private $country;
  168.     /**
  169.      * @ORM\ManyToOne(targetEntity="PaymentSystem", inversedBy="orders")
  170.      * @ORM\JoinColumn()
  171.      */
  172.     private $paymentSystem;
  173.     /**
  174.      * @ORM\OneToMany(targetEntity="BraintreeResponse", mappedBy="order")
  175.      */
  176.     private $braintreeResponse;
  177.     /**
  178.      * @ORM\Column(type="datetime")
  179.      */
  180.     private $createdAt;
  181.     /**
  182.      * @ORM\Column(type="datetime", nullable=true)
  183.      */
  184.     private $updatedAt;
  185.     /**
  186.      * @ORM\Column(type="datetime", nullable=true)
  187.      */
  188.     private $deletedAt;
  189.     /**
  190.      * @ORM\Column(type="string", length=255, nullable=true)
  191.      */
  192.     private $infoline;
  193.     /**
  194.      * @ORM\Column(type="string", length=255, nullable=true)
  195.      */
  196.     private $postOrder;
  197.     /**
  198.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\User", mappedBy="orderDuringRegistration")
  199.      */
  200.     private $userFirstOrder;
  201.     /**
  202.      * @ORM\Column(type="text", nullable=true)
  203.      */
  204.     private $marketing;
  205.     /**
  206.      * @ORM\OneToOne(targetEntity="TeleOrder", mappedBy="mainOrder", cascade={"persist", "remove"})
  207.      */
  208.     private $teleOrder;
  209.     /**
  210.      * @ORM\Column(type="datetime", nullable=true)
  211.      */
  212.     private $foExportetAt;
  213.     /**
  214.      * @ORM\OneToMany(targetEntity=ExportLog::class, mappedBy="orders")
  215.      */
  216.     private $exportLogs;
  217.     /**
  218.      * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  219.      */
  220.     private $isTest;
  221.     /**
  222.      * @ORM\Column(type="boolean", nullable=true)
  223.      */
  224.     private $isGATransactionSent;
  225.     /**
  226.      * @ORM\Column(type="string", length=255, nullable=true)
  227.      */
  228.     private $lab;
  229.     /**
  230.      * @ORM\Column(type="boolean", options={"default":0})
  231.      */
  232.     private $isSbExportNeeded false;
  233.     /**
  234.      * @ORM\Column(type="datetime", nullable=true)
  235.      */
  236.     private $sbExportAt;
  237.     /**
  238.      * @ORM\Column(type="integer", options={"default": 0})
  239.      */
  240.     private $extendedPaymentTime 0;
  241.     /**
  242.      * @ORM\ManyToOne(targetEntity=ShippingType::class)
  243.      */
  244.     private $shippingType;
  245.     /**
  246.      * @ORM\OneToOne(targetEntity=OrderTeleConsultant::class, cascade={"persist", "remove"})
  247.      */
  248.     private $teleConsultant;
  249.     /**
  250.      * @ORM\Column(type="string", length=255, nullable=true)
  251.      */
  252.     private $exportedToSbBy;
  253.     /**
  254.      * @ORM\OneToMany(targetEntity=UserCard::class, mappedBy="orders")
  255.      */
  256.     private $userCards;
  257.     /**
  258.      * @ORM\Column(type="text", nullable=true)
  259.      */
  260.     private $fromSourceAll;
  261.     /**
  262.      * @ORM\Column(type="text", nullable=true)
  263.      */
  264.     private $actionNumberAll;
  265.     /**
  266.      * @ORM\OneToOne(targetEntity=ProductVariantReviewNotification::class, mappedBy="orders")
  267.      */
  268.     private $productVariantsReviewNotification;
  269.     /**
  270.      * @ORM\Column(type="datetime", nullable=true)
  271.      */
  272.     private $paymentRewardDeadline;
  273.     /**
  274.      * @ORM\ManyToOne(targetEntity=UserAdditionalAccessOffer::class, inversedBy="orders")
  275.      */
  276.     private $userAdditionalAccessOffer;
  277.     /**
  278.      * @ORM\OneToMany(targetEntity=AdditionalAccessBeneficiary::class, mappedBy="orders", orphanRemoval=true)
  279.      */
  280.     private $additionalAccessBeneficiaries;
  281.     /**
  282.      * @ORM\Column(type="boolean", nullable=true)
  283.      */
  284.     private $teleOrderSplit;
  285.     /**
  286.      * @ORM\Column(type="string", length=255, nullable=true)
  287.      */
  288.     private $burAssignedSupportId;
  289.     /** @ORM\PrePersist() */
  290.     public function prePersist()
  291.     {
  292.         $this->createdAt = new \DateTime();
  293.     }
  294.     /** @ORM\PreUpdate() */
  295.     public function preUpdate()
  296.     {
  297.         $this->updatedAt = new \DateTime();
  298.     }
  299.     public function __toString()
  300.     {
  301.         return (string)$this->ordTran;
  302.     }
  303.     public function getObjectVars()
  304.     {
  305.         return get_object_vars($this);
  306.     }
  307.     public function getTotalShippingCost($returnNet true)
  308.     {
  309.         $totalShippingCostNet   0;
  310.         $totalShippingCostGross 0;
  311.         foreach ($this->getOrderPart() as $orderPart)
  312.         {
  313.             /** @var OrderPart $orderPart */
  314.             $totalShippingCostNet   += $orderPart->getTotalShippingCostNet();
  315.             $totalShippingCostGross += $orderPart->getTotalShippingCostGross();
  316.         }
  317.         return $returnNet $totalShippingCostNet $totalShippingCostGross;
  318.     }
  319.     public function getTotalPriceGrossWithShipping()
  320.     {
  321.         return $this->getTotalPriceGross() + $this->getTotalShippingCost(false);
  322.     }
  323.     public function getTotalPriceNetWithShipping()
  324.     {
  325.         return $this->getTotalPriceNet() + $this->getTotalShippingCost();
  326.     }
  327.     public function hasTestProduct()
  328.     {
  329.         /** @var OrderPart $orderPart */
  330.         foreach ($this->getOrderPart() as $orderPart)
  331.         {
  332.             if ($orderPart->hasTestProduct())
  333.             {
  334.                 return true;
  335.             }
  336.         }
  337.         return false;
  338.     }
  339.     //------------------------------ setters & getters
  340.     /**
  341.      * Get id
  342.      *
  343.      * @return int
  344.      */
  345.     public function getId()
  346.     {
  347.         return $this->id;
  348.     }
  349.     /**
  350.      * Set ordTran
  351.      *
  352.      * @param string $ordTran
  353.      *
  354.      * @return Orders
  355.      */
  356.     public function setOrdTran($ordTran)
  357.     {
  358.         $this->ordTran $ordTran;
  359.         return $this;
  360.     }
  361.     /**
  362.      * Get ordTran
  363.      *
  364.      * @return string
  365.      */
  366.     public function getOrdTran()
  367.     {
  368.         return $this->ordTran;
  369.     }
  370.     public function getOrdTranForSummaryLink()
  371.     {
  372.         foreach ($this->orderPart as $orderPart)
  373.         {
  374.             if (!empty($orderPart->getOrdTran()) && strpos($orderPart->getOrdTran(), 'WF') !== false)
  375.             {
  376.                 return $orderPart->getOrdTran();
  377.             }
  378.         }
  379.         return $this->ordTran;
  380.     }
  381.     /**
  382.      * Set createdAt
  383.      *
  384.      * @param \DateTime $createdAt
  385.      *
  386.      * @return Orders
  387.      */
  388.     public function setCreatedAt($createdAt)
  389.     {
  390.         $this->createdAt $createdAt;
  391.         return $this;
  392.     }
  393.     /**
  394.      * Get createdAt
  395.      *
  396.      * @return \DateTime
  397.      */
  398.     public function getCreatedAt()
  399.     {
  400.         return $this->createdAt;
  401.     }
  402.     /**
  403.      * Set updatedAt
  404.      *
  405.      * @param \DateTime $updatedAt
  406.      *
  407.      * @return Orders
  408.      */
  409.     public function setUpdatedAt($updatedAt)
  410.     {
  411.         $this->updatedAt $updatedAt;
  412.         return $this;
  413.     }
  414.     /**
  415.      * Get updatedAt
  416.      *
  417.      * @return \DateTime
  418.      */
  419.     public function getUpdatedAt()
  420.     {
  421.         return $this->updatedAt;
  422.     }
  423.     /**
  424.      * Set user
  425.      *
  426.      * @param \App\Entity\Gos\User $user
  427.      *
  428.      * @return Orders
  429.      */
  430.     public function setUser(\App\Entity\Gos\User $user null)
  431.     {
  432.         $this->user $user;
  433.         return $this;
  434.     }
  435.     /**
  436.      * Get user
  437.      *
  438.      * @return \App\Entity\Gos\User
  439.      */
  440.     public function getUser()
  441.     {
  442.         return $this->user;
  443.     }
  444.     /**
  445.      * Set orderType
  446.      *
  447.      * @param \App\Entity\Gos\OrderType $orderType
  448.      *
  449.      * @return Orders
  450.      */
  451.     public function setOrderType(\App\Entity\Gos\OrderType $orderType null)
  452.     {
  453.         $this->orderType $orderType;
  454.         return $this;
  455.     }
  456.     /**
  457.      * Get orderType
  458.      *
  459.      * @return \App\Entity\Gos\OrderType
  460.      */
  461.     public function getOrderType()
  462.     {
  463.         return $this->orderType;
  464.     }
  465.     /**
  466.      * Set comment
  467.      *
  468.      * @param string $comment
  469.      *
  470.      * @return Orders
  471.      */
  472.     public function setComment($comment)
  473.     {
  474.         $this->comment $comment;
  475.         return $this;
  476.     }
  477.     /**
  478.      * Get comment
  479.      *
  480.      * @return string
  481.      */
  482.     public function getComment()
  483.     {
  484.         return $this->comment;
  485.     }
  486.     /**
  487.      * Set address
  488.      *
  489.      * @param \App\Entity\Gos\Address $address
  490.      *
  491.      * @return Orders
  492.      */
  493.     public function setAddress(\App\Entity\Gos\Address $address null)
  494.     {
  495.         $this->address $address;
  496.         return $this;
  497.     }
  498.     /**
  499.      * Get address
  500.      *
  501.      * @return \App\Entity\Gos\Address
  502.      */
  503.     public function getAddress()
  504.     {
  505.         return $this->address;
  506.     }
  507.     /**
  508.      * Set receiveAdvertising
  509.      *
  510.      * @param boolean $receiveAdvertising
  511.      *
  512.      * @return Orders
  513.      */
  514.     public function setReceiveAdvertising($receiveAdvertising)
  515.     {
  516.         $this->receiveAdvertising $receiveAdvertising;
  517.         return $this;
  518.     }
  519.     /**
  520.      * Get receiveAdvertising
  521.      *
  522.      * @return boolean
  523.      */
  524.     public function getReceiveAdvertising()
  525.     {
  526.         return $this->receiveAdvertising;
  527.     }
  528.     /**
  529.      * Set totalPriceGross
  530.      *
  531.      * @param float $totalPriceGross
  532.      *
  533.      * @return Orders
  534.      */
  535.     public function setTotalPriceGross($totalPriceGross)
  536.     {
  537.         $this->totalPriceGross round($totalPriceGross2);
  538.         return $this;
  539.     }
  540.     /**
  541.      * Get totalPriceGross
  542.      *
  543.      * @return float
  544.      */
  545.     public function getTotalPriceGross()
  546.     {
  547.         return $this->totalPriceGross;
  548.     }
  549.     /**
  550.      * Set totalPriceNet
  551.      *
  552.      * @param float $totalPriceNet
  553.      *
  554.      * @return Orders
  555.      */
  556.     public function setTotalPriceNet($totalPriceNet)
  557.     {
  558.         $this->totalPriceNet round($totalPriceNet,2);
  559.         return $this;
  560.     }
  561.     /**
  562.      * Get totalPriceNet
  563.      *
  564.      * @return float
  565.      */
  566.     public function getTotalPriceNet()
  567.     {
  568.         return $this->totalPriceNet;
  569.     }
  570.     /**
  571.      * Set totalPriceBeforeCouponGross
  572.      *
  573.      * @param float $totalPriceBeforeCouponGross
  574.      *
  575.      * @return Orders
  576.      */
  577.     public function setTotalPriceBeforeCouponGross($totalPriceBeforeCouponGross)
  578.     {
  579.         $this->totalPriceBeforeCouponGross round($totalPriceBeforeCouponGross,);
  580.         return $this;
  581.     }
  582.     /**
  583.      * Get totalPriceBeforeCouponGross
  584.      *
  585.      * @return float
  586.      */
  587.     public function getTotalPriceBeforeCouponGross()
  588.     {
  589.         return $this->totalPriceBeforeCouponGross;
  590.     }
  591.     /**
  592.      * Set totalPriceBeforeCouponNet
  593.      *
  594.      * @param float $totalPriceBeforeCouponNet
  595.      *
  596.      * @return Orders
  597.      */
  598.     public function setTotalPriceBeforeCouponNet($totalPriceBeforeCouponNet)
  599.     {
  600.         $this->totalPriceBeforeCouponNet round($totalPriceBeforeCouponNet,2);
  601.         return $this;
  602.     }
  603.     /**
  604.      * Get totalPriceBeforeCouponNet
  605.      *
  606.      * @return float
  607.      */
  608.     public function getTotalPriceBeforeCouponNet()
  609.     {
  610.         return $this->totalPriceBeforeCouponNet;
  611.     }
  612.     /**
  613.      * Set couponCode
  614.      *
  615.      * @param string $couponCode
  616.      *
  617.      * @return Orders
  618.      */
  619.     public function setCouponCode($couponCode)
  620.     {
  621.         $this->couponCode $couponCode;
  622.         return $this;
  623.     }
  624.     /**
  625.      * Get couponCode
  626.      *
  627.      * @return string
  628.      */
  629.     public function getCouponCode()
  630.     {
  631.         return $this->couponCode;
  632.     }
  633.     /**
  634.      * Constructor
  635.      */
  636.     public function __construct()
  637.     {
  638.         $this->orderProductVariant  = new ArrayCollection();
  639.         $this->orderPart            = new ArrayCollection();
  640.         $this->participants         = new ArrayCollection();
  641.         $this->orderTerms           = new ArrayCollection();
  642.         $this->salesManagoEvent     = new ArrayCollection();
  643.         $this->userTerms            = new ArrayCollection();
  644.         $this->buyerGift            = new ArrayCollection();
  645.         $this->braintreeResponse    = new ArrayCollection();
  646.         $this->exportLogs           = new ArrayCollection();
  647.         $this->userCards            = new ArrayCollection();
  648.         $this->additionalAccessBeneficiaries = new ArrayCollection();
  649.     }
  650.     /**
  651.      * Set actionNumber
  652.      *
  653.      * @param string $actionNumber
  654.      *
  655.      * @return Orders
  656.      */
  657.     public function setActionNumber($actionNumber)
  658.     {
  659.         $this->actionNumber $actionNumber;
  660.         return $this;
  661.     }
  662.     /**
  663.      * Get actionNumber
  664.      *
  665.      * @return string
  666.      */
  667.     public function getActionNumber()
  668.     {
  669.         return $this->actionNumber;
  670.     }
  671.     /**
  672.      * Set fromSource
  673.      *
  674.      * @param string $fromSource
  675.      *
  676.      * @return Orders
  677.      */
  678.     public function setFromSource($fromSource)
  679.     {
  680.         $this->fromSource $fromSource;
  681.         return $this;
  682.     }
  683.     /**
  684.      * Get fromSource
  685.      *
  686.      * @return string
  687.      */
  688.     public function getFromSource()
  689.     {
  690.         return $this->fromSource;
  691.     }
  692.     /**
  693.      * Set campaign
  694.      *
  695.      * @param string $campaign
  696.      * @return Orders
  697.      */
  698.     public function setCampaign($campaign)
  699.     {
  700.         $this->campaign $campaign;
  701.         return $this;
  702.     }
  703.     /**
  704.      * Get campaign
  705.      *
  706.      * @return string
  707.      */
  708.     public function getCampaign()
  709.     {
  710.         return $this->campaign;
  711.     }
  712.     /**
  713.      * Set campaignChannel
  714.      *
  715.      * @param string $campaignChannel
  716.      * @return Orders
  717.      */
  718.     public function setCampaignChannel($campaignChannel)
  719.     {
  720.         $this->campaignChannel $campaignChannel;
  721.         return $this;
  722.     }
  723.     /**
  724.      * Get campaignChannel
  725.      *
  726.      * @return string
  727.      */
  728.     public function getCampaignChannel()
  729.     {
  730.         return $this->campaignChannel;
  731.     }
  732.     /**
  733.      * Add orderPart
  734.      *
  735.      * @param \App\Entity\Gos\OrderPart $orderPart
  736.      *
  737.      * @return Orders
  738.      */
  739.     public function addOrderPart(\App\Entity\Gos\OrderPart $orderPart)
  740.     {
  741.         $this->orderPart[] = $orderPart;
  742.         return $this;
  743.     }
  744.     /**
  745.      * Remove orderPart
  746.      *
  747.      * @param \App\Entity\Gos\OrderPart $orderPart
  748.      */
  749.     public function removeOrderPart(\App\Entity\Gos\OrderPart $orderPart)
  750.     {
  751.         $this->orderPart->removeElement($orderPart);
  752.     }
  753.     /**
  754.      * Get orderPart
  755.      *
  756.      * @return \Doctrine\Common\Collections\Collection
  757.      */
  758.     public function getOrderPart()
  759.     {
  760.         return $this->orderPart;
  761.     }
  762.     /**
  763.      * Set portalSettings
  764.      *
  765.      * @param \App\Entity\Gos\PortalSettings $portalSettings
  766.      *
  767.      * @return Orders
  768.      */
  769.     public function setPortalSettings(\App\Entity\Gos\PortalSettings $portalSettings null)
  770.     {
  771.         $this->portalSettings $portalSettings;
  772.         return $this;
  773.     }
  774.     /**
  775.      * Get portalSettings
  776.      *
  777.      * @return \App\Entity\Gos\PortalSettings
  778.      */
  779.     public function getPortalSettings()
  780.     {
  781.         return $this->portalSettings;
  782.     }
  783.     /**
  784.      * Add orderTerm
  785.      *
  786.      * @param \App\Entity\Gos\OrderTerm $orderTerm
  787.      *
  788.      * @return Orders
  789.      */
  790.     public function addOrderTerm(\App\Entity\Gos\OrderTerm $orderTerm)
  791.     {
  792.         $this->orderTerms[] = $orderTerm;
  793.         return $this;
  794.     }
  795.     /**
  796.      * Remove orderTerm
  797.      *
  798.      * @param \App\Entity\Gos\OrderTerm $orderTerm
  799.      */
  800.     public function removeOrderTerm(\App\Entity\Gos\OrderTerm $orderTerm)
  801.     {
  802.         $this->orderTerms->removeElement($orderTerm);
  803.     }
  804.     /**
  805.      * Get orderTerms
  806.      *
  807.      * @return \Doctrine\Common\Collections\Collection
  808.      */
  809.     public function getOrderTerms()
  810.     {
  811.         return $this->orderTerms;
  812.     }
  813.     /**
  814.      * Set clientIpv4
  815.      *
  816.      * @param string $clientIpv4
  817.      *
  818.      * @return Orders
  819.      */
  820.     public function setClientIpv4($clientIpv4)
  821.     {
  822.         $this->client_ipv4 $clientIpv4;
  823.         return $this;
  824.     }
  825.     /**
  826.      * Get clientIpv4
  827.      *
  828.      * @return string
  829.      */
  830.     public function getClientIpv4()
  831.     {
  832.         return $this->client_ipv4;
  833.     }
  834.     /**
  835.      * Set clientHost
  836.      *
  837.      * @param string $clientHost
  838.      *
  839.      * @return Orders
  840.      */
  841.     public function setClientHost($clientHost)
  842.     {
  843.         $this->client_host $clientHost;
  844.         return $this;
  845.     }
  846.     /**
  847.      * Get clientHost
  848.      *
  849.      * @return string
  850.      */
  851.     public function getClientHost()
  852.     {
  853.         return $this->client_host;
  854.     }
  855.     /**
  856.      * Set deletedAt
  857.      *
  858.      * @param \DateTime $deletedAt
  859.      *
  860.      * @return Orders
  861.      */
  862.     public function setDeletedAt($deletedAt)
  863.     {
  864.         $this->deletedAt $deletedAt;
  865.         return $this;
  866.     }
  867.     /**
  868.      * Get deletedAt
  869.      *
  870.      * @return \DateTime
  871.      */
  872.     public function getDeletedAt()
  873.     {
  874.         return $this->deletedAt;
  875.     }
  876.     /**
  877.      * Add userTerm
  878.      *
  879.      * @param \App\Entity\Gos\UserTerms $userTerm
  880.      *
  881.      * @return Orders
  882.      */
  883.     public function addUserTerm(\App\Entity\Gos\UserTerms $userTerm)
  884.     {
  885.         $this->userTerms[] = $userTerm;
  886.         return $this;
  887.     }
  888.     /**
  889.      * Remove userTerm
  890.      *
  891.      * @param \App\Entity\Gos\UserTerms $userTerm
  892.      */
  893.     public function removeUserTerm(\App\Entity\Gos\UserTerms $userTerm)
  894.     {
  895.         $this->userTerms->removeElement($userTerm);
  896.     }
  897.     /**
  898.      * Get userTerms
  899.      *
  900.      * @return \Doctrine\Common\Collections\Collection
  901.      */
  902.     public function getUserTerms()
  903.     {
  904.         return $this->userTerms;
  905.     }
  906.     /**
  907.      * Add salesManagoEvent
  908.      *
  909.      * @param \App\Entity\Gos\SalesManagoEvent $salesManagoEvent
  910.      *
  911.      * @return Orders
  912.      */
  913.     public function addSalesManagoEvent(\App\Entity\Gos\SalesManagoEvent $salesManagoEvent)
  914.     {
  915.         $this->salesManagoEvent[] = $salesManagoEvent;
  916.         return $this;
  917.     }
  918.     /**
  919.      * Remove salesManagoEvent
  920.      *
  921.      * @param \App\Entity\Gos\SalesManagoEvent $salesManagoEvent
  922.      */
  923.     public function removeSalesManagoEvent(\App\Entity\Gos\SalesManagoEvent $salesManagoEvent)
  924.     {
  925.         $this->salesManagoEvent->removeElement($salesManagoEvent);
  926.     }
  927.     /**
  928.      * Get salesManagoEvent
  929.      *
  930.      * @return \Doctrine\Common\Collections\Collection
  931.      */
  932.     public function getSalesManagoEvent()
  933.     {
  934.         return $this->salesManagoEvent;
  935.     }
  936.     public function getInfoline(): ?string
  937.     {
  938.         return $this->infoline;
  939.     }
  940.     public function setInfoline(?string $infoline): self
  941.     {
  942.         $this->infoline $infoline;
  943.         return $this;
  944.     }
  945.     public function getPostOrder(): ?string
  946.     {
  947.         return $this->postOrder;
  948.     }
  949.     public function setPostOrder(?string $postOrder): self
  950.     {
  951.         $this->postOrder $postOrder;
  952.         return $this;
  953.     }
  954.     public function getNoTaxPublicSectorUnit(): ?string
  955.     {
  956.         return $this->noTaxPublicSectorUnit;
  957.     }
  958.     public function setNoTaxPublicSectorUnit(?string $noTaxPublicSectorUnit): self
  959.     {
  960.         $this->noTaxPublicSectorUnit $noTaxPublicSectorUnit;
  961.         return $this;
  962.     }
  963.     public function getNoTaxType(): ?NoTaxType
  964.     {
  965.         return $this->noTaxType;
  966.     }
  967.     public function setNoTaxType(?NoTaxType $noTaxType): self
  968.     {
  969.         $this->noTaxType $noTaxType;
  970.         return $this;
  971.     }
  972.     public function getTouchPoint(): ?TouchPoint
  973.     {
  974.         return $this->touchPoint;
  975.     }
  976.     public function setTouchPoint(?TouchPoint $touchPoint): self
  977.     {
  978.         $this->touchPoint $touchPoint;
  979.         // set (or unset) the owning side of the relation if necessary
  980.         $newOrder $touchPoint === null null $this;
  981.         if ($newOrder !== $touchPoint->getOrder()) {
  982.             $touchPoint->setOrder($newOrder);
  983.         }
  984.         return $this;
  985.     }
  986.     public function getBuyerGift(): ?Collection
  987.     {
  988.         return $this->buyerGift;
  989.     }
  990.     public function setBuyerGift(?Gift $buyerGift): self
  991.     {
  992.         $this->buyerGift $buyerGift;
  993.         // set (or unset) the owning side of the relation if necessary
  994.         $newBuyerOrder $buyerGift === null null $this;
  995.         if ($newBuyerOrder !== $buyerGift->getBuyerOrder()) {
  996.             $buyerGift->setBuyerOrder($newBuyerOrder);
  997.         }
  998.         return $this;
  999.     }
  1000.     public function getRecipientGift(): ?Gift
  1001.     {
  1002.         return $this->recipientGift;
  1003.     }
  1004.     public function setRecipientGift(?Gift $recipientGift): self
  1005.     {
  1006.         $this->recipientGift $recipientGift;
  1007.         // set (or unset) the owning side of the relation if necessary
  1008.         $newRecipientOrder $recipientGift === null null $this;
  1009.         if ($newRecipientOrder !== $recipientGift->getRecipientOrder()) {
  1010.             $recipientGift->setRecipientOrder($newRecipientOrder);
  1011.         }
  1012.         return $this;
  1013.     }
  1014.     public function addBuyerGift(Gift $buyerGift): self
  1015.     {
  1016.         if (!$this->buyerGift->contains($buyerGift)) {
  1017.             $this->buyerGift[] = $buyerGift;
  1018.             $buyerGift->setBuyerOrder($this);
  1019.         }
  1020.         return $this;
  1021.     }
  1022.     public function removeBuyerGift(Gift $buyerGift): self
  1023.     {
  1024.         if ($this->buyerGift->contains($buyerGift)) {
  1025.             $this->buyerGift->removeElement($buyerGift);
  1026.             // set the owning side to null (unless already changed)
  1027.             if ($buyerGift->getBuyerOrder() === $this) {
  1028.                 $buyerGift->setBuyerOrder(null);
  1029.             }
  1030.         }
  1031.         return $this;
  1032.     }
  1033.     public function getTouchPointAll(): ?TouchPointAll
  1034.     {
  1035.         return $this->touchPointAll;
  1036.     }
  1037.     public function setTouchPointAll(?TouchPointAll $touchPointAll): self
  1038.     {
  1039.         $this->touchPointAll $touchPointAll;
  1040.         // set (or unset) the owning side of the relation if necessary
  1041.         $newOrder $touchPointAll === null null $this;
  1042.         if ($newOrder !== $touchPointAll->getOrder()) {
  1043.             $touchPointAll->setOrder($newOrder);
  1044.         }
  1045.         return $this;
  1046.     }
  1047.     public function getCountry(): ?Country
  1048.     {
  1049.         return $this->country;
  1050.     }
  1051.     public function setCountry(?Country $country): self
  1052.     {
  1053.         $this->country $country;
  1054.         return $this;
  1055.     }
  1056.     public function getUserFirstOrder(): ?User
  1057.     {
  1058.         return $this->userFirstOrder;
  1059.     }
  1060.     public function setUserFirstOrder(?User $user): self
  1061.     {
  1062.         $this->userFirstOrder $user;
  1063.         return $this;
  1064.     }
  1065.     public function checkIsCorrect(): bool
  1066.     {
  1067.         foreach ($this->orderPart as $orderPart)
  1068.         {
  1069.             /** @var OrderPart $orderPart */
  1070.             if (!$orderPart->getIsCorrect()) return false;
  1071.         }
  1072.         return true;
  1073.     }
  1074.     public function mustBeHiddenInSB(): bool
  1075.     {
  1076.         /** @var OrderPart $orderPart */
  1077.         foreach ($this->orderPart as $orderPart)
  1078.         {
  1079.             if ($orderPart->checkIfToHideInSB()) return true;
  1080.         }
  1081.         return false;
  1082.     }
  1083.     public function getProductsWithInvoicePayment(): array
  1084.     {
  1085.         $products = [];
  1086.         /** @var OrderPart $orderPart */
  1087.         foreach ($this->orderPart as $orderPart)
  1088.         {
  1089.             if (!$orderPart->getPaymentMethod())
  1090.             {
  1091.                 continue;
  1092.             }
  1093.             if ($orderPart->getPaymentMethod()->getSlug() === 'invoice')
  1094.             {
  1095.                 foreach ($orderPart->getOrderProductVariant() as $opv)
  1096.                 {
  1097.                     $products[] = $opv;
  1098.                 }
  1099.             }
  1100.         }
  1101.         return $products;
  1102.     }
  1103.     public function omittedShippingCostsInAllProducts(): bool
  1104.     {
  1105.         /** @var OrderPart $orderPart */
  1106.         foreach ($this->orderPart as $orderPart)
  1107.         {
  1108.             if (!$orderPart->omittedShippingCostsInAllProducts())
  1109.             {
  1110.                 return false;
  1111.             }
  1112.         }
  1113.         return true;
  1114.     }
  1115.     public function getProductsWithProformaPayment(): array
  1116.     {
  1117.         $products = [];
  1118.         /** @var OrderPart $orderPart */
  1119.         foreach ($this->orderPart as $orderPart)
  1120.         {
  1121.             /** @var OrderProductVariant $opv */
  1122.             if (!$orderPart->getPaymentMethod())
  1123.             {
  1124.                 continue;
  1125.             }
  1126.             if ($orderPart->getPaymentMethod()->getSlug() === 'proforma-invoice')
  1127.             {
  1128.                 foreach ($orderPart->getOrderProductVariant() as $opv)
  1129.                 {
  1130.                     $products[] = $opv;
  1131.                 }
  1132.             }
  1133.         }
  1134.         return $products;
  1135.     }
  1136.     public function canBePaidForWithOnline(): bool
  1137.     {
  1138.         /** @var OrderPart $orderPart */
  1139.         foreach ($this->orderPart as $orderPart)
  1140.         {
  1141.             if (!$orderPart->checkIfPayOnlineIsActive())
  1142.             {
  1143.                 return false;
  1144.             }
  1145.         }
  1146.         return true;
  1147.     }
  1148.     public function hasRecurringPaymentProducts(): bool
  1149.     {
  1150.         foreach ($this->orderPart as $orderPart)
  1151.         {
  1152.             if ($orderPart->hasRecurringPaymentProducts()) return true;
  1153.         }
  1154.         return false;
  1155.     }
  1156.     public function hasUniqskillsProducts()
  1157.     {
  1158.         foreach ($this->orderPart as $orderPart)
  1159.         {
  1160.             if ($orderPart->hasUniqskillsProducts())
  1161.                 return true;
  1162.         }
  1163.         return false;
  1164.     }
  1165.     public function hasOnlyUniqskillsProducts()
  1166.     {
  1167.         foreach ($this->orderPart as $orderPart)
  1168.         {
  1169.             if (!$orderPart->hasOnlyUniqskillsProducts())
  1170.                 return false;
  1171.         }
  1172.         return true;
  1173.     }
  1174.     public function getOrderedCourse()
  1175.     {
  1176.         /** @var OrderPart $orderPart */
  1177.         foreach ($this->getOrderPart() as $orderPart)
  1178.         {
  1179.             /** @var OrderProductVariant $opv */
  1180.             foreach ($orderPart->getOrderProductVariant() as $opv)
  1181.             {
  1182.                 if ($opv->getProductVariant() === null)
  1183.                 {
  1184.                     return null;
  1185.                 }
  1186.                 if (!$opv->getProductVariant()->getCourses()->isEmpty())
  1187.                 {
  1188.                     return $opv->getProductVariant()->getCourses()->first();
  1189.                 }
  1190.             }
  1191.         }
  1192.         return null;
  1193.     }
  1194.     public function getPaymentSystem(): ?PaymentSystem
  1195.     {
  1196.         return $this->paymentSystem;
  1197.     }
  1198.     public function setPaymentSystem(?PaymentSystem $paymentSystem): self
  1199.     {
  1200.         $this->paymentSystem $paymentSystem;
  1201.         return $this;
  1202.     }
  1203.     public function hasEventProducts()
  1204.     {
  1205.         foreach ($this->orderPart as $orderPart)
  1206.         {
  1207.             if ($orderPart->hasEventProduct())
  1208.                 return true;
  1209.         }
  1210.         return false;
  1211.     }
  1212.     public function hasDelayedProformaProducts()
  1213.     {
  1214.         foreach ($this->orderPart as $orderPart)
  1215.         {
  1216.             if ($orderPart->hasDelayedProformaProducts())
  1217.                 return true;
  1218.         }
  1219.         return false;
  1220.     }
  1221.     /**
  1222.      * @return Collection|BraintreeResponse[]
  1223.      */
  1224.     public function getBraintreeResponse(): Collection
  1225.     {
  1226.         return $this->braintreeResponse;
  1227.     }
  1228.     public function addBraintreeResponse(BraintreeResponse $braintreeResponse): self
  1229.     {
  1230.         if (!$this->braintreeResponse->contains($braintreeResponse)) {
  1231.             $this->braintreeResponse[] = $braintreeResponse;
  1232.             $braintreeResponse->setOrder($this);
  1233.         }
  1234.         return $this;
  1235.     }
  1236.     public function removeBraintreeResponse(BraintreeResponse $braintreeResponse): self
  1237.     {
  1238.         if ($this->braintreeResponse->contains($braintreeResponse)) {
  1239.             $this->braintreeResponse->removeElement($braintreeResponse);
  1240.             // set the owning side to null (unless already changed)
  1241.             if ($braintreeResponse->getOrder() === $this) {
  1242.                 $braintreeResponse->setOrder(null);
  1243.             }
  1244.         }
  1245.         return $this;
  1246.     }
  1247.     public function getIsTele()
  1248.     {
  1249.         if (strpos($this->getComment(), 'TELE ') && $this->getClientHost() == 'www.gos.e-firma.pl')
  1250.         {
  1251.             return true;
  1252.         }
  1253.         return false;
  1254.     }
  1255.     public function getButtonParameters(): ?string
  1256.     {
  1257.         return $this->buttonParameters;
  1258.     }
  1259.     public function setButtonParameters(?string $buttonParameters): self
  1260.     {
  1261.         $this->buttonParameters $buttonParameters;
  1262.         return $this;
  1263.     }
  1264.     public function getMarketing(): ?string
  1265.     {
  1266.         return $this->marketing;
  1267.     }
  1268.     public function setMarketing(?string $marketing): self
  1269.     {
  1270.         $this->marketing $marketing;
  1271.         return $this;
  1272.     }
  1273.     public function addParticipant(Participants $participant)
  1274.     {
  1275.         $this->participants[] = $participant;
  1276.         return $this;
  1277.     }
  1278.     public function removeParticipant(Participants $participant)
  1279.     {
  1280.         $this->participants->removeElement($participant);
  1281.     }
  1282.     public function getParticipants()
  1283.     {
  1284.         return $this->participants;
  1285.     }
  1286.     
  1287.     public function hasAllProductsTaxFreeForBudgetUnit()
  1288.     {
  1289.         /** @var OrderPart $orderPart */
  1290.         foreach ($this->getOrderPart() as $orderPart)
  1291.         {
  1292.             /** @var OrderProductVariant $opv */
  1293.             foreach ($orderPart->getOrderProductVariant() as $opv)
  1294.             {
  1295.                 if (!$opv->getProductVariant()->getTaxFreeForBudgetUnit())
  1296.                 {
  1297.                     return false;
  1298.                 }
  1299.             }
  1300.         }
  1301.         
  1302.         return true;
  1303.     }
  1304.     /**
  1305.      * @return Collection|ProductVariant[]
  1306.      */
  1307.     public function getAllProductVariants(): ?Collection
  1308.     {
  1309.         $variants = new ArrayCollection();
  1310.         /** @var OrderPart $orderPart */
  1311.         foreach ($this->getOrderPart() as $orderPart)
  1312.         {
  1313.             /** @var OrderProductVariant $opv */
  1314.             foreach ($orderPart->getOrderProductVariant() as $opv)
  1315.             {
  1316.                 $variants->add($opv->getProductVariant());
  1317.             }
  1318.         }
  1319.         return $variants;
  1320.     }
  1321.     public function getAllPrimaryProductVariants(): Collection
  1322.     {
  1323.         $variants = new ArrayCollection();
  1324.         /** @var OrderPart $orderPart */
  1325.         foreach ($this->getOrderPart() as $orderPart)
  1326.         {
  1327.             /** @var OrderProductVariant $opv */
  1328.             foreach ($orderPart->getOrderProductVariant() as $opv)
  1329.             {
  1330.                 if ($opv->getPrimaryVariant() === null) {
  1331.                     $variants->add($opv->getProductVariant());
  1332.                 }
  1333.             }
  1334.         }
  1335.         return $variants;
  1336.     }
  1337.     public function getAllOrderProductVariants(): ?Collection
  1338.     {
  1339.         $orderProductVariants = new ArrayCollection();
  1340.         /** @var OrderPart $orderPart */
  1341.         foreach ($this->getOrderPart() as $orderPart)
  1342.         {
  1343.             /** @var OrderProductVariant $opv */
  1344.             foreach ($orderPart->getOrderProductVariant() as $opv)
  1345.             {
  1346.                 $orderProductVariants->add($opv);
  1347.             }
  1348.         }
  1349.         return $orderProductVariants;
  1350.     }
  1351.     public function isEmailInvoiceEnabled(): bool
  1352.     {
  1353.         /** @var OrderPart $orderPart */
  1354.         foreach ($this->getOrderPart() as $orderPart)
  1355.         {
  1356.             /** @var OrderProductVariant $opv */
  1357.             foreach ($orderPart->getOrderProductVariant() as $opv)
  1358.             {
  1359.                 if (
  1360.                     is_null($opv->getProductVariant()->getDocumentDistributionChannel())
  1361.                     ||
  1362.                     $opv->getProductVariant()->getDocumentDistributionChannel() === DocumentDistributionChannels::PAPER)
  1363.                 {
  1364.                     return false;
  1365.                 }
  1366.             }
  1367.         }
  1368.         return true;
  1369.     }
  1370.     public function getTeleOrder(): ?TeleOrder
  1371.     {
  1372.         return $this->teleOrder;
  1373.     }
  1374.     public function setTeleOrder(?TeleOrder $teleOrder): self
  1375.     {
  1376.         $this->teleOrder $teleOrder;
  1377.         return $this;
  1378.     }
  1379.     public function getFoExportetAt(): ?\DateTimeInterface
  1380.     {
  1381.         return $this->foExportetAt;
  1382.     }
  1383.     public function setFoExportetAt(?\DateTimeInterface $foExportetAt): self
  1384.     {
  1385.         $this->foExportetAt $foExportetAt;
  1386.         return $this;
  1387.     }
  1388.     /**
  1389.      * @return Collection|ExportLog[]
  1390.      */
  1391.     public function getExportLogs(): Collection
  1392.     {
  1393.         return $this->exportLogs;
  1394.     }
  1395.     public function addExportLog(ExportLog $exportLog): self
  1396.     {
  1397.         if (!$this->exportLogs->contains($exportLog)) {
  1398.             $this->exportLogs[] = $exportLog;
  1399.             $exportLog->setOrders($this);
  1400.         }
  1401.         return $this;
  1402.     }
  1403.     public function removeExportLog(ExportLog $exportLog): self
  1404.     {
  1405.         if ($this->exportLogs->contains($exportLog)) {
  1406.             $this->exportLogs->removeElement($exportLog);
  1407.             // set the owning side to null (unless already changed)
  1408.             if ($exportLog->getOrders() === $this) {
  1409.                 $exportLog->setOrders(null);
  1410.             }
  1411.         }
  1412.         return $this;
  1413.     }
  1414.     public function getIsTest(): ?bool
  1415.     {
  1416.         return $this->isTest;
  1417.     }
  1418.     public function setIsTest(?bool $isTest): self
  1419.     {
  1420.         $this->isTest $isTest;
  1421.         return $this;
  1422.     }
  1423.     public function getIsGATransactionSent(): ?bool
  1424.     {
  1425.         return $this->isGATransactionSent;
  1426.     }
  1427.     public function setIsGATransactionSent(?bool $isGATransactionSent): self
  1428.     {
  1429.         $this->isGATransactionSent $isGATransactionSent;
  1430.         return $this;
  1431.     }
  1432.     public function getLab(): ?string
  1433.     {
  1434.         return $this->lab;
  1435.     }
  1436.     public function setLab(?string $lab): self
  1437.     {
  1438.         $this->lab $lab;
  1439.         return $this;
  1440.     }
  1441.     public function getIsSbExportNeeded(): ?bool
  1442.     {
  1443.         return $this->isSbExportNeeded;
  1444.     }
  1445.     public function setIsSbExportNeeded(bool $isSbExportNeeded): self
  1446.     {
  1447.         $this->isSbExportNeeded $isSbExportNeeded;
  1448.         return $this;
  1449.     }
  1450.     public function getSbExportAt(): ?\DateTimeInterface
  1451.     {
  1452.         return $this->sbExportAt;
  1453.     }
  1454.     public function setSbExportAt(?\DateTimeInterface $sbExportAt): self
  1455.     {
  1456.         $this->sbExportAt $sbExportAt;
  1457.         return $this;
  1458.     }
  1459.     public function getExtendedPaymentTime(): ?int
  1460.     {
  1461.         return $this->extendedPaymentTime;
  1462.     }
  1463.     public function setExtendedPaymentTime(int $extendedPaymentTime): self
  1464.     {
  1465.         $this->extendedPaymentTime $extendedPaymentTime;
  1466.         return $this;
  1467.     }
  1468.     public function getShippingType(): ?ShippingType
  1469.     {
  1470.         return $this->shippingType;
  1471.     }
  1472.     public function setShippingType(?ShippingType $shippingType): self
  1473.     {
  1474.         $this->shippingType $shippingType;
  1475.         return $this;
  1476.     }
  1477.     public function getTeleConsultant(): ?OrderTeleConsultant
  1478.     {
  1479.         return $this->teleConsultant;
  1480.     }
  1481.     public function setTeleConsultant(?OrderTeleConsultant $teleConsultant): self
  1482.     {
  1483.         $this->teleConsultant $teleConsultant;
  1484.         return $this;
  1485.     }
  1486.     /**
  1487.      * @return Collection|UserCard[]
  1488.      */
  1489.     public function getUserCards(): Collection
  1490.     {
  1491.         return $this->userCards;
  1492.     }
  1493.     public function addUserCard(UserCard $userCard): self
  1494.     {
  1495.         if (!$this->userCards->contains($userCard)) {
  1496.             $this->userCards[] = $userCard;
  1497.             $userCard->setOrders($this);
  1498.         }
  1499.         return $this;
  1500.     }
  1501.     public function removeUserCard(UserCard $userCard): self
  1502.     {
  1503.         if ($this->userCards->contains($userCard)) {
  1504.             $this->userCards->removeElement($userCard);
  1505.             // set the owning side to null (unless already changed)
  1506.             if ($userCard->getOrders() === $this) {
  1507.                 $userCard->setOrders(null);
  1508.             }
  1509.         }
  1510.         return $this;
  1511.     }
  1512.     public function getExportedToSbBy(): ?string
  1513.     {
  1514.         return $this->exportedToSbBy;
  1515.     }
  1516.     public function setExportedToSbBy(?string $exportedToSbBy): self
  1517.     {
  1518.         $this->exportedToSbBy $exportedToSbBy;
  1519.         return $this;
  1520.     }
  1521.     /**
  1522.      * Checks the notifies of each orderPart
  1523.      * Returns true if all have status: COMPLETED
  1524.      *
  1525.      * @return bool
  1526.      */
  1527.     public function hasOnlinePaymentCompleted(): bool
  1528.     {
  1529.         if ($this->orderPart->isEmpty())
  1530.         {
  1531.             return false;
  1532.         }
  1533.         /** @var OrderPart $orderPart */
  1534.         foreach ($this->orderPart as $orderPart)
  1535.         {
  1536.             if (
  1537.                 $orderPart->getMasterNotify() === null
  1538.                 || !$orderPart->getMasterNotify()->isSuccessfullyPaid()
  1539.             )
  1540.             {
  1541.                 return false;
  1542.             }
  1543.         }
  1544.         return true;
  1545.     }
  1546.     public function getFromSourceAll(): ?string
  1547.     {
  1548.         return $this->fromSourceAll;
  1549.     }
  1550.     public function setFromSourceAll(?string $fromSourceAll): self
  1551.     {
  1552.         $this->fromSourceAll $fromSourceAll;
  1553.         return $this;
  1554.     }
  1555.     public function getActionNumberAll(): ?string
  1556.     {
  1557.         return $this->actionNumberAll;
  1558.     }
  1559.     public function setActionNumberAll(?string $actionNumberAll): self
  1560.     {
  1561.         $this->actionNumberAll $actionNumberAll;
  1562.         return $this;
  1563.     }
  1564.     public function getProductVariantsReviewNotification(): ?ProductVariantReviewNotification
  1565.     {
  1566.         return $this->productVariantsReviewNotification;
  1567.     }
  1568.     public function getPaymentRewardDeadline(): ?\DateTimeInterface
  1569.     {
  1570.         return $this->paymentRewardDeadline;
  1571.     }
  1572.     public function setPaymentRewardDeadline(?\DateTimeInterface $paymentRewardDeadline): self
  1573.     {
  1574.         $this->paymentRewardDeadline $paymentRewardDeadline;
  1575.         return $this;
  1576.     }
  1577.     public function getUserAdditionalAccessOffer(): ?UserAdditionalAccessOffer
  1578.     {
  1579.         return $this->userAdditionalAccessOffer;
  1580.     }
  1581.     public function setUserAdditionalAccessOffer(?UserAdditionalAccessOffer $userAdditionalAccessOffer): self
  1582.     {
  1583.         $this->userAdditionalAccessOffer $userAdditionalAccessOffer;
  1584.         return $this;
  1585.     }
  1586.     /**
  1587.      * @return Collection|AdditionalAccessBeneficiary[]
  1588.      */
  1589.     public function getAdditionalAccessBeneficiaries(): Collection
  1590.     {
  1591.         return $this->additionalAccessBeneficiaries;
  1592.     }
  1593.     public function addAdditionalAccessBeneficiary(AdditionalAccessBeneficiary $additionalAccessBeneficiary): self
  1594.     {
  1595.         if (!$this->additionalAccessBeneficiaries->contains($additionalAccessBeneficiary)) {
  1596.             $this->additionalAccessBeneficiaries[] = $additionalAccessBeneficiary;
  1597.             $additionalAccessBeneficiary->setOrders($this);
  1598.         }
  1599.         return $this;
  1600.     }
  1601.     public function removeAdditionalAccessBeneficiary(AdditionalAccessBeneficiary $additionalAccessBeneficiary): self
  1602.     {
  1603.         if ($this->additionalAccessBeneficiaries->contains($additionalAccessBeneficiary)) {
  1604.             $this->additionalAccessBeneficiaries->removeElement($additionalAccessBeneficiary);
  1605.             // set the owning side to null (unless already changed)
  1606.             if ($additionalAccessBeneficiary->getOrders() === $this) {
  1607.                 $additionalAccessBeneficiary->setOrders(null);
  1608.             }
  1609.         }
  1610.         return $this;
  1611.     }
  1612.     public function getTeleOrderSplit(): ?bool
  1613.     {
  1614.         return $this->teleOrderSplit;
  1615.     }
  1616.     public function setTeleOrderSplit(?bool $teleOrderSplit): self
  1617.     {
  1618.         $this->teleOrderSplit $teleOrderSplit;
  1619.         return $this;
  1620.     }
  1621.     public function getBurAssignedSupportId(): ?string
  1622.     {
  1623.         return $this->burAssignedSupportId;
  1624.     }
  1625.     public function setBurAssignedSupportId(?string $burAssignedSupportId): self
  1626.     {
  1627.         $this->burAssignedSupportId $burAssignedSupportId;
  1628.         return $this;
  1629.     }
  1630.     public function isOnboardingActive(): bool
  1631.     {
  1632.         $isActive false;
  1633.         $portalSettings $this->getPortalSettings();
  1634.         if ($portalSettings !== null) {
  1635.             $onboardingSettings $portalSettings->getOnboardingSettings();
  1636.             if ($onboardingSettings !== null) {
  1637.                 $isActive $onboardingSettings->getIsActive() === true;
  1638.             }
  1639.         }
  1640.         return $isActive;
  1641.     }
  1642.     public function getOnboardingEmailTemplate(): ?EmailTemplate
  1643.     {
  1644.         $emailTemplate null;
  1645.         $portalSettings $this->getPortalSettings();
  1646.         if ($portalSettings !== null) {
  1647.             $onboardingSettings $portalSettings->getOnboardingSettings();
  1648.             if ($onboardingSettings !== null) {
  1649.                 $emailTemplate $onboardingSettings->getEmailTemplate();
  1650.             }
  1651.         }
  1652.         return $emailTemplate;
  1653.     }
  1654.     public function getSalesManago2PurchaseTags(): array
  1655.     {
  1656.         $tags = [];
  1657.         /** @var OrderPart $orderPart */
  1658.         foreach ($this->getOrderPart() as $orderPart) {
  1659.             /** @var OrderProductVariant $orderProductVariant */
  1660.             foreach ($orderPart->getOrderProductVariant() as $orderProductVariant) {
  1661.                 $productVariant $orderProductVariant->getProductVariant();
  1662.                 $product $productVariant->getMasterProduct();
  1663.                 $tags[] = 'ZAKUP_P' $product->getProductNo() . 'END';
  1664.             }
  1665.         }
  1666.         return $tags;
  1667.     }
  1668.     public function getSalesmanago2Funnels(): array
  1669.     {
  1670.         $funnels = [];
  1671.         /** @var OrderPart $orderPart */
  1672.         foreach ($this->getOrderPart() as $orderPart) {
  1673.             /** @var OrderProductVariant $orderProductVariant */
  1674.             foreach ($orderPart->getOrderProductVariant() as $orderProductVariant) {
  1675.                 $productVariant $orderProductVariant->getProductVariant();
  1676.                 $product $productVariant->getMasterProduct();
  1677.                 $funnels[$product->getProductNo()] = $product->getSalesmanagoTags(true);
  1678.             }
  1679.         }
  1680.         return $funnels;
  1681.     }
  1682.     public function getTaxStatement(): ?string
  1683.     {
  1684.         return (new TaxStatement($this))->getStatement();
  1685.     }
  1686. }