diff --git a/ChangeLog b/ChangeLog index 43dc578e49b..a3f9db52ac9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,7 +44,9 @@ For developers: - New: Add option MAIN_MOTD_SETUPPAGE to add a content onto setup page. Also content for MAIN_MOTD_SETUPPAGE, MAIN_MOTD_SETUPPAGE, MAIN_HOME now accept "|langfile" into translation key to use a specific language file. - +- New: Make some changes to allow usage of several alternative $dolibarr_main_url_root variables. + Fix also several bugs with old code. + ***** ChangeLog for 3.4 compared to 3.3.2 ***** For users: diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 681b108e1b8..3386e3aa135 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -183,7 +183,6 @@ foreach($configfileparameters as $key) print ""; if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey}); else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); - else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT'); else print ${$newkey}; if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; print ""; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index b32ddf573bd..59f3b3f3856 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -302,7 +302,6 @@ foreach($configfileparameters as $key => $value) print ""; if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey}); else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); - else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT'); else print ${$newkey}; if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; print ""; diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 3aae9b0f009..133dd247459 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -75,7 +75,7 @@ if (GETPOST('action','alpha')=='install') $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']); if ($result > 0) { - $documentrootalt=DOL_DOCUMENT_ROOT_ALT; + $documentrootalt=DOL_DOCUMENT_ROOT.'/extensions'; $result=dol_uncompress($newfile,$documentrootalt); if (! empty($result['error'])) { @@ -95,7 +95,7 @@ if (GETPOST('action','alpha')=='install') * View */ -$dirins=DOL_DOCUMENT_ROOT_ALT; +$dirins=DOL_DOCUMENT_ROOT.'/extensions'; $dirins_ok=(is_dir($dirins)); $wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización'; @@ -141,7 +141,7 @@ print ''.$langs->trans("StepNb",3).': '; print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'
'; if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE)) { - if ($dirins_ok && $dirins != 'DOL_DOCUMENT_ROOT_ALT') + if ($dirins_ok) { print '
'; print ''; @@ -151,8 +151,8 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE)) } else { - $message=info_admin($langs->trans("NotExistsDirect").$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); - print $message; + $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); + print '
'.$message.'
'; } } else diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a6f3647b45e..77d2b9ecd66 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2468,22 +2468,32 @@ class Propal extends CommonObject global $conf, $db, $langs; $langs->load("propal"); - $dir = DOL_DOCUMENT_ROOT . "/core/modules/propale/"; - if (! empty($conf->global->PROPALE_ADDON)) { - $file = $conf->global->PROPALE_ADDON.".php"; + $mybool=false; - // Chargement de la classe de numerotation + $file = $conf->global->PROPALE_ADDON.".php"; $classname = $conf->global->PROPALE_ADDON; - require_once $dir.$file; + + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot."/core/modules/propale/"; + // Load file with numbering class (if found) + $mybool|=@include_once $dir.$file; + } + + if (! $mybool) + { + dol_print_error('',"Failed to include file ".$file); + return ''; + } $obj = new $classname(); - $numref = ""; $numref = $obj->getNextValue($soc,$this); - if ( $numref != "") + if ($numref != "") { return $numref; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8a2307aca81..abf1bb51db3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -129,36 +129,39 @@ class Commande extends CommonOrder global $db, $langs, $conf; $langs->load("order"); - $dir = DOL_DOCUMENT_ROOT . "/core/modules/commande"; - if (! empty($conf->global->COMMANDE_ADDON)) { - $file = $conf->global->COMMANDE_ADDON.".php"; + $mybool=false; - // Chargement de la classe de numerotation + $file = $conf->global->COMMANDE_ADDON.".php"; $classname = $conf->global->COMMANDE_ADDON; - $result=include_once $dir.'/'.$file; - if ($result) - { - $obj = new $classname(); - $numref = ""; - $numref = $obj->getNextValue($soc,$this); + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot."/core/modules/commande/"; + // Load file with numbering class (if found) + $mybool|=@include_once $dir.$file; + } - if ( $numref != "") - { - return $numref; - } - else - { - dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); - return ""; - } + if (! $mybool) + { + dol_print_error('',"Failed to include file ".$file); + return ''; + } + + $obj = new $classname(); + $numref = ""; + $numref = $obj->getNextValue($soc,$this); + + if ($numref != "") + { + return $numref; } else - { - print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_NotDefined"); - return ""; + { + dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); + return ""; } } else diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1e71d781e7f..53e7178ce6d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2540,11 +2540,10 @@ class Facture extends CommonInvoice } $obj = new $classname(); - $numref = ""; $numref = $obj->getNumRef($soc,$this,$mode); - if ( $numref != "") + if ($numref != "") { return $numref; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fbbf6bbdc1d..56bdb1207c7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -244,21 +244,30 @@ function dol_include_once($relpath, $classname='') /** - * Return path of url or filesystem. Return default_root or alternate root if file_exist fails + * Return path of url or filesystem. Return alternate root if exists * - * @param string $path Relative path to file (if mode=0, ie: mydir/myfile, ../myfile, ...) or relative url (if mode=1). + * @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path) - * @return string Full filsystem path (if mode=0), Full url path (if mode=1) + * @return string Full filesystem path (if mode=0), Full url path (if mode=1) */ function dol_buildpath($path, $type=0) { + global $conf; + + $path=preg_replace('/^\//','',$path); + if (empty($type)) // For a filesystem path { - $res = DOL_DOCUMENT_ROOT.$path; // Standard value - if (defined('DOL_DOCUMENT_ROOT_ALT') && DOL_DOCUMENT_ROOT_ALT) // We check only if alternate feature is used - { - if (! file_exists(DOL_DOCUMENT_ROOT.$path)) $res = DOL_DOCUMENT_ROOT_ALT.$path; - } + $res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard value + foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) + { + if ($key == 'main') continue; + if (file_exists($dirroot.'/'.$path)) + { + $res=$dirroot.'/'.$path; + break; + } + } } else // For an url path { @@ -266,29 +275,23 @@ function dol_buildpath($path, $type=0) // Note that trying to know if a file on disk exist by forging path on disk from url // works only for some web server and some setup. This is bugged when // using proxy, rewriting, virtual path, etc... - if ($type == 1) + $res=''; + if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value + if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value + foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) { - $res = DOL_URL_ROOT.$path; // Standard value - if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used + if ($key == 'main') continue; + preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?' + if (! empty($regs[1])) { - preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?' - if (! empty($regs[1])) - { - if (! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res = DOL_URL_ROOT_ALT.$path; + //print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'
'."\n"; + if (file_exists($dirroot.'/'.$path)) + { + if ($type == 1) $res=DOL_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path; + if ($type == 2) $res=DOL_MAIN_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path; + break; } - } - } - else if ($type == 2) - { - $res = DOL_MAIN_URL_ROOT.$path; // Standard value - if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used - { - preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?' - if (! empty($regs[1])) - { - if (! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res = DOL_MAIN_URL_ROOT_ALT.$path; - } - } + } } } @@ -1714,8 +1717,16 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srcon } // Clean parameters if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png'; - // If img file is not into standard path, we use alternate path (Avoid using DOL_URL_ROOT_ALT for performane) - if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT; + // If alt path are defined, define url where img file is, according to physical path + foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir/htdocs", ...) + { + if ($type == 'main') continue; + if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) + { + $url=$conf->file->dol_url_root[$type]; + break; + } + } // $url is '' or '/custom', $path is current theme or $fullpathpicto = $url.'/'.$path.'/img/'.$picto; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 37179df0f75..204b43f97e0 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -63,16 +63,14 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $url = $shorturl = $newTabMenu[$i]['url']; if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $param=''; - if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) - { - if (! preg_match('/\?/',$url)) $param.='?'; - else $param.='&'; - $param.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; - } + $tmp=explode('?',$newTabMenu[$i]['url'],2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1])?$tmp[1]:''); + + if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad - $url=dol_buildpath($url,1).$param; - $shorturl = $newTabMenu[$i]['url'].$param; + $url = dol_buildpath($url,1).($param?'?'.$param:''); + $shorturl = $shorturl.($param?'?'.$param:''); } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); @@ -246,15 +244,15 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $sql.= " WHERE entity = ".$conf->entity; $sql.= " AND clos = 0"; $sql.= " ORDER BY label"; - + $resql = $db->query($sql); if ($resql) { $numr = $db->num_rows($resql); $i = 0; - + if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); - + while ($i < $numr) { $objp = $db->fetch_object($resql); @@ -281,14 +279,14 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM if (! empty($conf->global->$paramkey)) { $link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i; - + $newmenu->add($link, dol_trunc($conf->global->$paramkey,24)); } $i++; } - } + } + - // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after //var_dump($menu_array_before);exit; //var_dump($menu_array_after);exit; @@ -346,7 +344,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM } print ''."\n"; - + // Menu niveau 0 if ($menu_array[$i]['level'] == 0) { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2f870665bf2..7db79024c62 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -192,7 +192,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", ''); } - + // HRM $tmpentry=array('enabled'=>(! empty($conf->holiday->enabled)), 'perms'=>(! empty($user->rights->holiday->write)), @@ -201,19 +201,19 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) if ($showmode) { $langs->load("holiday"); - + $classname=""; if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } else $classname = 'class="tmenu"'; $idsel='hrm'; - + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/holiday/index.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/holiday/index.php?mainmenu=holiday&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", ''); } - - + + // Tools $tmpentry=array('enabled'=>(! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled)), @@ -289,16 +289,14 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $url = $shorturl = $newTabMenu[$i]['url']; if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) { - $param=''; - if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) - { - if (! preg_match('/\?/',$url)) $param.='?'; - else $param.='&'; - $param.='mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; - } + $tmp=explode('?',$newTabMenu[$i]['url'],2); + $url = $shorturl = $tmp[0]; + $param = (isset($tmp[1])?$tmp[1]:''); + + if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu='; //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad - $url = dol_buildpath($url,1).$param; - $shorturl = $newTabMenu[$i]['url'].$param; + $url = dol_buildpath($url,1).($param?'?'.$param:''); + $shorturl = $shorturl.($param?'?'.$param:''); } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); @@ -1099,7 +1097,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer); } } - + /* * Menu HRM */ @@ -1108,14 +1106,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->holiday->enabled)) { $langs->load("holiday"); - + // HRM: Holiday module $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm'); $newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log); $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->view_log); - + } } @@ -1302,7 +1300,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } // For external modules - $url = dol_buildpath($menu_array[$i]['url'], 1); + $tmp=explode('?',$menu_array[$i]['url'],2); + $url = $tmp[0]; + $param = (isset($tmp[1])?$tmp[1]:''); + $url = dol_buildpath($url,1).($param?'?'.$param:''); + $url=preg_replace('/__LOGIN__/',$user->login,$url); $url=preg_replace('/__USERID__/',$user->id,$url); diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index abdb1006266..483b71f3e07 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -145,10 +145,6 @@ if (empty($dolibarr_main_data_root)) define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter) define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) -if (! empty($dolibarr_main_document_root_alt)) -{ - define('DOL_DOCUMENT_ROOT_ALT', $dolibarr_main_document_root_alt); // Filesystem paths to alternate core php (alternate htdocs) -} // Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT $tmp=''; $found=0; @@ -175,11 +171,12 @@ else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (e if (! empty($dolibarr_main_force_https)) $tmp=preg_replace('/^http:/i','https:',$tmp); define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...) $uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* -$suburi = strstr($uri, '/'); // $suburi contains url without domain +$suburi = strstr($uri, '/'); // $suburi contains url without domain:port if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) -// Define DOL_MAIN_URL_ROOT_ALT and DOL_URL_ROOT_ALT +/* +// Define DOL_MAIN_URL_ROOT_ALT and DOL_URL_ROOT_ALT (deprecated) if (! empty($dolibarr_main_url_root_alt)) { $altpart=str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt); @@ -188,12 +185,13 @@ if (! empty($dolibarr_main_url_root_alt)) //$tmp_alt=$dolibarr_main_url_root_alt; define('DOL_MAIN_URL_ROOT_ALT', $tmp_alt); // URL absolute root (https://sss/dolibarr/custom, ...) $uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT_ALT')); // $uri contains url without http* - $suburi = strstr($uri, '/'); // $suburi contains url without domain + $suburi = strstr($uri, '/'); // $suburi contains url without domain:port if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' define('DOL_URL_ROOT_ALT', $suburi); // URL relative root ('', '/dolibarr/custom', ...) } +*/ -//print DOL_URL_ROOT.'-'.DOL_URL_ROOT_ALT; +//print DOL_URL_ROOT; // Define prefix MAIN_DB_PREFIX define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 19912e3f58f..e62832ec692 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1422,11 +1422,10 @@ class FactureFournisseur extends CommonInvoice } $obj = new $classname(); - $numref = ""; $numref = $obj->getNumRef($soc,$this,$mode); - if ( $numref != "") + if ($numref != "") { return $numref; } diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 486748f92a7..83dd849d9a0 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -359,6 +359,7 @@ if (! $error && $db->connected && $action == "set") $dir[5] = $main_data_dir."/ficheinter"; $dir[6] = $main_data_dir."/produit"; $dir[7] = $main_data_dir."/doctemplates"; + $dir[7] = $main_data_dir."/extensions"; // Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas $num=count($dir); diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 08651603e61..61fde5a1215 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -145,7 +145,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) // Create the global $hookmanager object include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); - + $ok = 0; // If first install @@ -225,7 +225,6 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) if (! empty($force_install_module)) { if (! defined('DOL_DOCUMENT_ROOT') && ! empty($dolibarr_main_document_root)) define('DOL_DOCUMENT_ROOT',$dolibarr_main_document_root); - if (! defined('DOL_DOCUMENT_ROOT_ALT') && ! empty($dolibarr_main_document_root_alt)) define('DOL_DOCUMENT_ROOT_ALT',$dolibarr_main_document_root_alt); $tmparray=explode(',',$force_install_module); foreach ($tmparray as $modtoactivate) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 7d4a22fffa2..081204415b2 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -133,10 +133,6 @@ define('MAIN_DB_PREFIX',(isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefi define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir define('DOL_DATA_ROOT',(isset($dolibarr_main_data_root)?$dolibarr_main_data_root:'')); -if (! empty($dolibarr_main_document_root_alt)) -{ - define('DOL_DOCUMENT_ROOT_ALT', $dolibarr_main_document_root_alt); // Filesystem paths to alternate core php (alternate htdocs) -} define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root $uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* $suburi = strstr($uri, '/'); // $suburi contains url without domain @@ -323,7 +319,7 @@ function conf($dolibarr_main_document_root) { throw new Exception('Missing log handler file '.$handler.'.php'); } - + require_once $file; $loghandlerinstance = new $handler(); if (!$loghandlerinstance instanceof LogHandlerInterface) @@ -333,7 +329,7 @@ function conf($dolibarr_main_document_root) if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance; } - + return 1; } diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index 20a8141c619..f0029da19e4 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -19,8 +19,8 @@ EventOnFullDay=Événement sur la(les) journée(s) SearchAnAction= Rechercher un événement/tâche MenuToDoActions= Événements incomplets MenuDoneActions= Événements terminés -MenuToDoMyActions= Mes événements incomplets -MenuDoneMyActions= Mes événements terminés +MenuToDoMyActions= Mes événem. incomplets +MenuDoneMyActions= Mes événem. terminés ListOfEvents= Liste des événements Dolibarr ActionsAskedBy=Événements enregistrés par ActionsToDoBy=Événements affectés à diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e4a22c97285..a9ca7e4c2f7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1038,7 +1038,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $filescss=(array) $filescss; // To be sure filecss is an array foreach($filescss as $cssfile) { - // cssfile is a relative path + // cssfile is a relative path print ''."\n".'assertEquals(DOL_URL_ROOT,$expectedresult); return true; diff --git a/test/phpunit/FactureTestRounding.php b/test/phpunit/FactureTestRounding.php index 446b6893ae0..b90f67171d2 100644 --- a/test/phpunit/FactureTestRounding.php +++ b/test/phpunit/FactureTestRounding.php @@ -130,6 +130,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->lines=array(); @@ -171,6 +173,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->lines=array(); @@ -210,7 +214,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $db=$this->savdb; // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0 - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $localobject1a=new Facture($this->savdb); $localobject1a->initAsSpecimen('nolines'); $facid=$localobject1a->create($user); @@ -221,7 +226,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $this->assertEquals(115.43, $localobject1a->total_ttc); // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1 - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; + $localobject1b=new Facture($this->savdb); $localobject1b->initAsSpecimen('nolines'); $facid=$localobject1b->create($user); @@ -249,7 +255,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $db=$this->savdb; // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0 - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen('nolines'); $facid=$localobject2->create($user); @@ -262,7 +269,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $this->assertEquals(115.44, $localobject2->total_ttc); // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1 - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; + $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen('nolines'); $facid=$localobject2->create($user); @@ -292,7 +300,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $db=$this->savdb; // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0 - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + $localobject3=new Facture($this->savdb); $localobject3->initAsSpecimen('nolines'); $facid=$localobject3->create($user); @@ -307,7 +316,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase $this->assertEquals(115.45, $localobject3->total_ttc); // With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1 - $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1; + $localobject3=new Facture($this->savdb); $localobject3->initAsSpecimen('nolines'); $facid=$localobject3->create($user); diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index ecea4b517e1..57a95b0b40a 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -200,6 +200,8 @@ class PricesTest extends PHPUnit_Framework_TestCase $this->savlangs=$langs; $this->savdb=$db; + $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0; + // Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode $localobject=new Facture($this->savdb); $localobject->initAsSpecimen('nolines');