<?php
namespace App\Form\Input; class Select_AgencyBankAccount extends \Engine\Form\Input\Select { protected $idOffice = NULL; protected $notFilledOption = []; public function setIdOffice($idOffice) { $this->idOffice = $idOffice; } public function setNotFilledValue($key, $name) { $this->notFilledOption[$key] = $name; } protected function determinePossibleValues() { $basObj = new \App\EntityList\AgencyBankAccounts(); $basObj->setColumns(['idBank', 'account', 'currency', 'description']); $basObj->setOrderBy('id', 'ASC'); if ($this->idOffice) { $basObj->setFilter('off.idOffice', '=', $this->idOffice); } $basEx = $basObj->exportRecords(); $vals = []; if ($this->notFilledOption) { $vals = array_merge($vals, $this->notFilledOption); } foreach ($basEx as $ba) { $baDet = $ba['account']; if ($ba['currency']) { $baDet.= ' ['.$ba['currency'].']'; } if ($ba['idBank']) { $baDet.= ' - '.\Entity\Bank::select($ba['idBank'])->name; } if ($ba['description']) { $baDet.= ' - '.$ba['description']; } $vals[$ba['id']] = $baDet; } return $vals; } } 