diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 0c782c024a1..e8af356a245 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -250,14 +250,14 @@ if ($action == 'writebookkeeping') { // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched $replacedinvoice = 0; - if ($invoicestatic->close_code == 'replaced') + if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED) { $replacedinvoice = 1; $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. if ($alreadydispatched) $replacedinvoice = 2; } - // If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. + // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. if ($replacedinvoice == 1) { continue; @@ -560,14 +560,14 @@ if ($action == 'exportcsv') { // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched $replacedinvoice = 0; - if ($invoicestatic->close_code == 'replaced') + if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED) { $replacedinvoice = 1; $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. if ($alreadydispatched) $replacedinvoice = 2; } - // If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. + // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. if ($replacedinvoice == 1) { continue; @@ -760,14 +760,14 @@ if (empty($action) || $action == 'view') { // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched $replacedinvoice = 0; - if ($invoicestatic->close_code == 'replaced') + if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED) { $replacedinvoice = 1; $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. if ($alreadydispatched) $replacedinvoice = 2; } - // If no, we won't add it, if yes, we will also add the counterpart. + // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. if ($replacedinvoice == 1) { print ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 2a235cbe5d3..128c6be1471 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -252,14 +252,14 @@ if ($action == 'writebookkeeping') { // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched $replacedinvoice = 0; - if ($invoicestatic->close_code == 'replaced') + if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED) { $replacedinvoice = 1; $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. if ($alreadydispatched) $replacedinvoice = 2; } - // If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. + // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. if ($replacedinvoice == 1) { continue; @@ -515,14 +515,14 @@ if ($action == 'exportcsv') { // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched $replacedinvoice = 0; - if ($invoicestatic->close_code == 'replaced') + if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED) { $replacedinvoice = 1; $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. if ($alreadydispatched) $replacedinvoice = 2; } - // If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. + // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. if ($replacedinvoice == 1) { continue; @@ -692,14 +692,14 @@ if (empty($action) || $action == 'view') { // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched $replacedinvoice = 0; - if ($invoicestatic->close_code == 'replaced') + if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED) { $replacedinvoice = 1; $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. if ($alreadydispatched) $replacedinvoice = 2; } - // If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. + // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???. if ($replacedinvoice == 1) { print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f1d8c5d1a46..1891989a44a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2053,11 +2053,11 @@ class Facture extends CommonInvoice * of no payment even if merchandises were sent). * * @param User $user Object user making change - * @param string $close_code Code de fermeture + * @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...) * @param string $close_note Comment * @return int <0 if KO, >0 if OK */ - function set_canceled($user,$close_code='',$close_note='') + function set_canceled($user, $close_code='', $close_note='') { dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); @@ -2187,7 +2187,7 @@ class Facture extends CommonInvoice return -12; } - $result=$facreplaced->set_canceled($user,'replaced',''); + $result=$facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, ''); if ($result < 0) { $this->error=$facreplaced->error;