From 0031097d764e1c3768f363a98512367ef6f2db7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Jun 2005 11:31:53 +0000 Subject: [PATCH] =?UTF-8?q?Ajoute=20liste=20des=20derni=E8res=20interventi?= =?UTF-8?q?ons=20(plus=20complet=20que=20le=20simple=20lien)=20sur=20le=20?= =?UTF-8?q?meme=20mod=E8le=20que=20les=20contrats,=20factures...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/fiche.php | 171 +++++++++++++++++++++++++----------------- 1 file changed, 101 insertions(+), 70 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index dc5911c01cd..7a2978b9922 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -175,11 +175,6 @@ if ($_socid > 0) $head[$h][1] = $langs->trans("Accountancy"); $h++; } - if ($conf->compta->enabled) { - $head[$h][0] = DOL_URL_ROOT.'/fichinter/index.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Interventions"); - $h++; - } $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Note"); @@ -206,6 +201,7 @@ if ($_socid > 0) dolibarr_fiche_head($head, $hselected, $objsoc->nom); + /* * * @@ -267,23 +263,25 @@ if ($_socid > 0) // Nbre max d'éléments des petites listes $MAXLIST=4; + /* * Dernieres propales */ if ($conf->propal->enabled) { - print ''; + print '
'; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " AND s.idp = ".$objsoc->id; $sql .= " ORDER BY p.datep DESC"; - - if ( $db->query($sql) ) + + $resql=$db->query($sql); + if ($resql) { $var=true; - $num = $db->num_rows(); + $num = $db->num_rows($resql); if ($num >0 ) { print ''; @@ -294,7 +292,7 @@ if ($_socid > 0) $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; while ($i < $num && $i < $MAXLIST) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($resql); print ""; print "
propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) @@ -307,7 +305,7 @@ if ($_socid > 0) $var=!$var; $i++; } - $db->free(); + $db->free($resql); } else { dolibarr_print_error($db); @@ -320,7 +318,7 @@ if ($_socid > 0) */ if($conf->commande->enabled) { - print ''; + print '
'; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.total_ht, p.ref, ".$db->pdate("p.date_commande")." as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p"; @@ -328,10 +326,11 @@ if ($_socid > 0) $sql .= " AND s.idp = $objsoc->id"; $sql .= " ORDER BY p.date_commande DESC"; - if ( $db->query($sql) ) + $resql=$db->query($sql); + if ($resql) { $var=true; - $num = $db->num_rows(); + $num = $db->num_rows($resql); if ($num >0 ) { print ''; @@ -341,7 +340,7 @@ if ($_socid > 0) $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; while ($i < $num && $i < $MAXLIST) { - $objp = $db->fetch_object(); + $objp = $db->fetch_object($resql); $var=!$var; print ""; print ''; $i++; } - $db->free(); + $db->free($resql); } print "
'.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."\n"; @@ -354,17 +353,61 @@ if ($_socid > 0) print ''.$objp->statut.'
"; } + /* + * Dernieres interventions + */ + if ($conf->fichinter->enabled) + { + print ''; + + $sql = "SELECT s.nom, s.idp, f.rowid as id, f.ref, ".$db->pdate("f.datei")." as di"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; + $sql .= " WHERE f.fk_soc = s.idp"; + $sql .= " AND s.idp = ".$objsoc->id; + $sql .= " ORDER BY f.datei DESC"; + + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + if ($num >0 ) + { + print ''; + print ''; + print ''; + $var=!$var; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + print ""; + print '\n"; + print ''; + $var=!$var; + $i++; + } + $db->free($resql); + } + else { + dolibarr_print_error($db); + } + print "
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; + print "".dolibarr_print_date($objp->di)."
"; + } + /* * Derniers projets associés */ if ($conf->projet->enabled) { - print ''; + print '
'; $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; @@ -543,9 +586,7 @@ if ($_socid > 0) * */ print '
'; - print ''; - print ''; - print ''; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; @@ -555,11 +596,13 @@ if ($_socid > 0) $sql .= " ORDER BY a.datea DESC, a.id DESC"; $result=$db->query($sql); - if ($result) { - print "
'.$langs->trans("ActionsToDo").' '.$langs->trans("AddActionToDo").'
'; + print '
'.$langs->trans("ActionsToDo").' '.$langs->trans("AddActionToDo").'
\n"; - - $i = 0 ; $num = $db->num_rows($result); - while ($i < $num) { + if ($result) + { + $i = 0 ; + $num = $db->num_rows($result); + + while ($i < $num) + { $var = !$var; $obj = $db->fetch_object($result); @@ -590,11 +633,11 @@ if ($_socid > 0) print "\n"; print "\n"; - print ''; + print ''; if ($obj->propalrowid) { - print ''; } - /* - * Contact pour cette action - * - */ + + // Contact pour cette action if ($obj->fk_contact) { $contact = new Contact($db); $contact->fetch($obj->fk_contact); - print ''; + print ''; } else { - print ''; + print ''; } - /* - */ - print ''; + print ''; print "\n"; $i++; } @@ -632,15 +671,13 @@ if ($_socid > 0) } else { dolibarr_print_error($db); } - print "
" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."  '.img_object($langs->trans("ShowTask"),"task"); + print ''.img_object($langs->trans("ShowTask"),"task"); $transcode=$langs->trans("Action".$obj->acode); $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); print $libelle; @@ -602,27 +645,23 @@ if ($_socid > 0) } else { - print ''.img_object($langs->trans("ShowTask"),"task"); + print ''.img_object($langs->trans("ShowTask"),"task"); $transcode=$langs->trans("Action".$obj->acode); $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); print $libelle; print ''.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.''.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'  '.$obj->code.''.$obj->code.'
"; + print "

