diff --git a/Core/Model/Cuenta.php b/Core/Model/Cuenta.php index eced8f24a6..ad0116e150 100644 --- a/Core/Model/Cuenta.php +++ b/Core/Model/Cuenta.php @@ -185,12 +185,13 @@ public static function tableName(): string public function test(): bool { $this->codcuenta = trim($this->codcuenta); + $this->descripcion = $this->toolBox()->utils()->noHtml($this->descripcion); + if (empty($this->codcuenta) || false === is_numeric($this->codcuenta)) { $this->toolBox()->i18nLog()->warning('invalid-number', ['%number%' => $this->codcuenta]); return false; } - $this->descripcion = $this->toolBox()->utils()->noHtml($this->descripcion); if (strlen($this->descripcion) < 1 || strlen($this->descripcion) > 255) { $this->toolBox()->i18nLog()->warning('invalid-column-lenght', ['%column%' => 'descripcion', '%min%' => '1', '%max%' => '255']); return false; diff --git a/Core/Translation/gl_ES.json b/Core/Translation/gl_ES.json index 3ee2436704..60c0b78bba 100644 --- a/Core/Translation/gl_ES.json +++ b/Core/Translation/gl_ES.json @@ -421,7 +421,7 @@ "emails-sent": "Emails enviados", "employees": "Empregados", "empty": "Vacío", - "empty-contact-data": "El contacto debe tener nombre o email o dirección", + "empty-contact-data": "O contacto debe ter nome ou email ou dirección", "enable": "Activar", "enable-api": "Activar API", "enable-updates-beta": "Activar actualizacións beta", diff --git a/Test/Core/Model/CuentaTest.php b/Test/Core/Model/CuentaTest.php index 2c35c734c9..4cf4301e99 100644 --- a/Test/Core/Model/CuentaTest.php +++ b/Test/Core/Model/CuentaTest.php @@ -72,6 +72,21 @@ public function testCreateBadCode() } } + public function testHtmlOnDescription() + { + $account = new Cuenta(); + $account->codcuenta = '9999'; + $account->codejercicio = $this->getRandomExercise()->codejercicio; + $account->descripcion = 'Test'; + $this->assertTrue($account->save(), 'can-not-create-account'); + + // comprobamos que el html se ha escapado + $this->assertEquals('<b>Test</b>', $account->descripcion); + + // eliminamos + $this->assertTrue($account->delete(), 'account-cant-delete'); + } + public function testCreateClosed() { // cerramos un ejercicio diff --git a/Test/Core/Model/SubcuentaTest.php b/Test/Core/Model/SubcuentaTest.php deleted file mode 100644 index f7e3d614e9..0000000000 --- a/Test/Core/Model/SubcuentaTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * Copyright (C) 2017-2018 Carlos Garcia Gomez - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -namespace FacturaScripts\Test\Core\Model; - -use FacturaScripts\Core\Model\Subcuenta; -use FacturaScripts\Test\Core\CustomTest; - -/** - * @covers \Subcuenta - * - * @author Francesc Pineda Segarra - */ -final class SubcuentaTest extends CustomTest -{ - - protected function setUp(): void - { - $this->model = new Subcuenta(); - } -}