<?php
namespace App\EntityClone; class Service extends \App\EntityClone\BaseAbstract { protected function attachFields() { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $entityOld = \Entity\Service::select($this->id); $this->entityNew->idReservation= $entityOld->idOrder; $this->entityNew->serviceCode= $entityOld->serviceCode; if ($entityOld->serviceCode == $CFG['travel']['otherServiceCode']) { $this->entityNew->serviceName= $entityOld->serviceName; } $servFld = \App\Config\Services_Fields::getInstance()->get($entityOld->serviceCode); if ($entityOld->categoryCode and $servFld['category']['type']!='invisible') { $this->entityNew->category= $entityOld->categoryCode; } if ($entityOld->productTypeCode and $servFld['productType']['type']!='invisible') { $this->entityNew->productType= $entityOld->productTypeCode; } if ($servFld['productMultiplier']['type']!='invisible') { $multiplierGenAttr = \App\Config\Services_GeneralAttributes::getInstance()->getServiceMultiplier($entityOld->serviceCode); if ($multiplierGenAttr['type']=='list' and is_array($entityOld->multiplierCode)) { $this->entityNew->multiplier = $entityOld->multiplierCode; } elseif ($multiplierGenAttr['type']=='value' and is_numeric($entityOld->multiplierCode)) { $this->entityNew->multiplier = $entityOld->multiplierCode; } } if ($entityOld->serviceSourceCode and $servFld['serviceSource']['type']!='invisible') { $this->entityNew->serviceSource= $entityOld->serviceSourceCode; } if ($entityOld->productName and $servFld['productName']['type']!='invisible') { $this->entityNew->productName= $entityOld->productName; } if ($entityOld->idSupplierProduct) $this->entityNew->idSupplierProduct= $entityOld->idSupplierProduct; $this->entityNew->idCustomers= $entityOld->idCustomersList; $this->entityNew->undefinedPax= $entityOld->undefinedPax; $this->entityNew->departureCountryCode= $entityOld->departureCountryCode; $this->entityNew->departureCityId= $entityOld->departureCityId; $this->entityNew->departureStationCode= $entityOld->departureStationCode; $this->entityNew->destinationCountryCode= $entityOld->destinationCountryCode; $this->entityNew->destinationCityId= $entityOld->destinationCityId; $this->entityNew->destinationStationCode= $entityOld->destinationStationCode; $this->entityNew->description= $entityOld->description; $this->entityNew->preferences= $entityOld->preferences; $this->entityNew->comments= $entityOld->comments; if ($entityOld->agencyCostCenter) $this->entityNew->agencyCostCenter= $entityOld->agencyCostCenter; if (defined("CURRENT_ID_USER")) $this->entityNew->idUser= CURRENT_ID_USER; if (defined("CURRENT_ID_OFFICE")) $this->entityNew->idOffice= CURRENT_ID_OFFICE; $this->entityNew->estInvoiceDate= $entityOld->estInvoiceDate; $this->entityNew->estCashDate= $entityOld->estCashDate; if ($entityOld->startDatetime) $this->entityNew->startDatetime= $entityOld->startDatetime; if ($entityOld->endDatetime) $this->entityNew->endDatetime= $entityOld->endDatetime; $this->entityNew->remarks= $entityOld->remarks; return $this->entityNew; } } 