From 2fe1b0dfc9bf7ba3bb7f8c551e838021106842ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Mar 2006 16:30:48 +0000 Subject: [PATCH] Look: Ajout picto sur les status des propals --- htdocs/comm/index.php | 124 +++++++++++++++++++-------------------- htdocs/comm/propal.php | 4 +- htdocs/compta/propal.php | 4 +- htdocs/propal.class.php | 68 +++++++++++++++------ 4 files changed, 117 insertions(+), 83 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 71ed75af874..b2e6dd59b3f 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 ''; + print ''; + $var = true; + $i = 0; + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; + + print ""; + print "'; + + print ""; + print ''; + $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 "
'.$langs->trans("LastDoneTasks",$max).'
id\">".img_object($langs->trans("ShowTask"),"task"); + $transcode=$langs->trans("Action".$obj->code); + $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); + print $libelle; + print '".dolibarr_print_date($obj->da)."'.img_object($langs->trans("ShowCustomer"),"company").' '.$obj->sname.'

"; + + $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 ''; - print ''; - $var = true; - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print "'; - - print ""; - print ''; - $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 "
'.$langs->trans("LastDoneTasks",$max).'
id\">".img_object($langs->trans("ShowTask"),"task"); - $transcode=$langs->trans("Action".$obj->code); - $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); - print $libelle; - print '".dolibarr_print_date($obj->da)."'.img_object($langs->trans("ShowCustomer"),"company").' '.$obj->sname.'

"; - - $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 ''.$langs->trans("LastContracts",5).''; $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 "rowid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref.""; print "idp\">".img_object($langs->trans("ShowCompany","company"))." ".$obj->nom."\n"; - print "".$contrat->LibStatut($obj->enservice)."\n"; + print "".$staticcontrat->LibStatut($obj->enservice,3)."\n"; $var=!$var; $i++; } @@ -617,7 +617,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) { print ""; print dolibarr_print_date($objp->dp)."\n"; print "".price($objp->price)."\n"; - print "".$propalstatic->LibStatut($objp->fk_statut,0)."\n"; + print "".$propalstatic->LibStatut($objp->fk_statut,3)."\n"; print "\n"; $i++; $var=!$var; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 64805bbfda8..02cbf2bf7d4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -720,7 +720,7 @@ if ($_GET['propalid'] > 0) print ''.$langs->trans("Currency".$conf->monnaie).''; // Statut - print ''.$langs->trans('Status').''.$propal->getLibStatut().''; + print ''.$langs->trans('Status').''.$propal->getLibStatut(4).''; print '
'; /* @@ -1357,7 +1357,7 @@ else print ''.price($objp->price)."\n"; $propal=New Propal($db); - print ''.$propal->LibStatut($objp->fk_statut,0)."\n"; + print ''.$propal->LibStatut($objp->fk_statut,2)."\n"; print "\n"; $total = $total + $objp->price; diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index dcc7ed2fc01..c6500a687fc 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -356,7 +356,7 @@ if ($_GET["propalid"] > 0) print ''.$langs->trans("Currency".$conf->monnaie).''; // Statut - print ''.$langs->trans('Status').''.$propal->getLibStatut().''; + print ''.$langs->trans('Status').''.$propal->getLibStatut(4).''; print '
'; /* @@ -728,7 +728,7 @@ if ($_GET["propalid"] > 0) print strftime("%Y",$objp->dp)."\n"; print "".price($objp->price)."\n"; - print "".$propalstatic->LibStatut($objp->fk_statut,0)."\n"; + print "".$propalstatic->LibStatut($objp->fk_statut,2)."\n"; print "\n"; $i++; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index fdf5e330c05..bec74517bdb 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -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]; + } }