Look: Ajout picto sur les status des propals
This commit is contained in:
parent
f754367e53
commit
2fe1b0dfc9
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -353,6 +353,64 @@ else
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Dernières actions commerciales effectuées
|
||||
*/
|
||||
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code, c.libelle, a.fk_user_author, s.nom as sname, s.idp";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE c.id=a.fk_action AND a.percent >= 100 AND s.idp = a.fk_soc";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND s.idp = ".$socidp;
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) //restriction
|
||||
{
|
||||
$sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastDoneTasks",$max).'</td></tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"action/fiche.php?id=$obj->id\">".img_object($langs->trans("ShowTask"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->code);
|
||||
$libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
|
||||
print "<td>".dolibarr_print_date($obj->da)."</td>";
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.$obj->sname.'</a></td>';
|
||||
$i++;
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats à mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent à expiration"
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Derniers clients enregistrés
|
||||
*/
|
||||
@ -407,64 +465,6 @@ if ($user->rights->societe->lire)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Dernières actions commerciales effectuées
|
||||
*/
|
||||
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code, c.libelle, a.fk_user_author, s.nom as sname, s.idp";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE c.id=a.fk_action AND a.percent >= 100 AND s.idp = a.fk_soc";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND s.idp = $socidp";
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) //restriction
|
||||
{
|
||||
$sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastDoneTasks",$max).'</td></tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"action/fiche.php?id=$obj->id\">".img_object($langs->trans("ShowTask"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->code);
|
||||
$libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
|
||||
print "<td>".dolibarr_print_date($obj->da)."</td>";
|
||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.$obj->sname.'</a></td>';
|
||||
$i++;
|
||||
}
|
||||
// TODO Ajouter rappel pour "il y a des contrats à mettre en service"
|
||||
// TODO Ajouter rappel pour "il y a des contrats qui arrivent à expiration"
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Derniers contrat
|
||||
*
|
||||
@ -499,7 +499,7 @@ if ($conf->contrat->enabled && 0) // \todo A REFAIRE DEPUIS NOUVEAU CONTRAT
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastContracts",5).'</td></tr>';
|
||||
$i = 0;
|
||||
|
||||
$contrat=new Contrat($db);
|
||||
$staticcontrat=new Contrat($db);
|
||||
|
||||
$var=false;
|
||||
while ($i < $num)
|
||||
@ -507,7 +507,7 @@ if ($conf->contrat->enabled && 0) // \todo A REFAIRE DEPUIS NOUVEAU CONTRAT
|
||||
$obj = $db->fetch_object();
|
||||
print "<tr $bc[$var]><td><a href=\"../contrat/fiche.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref."</a></td>";
|
||||
print "<td><a href=\"fiche.php?socid=$obj->idp\">".img_object($langs->trans("ShowCompany","company"))." ".$obj->nom."</a></td>\n";
|
||||
print "<td align=\"right\">".$contrat->LibStatut($obj->enservice)."</td></tr>\n";
|
||||
print "<td align=\"right\">".$staticcontrat->LibStatut($obj->enservice,3)."</td></tr>\n";
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
@ -617,7 +617,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) {
|
||||
print "<td align=\"right\">";
|
||||
print dolibarr_print_date($objp->dp)."</td>\n";
|
||||
print "<td align=\"right\">".price($objp->price)."</td>\n";
|
||||
print "<td align=\"center\">".$propalstatic->LibStatut($objp->fk_statut,0)."</td>\n";
|
||||
print "<td align=\"center\">".$propalstatic->LibStatut($objp->fk_statut,3)."</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$var=!$var;
|
||||
|
||||
@ -720,7 +720,7 @@ if ($_GET['propalid'] > 0)
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$propal->getLibStatut().'</td></tr>';
|
||||
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$propal->getLibStatut(4).'</td></tr>';
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
@ -1357,7 +1357,7 @@ else
|
||||
|
||||
print '<td align="right">'.price($objp->price)."</td>\n";
|
||||
$propal=New Propal($db);
|
||||
print '<td align="center">'.$propal->LibStatut($objp->fk_statut,0)."</td>\n";
|
||||
print '<td align="center">'.$propal->LibStatut($objp->fk_statut,2)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$total = $total + $objp->price;
|
||||
|
||||
@ -356,7 +356,7 @@ if ($_GET["propalid"] > 0)
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$propal->getLibStatut().'</td></tr>';
|
||||
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$propal->getLibStatut(4).'</td></tr>';
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
@ -728,7 +728,7 @@ if ($_GET["propalid"] > 0)
|
||||
print strftime("%Y",$objp->dp)."</a></td>\n";
|
||||
|
||||
print "<td align=\"right\">".price($objp->price)."</td>\n";
|
||||
print "<td align=\"center\">".$propalstatic->LibStatut($objp->fk_statut,0)."</td>\n";
|
||||
print "<td align=\"center\">".$propalstatic->LibStatut($objp->fk_statut,2)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
@ -1365,25 +1365,59 @@ class Propal
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut d'une propale (brouillon, validée, ...)
|
||||
* \return string Libellé
|
||||
*/
|
||||
function getLibStatut()
|
||||
{
|
||||
return $this->LibStatut($this->statut);
|
||||
}
|
||||
/**
|
||||
* \brief Retourne le libellé du statut d'une propale (brouillon, validée, ...)
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
|
||||
* \return string Libellé
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->statut,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \param statut id statut
|
||||
* \param size Libellé court si 0, long si non défini
|
||||
* \return string Libellé
|
||||
*/
|
||||
function LibStatut($statut,$size=1)
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \param statut id statut
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
|
||||
* \return string Libellé
|
||||
*/
|
||||
function LibStatut($statut,$mode=1)
|
||||
{
|
||||
if ($size) return $this->labelstatut[$statut];
|
||||
else return $this->labelstatut_short[$statut];
|
||||
global $langs;
|
||||
$langs->load("propal");
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatut[$statut];
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
return $this->labelstatut_short[$statut];
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans('PropalStatusDraftShort'),'statut0').' '.$this->labelstatut_short[$statut];
|
||||
if ($statut==1) return img_picto($langs->trans('PropalStatusOpenedShort'),'statut1').' '.$this->labelstatut_short[$statut];
|
||||
if ($statut==2) return img_picto($langs->trans('PropalStatusSignedShort'),'statut3').' '.$this->labelstatut_short[$statut];
|
||||
if ($statut==3) return img_picto($langs->trans('PropalStatusNotSignedShort'),'statut5').' '.$this->labelstatut_short[$statut];
|
||||
if ($statut==4) return img_picto($langs->trans('PropalStatusBilledShort'),'statut6').' '.$this->labelstatut_short[$statut];
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans('PropalStatusDraftShort'),'statut0');
|
||||
if ($statut==1) return img_picto($langs->trans('PropalStatusOpenedShort'),'statut1');
|
||||
if ($statut==2) return img_picto($langs->trans('PropalStatusSignedShort'),'statut3');
|
||||
if ($statut==3) return img_picto($langs->trans('PropalStatusNotSignedShort'),'statut5');
|
||||
if ($statut==4) return img_picto($langs->trans('PropalStatusBilledShort'),'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans('PropalStatusDraft'),'statut0').' '.$this->labelstatut[$statut];
|
||||
if ($statut==1) return img_picto($langs->trans('PropalStatusOpened'),'statut1').' '.$this->labelstatut[$statut];
|
||||
if ($statut==2) return img_picto($langs->trans('PropalStatusSigned'),'statut3').' '.$this->labelstatut[$statut];
|
||||
if ($statut==3) return img_picto($langs->trans('PropalStatusNotSigned'),'statut5').' '.$this->labelstatut[$statut];
|
||||
if ($statut==4) return img_picto($langs->trans('PropalStatusBilled'),'statut6').' '.$this->labelstatut[$statut];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user