From ad928cb443369a67d6036535852dabe5506f8746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 26 Feb 2014 00:56:36 +0100 Subject: [PATCH] Replacing invoice integer types with Facture constants --- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/cashdesk/validation_verif.php | 2 +- htdocs/compta/facture/apercu.php | 8 ++++---- htdocs/compta/facture/prelevement.php | 24 ++++++++++++------------ 4 files changed, 18 insertions(+), 18 deletions(-) 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 ''; - if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('Date'); print 'id.'">'.img_edit($langs->trans('SetDate'),1).'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; print ''; - if ($object->type != 2) + if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editinvoicedate') { @@ -312,10 +312,10 @@ if ($object->id > 0) print ''; - if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('DateMaxPayment'); print 'id.'">'.img_edit($langs->trans('SetDate'),1).'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; print ''; - if ($object->type != 2) + if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editpaymentterm') { @@ -338,10 +338,10 @@ if ($object->id > 0) print ''; - if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print ''; - if ($object->type != 2) + if ($object->type != Facture::TYPE_CREDIT_NOTE) { if ($action == 'editconditions') {