From 8c1cf894d0b524220ac6225352b00afc832f5e1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Jul 2010 15:15:03 +0000 Subject: [PATCH] Fix bug #30384 --- htdocs/comm/index.php | 26 +++++++++++++--------- htdocs/compta/index.php | 17 +++++++------- htdocs/includes/boxes/box_clients.php | 11 ++++----- htdocs/includes/boxes/box_fournisseurs.php | 9 ++++---- htdocs/includes/boxes/box_prospect.php | 9 ++++---- htdocs/langs/en_US/boxes.lang | 1 + htdocs/langs/fr_FR/boxes.lang | 1 + 7 files changed, 41 insertions(+), 33 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 75aaa54f420..3300d1f62c7 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -286,12 +286,13 @@ if ($conf->propal->enabled && $user->rights->propale->lire) //$sql.= " AND p.fk_statut > 1"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; - $sql.= " ORDER BY p.datec DESC"; + $sql.= " ORDER BY p.datep DESC"; $sql.= $db->plimit($NBMAX, 0); - if ( $db->query($sql) ) + $resql=$db->query($sql); + if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $i = 0; print ''; @@ -299,7 +300,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) $var=False; while ($i < $num) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($resql); print ""; // Ref @@ -326,17 +327,20 @@ if ($conf->propal->enabled && $user->rights->propale->lire) print ''; print "\n"; + print dol_print_date($db->jdate($objp->dp),'day')."\n"; print "\n"; print "\n"; print "\n"; $i++; $var=!$var; - } print "
'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).'"; - print dol_print_date($objp->dp,'day')."".price($objp->total_ht)."".$propalstatic->LibStatut($objp->fk_statut,3)."

