diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 4e7c221feed..0f7ad41de14 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -77,13 +77,15 @@ abstract class CommonObject
*/
static function isExistingObject($element, $id, $ref='', $ref_ext='')
{
- global $db;
+ global $db,$conf;
$sql = "SELECT rowid, ref, ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX.$element;
- if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id);
- else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'";
- else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'";
+ $sql.= " WHERE entity IN (".getEntity($element).")" ;
+
+ if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
+ else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
+ else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'";
else {
$error='ErrorWrongParameters';
dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php
index 72206c13e2b..55386c88b55 100644
--- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php
@@ -41,6 +41,7 @@ print_titre($langs->trans('RelatedShippings'));
trans("Status"); ?> |
-
\ No newline at end of file
+
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 4db72d48814..344fa3ffa56 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -155,6 +155,7 @@ class ProductFournisseur extends Product
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0)
{
global $conf, $langs;
+ //global $mysoc;
// Clean parameter
if (empty($qty)) $qty=0;
diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
index 3a9d8f5bebe..d8d99dc6d6c 100644
--- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
@@ -39,6 +39,7 @@ print_titre($langs->trans('RelatedOrders'));
trans("Status"); ?> |
-
\ No newline at end of file
+
diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
index a6d9164a91c..cc6fafc180a 100644
--- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
@@ -41,6 +41,7 @@ else print_titre($langs->trans("RelatedBill"));
trans("Status"); ?> |
-
\ No newline at end of file
+