Replacing invoice integer types with Facture constants
This commit is contained in:
parent
d4d69e41b1
commit
ad928cb443
@ -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))
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -107,13 +107,13 @@ if ($id > 0 || ! empty($ref))
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
|
||||
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 '<br>'.$text.'.<br>';
|
||||
|
||||
@ -183,13 +183,13 @@ if ($object->id > 0)
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
|
||||
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 '<br>'.$text.'.<br>';
|
||||
@ -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 '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($object->type != 2)
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if ($action == 'editinvoicedate')
|
||||
{
|
||||
@ -312,10 +312,10 @@ if ($object->id > 0)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateMaxPayment');
|
||||
print '</td>';
|
||||
if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($object->type != 2)
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if ($action == 'editpaymentterm')
|
||||
{
|
||||
@ -338,10 +338,10 @@ if ($object->id > 0)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($object->type != 2)
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if ($action == 'editconditions')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user