From 702d91c65d26a861b61a1deb5b91acdfbf0fb34e Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 11 Sep 2025 12:25:22 +0200 Subject: [PATCH] Clean code --- htdocs/accountancy/class/accountancycategory.class.php | 2 +- htdocs/comm/propal/class/api_proposals.class.php | 2 +- htdocs/commande/class/api_orders.class.php | 2 +- htdocs/compta/facture/class/api_invoices.class.php | 2 +- htdocs/don/class/api_donations.class.php | 2 +- htdocs/expedition/class/api_shipments.class.php | 2 +- .../expensereport/class/api_expensereports.class.php | 8 ++++---- htdocs/fichinter/class/api_interventions.class.php | 10 +++++----- htdocs/fourn/class/api_supplier_invoices.class.php | 2 +- htdocs/fourn/class/api_supplier_orders.class.php | 2 +- .../class/api_knowledgemanagement.class.php | 4 ++-- htdocs/projet/class/api_projects.class.php | 2 +- htdocs/projet/class/api_tasks.class.php | 2 +- htdocs/reception/class/api_receptions.class.php | 2 +- .../class/api_supplier_proposals.class.php | 2 +- htdocs/website/index.php | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 4ab7a8a65ee..0b8dd671e2c 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -399,7 +399,6 @@ class AccountancyCategory // extends CommonObject */ public function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $sql = "DELETE FROM ".$this->db->prefix().$this->table_element; @@ -438,6 +437,7 @@ class AccountancyCategory // extends CommonObject public function display($id) { global $conf; + $sql = "SELECT t.rowid, t.account_number, t.label"; $sql .= " FROM ".$this->db->prefix()."accounting_account as t"; $sql .= " WHERE t.fk_accounting_category = ".((int) $id); diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index f32cb62fe97..25c267e3d4d 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -305,7 +305,7 @@ class Proposals extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index ab13e2bef41..91252f216b4 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -309,7 +309,7 @@ class Orders extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index b0596e96cd5..27611b83895 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -347,7 +347,7 @@ class Invoices extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } if (!is_array($request_data)) { diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 27a422c2f2d..149c48b98c3 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -200,7 +200,7 @@ class Donations extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('don', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 8118d765f30..07cb29803dc 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -208,7 +208,7 @@ class Shipments extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 4ac30885abe..c82b7c3bb11 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -215,7 +215,7 @@ class ExpenseReports extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields @@ -568,7 +568,7 @@ class ExpenseReports extends DolibarrApi public function validate($id, $notrigger = 0) { if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->expensereport->fetch($id); if (!$result) { @@ -613,7 +613,7 @@ class ExpenseReports extends DolibarrApi public function approve($id, $notrigger = 0) { if (!DolibarrApiAccess::$user->hasRight('expensereport', 'approve')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->expensereport->fetch($id); if (!$result) { @@ -659,7 +659,7 @@ class ExpenseReports extends DolibarrApi public function deny($id, $details, $notrigger = 0) { if (!DolibarrApiAccess::$user->hasRight('expensereport', 'approve')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->expensereport->fetch($id); if (!$result) { diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 12c0daa57dc..4d10d40b25a 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -250,7 +250,7 @@ class Interventions extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); @@ -376,7 +376,7 @@ class Interventions extends DolibarrApi public function postLine($id, $request_data = null) { if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validateLine($request_data); @@ -468,7 +468,7 @@ class Interventions extends DolibarrApi public function reopen($id) { if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->fichinter->fetch($id); if (!$result) { @@ -511,7 +511,7 @@ class Interventions extends DolibarrApi public function validate($id, $notrigger = 0) { if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->fichinter->fetch($id); if (!$result) { @@ -551,7 +551,7 @@ class Interventions extends DolibarrApi public function closeFichinter($id) { if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->fichinter->fetch($id); if (!$result) { diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 0e8a46dffd6..dfe4149691c 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -231,7 +231,7 @@ class SupplierInvoices extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight("fournisseur", "facture", "creer")) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } if (!is_array($request_data)) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 9cf52085dfe..25dc0aaed95 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -247,7 +247,7 @@ class SupplierOrders extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight("fournisseur", "commande", "creer") && !DolibarrApiAccess::$user->hasRight("supplier_order", "creer")) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } if (!is_array($request_data)) { diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 12d387ab09c..8f5bf236491 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -457,7 +457,7 @@ class KnowledgeManagement extends DolibarrApi public function validate($id, $notrigger = 0) { if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->knowledgerecord->fetch($id); if (!$result) { @@ -494,7 +494,7 @@ class KnowledgeManagement extends DolibarrApi public function cancel($id, $notrigger = 0) { if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } $result = $this->knowledgerecord->fetch($id); if (!$result) { diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index db9d4e4a8ff..f4c52278354 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -313,7 +313,7 @@ class Projects extends DolibarrApi { global $conf; if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 0c2b1c6b859..673741ee3fe 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -196,7 +196,7 @@ class Tasks extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index 05eb602f526..e4ab8d369dc 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -207,7 +207,7 @@ class Receptions extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 308f899886b..5762b6e683e 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -126,7 +126,7 @@ class SupplierProposals extends DolibarrApi public function post($request_data = null) { if (!DolibarrApiAccess::$user->hasRight('supplier_proposal', 'creer')) { - throw new RestException(403, "Insuffisant rights"); + throw new RestException(403, "Insufficiant rights"); } // Check mandatory fields $result = $this->_validate($request_data); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 4dbc224767c..5c8ba93ed2b 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3362,7 +3362,7 @@ if (!GETPOST('hide_websitemenu')) { } elseif (empty($virtualurl)) { //$htmltext .= '
'.$langs->trans("VirtualHostUrlNotDefined").'

'; } else { - $htmltext .= '
'.$langs->trans("GoTo").' '.$virtualurl.'

'; + $htmltext .= '
'.$langs->trans("GoTo").' '.$virtualurl.' '.img_picto('', 'url').'

'; } if (getDolGlobalString('WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER')) { $htmltext .= '';