Fix close code

This commit is contained in:
Laurent Destailleur 2018-01-11 18:24:40 +01:00
parent 0b893c11fd
commit e152e81d18
3 changed files with 15 additions and 15 deletions

View File

@ -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 // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; 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) if ($replacedinvoice == 1)
{ {
continue; 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 // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; 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) if ($replacedinvoice == 1)
{ {
continue; 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 // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; 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) if ($replacedinvoice == 1)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -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 // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; 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) if ($replacedinvoice == 1)
{ {
continue; 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 // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; 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) if ($replacedinvoice == 1)
{ {
continue; 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 // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; 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) if ($replacedinvoice == 1)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -2053,7 +2053,7 @@ class Facture extends CommonInvoice
* of no payment even if merchandises were sent). * of no payment even if merchandises were sent).
* *
* @param User $user Object user making change * @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 * @param string $close_note Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -2187,7 +2187,7 @@ class Facture extends CommonInvoice
return -12; return -12;
} }
$result=$facreplaced->set_canceled($user,'replaced',''); $result=$facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, '');
if ($result < 0) if ($result < 0)
{ {
$this->error=$facreplaced->error; $this->error=$facreplaced->error;