From 9b215e117a592bcbe3547496a15fcfb59eb762f7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 21 Dec 2018 11:23:44 +0100 Subject: [PATCH] FIX check if "entity" is already defined in "$param" --- htdocs/core/class/html.formfile.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2444dc293fd..c7288aa63d3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -300,8 +300,10 @@ class FormFile return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - // Add entity in $param - $param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity); + // Add entity in $param if not already exists + if (!preg_match('/entity\=[0-9]+/', $param)) { + $param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity); + } $printer=0; if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements