diff --git a/htdocs/core/actions_fetchobject.inc.php b/htdocs/core/actions_fetchobject.inc.php index e42c2e9a83b..780895e47a9 100644 --- a/htdocs/core/actions_fetchobject.inc.php +++ b/htdocs/core/actions_fetchobject.inc.php @@ -40,7 +40,13 @@ if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtas } else { - if (empty($object->error) && ! count($object->errors)) setEventMessages('Fetch on object return an error without filling $object->error nor $object->errors', null, 'errors'); + if (empty($object->error) && ! count($object->errors)) + { + if ($ret < 0) // if $ret == 0, it means not found. + { + setEventMessages('Fetch on object (type '.get_class($object).') return an error without filling $object->error nor $object->errors', null, 'errors'); + } + } else setEventMessages($object->error, $object->errors, 'errors'); $action=''; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 710ccb37500..38a6c8e8c7c 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -302,7 +302,7 @@ $listofreferent=array( 'class'=>'CommandeFournisseur', 'table'=>'commande_fournisseur', 'datefieldname'=>'date_commande', - 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'suppliers', 'buttonnew'=>'AddSupplierOrder', 'testnew'=>$user->rights->fournisseur->commande->creer, @@ -314,7 +314,7 @@ $listofreferent=array( 'margin'=>'minus', 'table'=>'facture_fourn', 'datefieldname'=>'datef', - 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, + 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'suppliers', 'buttonnew'=>'AddSupplierInvoice', 'testnew'=>$user->rights->fournisseur->facture->creer,