From b496e73a9f184f54470bfca2e83e438b521532cc Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:16:38 +0100 Subject: [PATCH] Update export.class.php Allow usage of a method param that is not part of the $obj from the sql request. The issue I encontered is the usage of order's LibStatut method that required a $mode param that can't be fetched from the sql request obj. This would be the code for the export declaration : $this->export_special_array[$r] = array( 'orders.fk_statut'=> [ 'rule' => 'compute', 'class' => 'Commande', 'classfile' => '/commande/class/commande.class.php', 'method' => 'LibStatut', 'method_params' => ['orders_fk_statut', 'orders_facture', '1'], ], ); We can see that the first two params will come from the $obj, but the third one will be used for it's value (in this case '1'). --- htdocs/exports/class/export.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 5cabec8df2061..214a518b94478 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -837,7 +837,7 @@ public function build_file($user, $model, $datatoexport, $array_selected, $array $params = []; if (!empty($item['method_params'])) { foreach ($item['method_params'] as $paramName) { - $params[] = $obj->$paramName ?? null; + $params[] = $obj->$paramName ?? ($paramName ?? null); } } $value = $tmpObject->$methodName(...$params);