Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2013-01-17 20:56:28 +01:00
commit 34c5343103
17 changed files with 106 additions and 120 deletions

View File

@ -2,6 +2,15 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 3.4 compared to 3.3 *****
For users:
- New: Some performance enhancements
For developers:
For translators:
***** ChangeLog for 3.3 compared to 3.2.3 *****
For users:

View File

@ -357,7 +357,6 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{

View File

@ -89,7 +89,7 @@ print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTheme").'</td><
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) print $conf->smart_menu;
else print $conf->top_menu;
else print $conf->standard_menu;
print '</td></tr>'."\n";
print '</table>';
print '<br>';

View File

@ -48,7 +48,7 @@ class Conf
public $theme; // Contains current theme ("eldy", "auguria", ...)
public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...)
//! Used to store current menu handlers
public $top_menu;
public $standard_menu;
public $smart_menu;
public $modules = array(); // List of activated modules

View File

@ -822,7 +822,6 @@ class FormOther
$arrayboxtoactivatelabel=array();
if (! empty($user->conf->$confuserzone))
{
$langs->load("boxes");
foreach($boxactivated as $box)
{
if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
@ -862,6 +861,8 @@ class FormOther
if ($nbboxactivated)
{
$langs->load("boxes");
$emptybox=new ModeleBoxes($db);
print '<table width="100%" class="notopnoleftnoright">';

View File

@ -378,7 +378,7 @@ class Menubase
*
* @param string $mymainmenu Value for mainmenu to filter menu to load (always '')
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user Filter on type of user (0=Internal,1=External,2=All)
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Return array with menu entries for top menu
@ -415,7 +415,7 @@ class Menubase
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
* @param string $mymainmenu Value for mainmenu to filter menu to load (often $_SESSION["mainmenu"])
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user Filter on type of user (0=Internal,1=External,2=All)
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Menu array for particular mainmenu value or full tabArray
@ -425,12 +425,12 @@ class Menubase
global $langs, $user, $conf; // To export to dol_eval function
global $mainmenu,$leftmenu; // To export to dol_eval function
$mainmenu=$mymainmenu; // To export to dol_eval function
$leftmenu=$myleftmenu; // To export to dol_eval function
// We initialize newmenu with first already found menu entries
$this->newmenu = $newmenu;
$mainmenu=$mymainmenu; // To export to dol_eval function
$leftmenu=$myleftmenu; // To export to dol_eval function
// Load datas from database into $tabMenu, later we will complete this->newmenu with values into $tabMenu
if (count($tabMenu) == 0) // To avoid to read into database a second time
{
@ -510,7 +510,7 @@ class Menubase
*
* @param string $mymainmenu Value for left that defined mainmenu
* @param string $myleftmenu Value for left that defined leftmenu
* @param int $type_user 0=Internal,1=External,2=All
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
* @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
* @return int >0 if OK, <0 if KO
@ -530,9 +530,10 @@ class Menubase
$sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";
// If type_user == 2, no test required
$sql.= " ORDER BY m.position, m.rowid";
//$tmp1=dol_microtime_float();
//print '>>> 1 0<br>';
dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)." sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
@ -567,11 +568,14 @@ class Menubase
// Define $title
if ($enabled)
{
$title = $langs->trans($menu['titre']);
//$tmp3=dol_microtime_float();
//print '>>> 2 '.($tmp3 - $tmp1).'<br>';
$title = $langs->trans($menu['titre']);
if ($title == $menu['titre']) // Translation not found
{
if (! empty($menu['langs'])) // If there is a dedicated translation file
{
//print 'Load file '.$menu['langs'].'<br>';
$langs->load($menu['langs']);
}
@ -580,7 +584,7 @@ class Menubase
$tab_titre = explode("/",$menu['titre']);
$title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
}
else if (preg_match('/\|\|/',$menu['titre'])) // To manage different translation
else if (preg_match('/\|\|/',$menu['titre'])) // To manage different translation (Title||AltTitle@ConditionForAltTitle)
{
$tab_title = explode("||",$menu['titre']);
$alt_title = explode("@",$tab_title[1]);
@ -592,7 +596,9 @@ class Menubase
$title = $langs->trans($menu['titre']);
}
}
//$tmp4=dol_microtime_float();
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
// We complete tabMenu
$tabMenu[$b]['rowid'] = $menu['rowid'];
$tabMenu[$b]['module'] = $menu['module'];
@ -614,10 +620,10 @@ class Menubase
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
$tabMenu[$b]['position'] = $menu['position'];
$b++;
}
$a++;
}
$this->db->free($resql);

View File

@ -169,7 +169,7 @@ class Translate
}
if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys
dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
//dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
$newdomain = $domain;
$modulename = '';

