FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID

This commit is contained in:
Marc de Lima Lucio 2021-10-28 15:26:40 +02:00
parent e1af439a6d
commit eb8d7f92c3
5 changed files with 17 additions and 21 deletions

View File

@ -2756,15 +2756,6 @@ if (empty($reshook))
* View * 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'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -3679,6 +3670,15 @@ if ($action == 'create')
} }
elseif ($id > 0 || !empty($ref)) elseif ($id > 0 || !empty($ref))
{ {
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound");
echo ' <a href="javascript:history.go(-1)">'.$langs->trans('GoBack').'</div>';
llxFooter();
exit;
}
/* /*
* Show object in view mode * Show object in view mode
*/ */

View File

@ -120,10 +120,9 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer)
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound");
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>'; echo ' <a href="javascript:history.go(-1)">'.$langs->trans('GoBack').'</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -87,10 +87,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound");
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>'; echo ' <a href="javascript:history.go(-1)">'.$langs->trans('GoBack').'</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -45,10 +45,9 @@ $ref = GETPOST("ref", 'alpha');
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound");
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>'; echo ' <a href="javascript:history.go(-1)">'.$langs->trans('GoBack').'</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -66,10 +66,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound");
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>'; echo ' <a href="javascript:history.go(-1)">'.$langs->trans('GoBack').'</div>';
llxFooter(); llxFooter();
exit; exit;
} }