From 1fe933fa177153d0d6d265774257c146da9d29e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Feb 2007 04:57:56 +0000 Subject: [PATCH] Meilleur affichage liens factures de doit - remplacement sur PDF. --- htdocs/compta/facture.php | 30 ++++++++++++++----- .../modules/facture/pdf_crabe.modules.php | 15 ++++++++-- htdocs/langs/en_US/bills.lang | 3 ++ htdocs/langs/fr_FR/bills.lang | 3 ++ 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2e006b3caa2..ce89d729332 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2408,9 +2408,12 @@ else } // Récurrente - if (! $conf->global->FACTURE_DISABLE_RECUR) + if (! $conf->global->FACTURE_DISABLE_RECUR && $fac->type == 0) { - print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + if (! $facidnext) + { + print ''.$langs->trans("ChangeIntoRepeatableInvoice").''; + } } // Valider @@ -2493,17 +2496,30 @@ else } else { - print ''.$langs->trans('ClassifyCanceled').''; - - // \todo - // Ajouter bouton "Annuler et Créer facture remplacement" + if ($facidnext) + { + print ''.$langs->trans('ClassifyCanceled').''; + } + else + { + print ''.$langs->trans('ClassifyCanceled').''; + // \todo + // Ajouter bouton "Annuler et Créer facture remplacement" + } } } // Supprimer if ($fac->is_erasable() && $user->rights->facture->supprimer && $_GET['action'] != 'delete') { - print ''.$langs->trans('Delete').''; + if ($facidnext) + { + print ''.$langs->trans('Delete').''; + } + else + { + print ''.$langs->trans('Delete').''; + } } print ''; diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 6b8151b59d0..2e289e1b2aa 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -875,6 +875,17 @@ class pdf_crabe extends ModelePDFFactures $posy+=1; $pdf->SetFont('Arial','',10); + $facidnext=$object->getIdReplacingInvoice('validated'); + if ($object->type == 0 && $facidnext) + { + $objectreplacing=new Facture($this->db); + $objectreplacing->fetch($facidnext); + + $posy+=5; + $pdf->SetXY(100,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementByInvoice").' : '.$objectreplacing->ref, '', 'R'); + } if ($object->type == 1) { $objectreplaced=new Facture($this->db); @@ -883,7 +894,7 @@ class pdf_crabe extends ModelePDFFactures $posy+=5; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplaceInvoice", $objectreplaced->ref), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementInvoice").' : '.$objectreplaced->ref, '', 'R'); } if ($object->type == 2) { @@ -893,7 +904,7 @@ class pdf_crabe extends ModelePDFFactures $posy+=5; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectInvoice", $objectreplaced->ref), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$objectreplaced->ref, '', 'R'); } $posy+=5; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 4fae291a6ae..53320336f86 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -18,8 +18,11 @@ InvoiceAvoir=Credit note InvoiceAvoirAsk=Credit note to correct invoice InvoiceAvoirDesc=The credit note is a negative invoice used to solve fact that an invoice has an higher amount that should be (all possible reasons) or a product returned after invoice was payed. ReplaceInvoice=Replace invoice %s +ReplacementInvoice=Replacement invoice ReplacedByInvoice=Replaced by invoice %s +ReplacementByInvoice=Replaced by invoice CorrectInvoice=Correct invoice %s +CorrectionInvoice=Correction invoice NoReplacableInvoice=No replacable invoices NoInvoiceToCorrect=No invoice to correct InvoiceHasAvoir=Corrected by one or several invoices diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 53f1f6d0ac7..e07f7eccf80 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -18,8 +18,11 @@ InvoiceAvoir=Facture avoir InvoiceAvoirAsk=Facture avoir pour correction de la facture InvoiceAvoirDesc=La facture d'avoir est une facture négative destinée à compenser une facture comportant un montant supérieur à ce qui aurait du (toutes causes possibles) ou parce qu'un produit a été retourné après que la facture soit payée. ReplaceInvoice=Remplace la facture %s +ReplacementInvoice=Remplacement facture ReplacedByInvoice=Remplacée par la facture %s +ReplacementByInvoice=Remplacée par facture CorrectInvoice=Corrige facture %s +CorrectionInvoice=Correction facture NoReplacableInvoice=Pas de factures remplacables NoInvoiceToCorrect=Pas de factures à corriger InvoiceHasAvoir=Corrigée par un ou plusieurs avoirs