diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index b336d9b0402..6148a0ac402 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * * This program is free software; you can redistribute it and/or modify @@ -22,8 +22,7 @@ * */ -/*! - \file htdocs/comm/fiche.php +/** \file htdocs/comm/fiche.php \ingroup commercial \brief Onglet client de la fiche societe \version $Revision$ @@ -242,14 +241,14 @@ if ($_socid > 0) print ''; print $langs->trans("CustomerDiscount").''.$objsoc->remise_client." %"; print ''; - print img_edit("Modifier la remise"); + print img_edit($langs->trans("Modify")); print ""; print ''; print 'Remise exceptionnelles'; print ''; print ''; - print img_edit("Modifier la remise"); + print img_edit($langs->trans("Modify")); print ""; print ''; @@ -262,120 +261,142 @@ if ($_socid > 0) */ print "\n"; - //if ($conf->propal->enabled) { - print ''; - + + // Nbre max d'éléments des petites listes + $MAXLIST=4; + /* - * - * Propales - * + * Dernieres propales */ - $var = true; - 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 WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; - $sql .= " AND s.idp = ".$objsoc->id." ORDER BY p.datep DESC"; - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - if ($num >0 ) - { - print ""; - $var=!$var; - } - $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; - while ($i < $num && $i < 2) - { - $objp = $db->fetch_object(); - print ""; - print "\n"; - print ''; - print ''; - $var=!$var; - $i++; - } - $db->free(); - } - else { - dolibarr_print_error($db); + if ($conf->propal->enabled) + { + print '
id\">Liste des propales ($num)
propalid\">$objp->ref\n"; - if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) - { - print " > 15 jours"; - } - print "".strftime("%d %B %Y",$objp->dp)."'.price($objp->price).''.$objp->statut.'
'; + + $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) ) + { + $var=true; + $num = $db->num_rows(); + 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(); + print ""; + print "\n"; + print ''; + print ''; + $var=!$var; + $i++; + } + $db->free(); + } + else { + dolibarr_print_error($db); + } + print "
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
propalid\">$objp->ref\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) + { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."'.price($objp->price).''.$objp->statut.'
"; } - + /* - * Commandes - * Que si le module est actif ! + * Dernieres commandes */ - if($conf->commande->enabled) { - 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 WHERE p.fk_soc = s.idp "; - $sql .= " AND s.idp = $objsoc->id ORDER BY p.date_commande DESC"; - - if ( $db->query($sql) ) - { - $num = $db->num_rows(); - if ($num >0 ) - { - print ""; - print ''; - } - $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; - while ($i < $num && $i < 2) - { - $objp = $db->fetch_object(); - $var=!$var; - print ""; - print '\n"; - print ''; - print ''; - $i++; - } - $db->free(); - } + if($conf->commande->enabled) + { + print '
Liste des commandes ('.$num.')
'.$objp->ref."\n"; - if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) - { - print " > 15 jours"; - } - print "".strftime("%d %B %Y",$objp->dp)."'.price($objp->total_ht).''.$objp->statut.'
'; + + $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"; + $sql .= " WHERE p.fk_soc = s.idp "; + $sql .= " AND s.idp = $objsoc->id"; + $sql .= " ORDER BY p.date_commande DESC"; + + if ( $db->query($sql) ) + { + $var=true; + $num = $db->num_rows(); + if ($num >0 ) + { + print ""; + print ''; + print ''; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object(); + $var=!$var; + print ""; + print '\n"; + print ''; + print ''; + $i++; + } + $db->free(); + } + print "
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')
'.$objp->ref."\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) + { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."'.price($objp->total_ht).''.$objp->statut.'
"; } + /* - * - * Liste des projets associés - * + * Derniers projets associés */ - $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $objsoc->id"; - if ( $db->query($sql) ) { - print ""; - $i = 0 ; - $num = $db->num_rows(); - if ($num > 0) { - $tag = !$tag; print ""; - print ""; - } - while ($i < $num && $i < 5) { - $obj = $db->fetch_object(); - $tag = !$tag; - print ""; - print ''; - - print ""; - $i++; - } - $db->free(); - print "
id\">liste des projets ($num)
'.$obj->title.'".$obj->ref ."
"; + if ($conf->projet->enabled) + { + print ''; + + $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " WHERE p.fk_soc = $objsoc->id"; + $sql .= " ORDER BY p.dateo DESC"; + + if ( $db->query($sql) ) { + $var=true; + $i = 0 ; + $num = $db->num_rows(); + if ($num > 0) { + print ""; + print ''; + print ''; + } + while ($i < $num && $i < $MAXLIST) { + $obj = $db->fetch_object(); + $var = !$var; + print ""; + print ''; + + print ""; + $i++; + } + $db->free(); + } + else + { + dolibarr_print_error($db); + } + print "
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.$obj->title.'".$obj->ref ."
"; } - else - { - dolibarr_print_error($db); - } - + /* * * @@ -383,6 +404,7 @@ if ($_socid > 0) print ""; print "\n"; + /* * Barre d'action * @@ -446,10 +468,11 @@ if ($_socid > 0) * Liste des contacts * */ - if (defined("MAIN_MODULE_CLICKTODIAL") && MAIN_MODULE_CLICKTODIAL==1) + if ($conf->clicktodial->enabled) { $user->fetch_clicktodial(); // lecture des infos de clicktodial } + print ''; print ''; @@ -461,7 +484,8 @@ if ($_socid > 0) $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note "; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; - $sql .= " WHERE p.fk_soc = $objsoc->id ORDER by p.datec"; + $sql .= " WHERE p.fk_soc = $objsoc->id"; + $sql .= " ORDER by p.datec"; $result = $db->query($sql); $i = 0 ; $num = $db->num_rows(); $tag = True; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index ce105ff5d0e..03ca28e3865 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -246,26 +246,33 @@ if ($socid > 0) print "\n"; print '"; print "
'.$langs->trans("Firstname").' '.$langs->trans("Lastname").''; - /* - * Factures - */ - if ($user->rights->facture->lire) - { - print ''; - $var=!$var; - $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye as paye, f.fk_statut as statut, f.rowid as facid "; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND s.idp = ".$societe->id." ORDER BY f.datef DESC"; + // Nbre max d'éléments des petites listes + $MAXLIST=5; + /* + * Dernieres factures + */ + if ($conf->facture->enabled && $user->rights->facture->lire) + { + print '
'; + + $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye as paye, f.fk_statut as statut, f.rowid as facid "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.fk_soc = s.idp AND s.idp = ".$societe->id; + $sql .= " ORDER BY f.datef DESC"; + if ( $db->query($sql) ) { + $var=true; $num = $db->num_rows(); $i = 0; if ($num > 0) { print ""; - print ""; + print ''; + print ''; } - - while ($i < $num && $i < 5) + + while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object(); $var=!$var; @@ -280,7 +287,7 @@ if ($socid > 0) print "\n"; } print "\n"; - + $fac = new Facture($db); print "\n"; print "\n"; @@ -290,45 +297,53 @@ if ($socid > 0) } else { - print $db->error(); + dolibarr_print_error($db); } print "
id\">Liste des factures clients ($num)
'.$langs->trans("LastBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')
!!!".number_format($objp->amount, 2, ',', ' ')."".($fac->LibStatut($objp->paye,$objp->statut))."
"; } - + /* - * Liste des projets associés - * + * Derniers projets associés */ - $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $societe->id"; - if ( $db->query($sql) ) - { + if ($conf->projet->enabled) + { print ''; - $i = 0 ; - $num = $db->num_rows(); - if ($num > 0) - { - $tag = !$tag; print ""; - print ""; - } - while ($i < $num && $i < 5) - { - $obj = $db->fetch_object(); - $tag = !$tag; - print ""; - print ''; - - print ""; - $i++; - } - $db->free(); + + $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " WHERE p.fk_soc = $societe->id"; + $sql .= " ORDER by p.dateo"; + + if ( $db->query($sql) ) + { + $var=true; + $i = 0 ; + $num = $db->num_rows(); + if ($num > 0) + { + print ""; + print ''; + print ''; + } + while ($i < $num && $i < $MAXLIST) + { + $obj = $db->fetch_object(); + $var = !$var; + print ""; + print ''; + + print ""; + $i++; + } + $db->free(); + } + else + { + dolibarr_print_error($db); + } print "
id\">Liste des projets ($num)
'.$obj->title.'".strftime("%d %b %Y", $obj->do) ."
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.$obj->title.'".strftime("%d %b %Y", $obj->do) ."
"; - } - else - { - dolibarr_print_error($db); - } - + } + print "
\n";