From 3b3319e4358b2011c8fdad72e801b23512088973 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Jun 2015 13:01:51 +0200 Subject: [PATCH] Add contrl invoice supplier already exists (as it is done on customer invoice) --- htdocs/fourn/facture/card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bf310d92f8d..b4b853b58bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1508,7 +1508,16 @@ if ($action == 'create') $langs->load('orders'); $txt=$langs->trans("SupplierOrder"); } - print ''.$txt.''.$objectsrc->getNomUrl(1).''; + print ''.$txt.''.$objectsrc->getNomUrl(1); + //We check if Origin document has already an invoice attached to it + $objectsrc->fetchObjectLinked($originid,'','','invoice_supplier'); + $cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']); + 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->country_code=='ES')