- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\ShopBundle\Context\FilterMerchantInterface;
-
-
- abstract class Document extends AbstractDocumentEntity implements FilterMerchantInterface
- {
- const TYPE_INVOICE = 'invoice' ;
- const TYPE_QUOTATION = 'quotation' ;
- const TYPE_PURCHASE_ORDER = 'purchase-order' ;
- const TYPE_DELIVERY_NOTE = 'delivery-note' ;
-
-
-
- protected $merchant;
-
-
-
- protected $type;
-
-
-
- protected $reference;
-
-
-
- protected $logo;
-
-
-
- protected $merchantAddress;
-
-
-
- protected $buyerAddress;
-
-
-
- protected $merchantAddressText;
-
-
-
- protected $buyerAddressText;
-
-
-
- protected $deliveryAddressText;
-
-
-
- protected $isSent;
-
-
-
- protected $orderShops;
-
-
-
- protected $orderRefund;
-
- public function __construct()
- {
- $this->orderShops = new ArrayCollection();
- }
-
- public function getMerchant(): ?Merchant
- {
- return $this->merchant;
- }
-
- public function setMerchant(?Merchant $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
- public function getLabel()
- {
- if($this->getType() == self::TYPE_INVOICE) {
- return 'Facture' ;
- }
- elseif($this->getType() == self::TYPE_QUOTATION) {
- return 'Devis' ;
- }
- elseif($this->getType() == self::TYPE_PURCHASE_ORDER) {
- return 'Bon de commande' ;
- }
- elseif($this->getType() == self::TYPE_DELIVERY_NOTE) {
- return 'Bon de livraison' ;
- }
- }
-
- public function getType(): ?string
- {
- return $this->type;
- }
-
- public function setType(string $type): self
- {
- $this->type = $type;
-
- return $this;
- }
-
- public function getReference(): ?string
- {
- return $this->reference;
- }
-
- public function setReference(?string $reference): self
- {
- $this->reference = $reference;
-
- return $this;
- }
-
- public function getLogo(): ?string
- {
- return $this->logo;
- }
-
- public function setLogo(string $logo): self
- {
- $this->logo = $logo;
-
- return $this;
- }
-
- public function getMerchantAddress(): ?Address
- {
- return $this->merchantAddress;
- }
-
- public function setMerchantAddress(?Address $merchantAddress): self
- {
- $this->merchantAddress = $merchantAddress;
-
- return $this;
- }
-
- public function getBuyerAddress(): ?Address
- {
- return $this->buyerAddress;
- }
-
- public function setBuyerAddress(?Address $buyerAddress): self
- {
- $this->buyerAddress = $buyerAddress;
-
- return $this;
- }
-
- public function getMerchantAddressText(): ?string
- {
- return $this->merchantAddressText;
- }
-
- public function setMerchantAddressText(string $merchantAddressText): self
- {
- $this->merchantAddressText = $merchantAddressText;
-
- return $this;
- }
-
- public function getBuyerAddressText(): ?string
- {
- return $this->buyerAddressText;
- }
-
- public function setBuyerAddressText(?string $buyerAddressText): self
- {
- $this->buyerAddressText = $buyerAddressText;
-
- return $this;
- }
-
- public function getDeliveryAddressText(): ?string
- {
- return $this->deliveryAddressText;
- }
-
- public function setDeliveryAddressText(?string $deliveryAddressText): self
- {
- $this->deliveryAddressText = $deliveryAddressText;
-
- return $this;
- }
-
- public function getIsSent(): ?bool
- {
- return $this->isSent;
- }
-
- public function setIsSent(?bool $isSent): self
- {
- $this->isSent = $isSent;
-
- return $this;
- }
-
-
-
- public function getOrderShops(): Collection
- {
- return $this->orderShops;
- }
-
- public function addOrderShop(OrderShop $orderShop): self
- {
- if (!$this->orderShops->contains($orderShop)) {
- $this->orderShops[] = $orderShop;
- $orderShop->addDocument($this);
- }
-
- return $this;
- }
-
- public function removeOrderShop(OrderShop $orderShop): self
- {
- if ($this->orderShops->contains($orderShop)) {
- $this->orderShops->removeElement($orderShop);
- $orderShop->removeDocument($this);
- }
-
- return $this;
- }
-
-
- public function getOrderRefund(): ?OrderRefund
- {
- return $this->orderRefund;
- }
-
- public function setOrderRefund(OrderRefund $orderRefund): self
- {
- $this->orderRefund = $orderRefund;
-
-
- if ($orderRefund->getDocument() !== $this) {
- $orderRefund->setDocument($this);
- }
-
- return $this;
- }
- }
|