Replacing invoice integer types with Facture constants

This commit is contained in:
Marcos García de La Fuente 2014-02-26 00:56:36 +01:00
parent d4d69e41b1
commit ad928cb443
4 changed files with 18 additions and 18 deletions

View File

@ -338,7 +338,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
} }
// Create draft invoice // Create draft invoice
$invoice->type=0; $invoice->type= Facture::TYPE_STANDARD;
$invoice->cond_reglement_id=$customer->cond_reglement_id; $invoice->cond_reglement_id=$customer->cond_reglement_id;
if (empty($invoice->cond_reglement_id)) if (empty($invoice->cond_reglement_id))
{ {

View File

@ -53,7 +53,7 @@ switch ($action)
$invoice=new Facture($db); $invoice=new Facture($db);
$invoice->date=dol_now(); $invoice->date=dol_now();
$invoice->type=0; $invoice->type= Facture::TYPE_STANDARD;
$num=$invoice->getNextNumRef($company); $num=$invoice->getNextNumRef($company);
$obj_facturation->numInvoice($num); $obj_facturation->numInvoice($num);

View File

@ -107,13 +107,13 @@ if ($id > 0 || ! empty($ref))
// Type // Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
print $object->getLibType(); print $object->getLibType();
if ($object->type == 1) if ($object->type == Facture::TYPE_REPLACEMENT)
{ {
$facreplaced=new Facture($db); $facreplaced=new Facture($db);
$facreplaced->fetch($object->fk_facture_source); $facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
} }
if ($object->type == 2) if ($object->type == Facture::TYPE_CREDIT_NOTE)
{ {
$facusing=new Facture($db); $facusing=new Facture($db);
$facusing->fetch($object->fk_facture_source); $facusing->fetch($object->fk_facture_source);
@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref))
if ($absolute_discount > 0) if ($absolute_discount > 0)
{ {
print '. '; 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) if ($object->statut == 0)
{ {
@ -164,7 +164,7 @@ if ($id > 0 || ! empty($ref))
} }
else 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)); $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print '<br>'.$text.'.<br>'; print '<br>'.$text.'.<br>';

View File

@ -183,13 +183,13 @@ if ($object->id > 0)
// Type // Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
print $object->getLibType(); print $object->getLibType();
if ($object->type == 1) if ($object->type == Facture::TYPE_REPLACEMENT)
{ {
$facreplaced=new Facture($db); $facreplaced=new Facture($db);
$facreplaced->fetch($object->fk_facture_source); $facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
} }
if ($object->type == 2) if ($object->type == Facture::TYPE_CREDIT_NOTE)
{ {
$facusing=new Facture($db); $facusing=new Facture($db);
$facusing->fetch($object->fk_facture_source); $facusing->fetch($object->fk_facture_source);
@ -228,7 +228,7 @@ if ($object->id > 0)
print '. '; print '. ';
if ($absolute_discount > 0) 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) if ($object->statut == 0)
{ {
@ -236,7 +236,7 @@ if ($object->id > 0)
} }
else 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)); $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
print '<br>'.$text.'.<br>'; print '<br>'.$text.'.<br>';
@ -260,9 +260,9 @@ if ($object->id > 0)
if ($absolute_creditnote > 0) if ($absolute_creditnote > 0)
{ {
// If validated, we show link "add credit note to payment" // 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)); $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse")); print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
@ -285,11 +285,11 @@ if ($object->id > 0)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Date'); print $langs->trans('Date');
print '</td>'; 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&amp;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&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2) if ($object->type != Facture::TYPE_CREDIT_NOTE)
{ {
if ($action == 'editinvoicedate') if ($action == 'editinvoicedate')
{ {
@ -312,10 +312,10 @@ if ($object->id > 0)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateMaxPayment'); print $langs->trans('DateMaxPayment');
print '</td>'; 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&amp;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&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2) if ($object->type != Facture::TYPE_CREDIT_NOTE)
{ {
if ($action == 'editpaymentterm') if ($action == 'editpaymentterm')
{ {
@ -338,10 +338,10 @@ if ($object->id > 0)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; 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&amp;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&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != 2) if ($object->type != Facture::TYPE_CREDIT_NOTE)
{ {
if ($action == 'editconditions') if ($action == 'editconditions')
{ {