<?php
 namespace App\ImportedOrder; class ServiceType extends EntityAbstract { public $codeTina; public $codeSystem; public $name; protected function validateEntityFields(\App\MessagesCollector $messagesCollector): void { if ($this->codeTina and !\App\Config\Services_Basic::getInstance()->checkService($this->codeTina)) { $messagesCollector->addInfo("The service code `{$this->codeTina}` is not valid."); } } public function getMatchedId($idExternalSystem) { $matchedServiceCodeSystem = null; if ($idExternalSystem and $this->codeSystem) { $matchedServiceCodeSystem = \App\Config\ImportedOrders_Matches::getInstance()->getServiceType($idExternalSystem, $this->codeSystem); } $ret = null; if ($this->codeTina and $matchedServiceCodeSystem) { if ($this->codeTina==$matchedServiceCodeSystem) { $ret = $this->codeTina; } else { $ret = ''; } } elseif ($matchedServiceCodeSystem) { $ret = $matchedServiceCodeSystem; } elseif ($this->codeTina) { $ret = $this->codeTina; } else { } return $ret; } } 