Ejemplo n.º 1
0
 /**
  * Creates a version of the current object and saves it.
  *
  * @param   ConnectionInterface $con the connection to use
  *
  * @return  ChildOrderVersion A version object
  */
 public function addVersion($con = null)
 {
     $this->enforceVersion = false;
     $version = new ChildOrderVersion();
     $version->setId($this->getId());
     $version->setRef($this->getRef());
     $version->setCustomerId($this->getCustomerId());
     $version->setInvoiceOrderAddressId($this->getInvoiceOrderAddressId());
     $version->setDeliveryOrderAddressId($this->getDeliveryOrderAddressId());
     $version->setInvoiceDate($this->getInvoiceDate());
     $version->setCurrencyId($this->getCurrencyId());
     $version->setCurrencyRate($this->getCurrencyRate());
     $version->setTransactionRef($this->getTransactionRef());
     $version->setDeliveryRef($this->getDeliveryRef());
     $version->setInvoiceRef($this->getInvoiceRef());
     $version->setDiscount($this->getDiscount());
     $version->setPostage($this->getPostage());
     $version->setPostageTax($this->getPostageTax());
     $version->setPostageTaxRuleTitle($this->getPostageTaxRuleTitle());
     $version->setPaymentModuleId($this->getPaymentModuleId());
     $version->setDeliveryModuleId($this->getDeliveryModuleId());
     $version->setStatusId($this->getStatusId());
     $version->setLangId($this->getLangId());
     $version->setCartId($this->getCartId());
     $version->setCreatedAt($this->getCreatedAt());
     $version->setUpdatedAt($this->getUpdatedAt());
     $version->setVersion($this->getVersion());
     $version->setVersionCreatedAt($this->getVersionCreatedAt());
     $version->setVersionCreatedBy($this->getVersionCreatedBy());
     $version->setOrder($this);
     if (($related = $this->getCustomer($con)) && $related->getVersion()) {
         $version->setCustomerIdVersion($related->getVersion());
     }
     $version->save($con);
     return $version;
 }