Fix: Corrige quelques problmes avec factures de remplacement

This commit is contained in:
Laurent Destailleur 2006-11-11 14:46:30 +00:00
parent 341f752029
commit e2c50daf11
4 changed files with 26 additions and 6 deletions

View File

@ -1595,6 +1595,9 @@ else
$author->fetch();
}
$facidnext=$fac->getIdReplacingInvoice();
$head = facture_prepare_head($fac);
dolibarr_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'));
@ -1673,8 +1676,24 @@ else
*/
if ($_GET['action'] == 'canceled')
{
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled');
print '<br />';
// Si il y a une facture de remplacement pas encore validée (etat brouillon),
// on ne permet pas de classer abandonner la facture
if ($facidnext)
{
$facturereplacement=new Facture($db);
$facturereplacement->fetch($facidnext);
$statusreplacement=$facturereplacement->statut;
}
print "x".$statusreplacement;
if ($facidnext && $statusreplacement == 0)
{
print '<div class="error">'.$langs->trans("ErrorCantCancelIfReplacementInvoiceNotValidated").'</div>';
}
else
{
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled');
print '<br />';
}
}
/*
@ -1761,7 +1780,6 @@ else
}
print ')';
}
$facidnext=$fac->getIdReplacingInvoice();
if ($facidnext > 0)
{
$facthatreplace=new Facture($db);

View File

@ -1013,7 +1013,7 @@ class Facture extends CommonObject
// Controle que facture source non deja remplacee par une autre
$idreplacement=$facreplaced->getIdReplacingInvoice();
if ($idreplacement != $rowid)
if ($idreplacement && $idreplacement != $rowid)
{
$facreplacement=new Facture($this->db);
$facreplacement->fetch($idreplacement);

View File

@ -90,10 +90,11 @@ ErrorVATIntraNotConfigured=Intracommunautary VAT number not yet defined
ErrorNoPaiementModeConfigured=No paiment mode yet defined
ErrorCreateBankAccount=Creat a bank account then go to Setup panel of Invoice module to define paiement modes
ErrorBillNotFound=Invoice %s does not exists
ErrorInvoiceAlreadyReplaced=Error, invoice %s has already been replaced by invoice %s
ErrorInvoiceAlreadyReplaced=Error, you try to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s.
ErrorDiscountAlreadyUsed=Error, discount already used
ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount
ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have a positive amount
ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status
BillFrom=From
BillTo=Bill to
ActionsOnBill=Actions on invoice

View File

@ -90,10 +90,11 @@ ErrorVATIntraNotConfigured=Num
ErrorNoPaiementModeConfigured=Aucun mode de règlement défini
ErrorCreateBankAccount=Créer un compte bancaire puis aller dans la configuration du module facture pour définir les modes de règlement
ErrorBillNotFound=Facture %s inexistante
ErrorInvoiceAlreadyReplaced=Erreur, la facture %s a déjà été remplacée par la facture %s
ErrorInvoiceAlreadyReplaced=Erreur, vous voulez valider une facture qui doit remplacer la facture %s. Mais cette dernière a déjà été remplacée par une autre facture %s.
ErrorDiscountAlreadyUsed=Erreur, la remise a déjà été attribuée
ErrorInvoiceAvoirMustBeNegative=Erreur, une facture de type Avoir doit avoir un montant négatif
ErrorInvoiceOfThisTypeMustBePositive=Erreur, une facture de ce type doit avoir un montant positif
ErrorCantCancelIfReplacementInvoiceNotValidated=Erreur, il n'est pas possible d'annuler une facture qui a été remplacée par une autre qui se trouve toujours à l'état 'brouillon'.
BillFrom=Émetteur
BillTo=Adressé à
ActionsOnBill=Actions sur la facture