From 358f8357f95f6d8c8f663f51ead8bc7e0edad6bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Sep 2020 18:25:38 +0200 Subject: [PATCH] FIX #14703 --- htdocs/compta/bank/class/account.class.php | 5 ++++- htdocs/compta/tva/card.php | 10 +++++----- htdocs/compta/tva/class/tva.class.php | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 07e4abb0197..31d7749a430 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -476,7 +476,7 @@ class Account extends CommonObject * @param string $oper 1,2,3,4... (deprecated) or 'TYP','VIR','PRE','LIQ','VAD','CB','CHQ'... * @param string $label Descripton * @param float $amount Amount - * @param string $num_chq Numero cheque ou virement + * @param string $num_chq Numero cheque or transfer * @param int $categorie Category id (optionnal) * @param User $user User that create * @param string $emetteur Name of cheque writer @@ -572,15 +572,18 @@ class Account extends CommonObject if (!$result) { $this->error = $this->db->lasterror(); $this->db->rollback(); + return -3; } } $this->db->commit(); + return $accline->id; } else { $this->error = $this->db->lasterror(); $this->db->rollback(); + return -2; } } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 658c9353a00..6d7c5935418 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -100,16 +100,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->label = GETPOST("label", 'alpha'); $object->note = GETPOST("note", 'none'); - if (empty($object->datev)) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateValue")), null, 'errors'); - $error++; - } if (empty($object->datep)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")), null, 'errors'); $error++; } + if (empty($object->datev)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PeriodEndDate")), null, 'errors'); + $error++; + } if (empty($object->type_payment) || $object->type_payment < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c01408f3c9a..668a58c4f77 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -519,6 +519,7 @@ class Tva extends CommonObject $this->amount = price2num(trim($this->amount)); $this->label = trim($this->label); $this->note = trim($this->note); + $this->num_payment = trim($this->num_payment); $this->fk_bank = (int) $this->fk_bank; $this->fk_user_creat = (int) $this->fk_user_creat; $this->fk_user_modif = (int) $this->fk_user_modif; @@ -603,9 +604,9 @@ class Tva extends CommonObject if ($result <= 0) dol_print_error($this->db); if ($this->amount > 0) { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), $this->num_payment, '', $user); } else { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), $this->num_payment, '', $user); } // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction