Qual: Better compatibility with other databases

This commit is contained in:
Laurent Destailleur 2009-10-28 18:08:35 +00:00
parent e5f6afc81e
commit 9042c10398
2 changed files with 15 additions and 16 deletions

View File

@ -68,16 +68,17 @@ if ($_GET["action"] == 'builddoc')
llxHeader(); llxHeader();
$sql = "SELECT count(*) as cc, date_format(a.datep, '%m/%Y') as df"; $sql = "SELECT count(*) as cc,";
$sql.= ", date_format(a.datep, '%m') as month"; $sql.= " date_format(a.datep, '%m/%Y') as df,";
$sql.= ", date_format(a.datep, '%Y') as year"; $sql.= " date_format(a.datep, '%m') as month,";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " date_format(a.datep, '%Y') as year";
$sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE a.fk_user_author = u.rowid"; $sql.= " WHERE a.fk_user_author = u.rowid";
$sql.= " AND u.entity = ".$conf->entity; $sql.= " AND u.entity = ".$conf->entity;
$sql.= " AND percent = 100"; $sql.= " AND percent = 100";
$sql.= " GROUP BY date_format(a.datep, '%m/%Y') "; $sql.= " GROUP BY year, month, df";
$sql.= " ORDER BY a.datep DESC"; $sql.= " ORDER BY year DESC, month DESC, df DESC";
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
//print $sql; //print $sql;

View File

@ -56,8 +56,7 @@ $fourns=array();
/* /*
* Affichage liste * View
*
*/ */
llxHeader(); llxHeader();
@ -85,8 +84,7 @@ if ($search_ville)
{ {
$sql .= " AND s.ville LIKE '%".$search_ville."%'"; $sql .= " AND s.ville LIKE '%".$search_ville."%'";
} }
$sql .= " AND ca.year > (date_format(".$db->idate(mktime()).",'%Y') - 5)"; // TODO Add date ranges
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
dol_syslog("fourn/stats.php sql=".$sql); dol_syslog("fourn/stats.php sql=".$sql);