From cc12baed57bda34c2833fdfcba78926ea23c86a0 Mon Sep 17 00:00:00 2001 From: atm-gregr Date: Thu, 16 Dec 2021 10:19:42 +0100 Subject: [PATCH 1/3] fix info tab on customer invoice record not found --- htdocs/compta/facture/info.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index ccf6dca135c..340dfda2957 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -43,6 +43,12 @@ $ref = GETPOST("ref", 'alpha'); * View */ +$object = new Facture($db); +$object->fetch($id, $ref); +$object->fetch_thirdparty(); + +$object->info($object->id); + if (empty($object->id)) { llxHeader(); $langs->load('errors'); @@ -57,12 +63,6 @@ $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); -$object = new Facture($db); -$object->fetch($id, $ref); -$object->fetch_thirdparty(); - -$object->info($object->id); - $head = facture_prepare_head($object); print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'); From dc1118a3dfaebac1f5a217357b1032c08625550c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Dec 2021 17:04:25 +0100 Subject: [PATCH 2/3] Update info.php --- htdocs/compta/facture/info.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 340dfda2957..e08b237d5ea 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -38,31 +38,30 @@ $langs->loadLangs(array('companies', 'bills')); $id = GETPOST("facid", "int"); $ref = GETPOST("ref", 'alpha'); +$object = new Facture($db); +$object->fetch($id, $ref); + /* * View */ -$object = new Facture($db); -$object->fetch($id, $ref); -$object->fetch_thirdparty(); - -$object->info($object->id); - -if (empty($object->id)) { - llxHeader(); - $langs->load('errors'); - echo '
'.$langs->trans("ErrorRecordNotFound").'
'; - llxFooter(); - exit; -} - $form = new Form($db); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); +if (empty($object->id)) { + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; +} + +$object->fetch_thirdparty(); +$object->info($object->id); + $head = facture_prepare_head($object); print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'); From e9b7fd0ef875943e09a5d1b9932dd1d3a1c79b16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Dec 2021 17:05:12 +0100 Subject: [PATCH 3/3] Update info.php --- htdocs/compta/facture/info.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index e08b237d5ea..abfbfabea21 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -39,7 +39,9 @@ $id = GETPOST("facid", "int"); $ref = GETPOST("ref", 'alpha'); $object = new Facture($db); -$object->fetch($id, $ref); +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); +} /*