diff --git a/functions/tools.php b/functions/tools.php index 9a4c350f..b4fe0faf 100644 --- a/functions/tools.php +++ b/functions/tools.php @@ -82,7 +82,7 @@ function doliConnect($fonction, $current_user = null, $boolean = false, $refresh } elseif ($fonction == 'order' && isset($current_user->user_email) && !empty($current_user->user_email)) { $thirdparty = callDoliApi("GET", "/thirdparties/email/".$current_user->user_email, null, dolidelay('doliconnector')); if (isset($thirdparty->id)) $object = callDoliApi("GET", "/orders?sortfield=t.rowid&sortorder=DESC&limit=1&thirdparty_ids=".$thirdparty->id."&sqlfilters=(t.fk_statut%3A%3D%3A'0')and(t.module_source%3A%3D%3A'doliconnect')&pagination_data=true", null, dolidelay('doliconnector', $refresh)); - if ( doliversion('20.0.0') && isset($object->data) ) { $object = $object->data; } else { $object = $object; } + if ( doliversion('20.0.0') && isset($object->data) ) { $object = $object->data; } elseif ( isset($object) ) { $object = $object; } else { $object = null; } $return = isset($object[0])?$object[0]:null; if (isset($object[0])) { $return = $object[0];