diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f8e471e37d7..c4b5a7d5bd7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1377,14 +1377,14 @@ class CommonObject
}
$classpath = $element.'/class';
- if ($element == 'facture') { $tplpath = 'compta/'.$element; $classpath = $tplpath.'/class'; } // To work with non standard path
- if ($element == 'propal') { $tplpath = 'comm/'.$element; $classpath = $tplpath.'/class'; } // To work with non standard path
- if ($element == 'invoice_supplier') { $tplpath = 'fourn/facture'; $classpath = 'fourn/class'; } // To work with non standard path
- if ($element == 'order_supplier') { $tplpath = 'fourn/commande'; $classpath = 'fourn/class'; } // To work with non standard path
+ if ($objecttype == 'facture') { $tplpath = 'compta/'.$element; $classpath = $tplpath.'/class'; } // To work with non standard path
+ if ($objecttype == 'propal') { $tplpath = 'comm/'.$element; $classpath = $tplpath.'/class'; } // To work with non standard path
+ if ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; $classpath = 'fourn/class'; } // To work with non standard path
+ if ($objecttype == 'order_supplier') { $tplpath = 'fourn/commande'; $classpath = 'fourn/class'; } // To work with non standard path
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
- if ($subelement == 'invoice_supplier') { $classfile='fournisseur.facture'; $classname='FactureFournisseur'; }
- if ($subelement == 'order_supplier') { $classfile='fournisseur.commande'; $classname='CommandeFournisseur'; }
+ if ($objecttype == 'invoice_supplier') { $classfile='fournisseur.facture'; $classname='FactureFournisseur'; }
+ if ($objecttype == 'order_supplier') { $classfile='fournisseur.commande'; $classname='CommandeFournisseur'; }
//print $classfile." - ".$classpath." - ".$tplpath;
if(!class_exists($classname))
{
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index b5f15eea3ef..ef31e077a9d 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -1368,8 +1368,6 @@ if ($id > 0 || ! empty($ref))
$object=$commande;
- if ($somethingshown) print '
';
-
/*
* Linked object block
*/
diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
index 3c4c97d1597..565d17b63db 100755
--- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
@@ -22,6 +22,13 @@
linkedObjectBlock;
+$objectid = $GLOBALS['object']->objectid;
+$num = count($objectid);
+
$langs->load("orders");
if ($somethingshown) { echo '
'; }
print_titre($langs->trans('RelatedOrders'));
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 0f635b6821e..69a92b7798c 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -1839,8 +1839,6 @@ else
$object=$fac;
- if ($somethingshown) print '
';
-
/*
* Linked object block
*/
diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
index b2b01865454..8f3a0eb998b 100755
--- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
@@ -22,6 +22,13 @@
linkedObjectBlock;
+$objectid = $GLOBALS['object']->objectid;
+$num = count($objectid);
+
$langs->load("bills");
if ($somethingshown) { echo '
'; }
if ($num > 1) print_titre($langs->trans("RelatedBills"));