diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 56b48160a77..afda9cb8ea3 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -91,7 +91,7 @@ function versiondolibarrarray() * \param sqlfile Full path to sql file * \return int <=0 if KO, >0 if OK */ -function run_sql($sqlfile,$silent=1) +function run_sql($sqlfile,$silent=1,$entity='') { global $db, $conf, $langs, $user; @@ -228,7 +228,7 @@ function run_sql($sqlfile,$silent=1) while (preg_match('/(__ENTITY__)/i',$newsql,$reg)) { $from = $reg[1]; - $to = $conf->entity; + $to = (!empty($entity)?$entity:$conf->entity); $newsql = str_replace($from,$to,$newsql); dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); }