"; - $db->free(); + $db->free($resql); + } + else + { + dol_print_error($db,''); } } @@ -347,7 +351,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire) { $langs->load("boxes"); - $sql = "SELECT s.rowid,s.nom,s.client,s.tms"; + $sql = "SELECT s.rowid,s.nom,s.client,s.datec,s.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 2, 3)"; @@ -407,7 +411,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) { $langs->load("boxes"); - $sql = "SELECT s.nom, s.rowid, s.datec as dc"; + $sql = "SELECT s.nom, s.rowid, s.datec as dc, s.tms as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; @@ -425,7 +429,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) $i = 0; print ''; - print ''; + print ''; print ''; print ''; if ($num) @@ -438,7 +442,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) $company->nom=$objp->nom; print ''; print ''; - print ''; + print ''; print ''; $var=!$var; $i++; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 1333a1598bf..1cfa0bacafc 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -470,18 +470,17 @@ if ($conf->societe->enabled && $user->rights->societe->lire) $langs->load("boxes"); - $sql = "SELECT s.nom, s.rowid, s.datec as dc"; + $sql = "SELECT s.nom, s.rowid, s.datec as dc, s.tms as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 3)"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; - $sql.= " ORDER BY s.datec DESC "; + $sql.= $db->order("s.tms","DESC"); $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) { $var=false; @@ -490,7 +489,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire) $i = 0; print '
'.$langs->trans("BoxTitleLastSuppliers",min($max,$num)).'
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("DateModificationShort").'
'.$company->getNomUrl(1,'supplier',48).''.dol_print_date($db->jdate($objp->dc),'day').''.dol_print_date($db->jdate($objp->dm),'day').'
'; - print ''; + print ''; print ''; print ''; if ($num) @@ -508,7 +507,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire) $var=!$var; print ''; print ''; - print ''; + print ''; print ''; $i++; @@ -529,14 +528,14 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) { $langs->load("boxes"); - $sql = "SELECT s.nom, s.rowid, s.datec as dc"; + $sql = "SELECT s.nom, s.rowid, s.datec as dc, s.tms as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; - $sql.= $db->order("s.datec","DESC"); + $sql.= $db->order("s.tms","DESC"); $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -548,7 +547,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) $i = 0; print '
'.$langs->trans("BoxTitleLastCustomers",min($max,$num)).'
'.$langs->trans("BoxTitleLastModifiedCustomers",min($max,$num)).''.$langs->trans("DateModificationShort").'
'.$customerstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->dc),'day').''.dol_print_date($db->jdate($objp->dm),'day').'
'; - print ''; + print ''; print ''; print ''; if ($num) @@ -563,7 +562,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire) $customerstatic->nom=$objp->nom; print ''; print ''; - print ''; + print ''; print ''; $var=!$var; $i++; diff --git a/htdocs/includes/boxes/box_clients.php b/htdocs/includes/boxes/box_clients.php index e449433e155..faf2add1c82 100644 --- a/htdocs/includes/boxes/box_clients.php +++ b/htdocs/includes/boxes/box_clients.php @@ -49,7 +49,7 @@ class box_clients extends ModeleBoxes { global $langs; $langs->load("boxes"); - $this->boxlabel=$langs->trans("BoxLastCustomers"); + $this->boxlabel=$langs->trans("BoxLastModifiedCustomers"); } /** @@ -63,18 +63,18 @@ class box_clients extends ModeleBoxes { $this->max=$max; - $this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomers",$max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers",$max)); if ($user->rights->societe->lire) { - $sql = "SELECT s.nom, s.rowid as socid, s.tms"; + $sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 3)"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = $user->societe_id"; - $sql.= " ORDER BY s.datec DESC"; + $sql.= " ORDER BY s.tms DESC"; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -87,7 +87,8 @@ class box_clients extends ModeleBoxes { while ($i < $num) { $objp = $db->fetch_object($result); - $datem=$objp->tms; + $datec=$db->jdate($objp->datec); + $datem=$db->jdate($objp->tms); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, diff --git a/htdocs/includes/boxes/box_fournisseurs.php b/htdocs/includes/boxes/box_fournisseurs.php index e03f82bea99..3dbf7034b6f 100644 --- a/htdocs/includes/boxes/box_fournisseurs.php +++ b/htdocs/includes/boxes/box_fournisseurs.php @@ -62,18 +62,18 @@ class box_fournisseurs extends ModeleBoxes { $this->max=$max; - $this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers",$max)); if ($user->rights->societe->lire) { - $sql = "SELECT s.nom, s.rowid as socid, s.tms"; + $sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY s.datec DESC "; + $sql.= " ORDER BY s.tms DESC "; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -86,7 +86,8 @@ class box_fournisseurs extends ModeleBoxes { while ($i < $num) { $objp = $db->fetch_object($result); - $datem=$objp->tms; + $datec=$db->jdate($objp->datec); + $datem=$db->jdate($objp->tms); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, diff --git a/htdocs/includes/boxes/box_prospect.php b/htdocs/includes/boxes/box_prospect.php index 7a405a390ab..41bb33645db 100644 --- a/htdocs/includes/boxes/box_prospect.php +++ b/htdocs/includes/boxes/box_prospect.php @@ -67,18 +67,18 @@ class box_prospect extends ModeleBoxes { $this->max=$max; - $this->info_box_head = array('text' => $langs->trans("BoxTitleLastProspects",$max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects",$max)); if ($user->rights->societe->lire) { - $sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.tms"; + $sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.datec, s.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (2, 3)"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " ORDER BY s.datec DESC"; + $sql.= " ORDER BY s.tms DESC"; $sql.= $db->plimit($max, 0); dol_syslog("box_prospect::loadBox sql=".$sql,LOG_DEBUG); @@ -92,7 +92,8 @@ class box_prospect extends ModeleBoxes { while ($i < $num) { $objp = $db->fetch_object($resql); - $datem=$objp->tms; + $datec=$db->jdate($objp->datec); + $datem=$db->jdate($objp->tms); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 6ff0da4545c..d498ae5453a 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -33,6 +33,7 @@ BoxTitleLastPropals=Last %s recorded proposals BoxTitleLastCustomerBills=Last %s customer's invoices BoxTitleLastSupplierBills=Last %s supplier's invoices BoxTitleLastProspects=Last %s recorded prospects +BoxTitleLastModifiedProspects=Last %s modified prospects BoxTitleLastProductsInContract=Last %s products/services in a contract BoxTitleOldestUnpaidCustomerBills=Oldest %s unpaid customer's invoices BoxTitleOldestUnpaidSupplierBills=Oldest %s unpaid supplier's invoices diff --git a/htdocs/langs/fr_FR/boxes.lang b/htdocs/langs/fr_FR/boxes.lang index 2680b36dbb1..1a936102f14 100644 --- a/htdocs/langs/fr_FR/boxes.lang +++ b/htdocs/langs/fr_FR/boxes.lang @@ -33,6 +33,7 @@ BoxTitleLastPropals=Les %s dernières propositions enregistrées BoxTitleLastCustomerBills=Les %s dernières factures clients modifiées BoxTitleLastSupplierBills=Les %s dernières factures fournisseurs modifiées BoxTitleLastProspects=Les %s derniers prospects enregistrés +BoxTitleLastModifiedProspects=Les %s derniers prospects modifiés BoxTitleLastProductsInContract=Les %s derniers produits/services contractés BoxTitleOldestUnpaidCustomerBills=Les %s plus anciennes factures clients impayées BoxTitleOldestUnpaidSupplierBills=Les %s plus anciennes factures fournisseurs impayées
'.$langs->trans("BoxTitleLastSuppliers",min($max,$num)).'
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("DateModificationShort").'
'.$customerstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->dc),'day').''.dol_print_date($db->jdate($objp->dm),'day').'