R
TDBMultiSearch - Problemas com getPostData()
Olá.
Na versão 7.2, o componente TDBMultiSearch, na função getPostData(), está abrindo uma transação sem finalizá-la depois.
Na versão 7.2, o componente TDBMultiSearch, na função getPostData(), está abrindo uma transação sem finalizá-la depois.
- <?php
- public function getPostData()
- {
- $ini = AdiantiApplicationConfig::get();
-
- if (isset($_POST[$this->name]))
- {
- $values = $_POST[$this->name];
-
- if (isset($ini['general']['compat']) AND $ini['general']['compat'] == '4')
- {
- $return = [];
- if (is_array($values))
- {
- TTransaction::open($this->database);
- foreach ($values as $value)
- {
- if ($value)
- {
- $model = $this->model;
- $pk = constant("{$model}::PRIMARYKEY");
-
- if ($pk === $this->key) // key is the primary key (default)
- {
- // use find because it uses cache
- $object = $model::find( $value );
- }
- else // key is an alternative key (uses where->first)
- {
- $object = $model::where( $this->key, '=', $value )->first();
- }
-
- if ($object)
- {
- $description = $object->render($this->mask);
- $return[$value] = $description;
- }
- }
- }
- }
- return $return;
- }
- else
- {
- if (empty($this->separator))
- {
- return $values;
- }
- else
- {
- return implode($this->separator, $values);
- }
- }
- }
- else
- {
- return '';
- }
- }
- ?>
Faltou, fechar a transação na linha 55
Corrigindo
Faltou, fechar a transação na linha 40
Sim. Só lembrando que este é um erro do framework que precisa ser corrigido.
Sim. Só lembrando que este é um erro do framework que precisa ser corrigido.
Sim. Só lembrando que este é um erro do framework que precisa ser corrigido.