New: Make some changes to allow usage of alternative
$dolibarr_main_url_root variables. Can now use several alternative path. Fix several bugs with all code.
This commit is contained in:
parent
9be6dd8b17
commit
7b5e0678db
@ -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:
|
||||
|
||||
@ -183,7 +183,6 @@ foreach($configfileparameters as $key)
|
||||
print "<td>";
|
||||
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 "</td>";
|
||||
|
||||
@ -302,7 +302,6 @@ foreach($configfileparameters as $key => $value)
|
||||
print "<td>";
|
||||
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 "</td>";
|
||||
|
||||
@ -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 '<b>'.$langs->trans("StepNb",3).'</b>: ';
|
||||
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
|
||||
if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
{
|
||||
if ($dirins_ok && $dirins != 'DOL_DOCUMENT_ROOT_ALT')
|
||||
if ($dirins_ok)
|
||||
{
|
||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||
print '<input type="hidden" name="action" value="install">';
|
||||
@ -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 '<div class="warning">'.$message.'</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -2540,11 +2540,10 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
||||
|
||||
if ( $numref != "")
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
|
||||
@ -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].'<br>'."\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;
|
||||
|
||||
@ -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 '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].' -->'."\n";
|
||||
|
||||
|
||||
// Menu niveau 0
|
||||
if ($menu_array[$i]['level'] == 0)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1422,11 +1422,10 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
||||
|
||||
if ( $numref != "")
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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 à
|
||||
|
||||
@ -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 '<!-- Includes CSS added by module '.$modcss. ' -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
|
||||
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
|
||||
|
||||
@ -64,15 +64,17 @@ $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dol
|
||||
$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; // Force https
|
||||
$conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode; // Force php strict mode (for debug)
|
||||
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; // Cookie cryptkey
|
||||
$conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT); // Define array of document root directories
|
||||
$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs')
|
||||
$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr')
|
||||
if (! empty($dolibarr_main_document_root_alt))
|
||||
{
|
||||
// dolibarr_main_document_root_alt can contains several directories
|
||||
$values=preg_split('/[;,]/',$dolibarr_main_document_root_alt);
|
||||
foreach($values as $value)
|
||||
{
|
||||
$conf->file->dol_document_root['alt']=$value;
|
||||
}
|
||||
$i=0;
|
||||
foreach($values as $value) $conf->file->dol_document_root['alt'.($i++)]=(string) $value;
|
||||
$values=preg_split('/[;,]/',$dolibarr_main_url_root_alt);
|
||||
$i=0;
|
||||
foreach($values as $value) $conf->file->dol_url_root['alt'.($i++)]=(string) $value;
|
||||
}
|
||||
|
||||
// Set properties specific to multicompany
|
||||
|
||||
@ -119,10 +119,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
|
||||
|
||||
@ -203,8 +203,6 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
print __METHOD__." DOL_MAIN_URL_ROOT=".DOL_MAIN_URL_ROOT."\n";
|
||||
print __METHOD__." DOL_URL_ROOT=".DOL_URL_ROOT."\n";
|
||||
print __METHOD__." DOL_MAIN_URL_ROOT_ALT=".DOL_MAIN_URL_ROOT_ALT."\n";
|
||||
print __METHOD__." DOL_URL_ROOT_ALT=".DOL_URL_ROOT_ALT."\n";
|
||||
$this->assertEquals(DOL_URL_ROOT,$expectedresult);
|
||||
|
||||
return true;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user