src/Entity/Account.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * Account
  6.  * @ORM\Table(name="account", indexes={@ORM\Index(name="ac_user", columns={"ac_user"})})
  7.  * @ORM\Entity(repositoryClass="App\Repository\AccountRepository")
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class Account {
  11.     const ACCOUNT_STATUS_ACTIVE 0;
  12.     const ACCOUNT_STATUS_INACTIVE 1;
  13.     const COMPLETE_ACCOUNT 0;
  14.     const INCOMPLETE_ACCOUNT 1;
  15.     const LEAD_2_ACCOUNT 2;
  16.     /**
  17.      * @var integer
  18.      * @ORM\Column(name="ac_id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="IDENTITY")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @var string
  25.      * @ORM\Column(name="ac_name", type="string", length=50, nullable=false)
  26.      */
  27.     private $acName;
  28.     /**
  29.      * @var string
  30.      * @ORM\Column(name="ac_legal_name", type="string", length=50, nullable=false, options={"default":""})
  31.      */
  32.     private $acLegalName '';
  33.     /**
  34.      * @var string
  35.      * @ORM\Column(name="ac_nick_name", type="string", length=255, nullable=true, unique=true)
  36.      */
  37.     private $acNickName;
  38.     /**
  39.      * @var string
  40.      * @ORM\Column(name="ac_phone_number", type="string", length=50, nullable=true)
  41.      */
  42.     private $acPhoneNumber;
  43.     /**
  44.      * @var string
  45.      * @ORM\Column(name="ac_email", type="string", length=50, nullable=true)
  46.      */
  47.     private $acEmail;
  48.     /**
  49.      * @var string
  50.      * @ORM\Column(name="ac_contact_name", type="string", length=50, nullable=true)
  51.      */
  52.     private $acContactName;
  53.     /**
  54.      * @var \DateTime
  55.      * @ORM\Column(name="ac_date_created", type="datetime", nullable=true)
  56.      */
  57.     private $acDateCreated;
  58.     /**
  59.      * @var \App\Entity\User
  60.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  61.      * @ORM\JoinColumns({
  62.      *   @ORM\JoinColumn(name="ac_user", referencedColumnName="us_id", nullable=true, onDelete="CASCADE")
  63.      * })
  64.      */
  65.     private $acUser;
  66.     /**
  67.      * @var string
  68.      * @ORM\Column(name="ac_suit_po_box", type="string", nullable=true)
  69.      */
  70.     private $acSuitPoBox;
  71.     /**
  72.      * @var string
  73.      * @ORM\Column(name="ac_address", type="string", nullable=true)
  74.      */
  75.     private $acAddress;
  76.     /**
  77.      * @var string
  78.      * @ORM\Column(name="ac_address_public", type="string", nullable=true)
  79.      */
  80.     private $acAddressPublic;
  81.     /**
  82.      * @var \App\Entity\City
  83.      * @ORM\ManyToOne(targetEntity="App\Entity\City")
  84.      * @ORM\JoinColumns({
  85.      *   @ORM\JoinColumn(name="ac_city_id", referencedColumnName="ci_id", nullable=true)
  86.      * })
  87.      */
  88.     private $city;
  89.     /**
  90.      * @var \App\Entity\Zipcode
  91.      * @ORM\ManyToOne(targetEntity="App\Entity\Zipcode")
  92.      * @ORM\JoinColumns({
  93.      *   @ORM\JoinColumn(name="ac_zip_code_id", referencedColumnName="zc_id", nullable=true)
  94.      * })
  95.      */
  96.     private $zipcode;
  97.     /**
  98.      * @var string
  99.      * @ORM\Column(name="ac_deleted", type="boolean", nullable=false)
  100.      */
  101.     private $deleted;
  102.     /**
  103.      * @var string
  104.      * @ORM\Column(name="omt_sync", type="guid", nullable=true)
  105.      */
  106.     private $omtSync;
  107.     /**
  108.      * @var string
  109.      * @ORM\Column(name="ac_ein_number", type="string", length=20, nullable=true, unique=true)
  110.      */
  111.     private $ein;
  112.     /**
  113.      * @var string
  114.      * @ORM\Column(name="ac_suite", type="string", length=100, nullable=true)
  115.      */
  116.     private $suite;
  117.     /**
  118.      * @var smallint
  119.      * @ORM\Column(name="ac_number_locations", type="smallint", nullable=false, options={"default":1})
  120.      */
  121.     private $numberLocations 1;
  122.     /**
  123.      * @var string
  124.      * @ORM\Column(name="ac_internal_notes", type="string", length=250, nullable=true)
  125.      */
  126.     private $internalNotes;
  127.     /**
  128.      * @var smallint
  129.      * @ORM\Column(name="ac_corporate_type_business", type="smallint", nullable=false, options={"default":1})
  130.      */
  131.     private $corporateTypeBusiness 1;
  132.     /**
  133.      * @var smallint
  134.      * @ORM\Column(name="ac_is_lead_account", type="smallint", nullable=false, options={"default":0})
  135.      */
  136.     private $isLeadAccount 0;
  137.     /**
  138.      * @var boolean
  139.      * @ORM\Column(name="ac_account_quote", type="boolean", nullable=false, options={"default":false})
  140.      */
  141.     private $accountQuote false;
  142.     /**
  143.      * @var boolean
  144.      * @ORM\Column(name="ac_is_testing", type="boolean", nullable=false, options={"default":false})
  145.      */
  146.     private $isTesting false;
  147.     /**
  148.      * @var \App\Entity\Company
  149.      * @ORM\ManyToOne(targetEntity="App\Entity\Company")
  150.      * @ORM\JoinColumns({
  151.      *   @ORM\JoinColumn(name="company", referencedColumnName="co_id", nullable=true)
  152.      * })
  153.      */
  154.     private $company;
  155.     
  156.     /**
  157.      * @return type
  158.      */
  159.     public function getOmtSync() {
  160.         return $this->omtSync;
  161.     }
  162.     /**
  163.      * @param type $omtSync
  164.      */
  165.     public function setOmtSync($omtSync) {
  166.         $this->omtSync $omtSync;
  167.     }
  168.     
  169.     /**
  170.      * @return type
  171.      */
  172.     public function getId() {
  173.         return $this->id;
  174.     }
  175.     /**
  176.      * @return type
  177.      */
  178.     public function getAcName() {
  179.         return $this->acName;
  180.     }
  181.     /**
  182.      * @return type
  183.      */
  184.     public function getAcLegalName() {
  185.         return $this->acLegalName;
  186.     }
  187.     /**
  188.      * @return type
  189.      */
  190.     public function getAcPhoneNumber() {
  191.         return $this->acPhoneNumber;
  192.     }
  193.     /**
  194.      * @return type
  195.      */
  196.     public function getAcEmail() {
  197.         return $this->acEmail;
  198.     }
  199.     /**
  200.      * @return type
  201.      */
  202.     public function getAcContactName() {
  203.         return $this->acContactName;
  204.     }
  205.     /**
  206.      * @return type
  207.      */
  208.     public function getAcDateCreated() {
  209.         return $this->acDateCreated;
  210.     }
  211.     /**
  212.      * @return type
  213.      */
  214.     public function getAcUser() {
  215.         return $this->acUser;
  216.     }
  217.     /**
  218.      * @param type $acName
  219.      */
  220.     public function setAcName($acName) {
  221.         $this->acName $acName;
  222.     }
  223.     /**
  224.      * @param type $acLegalName
  225.      */
  226.     public function setAcLegalName($acLegalName) {
  227.         $this->acLegalName $acLegalName;
  228.     }
  229.     /**
  230.      * @param type $acPhoneNumber
  231.      */
  232.     public function setAcPhoneNumber($acPhoneNumber) {
  233.         $this->acPhoneNumber $acPhoneNumber;
  234.     }
  235.     /**
  236.      * @param type $acEmail
  237.      */
  238.     public function setAcEmail($acEmail) {
  239.         $this->acEmail $acEmail;
  240.     }
  241.     /**
  242.      * @param type $acContactName
  243.      */
  244.     public function setAcContactName($acContactName) {
  245.         $this->acContactName $acContactName;
  246.     }
  247.     /**
  248.      * @param \DateTime $acDateCreated
  249.      */
  250.     public function setAcDateCreated(\DateTime $acDateCreated NULL) {
  251.         $this->acDateCreated $acDateCreated;
  252.     }
  253.     /**
  254.      * @param \App\Entity\User $acUser
  255.      */
  256.     public function setAcUser(\App\Entity\User $acUser null) {
  257.         $this->acUser $acUser;
  258.     }
  259.     /**
  260.      * @return type
  261.      */
  262.     public function __toString() {
  263.         return "" $this->acName;
  264.     }
  265.     /**
  266.      * @return type
  267.      */
  268.     public function getDeleted() {
  269.         return $this->deleted;
  270.     }
  271.     /**
  272.      * @param type $deleted
  273.      */
  274.     public function setDeleted($deleted) {
  275.         $this->deleted $deleted;
  276.     }
  277.     /**
  278.      * @param type $acNickName
  279.      */
  280.     public function setAcNickName($acNickName) {
  281.         $this->acNickName $acNickName;
  282.     }
  283.     /**
  284.      * @return type
  285.      */
  286.     public function getAcNickName() {
  287.         return $this->acNickName;
  288.     }
  289.     /**
  290.      * @ORM\PrePersist
  291.      */
  292.     public function defaultDeleted() {
  293.         $this->deleted false;
  294.     }
  295.     /**
  296.      * @return string
  297.      */
  298.     public function accountStatus() {
  299.         if (!$this->getDeleted()) {
  300.             return 'Active';
  301.         } else {
  302.             return 'Inactive';
  303.         }
  304.     }
  305.     /**
  306.      * @return type
  307.      */
  308.     public function getAcSuitPoBox() {
  309.         return $this->acSuitPoBox;
  310.     }
  311.     /**
  312.      * @return type
  313.      */
  314.     public function getAcAddress() {
  315.         return $this->acAddress;
  316.     }
  317.     /**
  318.      * @return type
  319.      */
  320.     public function getCity() {
  321.         return $this->city;
  322.     }
  323.     /**
  324.      * @return type
  325.      */
  326.     public function getZipcode() {
  327.         return $this->zipcode;
  328.     }
  329.     /**
  330.      * @param type $acSuiPoBox
  331.      */
  332.     public function setAcSuitPoBox($acSuiPoBox) {
  333.         $this->acSuitPoBox $acSuiPoBox;
  334.     }
  335.     /**
  336.      * @param type $acAddress
  337.      */
  338.     public function setAcAddress($acAddress) {
  339.         $this->acAddress $acAddress;
  340.     }
  341.     /**
  342.      * @param \App\Entity\City $acCitiId
  343.      */
  344.     public function setCity(\App\Entity\City $acCitiId) {
  345.         $this->city $acCitiId;
  346.     }
  347.     /**
  348.      * @param \App\Entity\Zipcode $zipcode
  349.      */
  350.     public function setZipcode(\App\Entity\Zipcode $zipcode) {
  351.         $this->zipcode $zipcode;
  352.     }
  353.     /**
  354.      * @author Aealan Z <lrobledo@kijho.com> 29/07/2016
  355.      * @param type $alias slachichas y mas
  356.      * @param type $search
  357.      * @return type
  358.      */
  359.     public static function filterSearchParameters($alias$search) {
  360.         $textParameters '';
  361.         $parameters = [];
  362.         if (isset($search ['acName']) && $search ['acName'] != '') {
  363.             $textParameters .= " AND " $alias ".acName LIKE :acName";
  364.             $parameters ['acName'] = "%" $search ['acName'] . "%";
  365.         }
  366.         if (isset($search ['acContactName']) && $search ['acContactName'] != '') {
  367.             $textParameters .= " AND " $alias ".acContactName LIKE :acContactName";
  368.             $parameters ['acContactName'] = "%" $search ['acContactName'] . "%";
  369.         }
  370.         if (isset($search ['acEmail']) && $search ['acEmail'] != '') {
  371.             $textParameters .= " AND " $alias ".acEmail LIKE :acEmail";
  372.             $parameters ['acEmail'] = "%" $search ['acEmail'] . "%";
  373.         }
  374.         if (isset($search ['deleted']) && $search ['deleted'] != '') {
  375.             $textParameters .= " AND " $alias ".deleted = :deleted";
  376.             $parameters ['deleted'] = $search ['deleted'];
  377.         }
  378.         if (isset($search ['acUser']) && $search ['acUser'] != '') {
  379.             $textParameters .= " AND " $alias ".acUser = :acUser";
  380.             $parameters ['acUser'] = $search ['acUser'];
  381.         }
  382.         if (isset($search['user']) && $search['user'] instanceof User && $search['user']->getUsType() != User::USER_SUPER_ADMIN && $search['user']->getUsType() != User::USER_INTERNAL_SUPPORT) {
  383.             if ($search['user']->getUsType() == User::USER_RESELLER) {
  384.                 $textParameters .= " AND $alias.acUser IN (SELECT US.id FROM App\Entity\User US WHERE US.usType IN ('"User::USER_RESELLER ."','"User::USER_SUB_RESELLER ."','"User::USER_SUB_SUB_RESELLER ."')) ";
  385.             }elseif($search['user']->getUsType() == User::USER_SUB_RESELLER){
  386.                 $textParameters .= " AND $alias.acUser IN (SELECT US.id FROM App\Entity\User US WHERE US.usType IN ('"User::USER_SUB_RESELLER ."','"User::USER_SUB_SUB_RESELLER ."')) ";
  387.             }elseif($search['user']->getUsType() == User::USER_SUB_SUB_RESELLER){
  388.                 $textParameters .= " AND $alias.acUser IN (SELECT US.id FROM App\Entity\User US WHERE US.usType = "User::USER_SUB_SUB_RESELLER .") ";
  389.             }
  390.         }
  391.         return ['text' => $textParameters'parameters' => $parameters];
  392.     }
  393.     /**
  394.      * @author Aealan Z <lrobledo@kijho.com> 29/07/2016
  395.      * @param type $alias slachichas y mas
  396.      * @param type $order
  397.      * @return string
  398.      */
  399.     public static function filterOrderParameters($alias$order) {
  400.         $orderBy ' ORDER BY ' $alias '.acName ASC';
  401.         if (isset($order ['order_by_contac_name']) && $order ['order_by_contac_name'] != '') {
  402.             if ($order ['order_by_contac_name'] % 2) {
  403.                 $orderBy " ORDER BY " $alias ".acContactName DESC";
  404.             } else {
  405.                 $orderBy " ORDER BY " $alias ".acContactName ASC";
  406.             }
  407.         } elseif (isset($order ['order_by_account_email']) && $order ['order_by_account_email'] != '') {
  408.             if ($order ['order_by_account_email'] % 2) {
  409.                 $orderBy " ORDER BY " $alias ".acEmail DESC";
  410.             } else {
  411.                 $orderBy " ORDER BY " $alias ".acEmail ASC";
  412.             }
  413.         } elseif (isset($order ['order_by_account_name']) && $order ['order_by_account_name'] != '') {
  414.             if ($order ['order_by_account_name'] % 2) {
  415.                 $orderBy " ORDER BY " $alias ".acName DESC";
  416.             } else {
  417.                 $orderBy " ORDER BY " $alias ".acName ASC";
  418.             }
  419.         } elseif (isset($order ['order_by_created_date']) && $order ['order_by_created_date'] != '') {
  420.             if ($order ['order_by_created_date'] % 2) {
  421.                 $orderBy " ORDER BY " $alias ".acDateCreated DESC";
  422.             } else {
  423.                 $orderBy " ORDER BY " $alias ".acDateCreated ASC";
  424.             }
  425.         }
  426.         return $orderBy;
  427.     }
  428.     /**
  429.      * Get the value of ein
  430.      */
  431.     public function getEin(){
  432.         return $this->ein;
  433.     }
  434.     /**
  435.      * Set the value of ein
  436.      */
  437.     public function setEin($ein){
  438.         $this->ein $ein;
  439.     }
  440.     /**
  441.      * Get the value of suite
  442.      */
  443.     public function getSuite(){
  444.         return $this->suite;
  445.     }
  446.     /**
  447.      * Set the value of suite
  448.      */
  449.     public function setSuite($suite){
  450.         $this->suite $suite;
  451.     }
  452.     /**
  453.      * Get the value of internalNotes
  454.      */
  455.     public function getInternalNotes(){
  456.         return $this->internalNotes;
  457.     }
  458.     /**
  459.      * Set the value of internalNotes
  460.      */
  461.     public function setInternalNotes($internalNotes){
  462.         $this->internalNotes $internalNotes;
  463.     }
  464.     /**
  465.      * Get the value of corporateTypeBusiness
  466.      */
  467.     public function getCorporateTypeBusiness(){
  468.         return $this->corporateTypeBusiness;
  469.     }
  470.     /**
  471.      * Set the value of corporateTypeBusiness
  472.      */
  473.     public function setCorporateTypeBusiness(string $corporateTypeBusiness){
  474.         $this->corporateTypeBusiness $corporateTypeBusiness;
  475.     }
  476.     public function showEverything() {
  477.         return get_object_vars($this);
  478.     }
  479.     /**
  480.      * Get the value of isLeadAccount
  481.      */ 
  482.     public function getIsLeadAccount()
  483.     {
  484.         return $this->isLeadAccount;
  485.     }
  486.     /**
  487.      * Set the value of isLeadAccount
  488.      * @param  $isLeadAccount
  489.      */ 
  490.     public function setIsLeadAccount($isLeadAccount)
  491.     {
  492.         $this->isLeadAccount $isLeadAccount;
  493.     }
  494.     /**
  495.      * Get the value of numberLocations
  496.      */
  497.     public function getNumberLocations(){
  498.         return $this->numberLocations;
  499.     }
  500.     /**
  501.      * Set the value of numberLocations
  502.      */
  503.     public function setNumberLocations($numberLocations){
  504.         $this->numberLocations $numberLocations;
  505.     }
  506.     /**
  507.      * Get the value of acAddressPublic
  508.      * @return  string
  509.      */ 
  510.     public function getAcAddressPublic(){
  511.         return $this->acAddressPublic;
  512.     }
  513.     /**
  514.      * Set the value of acAddressPublic
  515.      * @param  string  $acAddressPublic
  516.      */ 
  517.     public function setAcAddressPublic(string $acAddressPublic){
  518.         $this->acAddressPublic $acAddressPublic;
  519.     }
  520.     /**
  521.      * Get the value of accountQuote
  522.      */ 
  523.     public function getAccountQuote(){
  524.         return $this->accountQuote;
  525.     }
  526.     /**
  527.      * Set the value of accountQuote
  528.      */ 
  529.     public function setAccountQuote($accountQuote){
  530.         $this->accountQuote $accountQuote;
  531.     }
  532.     /**
  533.      * Get the value of isTesting
  534.      * @return  boolean
  535.      */ 
  536.     public function getIsTesting()
  537.     {
  538.         return $this->isTesting;
  539.     }
  540.     /**
  541.      * Set the value of isTesting
  542.      * @param  bool  $isTesting
  543.      */ 
  544.     public function setIsTesting(bool $isTesting)
  545.     {
  546.         $this->isTesting $isTesting;
  547.     }
  548.     /**
  549.      * Get Company
  550.      */ 
  551.     public function getCompany(){
  552.         return $this->company;
  553.     }
  554.     /**
  555.      * Set Company
  556.      */ 
  557.     public function setCompany($company){
  558.         $this->company $company;
  559.     }
  560. }