diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 74d10b3171a..0279ffc052a 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -89,7 +89,7 @@ else // Calcul de $min et $max $sql = "SELECT min(".$db->pdate("datev")."), max(".$db->pdate("datev").")"; $sql.= " FROM ".MAIN_DB_PREFIX."bank"; - if ($account) $sql.= " WHERE fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql.= " WHERE fk_account in (".$account.")"; $resql = $db->query($sql); if ($resql) { @@ -111,12 +111,14 @@ else if ($mode == 'standard') { // Chargement du tableau $amounts - // \todo peut etre optimise en virant les date_format $amounts = array(); $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE date_format(datev,'%Y%m') = '".$year.$month."'"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + $monthnext=$month+1; $yearnext=$year; + if ($monthnext > 12) { $monthnext=1; $yearnext++; } + $sql .= " WHERE datev >= '".$year."-".$month."-01 00:00:00'"; + $sql .= " AND datev < '".$yearnext."-".$monthnext."-01 00:00:00'"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%Y%m%d')"; $resql = $db->query($sql); if ($resql) @@ -141,7 +143,7 @@ else $sql = "SELECT SUM(amount)"; $sql .= " FROM ".MAIN_DB_PREFIX."bank"; $sql .= " WHERE datev < '".$year."-".sprintf("%02s",$month)."-01'"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $resql = $db->query($sql); if ($resql) { @@ -237,12 +239,12 @@ else if ($mode == 'standard') { // Chargement du tableau $amounts - // \todo peut etre optimise en virant les date_format $amounts = array(); $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE date_format(datev,'%Y') = '".$year."'"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + $sql .= " WHERE datev >= '".$year."-01-01 00:00:00'"; + $sql .= " AND datev <= '".$year."-12-31 23:59:59'"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%Y%m%d')"; $resql = $db->query($sql); if ($resql) @@ -267,7 +269,7 @@ else $sql = "SELECT sum(amount)"; $sql .= " FROM ".MAIN_DB_PREFIX."bank"; $sql .= " WHERE datev < '".$year."-01-01'"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $resql = $db->query($sql); if ($resql) { @@ -356,11 +358,10 @@ else if ($mode == 'showalltime') { // Chargement du tableau $amounts - // \todo peut etre optimise en virant les date_format $amounts = array(); $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - if ($account) $sql .= " WHERE fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " WHERE fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%Y%m%d')"; $resql = $db->query($sql); if ($resql) @@ -463,7 +464,7 @@ else $sql .= " WHERE datev >= '".$year."-".$month."-01 00:00:00'"; $sql .= " AND datev < '".$yearnext."-".$monthnext."-01 00:00:00'"; $sql .= " AND amount > 0"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%d')"; $resql = $db->query($sql); if ($resql) @@ -489,7 +490,7 @@ else $sql .= " WHERE datev >= '".$year."-".$month."-01 00:00:00'"; $sql .= " AND datev < '".$yearnext."-".$monthnext."-01 00:00:00'"; $sql .= " AND amount < 0"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%d')"; $resql = $db->query($sql); if ($resql) @@ -561,7 +562,7 @@ else $sql .= " WHERE datev >= '".$year."-01-01 00:00:00'"; $sql .= " AND datev <= '".$year."-12-31 23:59:59'"; $sql .= " AND amount > 0"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%m');"; $resql = $db->query($sql); if ($resql) @@ -585,7 +586,7 @@ else $sql .= " WHERE datev >= '".$year."-01-01 00:00:00'"; $sql .= " AND datev <= '".$year."-12-31 23:59:59'"; $sql .= " AND amount < 0"; - if ($account) $sql .= " AND fk_account in (".$account.")"; + if ($account && $_GET["option"]!='all') $sql .= " AND fk_account in (".$account.")"; $sql .= " GROUP BY date_format(datev,'%m')"; $resql = $db->query($sql); if ($resql) @@ -663,7 +664,17 @@ if ($account) if (! eregi(',',$account)) { $moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':''); - print $form->showrefnav($acct,'ref','',1,'ref','ref','',$moreparam); + if ($_GET["option"]!='all') + { + $morehtml=''.$langs->trans("ShowAllAccounts").''; + print $form->showrefnav($acct,'ref','',1,'ref','ref','',$moreparam); + } + else + { + $morehtml=''.$langs->trans("BackToAccount").''; + print $langs->trans("All"); + //print $morehtml; + } } else { @@ -680,14 +691,14 @@ if ($account) } else { - print $langs->trans("ALL"); + print $langs->trans("All"); } print ''; // Label print ''.$langs->trans("Label").''; print ''; -if ($account) +if ($account && $_GET["option"]!='all') { print $acct->label; } @@ -699,11 +710,25 @@ print ''; print ''; -print '
'; - - print ''; +// Navigation links +print ''; + + if ($mode == 'standard') { $prevyear=$year;$nextyear=$year; @@ -748,24 +773,6 @@ if ($mode == 'showalltime') print ''; } -// Switch All time/Not all time -if ($mode == 'showalltime') -{ - print ''; -} -else -{ - print ''; -} - print '
'.$morehtml.'     '; +if ($mode == 'showalltime') +{ + print ''; + print $langs->trans("GoBack"); + print ''; +} +else +{ + print ''; + print $langs->trans("ShowAllTimeBalance"); + print ''; +} +print '


