diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index f0f8ce54302..31a204b5479 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -243,7 +243,7 @@ if ($id > 0) $hselected=1; - dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->ref); + dolibarr_fiche_head($head, $hselected, $langs->trans("Contract")); /* * Contrat diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index cb8ed299bfe..52cfa102edd 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -858,7 +858,7 @@ class Contrat /** * \brief Retourne le libellé du statut du contrat - * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court + * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long * \return string Libellé */ function getLibStatut($mode) @@ -869,7 +869,7 @@ class Contrat /** * \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 + * \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) @@ -892,13 +892,19 @@ class Contrat { 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 ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$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'); } + if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); } + } + if ($mode == 4) + { + 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'),'statut6').' '.$langs->trans("ContractStatusClosed"); } } } @@ -1374,6 +1380,59 @@ class ContratLigne { return $this->statut == 4 ; } + + /** + * \brief Retourne le libellé du statut du contrat + * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto + * \return string Libellé + */ + function getLibStatut($mode) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * \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 + * \return string Libellé + */ + function LibStatut($statut,$mode) + { + global $langs; + $langs->load("contracts"); + if ($mode == 0) + { + if ($statut == 0) { return $langs->trans("ServiceStatusInitial"); } + if ($statut == 4) { return $langs->trans("ServiceStatusRunning"); } + if ($statut == 5) { return $langs->trans("ServiceStatusClosed"); } + } + if ($mode == 1) + { + if ($statut == 0) { return $langs->trans("ServiceStatusInitial"); } + if ($statut == 4) { return $langs->trans("ServiceStatusRunning"); } + if ($statut == 5) { return $langs->trans("ServiceStatusClosed"); } + } + if ($mode == 2) + { + if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } + if ($statut == 4) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } + if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } + } + if ($mode == 3) + { + if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0'); } + if ($statut == 4) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4'); } + if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6'); } + } + if ($mode == 4) + { + if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } + if ($statut == 4) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } + if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } + } + } + } diff --git a/htdocs/contrat/enservice.php b/htdocs/contrat/enservice.php index 4d5c62f3a94..ac18668469f 100644 --- a/htdocs/contrat/enservice.php +++ b/htdocs/contrat/enservice.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 @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -33,7 +32,6 @@ require("./pre.inc.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"]; @@ -41,17 +39,13 @@ $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; $statut=isset($_GET["statut"])?$_GET["statut"]:1; $socid=$_GET["socid"]; - -/* - * Sécurité accés client - */ +// Sécurité accés client if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } - if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; @@ -60,6 +54,15 @@ $offset = $limit * $page ; if (! $sortfield) $sortfield="cd.date_ouverture"; if (! $sortorder) $sortorder="DESC"; +$staticcontrat=new Contrat($db); +$staticcontratligne=new ContratLigne($db); + + +/* + * Affichage page + */ + +llxHeader(); $sql = "SELECT s.nom, c.rowid as cid, s.idp as sidp, cd.rowid, cd.label, cd.statut, p.rowid as pid,"; $sql .= " ".$db->pdate("cd.date_ouverture")." as date_ouverture,"; @@ -110,7 +113,9 @@ if ($resql) if ($obj->date_fin_validite < mktime()) print img_warning($langs->trans("Late")); else print '    '; print ''; - print 'statut'; + print ''; + print $staticcontratligne->LibStatut($obj->statut,2); + print ''; print "\n"; $i++; } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 0efa28f0981..59904b03c9a 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -488,7 +488,7 @@ else $hselected = 0; - dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->ref); + dolibarr_fiche_head($head, $hselected, $langs->trans("Contract")); /* @@ -542,7 +542,7 @@ else // Statut contrat print ''.$langs->trans("Status").''; - print $contrat->statuts[$contrat->statut]; + print $contrat->getLibStatut(2); print ""; // Date diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 7c91cd65793..4590a28267f 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -49,6 +49,7 @@ if ($user->societe_id > 0) } $staticcontrat=new Contrat($db); +$staticcontratligne=new ContratLigne($db); /* @@ -87,9 +88,9 @@ $var=false; print ''; print ''; print ''; print '
'.$langs->trans("ServicesLegend").'
'; -print img_statut(0,$langs->trans("ServiceStatusInitial")).' '.$langs->trans("ServiceStatusInitial").'
'; -print img_statut(4,$langs->trans("ServiceStatusRunning")).' '.$langs->trans("ServiceStatusRunning").'
'; -print img_statut(5,$langs->trans("ServiceStatusClosed")).' '.$langs->trans("ServiceStatusClosed").'
'; +print $staticcontratligne->LibStatut(0,4).'
'; +print $staticcontratligne->LibStatut(4,4).'
'; +print $staticcontratligne->LibStatut(5,4).'
'; print '
'; @@ -127,9 +128,9 @@ if ($result) print ''.$langs->trans("LastContracts",5).''; print ''.$langs->trans("DateCreation").''; print ''.$langs->trans("Status").''; - print ''.img_statut(0,$langs->trans("ServiceStatusInitial")).''; - print ''.img_statut(4,$langs->trans("ServiceStatusRunning")).''; - print ''.img_statut(5,$langs->trans("ServiceStatusClosed")).''; + print ''.$staticcontratligne->LibStatut(0,3).''; + print ''.$staticcontratligne->LibStatut(4,3).''; + print ''.$staticcontratligne->LibStatut(5,3).''; print "\n"; $var=True; @@ -201,7 +202,7 @@ if ( $db->query($sql) ) else print ' '.dolibarr_trunc($obj->note,20).''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).''; print ''; - print $staticcontrat->LibStatut($obj->statut,3); + print $staticcontratligne->LibStatut($obj->statut,3); print ''; print "\n"; $i++; diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 538cb82a851..b21c1f3ffcb 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -78,7 +78,7 @@ $head = contract_prepare_head($contrat); $hselected = 3; -dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").": $contrat->ref"); +dolibarr_fiche_head($head, $hselected, $langs->trans("Contract")); print ''; - // Statut contrat + // Statut contrat print '"; // Date diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php index 93f0148f33e..dc22a6e4327 100644 --- a/htdocs/contrat/liste.php +++ b/htdocs/contrat/liste.php @@ -34,9 +34,6 @@ $langs->load("contracts"); $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"]; @@ -60,8 +57,16 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } +$staticcontrat=new Contrat($db); +$staticcontratligne=new ContratLigne($db); +/* + * Affichage page + */ + +llxHeader(); + $sql = 'SELECT'; $sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,'; $sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > sysdate()",1,0).') as nb_running,'; @@ -99,9 +104,9 @@ if ($resql) print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param","",$sortfield); print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield); print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.statut","","$param",'align="center"',$sortfield); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; print ''; @@ -118,7 +123,6 @@ if ($resql) print ""; print "\n"; print ''; - $contratstatic=new Contrat($db); $now=mktime(); $var=True; @@ -128,13 +132,12 @@ if ($resql) $var=!$var; print ""; print "'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 02ca1708f35..214800fdea4 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -128,7 +128,7 @@ if ($_GET["id"]) $hselected = 2; - dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").": ".$contrat->ref); + dolibarr_fiche_head($head, $hselected, $langs->trans("Contract")); print '
'; diff --git a/htdocs/contrat/ligne.php b/htdocs/contrat/ligne.php index 820be92abe6..658f0a7e339 100644 --- a/htdocs/contrat/ligne.php +++ b/htdocs/contrat/ligne.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 @@ -28,6 +28,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php'); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/project.class.php"); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); @@ -110,39 +111,19 @@ if ($id > 0) $contrat = New Contrat($db); if ( $contrat->fetch($id) > 0) { - $author = new User($db); $author->id = $contrat->user_author_id; $author->fetch(); -/* Remplacé par fonctions des contacts de contrat - $commercial_signature = new User($db); - $commercial_signature->id = $contrat->commercial_signature_id; - $commercial_signature->fetch(); - - $commercial_suivi = new User($db); - $commercial_suivi->id = $contrat->commercial_suivi_id; - $commercial_suivi->fetch(); -*/ - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/contrat/fiche.php?id='.$contrat->id; - $head[$h][1] = $langs->trans("ContractCard"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$contrat->id; - $head[$h][1] = $langs->trans("ContractContacts"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/contrat/info.php?id='.$contrat->id; - $head[$h][1] = $langs->trans("Info"); - $hselected = $h; - $h++; - + $head = contract_prepare_head($contrat); + $h=sizeof($head); + + // On ajout onglet service $head[$h][0] = DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id."&ligne=".$_GET["ligne"]; $head[$h][1] = $langs->trans($langs->trans("EditServiceLine")); $hselected = $h; - dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->id); + dolibarr_fiche_head($head, $hselected, $langs->trans("Contract")); /* @@ -183,9 +164,9 @@ if ($id > 0) print ''; print ''.$contrat->societe->nom.'
'.$langs->trans("Status").''; - print $contrat->statuts[$contrat->statut]; + print $contrat->getLibStatut(2); print "
'.img_statut(0,$langs->trans("ServiceStatusInitial")).''.img_statut(4,$langs->trans("ServiceStatusRunning")).''.img_statut(5,$langs->trans("ServiceStatusClosed")).''.$staticcontratligne->LibStatut(0,3).''.$staticcontratligne->LibStatut(4,3).''.$staticcontratligne->LibStatut(5,3).'
cid\">"; - print img_object($langs->trans("ShowContract"),"contract").' ' - . (isset($obj->ref) ? $obj->ref : $obj->cid) .''; + print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .''; if ($obj->nb_late) print img_warning($langs->trans("Late")); print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.dolibarr_print_date($obj->datec).''.$contratstatic->LibStatut($obj->statut,1).''.$staticcontrat->LibStatut($obj->statut,3).''.($obj->nb_initial>0?$obj->nb_initial:'').''.($obj->nb_running+$obj->nb_late>0?$obj->nb_running+$obj->nb_late:'').''.($obj->nb_closed>0?$obj->nb_closed:'').'
'; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index ecc8619f0e3..499cc9e91e1 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -28,11 +28,11 @@ */ require("./pre.inc.php"); +require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); $langs->load("products"); $langs->load("companies"); - $mode = isset($_GET["mode"])?$_GET["mode"]:$_POST["mode"]; $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; @@ -58,7 +58,13 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } +$staticcontrat=new Contrat($db); +$staticcontratligne=new ContratLigne($db); + +/* + * Affichage page + */ llxHeader(); @@ -164,7 +170,9 @@ if ($resql) if ($obj->date_fin_validite && $obj->date_fin_validite < (time() - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late")); else print '    '; print ''; - print ''; + print ''; print "\n"; $i++; }
statut'; + print $staticcontratligne->LibStatut($obj->statut,2); + print '