From d4402aa7f55effa2e2fc27d5cfe7487be234f141 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 01:09:23 +0100 Subject: [PATCH] code easier to understand --- htdocs/adherents/class/adherent.class.php | 5 +++-- htdocs/comm/action/class/actioncomm.class.php | 5 +++-- htdocs/comm/mailing/class/mailing.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/expedition/class/expedition.class.php | 5 +++-- htdocs/expensereport/class/expensereport.class.php | 6 ++++-- htdocs/holiday/class/holiday.class.php | 4 ++-- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 5 +++-- htdocs/product/class/product.class.php | 4 ++-- htdocs/societe/class/societe.class.php | 5 +++-- htdocs/ticket/class/ticket.class.php | 4 ++-- 11 files changed, 29 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 039fd4d51c0..f8d37ff30ca 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2286,10 +2286,11 @@ class Adherent extends CommonObject { global $conf, $langs; - $datas = []; $langs->loadLangs(['members', 'companies']); + $nofetch = !empty($params['nofetch']); + + $datas = array(); - $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); return ['optimize' => $langs->trans("ShowUser")]; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9999f63b624..65d45ceb797 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1578,9 +1578,10 @@ class ActionComm extends CommonObject { global $conf, $langs, $user; $langs->load('agenda'); - $datas = []; - $nofetch = empty($params['nofetch']) ? false : true; + $datas = array(); + $nofetch = !empty($params['nofetch']); + // Set label of type $labeltype = ''; if ($this->type_code) { diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 6c21eb2e3b7..7ae756630cb 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -736,10 +736,10 @@ class Mailing extends CommonObject { global $conf, $langs; - $nofetch = empty($params['nofetch']) ? false : true; + $nofetch = !empty($params['nofetch']); $langs->load('mails'); - $datas = []; + $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowEMailing").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4ccdf93cb58..89b2a5f31d9 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1415,9 +1415,9 @@ class Account extends CommonObject global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; - $datas = []; + $datas = array(); - $nofetch = empty($params['nofetch']) ? false : true; + $nofetch = !empty($params['nofetch']); $pictos = img_picto('', $this->picto).' '.$langs->trans("BankAccount").''; if (isset($this->status)) { $pictos .= ' '.$this->getLibStatut(5); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 896f10ed9ec..417ac943493 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1834,8 +1834,9 @@ class Expedition extends CommonObject global $conf, $langs; $langs->load('shipping'); - $nofetch = empty($params['nofetch']) ? false : true; - $datas = []; + $nofetch = !empty($params['nofetch']); + + $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Shipment").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 84094914107..30862623810 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1705,9 +1705,11 @@ class ExpenseReport extends CommonObject global $conf, $langs; $langs->load('expensereport'); - $nofetch = empty($params['nofetch']) ? false : true; + + $nofetch = !empty($params['nofetch']); $moretitle = $params['moretitle'] ?? ''; - $datas = []; + + $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").''; if (isset($this->status)) { $datas['picto'] .= ' '.$this->getLibStatut(5); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 2d3cc7d9d37..4717db8bea0 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1311,9 +1311,9 @@ class Holiday extends CommonObject global $conf, $langs; $langs->load('holiday'); - $nofetch = empty($params['nofetch']) ? false : true; + $nofetch = !empty($params['nofetch']); - $datas = []; + $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Holiday").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index afc6ff87c26..275b0a2a2e3 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -727,8 +727,9 @@ class KnowledgeRecord extends CommonObject $langs->loadLangs(['knowledgemanagement', 'languages']); - $datas = []; - $nofetch = empty($params['nofetch']) ? false : true; + $datas = array(); + $nofetch = !empty($params['nofetch']); + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 321c6722018..8a6cfd5419c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5011,8 +5011,8 @@ class Product extends CommonObject $langs->load('products'); - $datas = []; - $nofetch = empty($params['nofetch']) ? false : true; + $datas = array(); + $nofetch = !empty($params['nofetch']); if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("ShowProduct")]; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a99c4a6d2fc..01f35b9ea17 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2613,10 +2613,11 @@ class Societe extends CommonObject $langs->loadLangs(['companies', 'commercial']); - $datas = []; + $datas = array(); $option = $params['option'] ?? ''; - $nofetch = empty($params['nofetch']) ? false : true; + $nofetch = !empty($params['nofetch']); + $name = $this->name; if (!empty($this->name_alias) && empty($noaliasinname)) { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index fcb43ebea28..8cf590a1cdf 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1432,9 +1432,9 @@ class Ticket extends CommonObject global $langs; $langs->load('ticket'); + $nofetch = !empty($params['nofetch']); - $nofetch = empty($params['nofetch']) ? false : true; - $datas = []; + $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").''; $datas['picto'] .= ' '.$this->getLibStatut(4); $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;