diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index 29b6ef1f1f2..2e8822b75d2 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -338,7 +338,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
}
// Create draft invoice
- $invoice->type=0;
+ $invoice->type= Facture::TYPE_STANDARD;
$invoice->cond_reglement_id=$customer->cond_reglement_id;
if (empty($invoice->cond_reglement_id))
{
diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php
index ffaa01b7a94..7cd29a54ec5 100644
--- a/htdocs/cashdesk/validation_verif.php
+++ b/htdocs/cashdesk/validation_verif.php
@@ -53,7 +53,7 @@ switch ($action)
$invoice=new Facture($db);
$invoice->date=dol_now();
- $invoice->type=0;
+ $invoice->type= Facture::TYPE_STANDARD;
$num=$invoice->getNextNumRef($company);
$obj_facturation->numInvoice($num);
diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php
index ab508e50035..afe5586ab13 100644
--- a/htdocs/compta/facture/apercu.php
+++ b/htdocs/compta/facture/apercu.php
@@ -107,13 +107,13 @@ if ($id > 0 || ! empty($ref))
// Type
print '
| '.$langs->trans('Type').' | ';
print $object->getLibType();
- if ($object->type == 1)
+ if ($object->type == Facture::TYPE_REPLACEMENT)
{
$facreplaced=new Facture($db);
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
}
- if ($object->type == 2)
+ if ($object->type == Facture::TYPE_CREDIT_NOTE)
{
$facusing=new Facture($db);
$facusing->fetch($object->fk_facture_source);
@@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref))
if ($absolute_discount > 0)
{
print '. ';
- if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
+ if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
if ($object->statut == 0)
{
@@ -164,7 +164,7 @@ if ($id > 0 || ! empty($ref))
}
else
{
- if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
+ if ($object->statut < 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print ' '.$text.'. ';
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 48b08946469..740bd8ea11a 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -183,13 +183,13 @@ if ($object->id > 0)
// Type
print ' |
| '.$langs->trans('Type').' | ';
print $object->getLibType();
- if ($object->type == 1)
+ if ($object->type == Facture::TYPE_REPLACEMENT)
{
$facreplaced=new Facture($db);
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
}
- if ($object->type == 2)
+ if ($object->type == Facture::TYPE_CREDIT_NOTE)
{
$facusing=new Facture($db);
$facusing->fetch($object->fk_facture_source);
@@ -228,7 +228,7 @@ if ($object->id > 0)
print '. ';
if ($absolute_discount > 0)
{
- if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
+ if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
if ($object->statut == 0)
{
@@ -236,7 +236,7 @@ if ($object->id > 0)
}
else
{
- if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
+ if ($object->statut < 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print ' '.$text.'. ';
@@ -260,9 +260,9 @@ if ($object->id > 0)
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
- if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
+ if ($object->statut != 1 || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_CREDIT_NOTE)
{
- if ($object->statut == 0 && $object->type != 3)
+ if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT)
{
$text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
@@ -285,11 +285,11 @@ if ($object->id > 0)
print '';
print ' | ';
- if ($object->type != 2)
+ if ($object->type != Facture::TYPE_CREDIT_NOTE)
{
if ($action == 'editinvoicedate')
{
@@ -312,10 +312,10 @@ if ($object->id > 0)
print '';
print ' | ';
- if ($object->type != 2)
+ if ($object->type != Facture::TYPE_CREDIT_NOTE)
{
if ($action == 'editpaymentterm')
{
@@ -338,10 +338,10 @@ if ($object->id > 0)
print '';
print ' | ';
- if ($object->type != 2)
+ if ($object->type != Facture::TYPE_CREDIT_NOTE)
{
if ($action == 'editconditions')
{
|