View File

@ -2105,7 +2105,7 @@ function dol_print_error($db='',$error='')
$out.="<br>\n";
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";;
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."<br>\n";;
$out.="<b>".$langs->trans("MenuManager").":</b> ".$conf->top_menu."<br>\n";
$out.="<b>".$langs->trans("MenuManager").":</b> ".$conf->standard_menu."<br>\n";
$out.="<br>\n";
$syslog.="url=".$_SERVER["REQUEST_URI"];
$syslog.=", query_string=".$_SERVER["QUERY_STRING"];

View File

@ -46,14 +46,10 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db, &$menu_array, &$menu_array_after)
function __construct($db)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}

View File

@ -38,7 +38,6 @@ class MenuManager
var $type_user=1; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $menu_array;
var $menu_array_after;
@ -47,14 +46,10 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db, &$menu_array, &$menu_array_after)
function __construct($db)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}

View File

@ -1474,7 +1474,6 @@ function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
{
//print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms'];
//print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal);
if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition
if ($type_user && $menuentry['module'])
{

View File

@ -45,14 +45,10 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db, &$menu_array, &$menu_array_after)
function __construct($db)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}

View File

@ -45,14 +45,10 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db,&$menu_array,&$menu_array_after)
function __construct($db)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}
@ -60,7 +56,7 @@ class MenuManager
* Show menu
*
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
* @return int Number of menu entries shown
*/
function showmenu($mode)
{

View File

@ -38,14 +38,10 @@ class MenuManager
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db, &$menu_array, &$menu_array_after)
function __construct($db)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}

View File

