Przeglądaj źródła

FIX: consistent UX when calling a tab from the invoice card with empty ref / id

atm-florian 3 lat temu
rodzic
commit
2da16ade6c

+ 11 - 0
htdocs/compta/facture/card.php

@@ -2756,6 +2756,17 @@ 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'),
+		'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
+	llxFooter();
+	dol_shutdown();
+	exit;
+}
+
 $form = new Form($db);
 $formother = new FormOther($db);
 $formfile = new FormFile($db);

+ 11 - 0
htdocs/compta/facture/contact.php

@@ -118,6 +118,17 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer)
  * View
  */
 
+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'),
+		'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
+	llxFooter();
+	dol_shutdown();
+	exit;
+}
+
 $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
 $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
 llxHeader('', $title, $helpurl);

+ 11 - 0
htdocs/compta/facture/document.php

@@ -85,6 +85,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
  * View
  */
 
+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'),
+		'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
+	llxFooter();
+	dol_shutdown();
+	exit;
+}
+
 $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
 $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
 llxHeader('', $title, $helpurl);

+ 11 - 0
htdocs/compta/facture/info.php

@@ -43,6 +43,17 @@ $ref = GETPOST("ref", 'alpha');
  * View
  */
 
+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'),
+		'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
+	llxFooter();
+	dol_shutdown();
+	exit;
+}
+
 $form = new Form($db);
 
 $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');

+ 11 - 0
htdocs/compta/facture/note.php

@@ -64,6 +64,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php';	// Must be include,
  * View
  */
 
+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'),
+		'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
+	llxFooter();
+	dol_shutdown();
+	exit;
+}
+
 $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
 $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
 llxHeader('', $title, $helpurl);