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
$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 '<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
$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 '<tr class="oddeven">';

View File

@ -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;