Code cleaning
This commit is contained in:
parent
fa1e972b86
commit
19984aee75
@ -118,7 +118,8 @@ if ($action=='add_action')
|
||||
*
|
||||
*/
|
||||
|
||||
if ($socid) {
|
||||
if ($socid)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
@ -128,123 +129,140 @@ if ($socid) {
|
||||
$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";
|
||||
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
if ($type)
|
||||
{
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD>Date</TD>';
|
||||
print "<TD>Action</TD>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD width=\"10%\">" .strftime("%Y %b %d %H:%M",$obj->da)."</TD>\n";
|
||||
print '<TD width="30%"><a href="fiche.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD>Date</TD>';
|
||||
print "<TD>Action</TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
$i++;
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD width=\"10%\">" .strftime("%Y %b %d %H:%M",$obj->da)."</TD>\n";
|
||||
print '<TD width="30%"><a href="fiche.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
print "</TR>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . '<br>' . $sql;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . '<br>' . $sql;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
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 .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
|
||||
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
if ($type)
|
||||
{
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit( $limit, $offset);
|
||||
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD colspan="4">Date</TD>';
|
||||
print '<TD>Société</a></td>';
|
||||
print '<TD>Action</a></TD>';
|
||||
print '<TD>Contact</a></TD>';
|
||||
print "<TD align=\"right\">Auteur</TD>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center"> </td>';
|
||||
} else {
|
||||
print "<TD>" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center"> </td>';
|
||||
} else {
|
||||
print "<TD>" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<TD width="20%">';
|
||||
|
||||
print ' <a href="/comm/fiche.php3?socid='.$obj->socidp.'">'.$obj->societe.'</A></TD>';
|
||||
|
||||
print '<TD width="30%"><a href="fiche.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
/*
|
||||
* Contact
|
||||
*/
|
||||
print '<TD width="30%">';
|
||||
if ($obj->fk_contact) {
|
||||
$cont = new Contact($db);
|
||||
$cont->fetch($obj->fk_contact);
|
||||
print '<a href="/comm/contact.php3?id='.$cont->id.'">'.$cont->fullname.'</a>';
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<TD align=\"right\" width=\"20%\">$obj->code</TD>\n";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD colspan="4">Date</TD>';
|
||||
print '<TD>Société</a></td>';
|
||||
print '<TD>Action</a></TD>';
|
||||
print '<TD>Contact</a></TD>';
|
||||
print "<TD align=\"right\">Auteur</TD>";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) )
|
||||
{
|
||||
print '<td align="center"> </td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<TD>" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) )
|
||||
{
|
||||
print '<td align="center"> </td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<TD>" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<TD width="20%">';
|
||||
|
||||
print ' <a href="/comm/fiche.php3?socid='.$obj->socidp.'">'.$obj->societe.'</A></TD>';
|
||||
|
||||
print '<TD width="30%"><a href="fiche.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
/*
|
||||
* Contact
|
||||
*/
|
||||
print '<TD width="30%">';
|
||||
if ($obj->fk_contact)
|
||||
{
|
||||
$cont = new Contact($db);
|
||||
$cont->fetch($obj->fk_contact);
|
||||
print '<a href="/comm/contact.php3?id='.$cont->id.'">'.$cont->fullname.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<TD align=\"right\" width=\"20%\">$obj->code</TD>\n";
|
||||
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error() . ' ' . $sql ;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . ' ' . $sql ;
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user