diff --git a/Core/Model/Subcuenta.php b/Core/Model/Subcuenta.php index 21a9e05f07..c1eefe33f9 100644 --- a/Core/Model/Subcuenta.php +++ b/Core/Model/Subcuenta.php @@ -205,8 +205,12 @@ public function test(): bool { $this->saldo = $this->debe - $this->haber; - $this->codcuenta = trim($this->codcuenta); - $this->codsubcuenta = empty($this->idsubcuenta) ? $this->transformCodsubcuenta($this->codsubcuenta) : trim($this->codsubcuenta); + // escape html + foreach (['codcuenta', 'codsubcuenta', 'descripcion', 'codcuentaesp'] as $field) { + $this->{$field} = self::toolBox()::utils()::noHtml($this->{$field}); + } + + $this->codsubcuenta = empty($this->idsubcuenta) ? $this->transformCodsubcuenta($this->codsubcuenta) : $this->codsubcuenta; $this->descripcion = $this->toolBox()->utils()->noHtml($this->descripcion); if (strlen($this->descripcion) < 1 || strlen($this->descripcion) > 255) { $this->toolBox()->i18nLog()->warning( @@ -218,7 +222,7 @@ public function test(): bool // check exercise $exercise = $this->getExercise(); - if (!$this->disableAdditionalTest && strlen($this->codsubcuenta) !== $exercise->longsubcuenta) { + if (false === $this->disableAdditionalTest && strlen($this->codsubcuenta) !== $exercise->longsubcuenta) { $this->toolBox()->i18nLog()->warning('account-length-error', ['%code%' => $this->codsubcuenta]); return false; }