From 19984aee75db0455e32183819fc7ac27b3b6a42b Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 24 Jun 2003 20:05:27 +0000 Subject: [PATCH] Code cleaning --- htdocs/comm/action/index.php3 | 216 ++++++++++++++++++---------------- 1 file changed, 117 insertions(+), 99 deletions(-) diff --git a/htdocs/comm/action/index.php3 b/htdocs/comm/action/index.php3 index 8ee42565e53..79cab5a8216 100644 --- a/htdocs/comm/action/index.php3 +++ b/htdocs/comm/action/index.php3 @@ -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 ''; - print ''; - print ''; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $obj = $db->fetch_object( $i); - - $var=!$var; - - print ""; - print "\n"; - print ''; + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + print '
DateAction
" .strftime("%Y %b %d %H:%M",$obj->da)."'.$obj->libelle.'
'; + print ''; + print ''; + print ""; print "\n"; - - $i++; + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + print "\n"; + print ''; + print "\n"; + + $i++; + } + print "
DateAction
" .strftime("%Y %b %d %H:%M",$obj->da)."'.$obj->libelle.'
"; + $db->free(); + } else { + print $db->error() . '
' . $sql; } - print ""; - $db->free(); - } else { - print $db->error() . '
' . $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 ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $obj = $db->fetch_object( $i); - - $var=!$var; - - print ""; - - if ($oldyear == strftime("%Y",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print "\n"; - print "\n"; - - print ''; - - print ''; - /* - * Contact - */ - print ''; - /* - * - */ - print "\n"; - + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + print "
DateSociétéActionContactAuteur
 " .strftime("%Y",$obj->da)." " .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."'; - - print ' '.$obj->societe.''.$obj->libelle.''; - if ($obj->fk_contact) { - $cont = new Contact($db); - $cont->fetch($obj->fk_contact); - print ''.$cont->fullname.''; - } else { - print " "; - } - print '$obj->code
"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ""; print "\n"; - $i++; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) + { + print ''; + } + else + { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) + { + print ''; + } + else + { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + print ''; + /* + * Contact + */ + print ''; + /* + * + */ + print "\n"; + + print "\n"; + $i++; + } + print "
DateSociétéActionContactAuteur
 " .strftime("%Y",$obj->da)." " .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."'; + + print ' '.$obj->societe.''.$obj->libelle.''; + if ($obj->fk_contact) + { + $cont = new Contact($db); + $cont->fetch($obj->fk_contact); + print ''.$cont->fullname.''; + } + else + { + print " "; + } + print '$obj->code
"; + $db->free(); + } + else + { + print $db->error() . ' ' . $sql ; } - print ""; - $db->free(); - } else { - print $db->error() . ' ' . $sql ; - } } $db->close();