From fc8cc70d7ea41b850bc51e9c3fab6e5dcbaff676 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Nov 2025 12:50:32 +0100 Subject: [PATCH] Clean code --- htdocs/core/class/commonobject.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 29379743f84..f887b18b265 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2158,20 +2158,21 @@ abstract class CommonObject public function fetch_origin() { // phpcs:enable - $origin = $this->origin ? $this->origin : $this->origin_type; + $tmpclassname = $this->origin ? $this->origin : $this->origin_type; // Manage classes with non standard name - if ($origin == 'shipping') { - $origin = 'expedition'; + if ($tmpclassname == 'shipping') { + $tmpclassname = 'Expedition'; } - if ($origin == 'delivery') { - $origin = 'livraison'; + if ($tmpclassname == 'delivery') { + $tmpclassname = 'Livraison'; } - if ($origin == 'order_supplier' || $origin == 'supplier_order') { - $origin = 'commandeFournisseur'; + if ($tmpclassname == 'order_supplier' || $tmpclassname == 'supplier_order') { + $tmpclassname = 'CommandeFournisseur'; } - $classname = ucfirst($origin); + $classname = ucfirst($tmpclassname); + $this->origin_object = new $classname($this->db); // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall $this->origin_object->fetch($this->origin_id);