Trad: Traduction des titres des petites listes des derniers projets, propals, factures, commandes des onglets compta et commercial.

Fix: On distingue le nombre affiché du nombre total.
This commit is contained in:
Laurent Destailleur 2005-01-16 18:02:39 +00:00
parent 0315954f79
commit f89b4714b9
2 changed files with 195 additions and 156 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 \ingroup commercial
\brief Onglet client de la fiche societe \brief Onglet client de la fiche societe
\version $Revision$ \version $Revision$
@ -242,14 +241,14 @@ if ($_socid > 0)
print '<tr><td>'; print '<tr><td>';
print $langs->trans("CustomerDiscount").'</td><td>'.$objsoc->remise_client."&nbsp;%</td>"; print $langs->trans("CustomerDiscount").'</td><td>'.$objsoc->remise_client."&nbsp;%</td>";
print '<td colspan="2"><a href="remise.php?id='.$objsoc->id.'">'; print '<td colspan="2"><a href="remise.php?id='.$objsoc->id.'">';
print img_edit("Modifier la remise"); print img_edit($langs->trans("Modify"));
print "</a>"; print "</a>";
print '</td>'; print '</td>';
print '<tr><td colspan="2">Remise exceptionnelles'; print '<tr><td colspan="2">Remise exceptionnelles';
print '</td>'; print '</td>';
print '<td colspan="2"><a href="remx.php?id='.$objsoc->id.'">'; print '<td colspan="2"><a href="remx.php?id='.$objsoc->id.'">';
print img_edit("Modifier la remise"); print img_edit($langs->trans("Modify"));
print "</a>"; print "</a>";
print '</td></tr>'; print '</td></tr>';
@ -262,120 +261,142 @@ if ($_socid > 0)
*/ */
print "</td>\n"; print "</td>\n";
//if ($conf->propal->enabled) {
print '<td valign="top" width="50%">'; print '<td valign="top" width="50%">';
// Nbre max d'éléments des petites listes
$MAXLIST=4;
/* /*
* * Dernieres propales
* Propales
*
*/ */
$var = true; if ($conf->propal->enabled)
print '<table class="border" width="100%">'; {
$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"; print '<table class="border" width="100%">';
$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"; $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";
if ( $db->query($sql) ) $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
{ $sql .= " AND s.idp = ".$objsoc->id;
$num = $db->num_rows(); $sql .= " ORDER BY p.datep DESC";
if ($num >0 )
{ if ( $db->query($sql) )
print "<tr $bc[$var]><td colspan=\"4\"><a href=\"propal.php?socidp=$objsoc->id\">Liste des propales ($num)</td></tr>"; {
$var=!$var; $var=true;
} $num = $db->num_rows();
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ; if ($num >0 )
while ($i < $num && $i < 2) {
{ print "<tr $bc[$var]>";
$objp = $db->fetch_object(); print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socidp='.$objsoc->id.'">'.$langs->trans("AllPropals").' ('.$num.')</td></tr></table></td>';
print "<tr $bc[$var]>"; print '</tr>';
print "<td><a href=\"propal.php?propalid=$objp->propalid\">$objp->ref</a>\n"; $var=!$var;
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) }
{ $i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
print " <b>&gt; 15 jours</b>"; while ($i < $num && $i < $MAXLIST)
} {
print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</td>\n"; $objp = $db->fetch_object();
print '<td align="right" width="120">'.price($objp->price).'</td>'; print "<tr $bc[$var]>";
print '<td width="100" align="center">'.$objp->statut.'</td></tr>'; print "<td><a href=\"propal.php?propalid=$objp->propalid\">$objp->ref</a>\n";
$var=!$var; if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 )
$i++; {
} print " <b>&gt; 15 jours</b>";
$db->free(); }
} print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</td>\n";
else { print '<td align="right" width="120">'.price($objp->price).'</td>';
dolibarr_print_error($db); print '<td width="100" align="center">'.$objp->statut.'</td></tr>';
$var=!$var;
$i++;
}
$db->free();
}
else {
dolibarr_print_error($db);
}
print "</table>";
} }
/* /*
* Commandes * Dernieres commandes
* Que si le module est actif !
*/ */
if($conf->commande->enabled) { if($conf->commande->enabled)
print '<table class="border" width="100%">'; {
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.total_ht, p.ref, ".$db->pdate("p.date_commande")." as dp"; print '<table class="border" width="100%">';
$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"; $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";
if ( $db->query($sql) ) $sql .= " WHERE p.fk_soc = s.idp ";
{ $sql .= " AND s.idp = $objsoc->id";
$num = $db->num_rows(); $sql .= " ORDER BY p.date_commande DESC";
if ($num >0 )
{ if ( $db->query($sql) )
print "<tr $bc[$var]>"; {
print '<td colspan="4"><a href="'.DOL_URL_ROOT.'/commande/liste.php?socidp='.$objsoc->id.'">Liste des commandes ('.$num.')</td></tr>'; $var=true;
} $num = $db->num_rows();
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ; if ($num >0 )
while ($i < $num && $i < 2) {
{ print "<tr $bc[$var]>";
$objp = $db->fetch_object(); print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/liste.php?socidp='.$objsoc->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table></td>';
$var=!$var; print '</tr>';
print "<tr $bc[$var]>"; }
print '<td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->propalid.'">'.$objp->ref."</a>\n"; $i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) while ($i < $num && $i < $MAXLIST)
{ {
print " <b>&gt; 15 jours</b>"; $objp = $db->fetch_object();
} $var=!$var;
print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</TD>\n"; print "<tr $bc[$var]>";
print '<td align="right" width="120">'.price($objp->total_ht).'</td>'; print '<td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->propalid.'">'.$objp->ref."</a>\n";
print '<td align="center" width="100">'.$objp->statut.'</td></tr>'; if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 )
$i++; {
} print " <b>&gt; 15 jours</b>";
$db->free(); }
} print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</td>\n";
print '<td align="right" width="120">'.price($objp->total_ht).'</td>';
print '<td align="center" width="100">'.$objp->statut.'</td></tr>';
$i++;
}
$db->free();
}
print "</table>";
} }
/* /*
* * Derniers projets associés
* Liste des projets associés
*
*/ */
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; if ($conf->projet->enabled)
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $objsoc->id"; {
if ( $db->query($sql) ) { print '<table class="border" width=100%>';
print "<table class=\"border\" cellspacing=0 width=100% cellpadding=\"1\">";
$i = 0 ; $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
$num = $db->num_rows(); $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
if ($num > 0) { $sql .= " WHERE p.fk_soc = $objsoc->id";
$tag = !$tag; print "<tr $bc[$tag]>"; $sql .= " ORDER BY p.dateo DESC";
print "<td colspan=\"2\"><a href=\"../projet/index.php?socidp=$objsoc->id\">liste des projets ($num)</td></tr>";
} if ( $db->query($sql) ) {
while ($i < $num && $i < 5) { $var=true;
$obj = $db->fetch_object(); $i = 0 ;
$tag = !$tag; $num = $db->num_rows();
print "<tr $bc[$tag]>"; if ($num > 0) {
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>'; print "<tr $bc[$var]>";
print '<td colspan="2"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/index.php?socidp='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
print "<td align=\"right\">".$obj->ref ."</td></tr>"; print '</tr>';
$i++; }
} while ($i < $num && $i < $MAXLIST) {
$db->free(); $obj = $db->fetch_object();
print "</table>"; $var = !$var;
print "<tr $bc[$var]>";
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
print "<td align=\"right\">".$obj->ref ."</td></tr>";
$i++;
}
$db->free();
}
else
{
dolibarr_print_error($db);
}
print "</table>";
} }
else
{
dolibarr_print_error($db);
}
/* /*
* *
* *
@ -383,6 +404,7 @@ if ($_socid > 0)
print "</td></tr>"; print "</td></tr>";
print "</table></div>\n"; print "</table></div>\n";
/* /*
* Barre d'action * Barre d'action
* *
@ -446,10 +468,11 @@ if ($_socid > 0)
* Liste des contacts * Liste des contacts
* *
*/ */
if (defined("MAIN_MODULE_CLICKTODIAL") && MAIN_MODULE_CLICKTODIAL==1) if ($conf->clicktodial->enabled)
{ {
$user->fetch_clicktodial(); // lecture des infos de clicktodial $user->fetch_clicktodial(); // lecture des infos de clicktodial
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Firstname").' '.$langs->trans("Lastname").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("Firstname").' '.$langs->trans("Lastname").'</td>';
@ -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 = "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 .= " 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); $result = $db->query($sql);
$i = 0 ; $num = $db->num_rows(); $tag = True; $i = 0 ; $num = $db->num_rows(); $tag = True;

View File

@ -246,26 +246,33 @@ if ($socid > 0)
print "</td>\n"; print "</td>\n";
print '<td valign="top" width="50%">'; print '<td valign="top" width="50%">';
/* // Nbre max d'éléments des petites listes
* Factures $MAXLIST=5;
*/
if ($user->rights->facture->lire)
{
print '<table class="border" width="100%" cellspacing="0" cellpadding="1">';
$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";
/*
* Dernieres factures
*/
if ($conf->facture->enabled && $user->rights->facture->lire)
{
print '<table class="border" width="100%">';
$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) ) if ( $db->query($sql) )
{ {
$var=true;
$num = $db->num_rows(); $i = 0; $num = $db->num_rows(); $i = 0;
if ($num > 0) if ($num > 0)
{ {
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td colspan=\"4\"><a href=\"facture.php?socidp=$societe->id\">Liste des factures clients ($num)</td></tr>"; print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture.php?socidp='.$societe->id.'">'.$langs->trans("AllBills").' ('.$num.')</td></tr></table></td>';
print '</tr>';
} }
while ($i < $num && $i < 5) while ($i < $num && $i < $MAXLIST)
{ {
$objp = $db->fetch_object(); $objp = $db->fetch_object();
$var=!$var; $var=!$var;
@ -280,7 +287,7 @@ if ($socid > 0)
print "<td align=\"right\"><b>!!!</b></td>\n"; print "<td align=\"right\"><b>!!!</b></td>\n";
} }
print "<td align=\"right\">".number_format($objp->amount, 2, ',', ' ')."</td>\n"; print "<td align=\"right\">".number_format($objp->amount, 2, ',', ' ')."</td>\n";
$fac = new Facture($db); $fac = new Facture($db);
print "<td align=\"center\">".($fac->LibStatut($objp->paye,$objp->statut))."</td>\n"; print "<td align=\"center\">".($fac->LibStatut($objp->paye,$objp->statut))."</td>\n";
print "</tr>\n"; print "</tr>\n";
@ -290,45 +297,53 @@ if ($socid > 0)
} }
else else
{ {
print $db->error(); dolibarr_print_error($db);
} }
print "</table>"; print "</table>";
} }
/* /*
* Liste des projets associés * Derniers projets associés
*
*/ */
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; if ($conf->projet->enabled)
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $societe->id"; {
if ( $db->query($sql) )
{
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$i = 0 ;
$num = $db->num_rows(); $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
if ($num > 0) $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
{ $sql .= " WHERE p.fk_soc = $societe->id";
$tag = !$tag; print "<tr $bc[$tag]>"; $sql .= " ORDER by p.dateo";
print "<td colspan=\"2\"><a href=\"../projet/index.php?socidp=$societe->id\">Liste des projets ($num)</td></tr>";
} if ( $db->query($sql) )
while ($i < $num && $i < 5) {
{ $var=true;
$obj = $db->fetch_object(); $i = 0 ;
$tag = !$tag; $num = $db->num_rows();
print "<tr $bc[$tag]>"; if ($num > 0)
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>'; {
print "<tr $bc[$var]>";
print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>"; print '<td colspan="2"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/index.php?socidp='.$societe->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
$i++; print '</tr>';
} }
$db->free(); while ($i < $num && $i < $MAXLIST)
{
$obj = $db->fetch_object();
$var = !$var;
print "<tr $bc[$var]>";
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>";
$i++;
}
$db->free();
}
else
{
dolibarr_print_error($db);
}
print "</table>"; print "</table>";
} }
else
{
dolibarr_print_error($db);
}
print "</td></tr>"; print "</td></tr>";
print "</table></div>\n"; print "</table></div>\n";