From f7d4d78008b132574dc81f6e358bd498b4863f7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 17:55:55 +0200 Subject: [PATCH 1/4] Fix error 500 --- htdocs/accountancy/journal/bankjournal.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 06f5a56f943..d2ad7a0503e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1179,6 +1179,7 @@ if (empty($action) || $action == 'view') { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; } else { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; + } } else { From 1101c4e587232905e2caa9c61545c47a8503e888 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:01:04 +0200 Subject: [PATCH 2/4] Fix trans --- htdocs/langs/en_US/accountancy.lang | 1 + htdocs/langs/fr_FR/accountancy.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 4b22f512826..9b80eae930c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -218,6 +218,7 @@ ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. We will use %s +ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unknown and subledger not defined on the payment. We will keep the subledger account value empty. ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Third-party account not defined or third party unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 0150ff7d017..7c0602332f3 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -218,6 +218,7 @@ ListAccounts=Liste des comptes comptables UnknownAccountForThirdparty=Compte de tiers inconnu. %s sera utilisé UnknownAccountForThirdpartyBlocking=Compte de tiers inconnu. Erreur bloquante. ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Code comptable du tiers non défini ou tiers inconnu. On utilisera %s. +ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Tiers inconnu et code comptable auxiliaire non défini sur le paiement. Nous conserverons la valeur du compte auxiliaire vide. ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Compte tiers non défini ou inconnu. Erreur bloquante. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Compte tiers inconnu et compte d'attente non défini. Erreur blocante. PaymentsNotLinkedToProduct=Paiement non lié à un produit / service From 42ee9845ad33dfa9a7a623102357c4e13e3ee0cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 15:21:02 +0200 Subject: [PATCH 3/4] Report error --- htdocs/compta/facture/class/facture.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 05661fb01cc..1558b6cbfab 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5013,8 +5013,7 @@ class FactureLigne extends CommonInvoiceLine $returnPercent = floatval($res['situation_percent']); - if($include_credit_note) { - + if ($include_credit_note) { $sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; $sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; $sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id; @@ -5026,6 +5025,8 @@ class FactureLigne extends CommonInvoiceLine while($obj = $this->db->fetch_object($res)) { $returnPercent = $returnPercent + floatval($obj->situation_percent); } + } else { + dol_print_error($this->db); } } From df917805525cbd22453c9b05c68d4b2785f2290a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 15:57:08 +0200 Subject: [PATCH 4/4] FIX Situation invoice take into account the credit notes. --- htdocs/compta/facture/card.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d83e13da433..934916fa31e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1590,6 +1590,8 @@ if (empty($reshook)) if (!empty($origin) && !empty($originid)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + $object->origin = $origin; $object->origin_id = $originid; @@ -1601,6 +1603,17 @@ if (empty($reshook)) $line->fetch_optionals($line->id); $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note + // The $line->situation_percent has been modified, so we must recalculate all amounts + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $line->situation_percent); + $line->total_ht = $tabprice[0]; + $line->total_tva = $tabprice[1]; + $line->total_ttc = $tabprice[2]; + $line->total_localtax1 = $tabprice[9]; + $line->total_localtax2 = $tabprice[10]; + $line->multicurrency_total_ht = $tabprice[16]; + $line->multicurrency_total_tva = $tabprice[17]; + $line->multicurrency_total_ttc = $tabprice[18]; + // Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée if ($line->fk_remise_except) { @@ -1644,6 +1657,7 @@ if (empty($reshook)) { $nextSituationInvoice = new Facture($db); $nextSituationInvoice->fetch($id); + // create extrafields with data from create form $extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice);