Merge pull request #19634 from atm-gregr/FIX_Info_Tab_returns_Record_not_found

FIX :  info tab on customer invoice record not found
This commit is contained in:
Laurent Destailleur 2021-12-16 17:05:22 +01:00 committed by GitHub
commit 15b85258e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,29 +38,30 @@ $langs->loadLangs(array('companies', 'bills'));
$id = GETPOST("facid", "int");
$ref = GETPOST("ref", 'alpha');
$object = new Facture($db);
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
}
/*
* View
*/
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
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);
$object = new Facture($db);
$object->fetch($id, $ref);
$object->fetch_thirdparty();
if (empty($object->id)) {
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$object->fetch_thirdparty();
$object->info($object->id);
$head = facture_prepare_head($object);