From eb8d7f92c3abb79c0bb394633fd7a8e8c8dbdf23 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 28 Oct 2021 15:26:40 +0200 Subject: [PATCH] FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID --- htdocs/compta/facture/card.php | 18 +++++++++--------- htdocs/compta/facture/contact.php | 5 ++--- htdocs/compta/facture/document.php | 5 ++--- htdocs/compta/facture/info.php | 5 ++--- htdocs/compta/facture/note.php | 5 ++--- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c772fd0ad7b..f18bc9e6c00 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2756,15 +2756,6 @@ if (empty($reshook)) * View */ -if (empty($object->id)) { - llxHeader(); - $head = facture_prepare_head($object); - $langs->load('errors'); - echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'), - '
' . $langs->trans("ErrorRecordNotFound") . '
'; - llxFooter(); - exit; -} $form = new Form($db); $formother = new FormOther($db); @@ -3679,6 +3670,15 @@ if ($action == 'create') } elseif ($id > 0 || !empty($ref)) { + if (empty($object->id)) { + llxHeader(); + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound"); + echo ' '.$langs->trans('GoBack').'
'; + llxFooter(); + exit; + } + /* * Show object in view mode */ diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 7177463c30e..8395409cbd6 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -120,10 +120,9 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer) if (empty($object->id)) { llxHeader(); - $head = facture_prepare_head($object); $langs->load('errors'); - echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'), - '
' . $langs->trans("ErrorRecordNotFound") . '
'; + echo '
'.$langs->trans("ErrorRecordNotFound"); + echo ' '.$langs->trans('GoBack').'
'; llxFooter(); exit; } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 0818b944705..e6cf3551738 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -87,10 +87,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; if (empty($object->id)) { llxHeader(); - $head = facture_prepare_head($object); $langs->load('errors'); - echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'), - '
' . $langs->trans("ErrorRecordNotFound") . '
'; + echo '
'.$langs->trans("ErrorRecordNotFound"); + echo ' '.$langs->trans('GoBack').'
'; llxFooter(); exit; } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 955c41693c0..51b2ce8f4e3 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -45,10 +45,9 @@ $ref = GETPOST("ref", 'alpha'); if (empty($object->id)) { llxHeader(); - $head = facture_prepare_head($object); $langs->load('errors'); - echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'), - '
' . $langs->trans("ErrorRecordNotFound") . '
'; + echo '
'.$langs->trans("ErrorRecordNotFound"); + echo ' '.$langs->trans('GoBack').'
'; llxFooter(); exit; } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index dadb61b551d..089d01b4a1f 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -66,10 +66,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if (empty($object->id)) { llxHeader(); - $head = facture_prepare_head($object); $langs->load('errors'); - echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'), - '
' . $langs->trans("ErrorRecordNotFound") . '
'; + echo '
'.$langs->trans("ErrorRecordNotFound"); + echo ' '.$langs->trans('GoBack').'
'; llxFooter(); exit; }