"; /* * Listes des actions effectuees */ print ''; - print ''; - print ''; - print ''; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; @@ -652,12 +689,12 @@ if ($_socid > 0) $result=$db->query($sql); if ($result) { - print '
'.$langs->trans("ActionsDone").'
'; + print '
'.$langs->trans("ActionsDone").'
'; - $i = 0 ; $num = $db->num_rows($result); $oldyear=''; $oldmonth=''; + $var=true; + while ($i < $num) { $var = !$var; @@ -665,34 +702,34 @@ if ($_socid > 0) $obj = $db->fetch_object($result); print ""; + // Champ date if ($oldyear == strftime("%Y",$obj->da) ) { - print ''; + print ''; } else { - print "\n"; + print '\n"; $oldyear = strftime("%Y",$obj->da); } if ($oldmonth == strftime("%Y%b",$obj->da) ) { - print ''; + print ''; } else { - print "\n"; + print '\n"; $oldmonth = strftime("%Y%b",$obj->da); } + print '\n"; + print '\n"; - print "\n"; - print "\n"; - - print ''; + print ''; if ($obj->propalrowid) { - print ''; } - /* - * Contact pour cette action - * - */ + + // Contact pour cette action if ($obj->fk_contact) { $contact = new Contact($db); $contact->fetch($obj->fk_contact); - print ''; + print ''; } else { - print ''; + print ''; } - /* - */ - print ''; + + print ''; print "\n"; $i++; } - print "
||" .strftime("%Y",$obj->da)."'.strftime("%Y",$obj->da)."||" .strftime("%b",$obj->da)."'.strftime("%b",$obj->da)."'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."  '.img_object($langs->trans("ShowTask"),"task"); + print ''.img_object($langs->trans("ShowTask"),"task"); $transcode=$langs->trans("Action".$obj->acode); $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); print $libelle; @@ -700,33 +737,29 @@ if ($_socid > 0) } else { - print ''.img_object($langs->trans("ShowTask"),"task"); + print ''.img_object($langs->trans("ShowTask"),"task"); $transcode=$langs->trans("Action".$obj->acode); $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); print $libelle; print ''.img_object($langs->trans("Showcontact"),"contact").' '.$contact->fullname.''.img_object($langs->trans("Showcontact"),"contact").' '.$contact->fullname.'  '.$obj->code.''.$obj->code.'
"; $db->free($result); } @@ -734,20 +767,17 @@ if ($_socid > 0) { dolibarr_print_error($db); } - print ""; + print ""; + // Notes sur la societe /* - * - * Notes sur la societe - * - */ if ($objsoc->note) { print ''; print ""; print "
".nl2br($objsoc->note)."
"; } - + */ } } else { dolibarr_print_error($db); @@ -755,5 +785,6 @@ if ($_socid > 0) $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); + +llxFooter('$Date$ - $Revision$'); ?>