From 973d61fe135fa2da3dce87e165cb6b727b21796d Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 7 Aug 2014 16:23:02 +0200 Subject: [PATCH] [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice --- ChangeLog | 1 + htdocs/compta/facture.php | 11 ++++++++++- htdocs/langs/en_US/bills.lang | 2 ++ htdocs/langs/fr_FR/bills.lang | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bbfdf2e114f..26fe1616611 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,7 @@ For users: - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. - New: [ task #1204 ] add a External reference to contract +- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice For translators: - Update language files. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index fbe462ca0e7..52db008e955 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2304,7 +2304,16 @@ if ($action == 'create') elseif ($newclassname == 'Fichinter') $newclassname = 'Intervention'; - print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . ''; + print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1); + //We check if Origin document has already an invoice attached to it + $objectsrc->fetchObjectLinked($originid,'','','facture'); + $cntinvoice=count($objectsrc->linkedObjects['facture']); + if ($cntinvoice>=1) + { + setEventMessage('WarningBillExist','warnings'); + echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')'; + } + echo ''; print '' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . ''; print '' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . ""; if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 9f8353acfda..ededbf9cbdc 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -295,6 +295,8 @@ TotalOfTwoDiscountMustEqualsOriginal=Total of two new discount must be equal to ConfirmRemoveDiscount=Are you sure you want to remove this discount ? RelatedBill=Related invoice RelatedBills=Related invoices +LatestRelatedBill=Latest related invoice +WarningBillExist=Warning, one or more invoice already exist # PaymentConditions PaymentConditionShortRECEP=Immediate diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index c4bf33c56cc..aaea4122b22 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -295,6 +295,8 @@ TotalOfTwoDiscountMustEqualsOriginal=La somme du montant des 2 nouvelles réduct ConfirmRemoveDiscount=Êtes-vous sûr de vouloir supprimer cette réduction ? RelatedBill=Facture associée RelatedBills=Factures associées +LatestRelatedBill=Dernière facture associée +WarningBillExist=Attention, il existe déjà une ou plusieurs factures # PaymentConditions PaymentConditionShortRECEP=A réception