diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4e7c221feedf97c1ec8837d931d92edac2bbf9d6..0f7ad41de1456b3f13fc5b63f47df4e47dad911d 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 72206c13e2b2118db3b2b9a4d0d55e844dd9fdb3..55386c88b55147c664e55fd073b5b2f2367fff74 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -41,6 +41,7 @@ print_titre($langs->trans('RelatedShippings')); <td align="right"><?php echo $langs->trans("Status"); ?></td> </tr> <?php +$total=0; $var=true; foreach($linkedObjectBlock as $object) { @@ -71,4 +72,4 @@ foreach($linkedObjectBlock as $object) </tr> </table> -<!-- END PHP TEMPLATE --> \ No newline at end of file +<!-- END PHP TEMPLATE --> diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 4db72d488146d7516edea186559013b00d8e12c8..344fa3ffa56f34f88defe3888dd42a4dfaaa64cd 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 3a9d8f5bebe2901a8009ab91cb117becef7f50d5..d8d99dc6d6cc70f6dffb4283e58136894db7ade4 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')); <td align="right"><?php echo $langs->trans("Status"); ?></td> </tr> <?php +$total=0; $var=true; foreach($linkedObjectBlock as $object) { @@ -68,4 +69,4 @@ foreach($linkedObjectBlock as $object) </tr> </table> -<!-- END PHP TEMPLATE --> \ No newline at end of file +<!-- END PHP TEMPLATE --> diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index a6d9164a91c35883db4dd11aac0a81b94e9b6ed5..cc6fafc180a900e7a00d998fc274976e25ec2851 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")); <td align="right"><?php echo $langs->trans("Status"); ?></td> </tr> <?php +$total=0; $var=true; foreach($linkedObjectBlock as $object) { @@ -69,4 +70,4 @@ foreach($linkedObjectBlock as $object) </tr> </table> -<!-- END PHP TEMPLATE --> \ No newline at end of file +<!-- END PHP TEMPLATE -->