<?php
 namespace App\Form\Input; class Autocomplete_ImportedOrderCustomer extends Autocomplete_Customer { protected $class = "autocompleteImportedOrderCustomer"; protected $idImportedService; protected $passengerIdx; protected $hideSelector = false; protected $insertType='manualSelect'; public function setHideSelector($value) { $this->hideSelector = $value; } public function setPassengerIdx($index) { $this->passengerIdx = $index; } public function setIdImportedService($value) { $this->idImportedService = $value; } public function setInsertType($insertType) { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); if ($insertType!='manualSelect' and $insertType!='autoInsert' and !in_array($insertType, $CFG['generalData']['personTypes'])) { throw new \Exception("The `insert type` `{$insertType}` is not valid."); } $this->insertType = $insertType; } protected function getTemplateParams($templateClass = null, $parentElement = null) { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); $params = parent::getTemplateParams($templateClass, $parentElement ); $params['hideSelector'] = $this->hideSelector; $params['idImportedService']= $this->idImportedService; $params['passengerIdx'] = $this->passengerIdx; $params['insertType'] = $this->insertType; $params['passengerTypes'] = []; foreach($CFG['generalData']['personTypes'] as $type) { $params['passengerTypes'][$type] = $_LANG['generalData']['personTypes'][$type]; } $psgList = (array)\Entity\ImportedService::select($this->idImportedService)->object->passengers; $currPsg = $psgList[$this->passengerIdx]; $params['fullName'] = ''; if ($currPsg->lastNameStandard) { $params['fullName'] = \App\Smarty\Functions\NameFormat::renderStr($currPsg->firstNameStandard, $currPsg->lastNameStandard); } elseif ($currPsg->lastNameLocal) { $params['fullName'] = \App\Smarty\Functions\NameFormat::renderStr($currPsg->firstNameLocal, $currPsg->lastNameLocal); } return $params; } protected function loadTranslations($templateClass = null) { parent::loadTranslations($templateClass); \App\Loader_Lang::getInstance()->loadAppFile('_customLoad/formField/inputs/inputAutocompleteImportedOrderCustomer.lang.php'); } } 