Code cleaning

This commit is contained in:
Rodolphe Quiedeville 2003-06-24 20:05:27 +00:00
parent fa1e972b86
commit 19984aee75

View File

@ -118,7 +118,8 @@ if ($action=='add_action')
* *
*/ */
if ($socid) { if ($socid)
{
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($socid); $societe->fetch($socid);
@ -128,13 +129,15 @@ if ($socid) {
$sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u"; $sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u";
$sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
if ($type) { if ($type)
{
$sql .= " AND c.id = $type"; $sql .= " AND c.id = $type";
} }
$sql .= " ORDER BY a.datea DESC"; $sql .= " ORDER BY a.datea DESC";
if ( $db->query($sql) ) { if ( $db->query($sql) )
{
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">'; print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
@ -143,7 +146,9 @@ $sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.
print "<TD>Action</TD>"; print "<TD>Action</TD>";
print "</TR>\n"; print "</TR>\n";
$var=True; $var=True;
while ($i < $num) {
while ($i < $num)
{
$obj = $db->fetch_object( $i); $obj = $db->fetch_object( $i);
$var=!$var; $var=!$var;
@ -167,11 +172,12 @@ else
print_barre_liste("Liste des actions commerciales effectuées",$page, $PHP_SELF); print_barre_liste("Liste des actions commerciales effectuées",$page, $PHP_SELF);
$sql = "SELECT s.nom as llx_societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact "; $sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact ";
$sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_societe as s, llx_user as u"; $sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_societe as s, llx_user as u";
$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
if ($type) { if ($type)
{
$sql .= " AND c.id = $type"; $sql .= " AND c.id = $type";
} }
@ -179,7 +185,8 @@ else
$sql .= $db->plimit( $limit, $offset); $sql .= $db->plimit( $limit, $offset);
if ( $db->query($sql) ) { if ( $db->query($sql) )
{
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">"; print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
@ -198,16 +205,22 @@ else
print "<TR $bc[$var]>"; print "<TR $bc[$var]>";
if ($oldyear == strftime("%Y",$obj->da) ) { if ($oldyear == strftime("%Y",$obj->da) )
{
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
} else { }
else
{
print "<TD>" .strftime("%Y",$obj->da)."</TD>\n"; print "<TD>" .strftime("%Y",$obj->da)."</TD>\n";
$oldyear = strftime("%Y",$obj->da); $oldyear = strftime("%Y",$obj->da);
} }
if ($oldmonth == strftime("%Y%b",$obj->da) ) { if ($oldmonth == strftime("%Y%b",$obj->da) )
{
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
} else { }
else
{
print "<TD>" .strftime("%b",$obj->da)."</TD>\n"; print "<TD>" .strftime("%b",$obj->da)."</TD>\n";
$oldmonth = strftime("%Y%b",$obj->da); $oldmonth = strftime("%Y%b",$obj->da);
} }
@ -224,11 +237,14 @@ else
* Contact * Contact
*/ */
print '<TD width="30%">'; print '<TD width="30%">';
if ($obj->fk_contact) { if ($obj->fk_contact)
{
$cont = new Contact($db); $cont = new Contact($db);
$cont->fetch($obj->fk_contact); $cont->fetch($obj->fk_contact);
print '<a href="/comm/contact.php3?id='.$cont->id.'">'.$cont->fullname.'</a>'; print '<a href="/comm/contact.php3?id='.$cont->id.'">'.$cont->fullname.'</a>';
} else { }
else
{
print "&nbsp;"; print "&nbsp;";
} }
print '</td>'; print '</td>';
@ -242,7 +258,9 @@ else
} }
print "</TABLE>"; print "</TABLE>";
$db->free(); $db->free();
} else { }
else
{
print $db->error() . ' ' . $sql ; print $db->error() . ' ' . $sql ;
} }
} }