'; - print ''; - print $langs->trans("GoBack"); - print ''; - print '

'; - print ''; - print $langs->trans("ShowAllTimeBalance"); - print ''; - print '
'; print "\n\n"; @@ -774,5 +781,4 @@ print "\n\n"; $db->close(); llxFooter('$Date$ - $Revision$'); - ?> diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index be08f68a6e2..1b2285cb5bc 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -32,8 +32,8 @@ require_once('../lib/admin.lib.php'); // DOL_DOCUMENT_ROOT has been defined in function.inc.php to '..' -// Define REQUEST["logtohtml"] -$REQUEST["logtohtml"]=1; +// Define $_REQUEST["logtohtml"] +$_REQUEST["logtohtml"]=1; // Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative // et non path absolu. diff --git a/htdocs/lib/databases/mysql.lib.php b/htdocs/lib/databases/mysql.lib.php index bdb26a02fd5..4d2146d744c 100644 --- a/htdocs/lib/databases/mysql.lib.php +++ b/htdocs/lib/databases/mysql.lib.php @@ -85,12 +85,9 @@ class DoliDb { global $conf,$langs; - if (isset($conf->db->character_set) && $conf->db->character_set) { - $this->forcecharset=$conf->db->character_set; - } - if (isset($conf->db->dolibarr_main_db_collation) && $conf->db->dolibarr_main_db_collation) { - $this->forcecollate=$conf->db->dolibarr_main_db_collation; - } + if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set; + if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; + $this->database_user=$user; $this->transaction_opened=0; @@ -199,6 +196,7 @@ class DoliDb */ function select_db($database) { + dolibarr_syslog("DoliDB::select_db database=".$database, LOG_DEBUG); return mysql_select_db($database, $this->db); } diff --git a/htdocs/lib/databases/mysqli.lib.php b/htdocs/lib/databases/mysqli.lib.php index 7b83536ac85..c9de3662945 100644 --- a/htdocs/lib/databases/mysqli.lib.php +++ b/htdocs/lib/databases/mysqli.lib.php @@ -85,12 +85,9 @@ class DoliDb { global $conf,$langs; - if (isset($conf->db->character_set) && $conf->db->character_set) { - $this->forcecharset=$conf->db->character_set; - } - if (isset($conf->db->dolibarr_main_db_collation) && $conf->db->dolibarr_main_db_collation) { - $this->forcecollate=$conf->db->dolibarr_main_db_collation; - } + if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set; + if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; + $this->database_user=$user; $this->transaction_opened=0; @@ -201,6 +198,7 @@ class DoliDb */ function select_db($database) { + dolibarr_syslog("DoliDB::select_db database=".$database, LOG_DEBUG); return mysqli_select_db($this->db,$database); } diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index a19f9f14501..f90d6754ddc 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -180,14 +180,15 @@ function dolibarr_syslog($message, $level=LOG_INFO) */ function dol_syslog($message, $level=LOG_INFO) { - global $conf,$user,$langs,$REQUEST; + global $conf,$user,$langs,$_REQUEST; // If adding log inside HTML page is required - if (! empty($REQUEST['logtohtml'])) + /* Disabled because this is a security hole + if (! empty($_REQUEST['logtohtml'])) { $conf->logbuffer[]=strftime("%Y-%m-%d %H:%M:%S",time())." ".$message; - } + */ // If syslog module enabled if (! empty($conf->syslog->enabled)) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c8e37b28bde..54e45277c23 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -979,11 +979,11 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$ /** - * \brief Impression du pied de page DIV + BODY + HTML - * \remarks Ferme 2 div - * \param foot Non utilise + * \brief Show HTML footer DIV + BODY + HTML + * \remarks Close 2 div + * \param foot Not used + * \param limitIEbug Not used */ - function llxFooter($foot='',$limitIEbug=1) { global $conf, $dolibarr_auto_user, $micro_start_time; @@ -1005,8 +1005,7 @@ function llxFooter($foot='',$limitIEbug=1) { print ' - Zend encoded file: '.(zend_loader_file_encoded()?'yes':'no'); } - print '"'; - print "\n"; + print '"'."\n"; } if ($conf->use_javascript_ajax) @@ -1017,7 +1016,22 @@ function llxFooter($foot='',$limitIEbug=1) // Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent if ($limitIEbug && ! $conf->browser->firefox) print "\n".'
 
'."\n"; - print "\n"; + // If there is some logs in buffer to show + if (sizeof($conf->logbuffer)) + { + print "\n"; + print "\n"; + } + + print "\n"; + print "\n"; print "\n"; }