@ -773,6 +773,45 @@ if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity'
}
}
//print 'eee'.$conf->standard_menu;
// Init menu manager
if (empty($user->societe_id)) // If internal user or not defined
{
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
}
else // If external user
{
$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
}
// For backward compatibility
if (empty($conf->standard_menu)) $conf->standard_menu ='eldy_backoffice.php';
elseif ($conf->standard_menu == 'eldy.php') $conf->standard_menu='eldy_backoffice.php';
// Load the menu manager (only if not already done)
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // menu=eldy_backoffice.php
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
{
$file_menu='eldy_backoffice.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
$menumanager = new MenuManager($db);
// Functions
@ -797,8 +836,11 @@ if (! function_exists("llxHeader"))
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='')
{
global $conf;
// html header
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
// top menu and left menu area
if (empty($conf->global->MAIN_HIDE_TOP_MENU))
{
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring);
@ -807,6 +849,8 @@ if (! function_exists("llxHeader"))
{
left_menu('', $help_url, '', '', 1, $title);
}
// main area
main_area($title);
}
}
@ -1150,7 +1194,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
{
global $user, $conf, $langs, $db;
global $dolibarr_main_authentication;
global $hookmanager;
global $hookmanager,$menumanager;
// Instantiate hooks of thirdparty module only if not already define
if (! is_object($hookmanager))
@ -1162,22 +1206,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$toprightmenu='';
// Define menu manager in setup
if (empty($user->societe_id)) // If internal user or not defined
{
$conf->top_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
}
else // If external user
{
$conf->top_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
}
// For backward compatibility
if ($conf->top_menu == 'eldy.php') $conf->top_menu='eldy_backoffice.php';
elseif ($conf->top_menu == 'rodolphe.php') $conf->top_menu='eldy_backoffice.php';
if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php';
// For backward compatibility with old modules
if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
@ -1267,27 +1295,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
/*
* Top menu
*/
$top_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu;
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
// Load the top menu manager (only if not already done)
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
{
$top_menu='eldy_backoffice.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$top_menu;
}
}
print "\n".'<!-- Start top horizontal menu '.$top_menu.' -->'."\n";
print "\n".'<!-- Start top horizontal -->'."\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '<div class="ui-layout-north"> <!-- Begin top layout -->'."\n";
@ -1296,10 +1304,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print '<div id="tmenu_tooltip" class="tmenu">'."\n";
// Show menu
$dummy1=array();$dummy2=array();
$menutop = new MenuManager($db,$dummy1,$dummy2);
$menutop->atarget=$target;
$menutop->showmenu('top'); // This contains a \n
$menumanager->atarget=$target;
$menumanager->showmenu('top'); // This contains a \n
print "</div>\n";
@ -1313,7 +1319,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')';
}
$logintext='<div class="login"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$user->id.'"';
$logintext.=$menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
$logintext.=$target?(' target="'.$target.'"'):'';
$logintext.='>'.$user->login.'</a>';
if ($user->societe_id) $logintext.=$companylink;
$logintext.='</div>';
@ -1349,7 +1355,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
&& $_SESSION["dol_authmode"] != 'http')
{
$logouttext .='<a href="'.DOL_URL_ROOT.'/user/logout.php"';
$logouttext .=$menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
$logouttext .=$atarget?(' target="'.$atarget.'"'):'';
$logouttext .='>';
$logouttext .= img_picto($langs->trans('Logout'), 'logout.png', 'class="login"');
$logouttext .='</a>';
@ -1415,7 +1421,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
function left_menu($menu_array_before, $helppagename='', $moresearchform='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='')
{
global $user, $conf, $langs, $db;
global $hookmanager;
global $hookmanager, $menumanager;
$searchform='';
$bookmarks='';
@ -1481,33 +1487,14 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$bookmarks=printBookmarksList($db, $langs);
}
$left_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu;
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
// Load the menu manager (only if not already done)
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$left_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
{
$top_menu='eldy_backoffice.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$top_menu;
}
}
// Left column
print '<!-- Begin left menu - menu '.$left_menu.' -->'."\n";
print '<!-- Begin left menu -->'."\n";
print '<div class="vmenu">'."\n";
$menuleft=new MenuManager($db,$menu_array_before,$menu_array_after);
$menuleft->showmenu('left'); // output menu_array and menu found in database
$menumanager->menu_array = $menu_array_before;
$menumanager->menu_array_after = $menu_array_after;
$menumanager->showmenu('left'); // output menu_array and menu found in database
// Show other forms

View File

@ -226,7 +226,7 @@ $server->register(
// Entry values
array('authentication'=>'tns:authentication','actioncomm'=>'tns:actioncomm'),
// Exit values
array('result'=>'tns:result'),
array('result'=>'tns:result','id'=>'xsd:string'),
$ns,
$ns.'#updateActionComm',
$styledoc,
@ -563,7 +563,10 @@ function updateActionComm($authentication,$actioncomm)
if ((! $error) && ($objectfound))
{
$db->commit();
$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''));
$objectresp=array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id
);
}
elseif ($objectfound)
{

View File

@ -233,7 +233,7 @@ $server->register(
// Entry values
array('authentication'=>'tns:authentication','thirdparty'=>'tns:thirdparty'),
// Exit values
array('result'=>'tns:result'),
array('result'=>'tns:result','id'=>'xsd:string'),
$ns,
$ns.'#updateThirdParty',
$styledoc,
@ -571,7 +571,7 @@ function updateThirdParty($authentication,$thirdparty)
$db->begin();
$result=$object->update($fuser);
$result=$object->update($thirdparty['id'],$fuser);
if ($result <= 0) {
$error++;
}
@ -580,7 +580,10 @@ function updateThirdParty($authentication,$thirdparty)
if ((! $error) && ($objectfound))
{
$db->commit();
$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''));
$objectresp=array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id
);
}
elseif ($objectfound)
{