From e9e100410a814d917e452227091ab741a2618545 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 14:51:19 +0100 Subject: [PATCH] Fix empty value --- htdocs/admin/facture_situation.php | 4 +++- htdocs/core/class/html.formsetup.class.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 636c5781b69..789faacacad 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -108,7 +108,9 @@ $item->fieldAttr = array( $item = $formSetup->newItem('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID'); $item->nameText = $langs->trans('PaymentConditionsShortRetainedWarranty'); $form->load_cache_conditions_paiements(); -$item->fieldOutputOverride = $form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label']; +if (!empty($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID) && isset($form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label'])) { + $item->fieldOutputOverride = $form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label']; +} $item->fieldInputOverride = $form->getSelectConditionsPaiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID', -1, 1); diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 722d7a8f247..8cfab129444 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -605,7 +605,7 @@ class FormSetupItem global $langs, $db, $conf, $form; $this->db = $db; - if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // form class have cache inside so I use it for optimise + if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // the form class has a cache inside so I am using it to optimize $this->form = $form; } else { $this->form = new Form($this->db);