From 5f35030da06176dba6e77ff307515af5f1693fd1 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Tue, 12 Feb 2019 17:41:14 +0100 Subject: [PATCH] Bugfix tests --- include/src/Components/Discount.php | 8 ++------ modules/fatture/actions.php | 2 +- modules/preventivi/actions.php | 2 +- tests/acceptance/AnagraficheCest.php | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/src/Components/Discount.php b/include/src/Components/Discount.php index e7ea04d06..fa9b48cf5 100644 --- a/include/src/Components/Discount.php +++ b/include/src/Components/Discount.php @@ -45,9 +45,7 @@ abstract class Discount extends Model */ public function getImponibileAttribute() { - $result = $this->subtotale; - - return $this->parent->tipo->reversed ? -$result : $result; + return $this->subtotale; } /** @@ -63,9 +61,7 @@ abstract class Discount extends Model */ public function getIvaAttribute() { - $result = $this->attributes['iva']; - - return $this->parent->tipo->reversed ? -$result : $result; + return $this->attributes['iva']; } protected static function boot() diff --git a/modules/fatture/actions.php b/modules/fatture/actions.php index 21a3c4b3e..f2bb5e99f 100644 --- a/modules/fatture/actions.php +++ b/modules/fatture/actions.php @@ -1289,7 +1289,7 @@ switch (post('op')) { // Aggiornamento sconto if (post('evadere')[$fattura->scontoGlobale->id] == 'on') { $nota->tipo_sconto_globale = $fattura->tipo_sconto_globale; - $nota->sconto_globale = $fattura->sconto_globale; + $nota->sconto_globale = $fattura->tipo_sconto_globale == 'PRC' ? $fattura->sconto_globale : -$fattura->sconto_globale; $nota->save(); $nota->updateSconto(); diff --git a/modules/preventivi/actions.php b/modules/preventivi/actions.php index 2360e0464..eeb9aceb8 100644 --- a/modules/preventivi/actions.php +++ b/modules/preventivi/actions.php @@ -369,7 +369,7 @@ switch (post('op')) { flash()->info(tr('Aggiunta nuova revisione!')); break; - // Creazione fattura da contratto + // Creazione fattura da preventivo case 'fattura_da_preventivo': $preventivo = Preventivo::find($id_record); diff --git a/tests/acceptance/AnagraficheCest.php b/tests/acceptance/AnagraficheCest.php index 3beca7aa8..3cb70b032 100644 --- a/tests/acceptance/AnagraficheCest.php +++ b/tests/acceptance/AnagraficheCest.php @@ -72,7 +72,7 @@ class AnagraficheCest $t->clickAndWaitModal('.btn-primary', '#tabs'); // Completa i campi per il nuovo elemento - $t->fillField('Ragione sociale', $name); + $t->fillField('Denominazione', $name); $t->select2('#idtipoanagrafica', $tipo); $t->click('.btn-box-tool'); $t->waitForElementVisible('#piva', 3); @@ -82,7 +82,7 @@ class AnagraficheCest $t->clickAndWait('Aggiungi', '#add-form'); // Controlla il salvataggio finale - $t->seeInField('Ragione sociale', $name); + $t->seeInField('Denominazione', $name); } /**