Fix: Order of last intervention are done on tms date

This commit is contained in:
Laurent Destailleur 2009-07-22 17:29:32 +00:00
parent 30a41b5437
commit e77d1c2a99

View File

@ -22,11 +22,11 @@
*/ */
/** /**
\file htdocs/comm/fiche.php * \file htdocs/comm/fiche.php
\ingroup commercial * \ingroup commercial
\brief Onglet client de la fiche societe * \brief Onglet client de la fiche societe
\version $Id$ * \version $Id$
*/ */
require_once("./pre.inc.php"); require_once("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@ -96,12 +96,15 @@ if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer)
} }
/* /*
* Recherche * View
*
*/ */
if ($mode == 'search') {
if ($mode-search == 'soc') { if ($mode == 'search')
{
if ($mode-search == 'soc')
{
$sql = "SELECT s.rowid"; $sql = "SELECT s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -110,8 +113,10 @@ if ($mode == 'search') {
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
} }
if ( $db->query($sql) ) { if ( $db->query($sql) )
if ( $db->num_rows() == 1) { {
if ( $db->num_rows() == 1)
{
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$socid = $obj->rowid; $socid = $obj->rowid;
} }
@ -120,13 +125,6 @@ if ($mode == 'search') {
} }
/*********************************************************************************
*
* Mode fiche
*
*********************************************************************************/
llxHeader('',$langs->trans('CustomerCard')); llxHeader('',$langs->trans('CustomerCard'));
$userstatic=new User($db); $userstatic=new User($db);
@ -510,7 +508,7 @@ if ($socid > 0)
} }
/* /*
* Dernieres interventions * Last interventions
*/ */
if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire)
{ {
@ -520,7 +518,7 @@ if ($socid > 0)
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
$sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND s.rowid = ".$objsoc->id; $sql .= " AND s.rowid = ".$objsoc->id;
$sql .= " ORDER BY f.datei DESC"; $sql .= " ORDER BY f.tms DESC";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)