diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 2764c6f19cf..cb8ed299bfe 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -855,28 +855,51 @@ class Contrat } } + /** * \brief Retourne le libellé du statut du contrat - * \return string Libellé + * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court + * \return string Libellé */ - function getLibStatut() + function getLibStatut($mode) { - return $this->LibStatut($this->statut); + return $this->LibStatut($this->statut,$mode); } /** * \brief Renvoi le libellé d'un statut donné - * \param statut id statut - * \return string Libellé + * \param statut id statut + * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto + * \return string Libellé */ - function LibStatut($statut) + function LibStatut($statut,$mode) { global $langs; $langs->load("contracts"); - - if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } - if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } - if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } + if ($mode == 0) + { + if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } + if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } + if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } + } + if ($mode == 1) + { + if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } + if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } + if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } + } + if ($mode == 2) + { + if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); } + if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); } + if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut5').' '.$langs->trans("ContractStatusClosed"); } + } + if ($mode == 3) + { + if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); } + if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); } + if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut5'); } + } } diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 455ef2ba09c..7c91cd65793 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/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 @@ -33,9 +33,6 @@ require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); $langs->load("products"); $langs->load("companies"); - -llxHeader(); - $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; @@ -51,6 +48,15 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } +$staticcontrat=new Contrat($db); + + +/* + * Affichage page + */ + +llxHeader(); + print_fiche_titre($langs->trans("ContractsArea")); @@ -126,8 +132,6 @@ if ($result) print ''.img_statut(5,$langs->trans("ServiceStatusClosed")).''; print "\n"; - $contratstatic=new Contrat($db); - $var=True; while ($i < $num) { @@ -142,7 +146,7 @@ if ($result) print ''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''; print ''.dolibarr_print_date($obj->datec).''; - print ''.$contratstatic->LibStatut($obj->statut).''; + print ''.$staticcontrat->LibStatut($obj->statut,2).''; print ''.($obj->nb_initial>0?$obj->nb_initial:'').''; print ''.($obj->nb_running+$obj->nb_late>0?$obj->nb_running+$obj->nb_late:'').''; print ''.($obj->nb_closed>0?$obj->nb_closed:'').''; @@ -196,7 +200,9 @@ if ( $db->query($sql) ) if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).''; else print ' '.dolibarr_trunc($obj->note,20).''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).''; - print 'statut'; + print ''; + print $staticcontrat->LibStatut($obj->statut,3); + print ''; print "\n"; $i++; } @@ -249,7 +255,9 @@ if ( $db->query($sql) ) if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).''; else print ' '.dolibarr_trunc($obj->note,20).''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).''; - print 'statut'; + print ''; + print $staticcontrat->LibStatut($obj->statut,3); + print ''; print "\n"; $i++; }