From b9336570ff65d161c434302110576520310e9956 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 13 May 2021 10:26:09 +0200 Subject: [PATCH] NEW report contact/adresses on credit note from invoice keep same contact/adresses from source invoice (ir: usefull for correct notifications) --- htdocs/compta/facture/card.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 48b7c505264..6dd4d050b8b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1093,6 +1093,19 @@ if (empty($reshook)) { } } $id = $object->create($user); + if ($id < 0) { + $error++; + } else { + // copy internal contacts + if ($object->copy_linked_contact($facture_source, 'internal') < 0) { + $error++; + } elseif ($facture_source->socid == $object->socid) { + // copy external contacts if same company + if ($object->copy_linked_contact($facture_source, 'external') < 0) { + $error++; + } + } + } // NOTE: Pb with situation invoice // NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total